comparison lisp/gnus/gnus-start.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents cf808b4c4290
children fe104dbd9147
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
46 :group 'gnus-start 46 :group 'gnus-start
47 :type 'file) 47 :type 'file)
48 48
49 (defcustom gnus-site-init-file 49 (defcustom gnus-site-init-file
50 (ignore-errors 50 (ignore-errors
51 (concat (file-name-directory 51 (concat (file-name-directory
52 (directory-file-name installation-directory)) 52 (directory-file-name installation-directory))
53 "site-lisp/gnus-init")) 53 "site-lisp/gnus-init"))
54 "The site-wide Gnus elisp startup file. 54 "The site-wide Gnus elisp startup file.
55 If a file with the .el or .elc suffixes exist, it will be read 55 If a file with the .el or .elc suffixes exist, it will be read
56 instead." 56 instead."
318 :group 'gnus-group-new 318 :group 'gnus-group-new
319 :type '(choice regexp 319 :type '(choice regexp
320 (const :tag "none" nil))) 320 (const :tag "none" nil)))
321 321
322 (defcustom gnus-modtime-botch nil 322 (defcustom gnus-modtime-botch nil
323 "*Non-nil means .newsrc should be deleted prior to save. 323 "*Non-nil means .newsrc should be deleted prior to save.
324 Its use is due to the bogus appearance that .newsrc was modified on 324 Its use is due to the bogus appearance that .newsrc was modified on
325 disc." 325 disc."
326 :group 'gnus-newsrc 326 :group 'gnus-newsrc
327 :type 'boolean) 327 :type 'boolean)
328 328
345 (defcustom gnus-get-new-news-hook nil 345 (defcustom gnus-get-new-news-hook nil
346 "A hook run just before Gnus checks for new news." 346 "A hook run just before Gnus checks for new news."
347 :group 'gnus-group-new 347 :group 'gnus-group-new
348 :type 'hook) 348 :type 'hook)
349 349
350 (defcustom gnus-after-getting-new-news-hook 350 (defcustom gnus-after-getting-new-news-hook
351 (when (gnus-boundp 'display-time-timer) 351 (when (gnus-boundp 'display-time-timer)
352 '(display-time-event-handler)) 352 '(display-time-event-handler))
353 "A hook run after Gnus checks for new news." 353 "A hook run after Gnus checks for new news."
354 :group 'gnus-group-new 354 :group 'gnus-group-new
355 :type 'hook) 355 :type 'hook)
813 "Setup news information. 813 "Setup news information.
814 If RAWFILE is non-nil, the .newsrc file will also be read. 814 If RAWFILE is non-nil, the .newsrc file will also be read.
815 If LEVEL is non-nil, the news will be set up at level LEVEL." 815 If LEVEL is non-nil, the news will be set up at level LEVEL."
816 (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile))))) 816 (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile)))))
817 817
818 (when init 818 (when init
819 ;; Clear some variables to re-initialize news information. 819 ;; Clear some variables to re-initialize news information.
820 (setq gnus-newsrc-alist nil 820 (setq gnus-newsrc-alist nil
821 gnus-active-hashtb nil) 821 gnus-active-hashtb nil)
822 ;; Read the newsrc file and create `gnus-newsrc-hashtb'. 822 ;; Read the newsrc file and create `gnus-newsrc-hashtb'.
823 (gnus-read-newsrc-file rawfile)) 823 (gnus-read-newsrc-file rawfile))
847 ;; Initialize the cache. 847 ;; Initialize the cache.
848 (when gnus-use-cache 848 (when gnus-use-cache
849 (gnus-cache-open)) 849 (gnus-cache-open))
850 850
851 ;; Possibly eval the dribble file. 851 ;; Possibly eval the dribble file.
852 (and init 852 (and init
853 (or gnus-use-dribble-file gnus-slave) 853 (or gnus-use-dribble-file gnus-slave)
854 (gnus-dribble-eval-file)) 854 (gnus-dribble-eval-file))
855 855
856 ;; Slave Gnusii should then clear the dribble buffer. 856 ;; Slave Gnusii should then clear the dribble buffer.
857 (when (and init gnus-slave) 857 (when (and init gnus-slave)
858 (gnus-dribble-clear)) 858 (gnus-dribble-clear))
872 (gnus-check-server gnus-select-method) 872 (gnus-check-server gnus-select-method)
873 (not gnus-slave)) 873 (not gnus-slave))
874 (gnus-find-new-newsgroups)) 874 (gnus-find-new-newsgroups))
875 875
876 ;; We might read in new NoCeM messages here. 876 ;; We might read in new NoCeM messages here.
877 (when (and gnus-use-nocem 877 (when (and gnus-use-nocem
878 (not level) 878 (not level)
879 (not dont-connect)) 879 (not dont-connect))
880 (gnus-nocem-scan-groups)) 880 (gnus-nocem-scan-groups))
881 881
882 ;; Read any slave files. 882 ;; Read any slave files.
1154 (setcdr (cdr entry) (cdddr entry))))) 1154 (setcdr (cdr entry) (cdddr entry)))))
1155 1155
1156 ;; Finally we enter (if needed) the list where it is supposed to 1156 ;; Finally we enter (if needed) the list where it is supposed to
1157 ;; go, and change the subscription level. If it is to be killed, 1157 ;; go, and change the subscription level. If it is to be killed,
1158 ;; we enter it into the killed or zombie list. 1158 ;; we enter it into the killed or zombie list.
1159 (cond 1159 (cond
1160 ((>= level gnus-level-zombie) 1160 ((>= level gnus-level-zombie)
1161 ;; Remove from the hash table. 1161 ;; Remove from the hash table.
1162 (gnus-sethash group nil gnus-newsrc-hashtb) 1162 (gnus-sethash group nil gnus-newsrc-hashtb)
1163 ;; We do not enter foreign groups into the list of dead 1163 ;; We do not enter foreign groups into the list of dead
1164 ;; groups. 1164 ;; groups.
1281 (defvar gnus-cache-active-hashtb) 1281 (defvar gnus-cache-active-hashtb)
1282 (defun gnus-cache-possibly-alter-active (group active) 1282 (defun gnus-cache-possibly-alter-active (group active)
1283 "Alter the ACTIVE info for GROUP to reflect the articles in the cache." 1283 "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
1284 (when gnus-cache-active-hashtb 1284 (when gnus-cache-active-hashtb
1285 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb))) 1285 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
1286 (and cache-active 1286 (and cache-active
1287 (< (car cache-active) (car active)) 1287 (< (car cache-active) (car active))
1288 (setcar active (car cache-active))) 1288 (setcar active (car cache-active)))
1289 (and cache-active 1289 (and cache-active
1290 (> (cdr cache-active) (cdr active)) 1290 (> (cdr cache-active) (cdr active))
1291 (setcdr active (cdr cache-active))))))) 1291 (setcdr active (cdr cache-active)))))))
1292 1292
1293 (defun gnus-get-unread-articles-in-group (info active &optional update) 1293 (defun gnus-get-unread-articles-in-group (info active &optional update)
1294 (when active 1294 (when active
1295 ;; Allow the backend to update the info in the group. 1295 ;; Allow the backend to update the info in the group.
1296 (when (and update 1296 (when (and update
1297 (gnus-request-update-info 1297 (gnus-request-update-info
1298 info (gnus-find-method-for-group (gnus-info-group info)))) 1298 info (gnus-find-method-for-group (gnus-info-group info))))
1299 (gnus-activate-group (gnus-info-group info) nil t)) 1299 (gnus-activate-group (gnus-info-group info) nil t))
1300 (let* ((range (gnus-info-read info)) 1300 (let* ((range (gnus-info-read info))
1301 (num 0)) 1301 (num 0))
1302 ;; If a cache is present, we may have to alter the active info. 1302 ;; If a cache is present, we may have to alter the active info.
1303 (when (and gnus-use-cache info) 1303 (when (and gnus-use-cache info)
1304 (inline (gnus-cache-possibly-alter-active 1304 (inline (gnus-cache-possibly-alter-active
1305 (gnus-info-group info) active))) 1305 (gnus-info-group info) active)))
1306 ;; Modify the list of read articles according to what articles 1306 ;; Modify the list of read articles according to what articles
1307 ;; are available; then tally the unread articles and add the 1307 ;; are available; then tally the unread articles and add the
1308 ;; number to the group hash table entry. 1308 ;; number to the group hash table entry.
1309 (cond 1309 (cond
1550 (gnus-dribble-touch)) 1550 (gnus-dribble-touch))
1551 1551
1552 ;; Get the active file(s) from the backend(s). 1552 ;; Get the active file(s) from the backend(s).
1553 (defun gnus-read-active-file (&optional force) 1553 (defun gnus-read-active-file (&optional force)
1554 (gnus-group-set-mode-line) 1554 (gnus-group-set-mode-line)
1555 (let ((methods 1555 (let ((methods
1556 (append 1556 (append
1557 (if (gnus-check-server gnus-select-method) 1557 (if (gnus-check-server gnus-select-method)
1558 ;; The native server is available. 1558 ;; The native server is available.
1559 (cons gnus-select-method gnus-secondary-select-methods) 1559 (cons gnus-select-method gnus-secondary-select-methods)
1560 ;; The native server is down, so we just do the 1560 ;; The native server is down, so we just do the
1588 (let ((newsrc (cdr gnus-newsrc-alist)) 1588 (let ((newsrc (cdr gnus-newsrc-alist))
1589 (gmethod (gnus-server-get-method nil method)) 1589 (gmethod (gnus-server-get-method nil method))
1590 groups info) 1590 groups info)
1591 (while (setq info (pop newsrc)) 1591 (while (setq info (pop newsrc))
1592 (when (gnus-server-equal 1592 (when (gnus-server-equal
1593 (gnus-find-method-for-group 1593 (gnus-find-method-for-group
1594 (gnus-info-group info) info) 1594 (gnus-info-group info) info)
1595 gmethod) 1595 gmethod)
1596 (push (gnus-group-real-name (gnus-info-group info)) 1596 (push (gnus-group-real-name (gnus-info-group info))
1597 groups))) 1597 groups)))
1598 (when groups 1598 (when groups
1626 "T only when gnus-ignored-newsgroups includes \"^to\\\\.\" as an element." 1626 "T only when gnus-ignored-newsgroups includes \"^to\\\\.\" as an element."
1627 ;; note this regexp is the same as: 1627 ;; note this regexp is the same as:
1628 ;; (concat (regexp-quote "^to\\.") "\\($\\|" (regexp-quote "\\|") "\\)") 1628 ;; (concat (regexp-quote "^to\\.") "\\($\\|" (regexp-quote "\\|") "\\)")
1629 (string-match "\\^to\\\\\\.\\($\\|\\\\|\\)" 1629 (string-match "\\^to\\\\\\.\\($\\|\\\\|\\)"
1630 gnus-ignored-newsgroups)) 1630 gnus-ignored-newsgroups))
1631 1631
1632 ;; Read an active file and place the results in `gnus-active-hashtb'. 1632 ;; Read an active file and place the results in `gnus-active-hashtb'.
1633 (defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors) 1633 (defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors)
1634 (unless method 1634 (unless method
1635 (setq method gnus-select-method)) 1635 (setq method gnus-select-method))
1636 (let ((cur (current-buffer)) 1636 (let ((cur (current-buffer))
1788 (set-buffer (nnheader-find-file-noselect newsrc-file)) 1788 (set-buffer (nnheader-find-file-noselect newsrc-file))
1789 (buffer-disable-undo (current-buffer)) 1789 (buffer-disable-undo (current-buffer))
1790 (gnus-newsrc-to-gnus-format) 1790 (gnus-newsrc-to-gnus-format)
1791 (kill-buffer (current-buffer)) 1791 (kill-buffer (current-buffer))
1792 (gnus-message 5 "Reading %s...done" newsrc-file))) 1792 (gnus-message 5 "Reading %s...done" newsrc-file)))
1793 1793
1794 ;; Convert old to new. 1794 ;; Convert old to new.
1795 (gnus-convert-old-newsrc)))) 1795 (gnus-convert-old-newsrc))))
1796 1796
1797 (defun gnus-convert-old-newsrc () 1797 (defun gnus-convert-old-newsrc ()
1798 "Convert old newsrc into the new format, if needed." 1798 "Convert old newsrc into the new format, if needed."
1872 ;; Copy marks into info. 1872 ;; Copy marks into info.
1873 (when (setq m (assoc (car group) marked)) 1873 (when (setq m (assoc (car group) marked))
1874 (unless (nthcdr 3 info) 1874 (unless (nthcdr 3 info)
1875 (nconc info (list nil))) 1875 (nconc info (list nil)))
1876 (gnus-info-set-marks 1876 (gnus-info-set-marks
1877 info (list (cons 'tick (gnus-compress-sequence 1877 info (list (cons 'tick (gnus-compress-sequence
1878 (sort (cdr m) '<) t)))))) 1878 (sort (cdr m) '<) t))))))
1879 (setq newsrc killed) 1879 (setq newsrc killed)
1880 (while newsrc 1880 (while newsrc
1881 (setcar newsrc (caar newsrc)) 1881 (setcar newsrc (caar newsrc))
1882 (setq newsrc (cdr newsrc))) 1882 (setq newsrc (cdr newsrc)))
1952 (or (and (re-search-forward "^[^ \t]" nil 'move) 1952 (or (and (re-search-forward "^[^ \t]" nil 'move)
1953 (progn (beginning-of-line) (point))) 1953 (progn (beginning-of-line) (point)))
1954 (point))))) 1954 (point)))))
1955 (forward-line -1)) 1955 (forward-line -1))
1956 (symbol 1956 (symbol
1957 ;; Group names can be just numbers. 1957 ;; Group names can be just numbers.
1958 (when (numberp symbol) 1958 (when (numberp symbol)
1959 (setq symbol (intern (int-to-string symbol) gnus-active-hashtb))) 1959 (setq symbol (intern (int-to-string symbol) gnus-active-hashtb)))
1960 (unless (boundp symbol) 1960 (unless (boundp symbol)
1961 (set symbol nil)) 1961 (set symbol nil))
1962 ;; It was a group name. 1962 ;; It was a group name.
2348 ;;; 2348 ;;;
2349 ;;; Group description. 2349 ;;; Group description.
2350 ;;; 2350 ;;;
2351 2351
2352 (defun gnus-read-all-descriptions-files () 2352 (defun gnus-read-all-descriptions-files ()
2353 (let ((methods (cons gnus-select-method 2353 (let ((methods (cons gnus-select-method
2354 (nconc 2354 (nconc
2355 (when (gnus-archive-server-wanted-p) 2355 (when (gnus-archive-server-wanted-p)
2356 (list "archive")) 2356 (list "archive"))
2357 gnus-secondary-select-methods)))) 2357 gnus-secondary-select-methods))))
2358 (while methods 2358 (while methods
2438 (list (apply 'list name abilities))))) 2438 (list (apply 'list name abilities)))))
2439 2439
2440 (defun gnus-set-default-directory () 2440 (defun gnus-set-default-directory ()
2441 "Set the default directory in the current buffer to `gnus-default-directory'. 2441 "Set the default directory in the current buffer to `gnus-default-directory'.
2442 If this variable is nil, don't do anything." 2442 If this variable is nil, don't do anything."
2443 (setq default-directory 2443 (setq default-directory
2444 (if (and gnus-default-directory 2444 (if (and gnus-default-directory
2445 (file-exists-p gnus-default-directory)) 2445 (file-exists-p gnus-default-directory))
2446 (file-name-as-directory (expand-file-name gnus-default-directory)) 2446 (file-name-as-directory (expand-file-name gnus-default-directory))
2447 default-directory))) 2447 default-directory)))
2448 2448