If a file with the .el or .elc suffixes exist, it will be read
instead.")
+(defvar gnus-site-init-file
+ (condition-case ()
+ (concat (file-name-directory
+ (directory-file-name installation-directory))
+ "site-lisp/gnus-init")
+ (error nil))
+ "*The site-wide Gnus elisp startup file.
+If a file with the .el or .elc suffixes exist, it will be read
+instead.")
+
(defvar gnus-default-subscribed-newsgroups nil
"*This variable lists what newsgroups should be subscribed the first time Gnus is used.
It should be a list of strings.
the automatic new newsgroups subscription methods become meaningless.
You should always set `gnus-check-new-newsgroups' to `ask-server' or
-nil if you set this variable to nil.")
+nil if you set this variable to nil.
+
+This variable can also be a regexp. In that case, all groups that do
+not match this regexp will be removed before saving the list.")
(defvar gnus-ignored-newsgroups
(purecopy (mapconcat 'identity
(if gnus-init-inhibit
(setq gnus-init-inhibit nil)
(setq gnus-init-inhibit inhibit-next)
- (and gnus-init-file
- (or (and (file-exists-p gnus-init-file)
- ;; Don't try to load a directory.
- (not (file-directory-p gnus-init-file)))
- (file-exists-p (concat gnus-init-file ".el"))
- (file-exists-p (concat gnus-init-file ".elc")))
- (condition-case var
- (load gnus-init-file nil t)
- (error
- (error "Error in %s: %s" gnus-init-file var))))))
+ (let ((files (list gnus-site-init-file gnus-init-file))
+ file)
+ (while files
+ (and (setq file (pop files))
+ (or (and (file-exists-p file)
+ ;; Don't try to load a directory.
+ (not (file-directory-p file)))
+ (file-exists-p (concat file ".el"))
+ (file-exists-p (concat file ".elc")))
+ (condition-case var
+ (load file nil t)
+ (error
+ (error "Error in %s: %s" file var))))))))
;; For subscribing new newsgroup
(gnus-read-init-file)
(setq gnus-slave slave)
- (when (string-match "xemacs" (emacs-version))
+ (when (string-match "XEmacs" (emacs-version))
(gnus-splash))
(let ((level (and (numberp arg) (> arg 0) arg))
;; If we don't read the complete active file, we fill in the
;; hashtb here.
- (if (or (null gnus-read-active-file)
- (eq gnus-read-active-file 'some))
- (gnus-update-active-hashtb-from-killed))
+ (when (or (null gnus-read-active-file)
+ (eq gnus-read-active-file 'some))
+ (gnus-update-active-hashtb-from-killed))
;; Read the active file and create `gnus-active-hashtb'.
;; If `gnus-read-active-file' is nil, then we just create an empty
(not level)
(gnus-read-active-file))
- (or gnus-active-hashtb
- (setq gnus-active-hashtb (make-vector 4095 0)))
+ (unless gnus-active-hashtb
+ (setq gnus-active-hashtb (make-vector 4095 0)))
;; Initialize the cache.
(when gnus-use-cache
(gnus-update-format-specifications)
;; See whether we need to read the description file.
- (if (and (string-match "%[-,0-9]*D" gnus-group-line-format)
- (not gnus-description-hashtb)
- (not dont-connect)
- gnus-read-active-file)
- (gnus-read-all-descriptions-files))
+ (when (and (string-match "%[-,0-9]*D" gnus-group-line-format)
+ (not gnus-description-hashtb)
+ (not dont-connect)
+ gnus-read-active-file)
+ (gnus-read-all-descriptions-files))
;; Find new newsgroups and treat them.
- (if (and init gnus-check-new-newsgroups (not level)
- (gnus-check-server gnus-select-method))
- (gnus-find-new-newsgroups))
+ (when (and init gnus-check-new-newsgroups (not level)
+ (gnus-check-server gnus-select-method))
+ (gnus-find-new-newsgroups))
;; We might read in new NoCeM messages here.
(when (and gnus-use-nocem
(not dont-connect))
(gnus-nocem-scan-groups))
+ ;; Read any slave files.
+ (unless gnus-slave
+ (gnus-master-read-slave-newsrc))
+
;; Find the number of unread articles in each non-dead group.
(let ((gnus-read-active-file (and (not level) gnus-read-active-file)))
(gnus-get-unread-articles level))
- (if (and init gnus-check-bogus-newsgroups
- gnus-read-active-file (not level)
- (gnus-server-opened gnus-select-method))
- (gnus-check-bogus-newsgroups))))
+ (when (and init gnus-check-bogus-newsgroups
+ gnus-read-active-file (not level)
+ (gnus-server-opened gnus-select-method))
+ (gnus-check-bogus-newsgroups))))
(defun gnus-find-new-newsgroups (&optional arg)
"Search for new newsgroups and add them.
t)
(condition-case ()
(gnus-request-group group dont-check method)
- ; (error nil)
+ (error nil)
(quit nil))
(gnus-set-active group (setq active (gnus-parse-active)))
;; Return the new active info.
(setq gnus-killed-list
(cons group gnus-killed-list))
(gnus-sethash group group gnus-killed-hashtb))))))
- gnus-active-hashtb))
+ gnus-active-hashtb)
+ (gnus-dribble-enter ""))
;; Get the active file(s) from the backend(s).
(defun gnus-read-active-file ()
;; the `gnus-newsrc-hashtb' has been created. While reading
;; the .newsrc file, Gnus will only use the information it
;; can find there for changing the data already read -
- ;; ie. reading the .newsrc file will not trash the data
+ ;; i. e., reading the .newsrc file will not trash the data
;; already read (except for read articles).
(save-excursion
(gnus-message 5 "Reading %s..." newsrc-file)
(gnus-newsrc-to-gnus-format)
(kill-buffer (current-buffer))
(gnus-message 5 "Reading %s...done" newsrc-file)))
-
- ;; Read any slave files.
- (unless gnus-slave
- (gnus-master-read-slave-newsrc))
;; Convert old to new.
(gnus-convert-old-newsrc))))
entry mentry)
(while rc
(or (null (nth 4 (car rc))) ; It's a native group.
- (assoc (caar rc) newsrc) ; It's already in the alist.
+ (assoc (caar rc) newsrc) ; It's already in the alist.
(if (setq entry (assoc (caar prev) newsrc))
(setcdr (setq mentry (memq entry newsrc))
(cons (car rc) (cdr mentry)))
(defun gnus-gnus-to-quick-newsrc-format ()
"Insert Gnus variables such as gnus-newsrc-alist in lisp format."
- (insert ";; Gnus startup file.\n")
- (insert ";; Never delete this file - touch .newsrc instead to force Gnus\n")
- (insert ";; to read .newsrc.\n")
- (insert "(setq gnus-newsrc-file-version "
- (prin1-to-string gnus-version) ")\n")
- (let ((variables
- (if gnus-save-killed-list gnus-variable-list
- ;; Remove the `gnus-killed-list' from the list of variables
- ;; to be saved, if required.
- (delq 'gnus-killed-list (copy-sequence gnus-variable-list))))
- ;; Peel off the "dummy" group.
- (gnus-newsrc-alist (cdr gnus-newsrc-alist))
- variable)
- ;; Insert the variables into the file.
- (while variables
- (when (and (boundp (setq variable (pop variables)))
- (symbol-value variable))
- (insert "(setq " (symbol-name variable) " '")
- (prin1 (symbol-value variable) (current-buffer))
- (insert ")\n")))))
+ (let ((print-quoted t))
+ (insert ";; Gnus startup file.\n")
+ (insert
+ ";; Never delete this file - touch .newsrc instead to force Gnus\n")
+ (insert ";; to read .newsrc.\n")
+ (insert "(setq gnus-newsrc-file-version "
+ (prin1-to-string gnus-version) ")\n")
+ (let* ((gnus-killed-list
+ (if (and gnus-save-killed-list
+ (stringp gnus-save-killed-list))
+ (gnus-strip-killed-list)
+ gnus-killed-list))
+ (variables
+ (if gnus-save-killed-list gnus-variable-list
+ ;; Remove the `gnus-killed-list' from the list of variables
+ ;; to be saved, if required.
+ (delq 'gnus-killed-list (copy-sequence gnus-variable-list))))
+ ;; Peel off the "dummy" group.
+ (gnus-newsrc-alist (cdr gnus-newsrc-alist))
+ variable)
+ ;; Insert the variables into the file.
+ (while variables
+ (when (and (boundp (setq variable (pop variables)))
+ (symbol-value variable))
+ (insert "(setq " (symbol-name variable) " '")
+ (prin1 (symbol-value variable) (current-buffer))
+ (insert ")\n"))))))
+
+(defun gnus-strip-killed-list ()
+ "Return the killed list minus the groups that match `gnus-save-killed-list'."
+ (let ((list gnus-killed-list)
+ olist)
+ (while list
+ (when (string-match gnus-save-killed-list)
+ (push (car list) olist))
+ (pop list))
+ (nreverse olist)))
(defun gnus-gnus-to-newsrc-format ()
;; Generate and save the .newsrc file.
(error
(gnus-error 3.2 "Possible error in %s" file)
nil))
- (or gnus-slave ; Slaves shouldn't delete these files.
+ (or gnus-slave ; Slaves shouldn't delete these files.
(condition-case ()
(delete-file file)
(error nil))))
(nconc gnus-valid-select-methods
(list (apply 'list name abilities)))))
+(defun gnus-set-default-directory ()
+ "Set the default directory in the current buffer to `gnus-default-directory'.
+If this variable is nil, don't do anything."
+ (setq default-directory
+ (if (and gnus-default-directory
+ (file-exists-p gnus-default-directory))
+ (file-name-as-directory (expand-file-name gnus-default-directory))
+ default-directory)))
+
(provide 'gnus-start)
;;; gnus-start.el ends here