• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/gnus/

Lines Matching +refs:gnus +refs:current +refs:article

0 ;;; gnus-start.el --- startup functions for Gnus
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
30 (require 'gnus)
31 (require 'gnus-win)
32 (require 'gnus-int)
33 (require 'gnus-spec)
34 (require 'gnus-range)
35 (require 'gnus-util)
37 (autoload 'gnus-agent-read-servers-validate "gnus-agent")
38 (autoload 'gnus-agent-save-local "gnus-agent")
39 (autoload 'gnus-agent-possibly-alter-active "gnus-agent")
44 (defvar gnus-agent-covered-methods nil)
45 (defvar gnus-agent-file-loading-local nil)
46 (defvar gnus-agent-file-loading-cache nil))
48 (defcustom gnus-startup-file (nnheader-concat gnus-home-directory ".newsrc")
51 :group 'gnus-start
54 (defcustom gnus-backup-startup-file 'never
59 :group 'gnus-start
64 (defcustom gnus-save-startup-file-via-temp-buffer t
70 :group 'gnus-start
74 (defcustom gnus-init-file (nnheader-concat gnus-home-directory ".gnus")
77 :group 'gnus-start
80 (defcustom gnus-site-init-file
84 "site-lisp/gnus-init")
88 :group 'gnus-start
91 (defcustom gnus-default-subscribed-newsgroups nil
96 :group 'gnus-start
99 (defcustom gnus-use-dribble-file t
103 :group 'gnus-dribble-file
106 (defcustom gnus-dribble-directory nil
110 :group 'gnus-dribble-file
113 (defcustom gnus-check-new-newsgroups 'ask-server
114 "*Non-nil means that Gnus will run `gnus-find-new-newsgroups' at startup.
119 When any of the following are true, `gnus-find-new-newsgroups' will instead
124 3. `gnus-read-active-file' is nil or `some'.
125 4. A prefix argument is given to `gnus-find-new-newsgroups' interactively.
128 `gnus-read-active-file' is nil or `some', then the killed list is no
129 longer necessary, so you could safely set `gnus-save-killed-list' to nil.
136 (setq gnus-check-new-newsgroups
140 check for new newsgroups with \\<gnus-group-mode-map>\\[gnus-find-new-newsgroups]."
141 :group 'gnus-start
150 (defcustom gnus-check-bogus-newsgroups nil
153 check for bogus newsgroups with \\<gnus-group-mode-map>\\[gnus-group-check-bogus-groups]."
154 :group 'gnus-start-server
157 (defcustom gnus-read-active-file 'some
169 `gnus-check-new-newsgroups' to `ask-server'. This may not work
171 :group 'gnus-start-server
176 (defconst gnus-level-subscribed 5
179 (defconst gnus-level-unsubscribed 7
181 Groups with levels less than `gnus-level-subscribed', which should be
184 (defconst gnus-level-zombie 8
187 (defconst gnus-level-killed 9
190 (defcustom gnus-level-default-subscribed 3
192 :group 'gnus-group-levels
195 (defcustom gnus-level-default-unsubscribed 6
197 :group 'gnus-group-levels
200 (defcustom gnus-activate-level (1+ gnus-level-subscribed)
204 :group 'gnus-group-levels
207 (defcustom gnus-activate-foreign-newsgroups 4
213 `gnus-level-subscribed'.
219 :group 'gnus-group-levels
223 (defcustom gnus-read-newsrc-file t
231 :group 'gnus-newsrc
234 (defcustom gnus-save-newsrc-file t
241 :group 'gnus-newsrc
244 (defcustom gnus-save-killed-list t
251 You should always set `gnus-check-new-newsgroups' to `ask-server' or
256 :group 'gnus-newsrc
264 (defcustom gnus-ignored-newsgroups
275 :group 'gnus-group-new
278 (defcustom gnus-subscribe-newsgroup-method 'gnus-subscribe-zombies
280 A few pre-made functions are supplied: `gnus-subscribe-randomly'
282 `gnus-subscribe-alphabetically' inserts new groups in strict
283 alphabetic order; `gnus-subscribe-hierarchically' inserts new groups
284 in hierarchical newsgroup order; `gnus-subscribe-interactively' asks
285 for your decision; `gnus-subscribe-killed' kills all new groups;
286 `gnus-subscribe-zombies' will make all new groups into zombies;
287 `gnus-subscribe-topics' will enter groups into the topics that
289 :group 'gnus-group-new
290 :type '(radio (function-item gnus-subscribe-randomly)
291 (function-item gnus-subscribe-alphabetically)
292 (function-item gnus-subscribe-hierarchically)
293 (function-item gnus-subscribe-interactively)
294 (function-item gnus-subscribe-killed)
295 (function-item gnus-subscribe-zombies)
296 (function-item gnus-subscribe-topics)
300 (defcustom gnus-subscribe-newsgroup-hooks nil
304 :group 'gnus-group-new
307 (defcustom gnus-subscribe-options-newsgroup-method
308 'gnus-subscribe-alphabetically
318 :group 'gnus-group-new
319 :type '(radio (function-item gnus-subscribe-randomly)
320 (function-item gnus-subscribe-alphabetically)
321 (function-item gnus-subscribe-hierarchically)
322 (function-item gnus-subscribe-interactively)
323 (function-item gnus-subscribe-killed)
324 (function-item gnus-subscribe-zombies)
325 (function-item gnus-subscribe-topics)
329 (defcustom gnus-subscribe-hierarchical-interactive nil
338 :group 'gnus-group-new
341 (defcustom gnus-auto-subscribed-groups
348 `gnus-subscribe-newsgroup-method'. Instead, they will
349 be subscribed using `gnus-subscribe-options-newsgroup-method'."
350 :group 'gnus-group-new
353 (defcustom gnus-options-subscribe nil
359 `gnus-subscribe-newsgroup-method'. Instead, they will
360 be subscribed using `gnus-subscribe-options-newsgroup-method'."
361 :group 'gnus-group-new
365 (defcustom gnus-options-not-subscribe nil
369 :group 'gnus-group-new
373 (defcustom gnus-modtime-botch nil
377 :group 'gnus-newsrc
380 (defcustom gnus-check-bogus-groups-hook nil
382 :group 'gnus-start-server
385 (defcustom gnus-startup-hook nil
388 :group 'gnus-start
391 (defcustom gnus-before-startup-hook nil
394 :group 'gnus-start
397 (defcustom gnus-started-hook nil
399 :group 'gnus-start
402 (defcustom gnus-setup-news-hook
403 '(gnus-fixup-nnimap-unread-after-getting-new-news)
405 :group 'gnus-start
408 (defcustom gnus-get-top-new-news-hook nil
411 :group 'gnus-group-new
414 (defcustom gnus-get-new-news-hook nil
416 :group 'gnus-group-new
419 (defcustom gnus-after-getting-new-news-hook
420 '(gnus-display-time-event-handler
421 gnus-fixup-nnimap-unread-after-getting-new-news)
423 :group 'gnus-group-new
426 (defcustom gnus-read-newsrc-el-hook nil
428 :group 'gnus-newsrc
431 (defcustom gnus-save-newsrc-hook nil
433 :group 'gnus-newsrc
436 (defcustom gnus-save-quick-newsrc-hook nil
439 :group 'gnus-newsrc
442 (defcustom gnus-save-standard-newsrc-hook nil
445 :group 'gnus-newsrc
448 (defcustom gnus-group-mode-hook nil
450 :group 'gnus-group-various
451 :options '(gnus-topic-mode)
454 (defcustom gnus-always-read-dribble-file nil
456 :group 'gnus-newsrc
461 (defvar gnus-ding-file-coding-system mm-universal-coding-system
464 (defvar gnus-newsrc-file-version nil)
465 (defvar gnus-override-subscribe-method nil)
466 (defvar gnus-dribble-buffer nil)
467 (defvar gnus-newsrc-options nil
470 (defvar gnus-newsrc-options-n nil
473 (defvar gnus-newsrc-last-checked-date nil
476 (defvar gnus-current-startup-file nil
477 "Startup file for the current host.")
480 (defvar gnus-group-line-format)
483 (defvar gnus-init-inhibit nil)
484 (defun gnus-read-init-file (&optional inhibit-next)
485 ;; Don't load .gnus if the -q option was used.
487 (if gnus-init-inhibit
488 (setq gnus-init-inhibit nil)
489 (setq gnus-init-inhibit inhibit-next)
490 (dolist (file (list gnus-site-init-file gnus-init-file))
502 (defun gnus-subscribe-hierarchical-interactive (groups)
530 (push group gnus-killed-list)
531 (gnus-sethash group group gnus-killed-hashtb)
538 (gnus-sethash group group gnus-killed-hashtb)
539 (gnus-subscribe-alphabetically (car groups))
545 (push group gnus-killed-list)
546 (gnus-sethash group group gnus-killed-hashtb)
556 (gnus-subscribe-alphabetically (car groups))
557 (gnus-sethash group group gnus-killed-hashtb))
561 (push group gnus-killed-list)
562 (gnus-sethash group group gnus-killed-hashtb)
565 (push group gnus-killed-list)
566 (gnus-sethash group group gnus-killed-hashtb)))
569 (defun gnus-subscribe-randomly (newsgroup)
571 (gnus-subscribe-newsgroup newsgroup))
573 (defun gnus-subscribe-alphabetically (newgroup)
575 (let ((groups (cdr gnus-newsrc-alist))
581 (gnus-subscribe-newsgroup newgroup before)))
583 (defun gnus-subscribe-hierarchically (newgroup)
587 (set-buffer (nnheader-find-file-noselect gnus-current-startup-file))
602 (gnus-subscribe-newsgroup newgroup before))
603 (kill-buffer (current-buffer)))))
605 (defun gnus-subscribe-interactively (group)
609 (if (gnus-y-or-n-p (format "Subscribe new newsgroup %s? " group))
610 (gnus-subscribe-hierarchically group)
611 (push group gnus-killed-list)))
613 (defun gnus-subscribe-zombies (group)
615 (push group gnus-zombie-list))
617 (defun gnus-subscribe-killed (group)
619 (push group gnus-killed-list))
621 (defun gnus-subscribe-newsgroup (newsgroup &optional next)
628 (gnus-group-change-level
629 newsgroup gnus-level-default-subscribed
630 gnus-level-killed (gnus-gethash (or next "dummy.group")
631 gnus-newsrc-hashtb))
632 (gnus-message 5 "Subscribe newsgroup: %s" newsgroup)
633 (run-hook-with-args 'gnus-subscribe-newsgroup-hooks newsgroup)
636 (defun gnus-read-active-file-p ()
637 "Say whether the active file has been read from `gnus-select-method'."
638 (memq gnus-select-method gnus-have-read-active-file))
644 (defvar gnus-current-headers)
645 (defvar gnus-thread-indent-array)
646 (defvar gnus-newsgroup-name)
647 (defvar gnus-newsgroup-headers)
648 (defvar gnus-group-list-mode)
649 (defvar gnus-group-mark-positions)
650 (defvar gnus-newsgroup-data)
651 (defvar gnus-newsgroup-unreads)
653 (defvar gnus-current-select-method)
659 (defun gnus-close-all-servers ()
662 (dolist (server gnus-opened-servers)
663 (gnus-close-server (car server))))
665 (defun gnus-clear-system ()
668 (let ((variables (remove 'gnus-format-specs gnus-variable-list)))
673 (setq gnus-list-of-killed-groups nil
674 gnus-have-read-active-file nil
675 gnus-agent-covered-methods nil
676 gnus-agent-file-loading-local nil
677 gnus-agent-file-loading-cache nil
678 gnus-server-method-cache nil
679 gnus-newsrc-alist nil
680 gnus-newsrc-hashtb nil
681 gnus-killed-list nil
682 gnus-zombie-list nil
683 gnus-killed-hashtb nil
684 gnus-active-hashtb nil
685 gnus-moderated-hashtb nil
686 gnus-description-hashtb nil
687 gnus-current-headers nil
688 gnus-thread-indent-array nil
689 gnus-newsgroup-headers nil
690 gnus-newsgroup-name nil
691 gnus-server-alist nil
692 gnus-group-list-mode nil
693 gnus-opened-servers nil
694 gnus-group-mark-positions nil
695 gnus-newsgroup-data nil
696 gnus-newsgroup-unreads nil
698 gnus-current-select-method nil
700 gnus-ephemeral-servers nil)
701 (gnus-shutdown 'gnus)
703 (and gnus-current-startup-file
704 (get-file-buffer gnus-current-startup-file)
705 (kill-buffer (get-file-buffer gnus-current-startup-file)))
707 (gnus-dribble-clear)
709 (when (get-file-buffer (gnus-newsgroup-kill-file nil))
710 (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil))))
711 (gnus-kill-buffer nntp-server-buffer)
713 (dolist (buffer (gnus-buffers))
714 (gnus-kill-buffer buffer))
716 (gnus-kill-gnus-frames))
718 (defun gnus-no-server-1 (&optional arg slave)
722 \(`gnus-level-default-subscribed' minus one). If ARG is non-nil
724 of an NNTP server to use. As opposed to \\[gnus], this command
727 (let ((val (or arg (1- gnus-level-default-subscribed))))
728 (gnus val t slave)
729 (make-local-variable 'gnus-group-use-permanent-levels)
730 (setq gnus-group-use-permanent-levels val)))
732 (defun gnus-1 (&optional arg dont-connect slave)
739 (if (gnus-alive-p)
741 (switch-to-buffer gnus-group-buffer)
742 (gnus-group-get-new-news
745 (max (car gnus-group-list-mode) arg))))
747 (gnus-clear-system)
748 (gnus-splash)
749 (gnus-run-hooks 'gnus-before-startup-hook)
751 (setq gnus-slave slave)
752 (gnus-read-init-file)
753 (if gnus-agent
754 (gnus-agentize))
756 (when gnus-simple-splash
757 (setq gnus-simple-splash nil)
760 (gnus-xmas-splash))
763 (gnus-x-splash))))
771 (gnus-start-news-server (and arg (not level))))))
774 (gnus-group-quit)
775 (gnus-run-hooks 'gnus-startup-hook)
778 ;; Find the current startup file name.
779 (setq gnus-current-startup-file
780 (gnus-make-newsrc-file gnus-startup-file))
783 (when (or gnus-slave gnus-use-dribble-file)
784 (gnus-dribble-read-file))
787 (when gnus-use-grouplens
789 (add-hook 'gnus-summary-mode-hook 'gnus-grouplens-mode))
792 (if gnus-agent
793 (gnus-request-create-group "queue" '(nndraft "")))
794 (gnus-request-create-group "drafts" '(nndraft ""))
795 (gnus-setup-news nil level dont-connect)
796 (gnus-run-hooks 'gnus-setup-news-hook)
797 (gnus-start-draft-setup)
799 (gnus-group-list-groups level)
800 (gnus-group-first-unread-group)
801 (gnus-configure-windows 'group)
802 (gnus-group-set-mode-line)
803 (gnus-run-hooks 'gnus-started-hook))))))
805 (defun gnus-start-draft-setup ()
807 (gnus-request-create-group "drafts" '(nndraft ""))
808 (unless (gnus-gethash "nndraft:drafts" gnus-newsrc-hashtb)
809 (gnus-message 3 "Subscribing drafts group")
810 (let ((gnus-level-default-subscribed 1))
811 (gnus-subscribe-group "nndraft:drafts" nil '(nndraft ""))))
812 (unless (equal (gnus-group-get-parameter "nndraft:drafts" 'gnus-dummy t)
813 '((gnus-draft-mode)))
814 (gnus-message 3 "Setting up drafts group")
815 (gnus-group-set-parameter
816 "nndraft:drafts" 'gnus-dummy '((gnus-draft-mode)))))
824 (defvar gnus-dribble-ignore nil)
825 (defvar gnus-dribble-eval-file nil)
827 (defun gnus-dribble-file-name ()
828 "Return the dribble file for the current .newsrc."
830 (if gnus-dribble-directory
831 (concat (file-name-as-directory gnus-dribble-directory)
832 (file-name-nondirectory gnus-current-startup-file))
833 gnus-current-startup-file)
836 (defun gnus-dribble-enter (string)
838 (when (and (not gnus-dribble-ignore)
839 gnus-dribble-buffer
840 (buffer-name gnus-dribble-buffer))
841 (let ((obuf (current-buffer)))
842 (set-buffer gnus-dribble-buffer)
849 ;; (set-window-point (get-buffer-window (current-buffer)) (point-max))
850 (bury-buffer gnus-dribble-buffer)
852 (set-buffer gnus-group-buffer)
853 (gnus-group-set-mode-line))
856 (defun gnus-dribble-touch ()
858 (gnus-dribble-enter ""))
860 (defun gnus-dribble-read-file ()
862 (let ((dribble-file (gnus-dribble-file-name)))
864 (set-buffer (setq gnus-dribble-buffer
865 (gnus-get-buffer-create
872 (bury-buffer (current-buffer))
875 (gnus-dribble-ignore t)
888 (when (and (file-exists-p gnus-current-startup-file)
890 (setq modes (file-modes gnus-current-startup-file)))
896 (when (or gnus-always-read-dribble-file
897 (gnus-y-or-n-p
901 (setq gnus-dribble-eval-file t)))))))
903 (defun gnus-dribble-eval-file ()
904 (when gnus-dribble-eval-file
905 (setq gnus-dribble-eval-file nil)
907 (let ((gnus-dribble-ignore t))
908 (set-buffer gnus-dribble-buffer)
909 (eval-buffer (current-buffer))))))
911 (defun gnus-dribble-delete-file ()
912 (when (file-exists-p (gnus-dribble-file-name))
913 (delete-file (gnus-dribble-file-name)))
914 (when gnus-dribble-buffer
916 (set-buffer gnus-dribble-buffer)
923 (defun gnus-dribble-save ()
924 (when (and gnus-dribble-buffer
925 (buffer-name gnus-dribble-buffer))
927 (set-buffer gnus-dribble-buffer)
930 (defun gnus-dribble-clear ()
931 (when (gnus-buffer-exists-p gnus-dribble-buffer)
933 (set-buffer gnus-dribble-buffer)
944 (defun gnus-setup-news (&optional rawfile level dont-connect)
949 (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile))))
956 (setq gnus-newsrc-alist nil
957 gnus-active-hashtb nil)
958 ;; Read the newsrc file and create `gnus-newsrc-hashtb'.
959 (gnus-read-newsrc-file rawfile))
962 (when gnus-message-archive-method
963 (unless (assoc "archive" gnus-server-alist)
964 (let ((method (or (and (stringp gnus-message-archive-method)
965 (gnus-server-to-method
966 gnus-message-archive-method))
967 gnus-message-archive-method)))
971 gnus-valid-select-methods)))
985 gnus-server-alist))))
989 (when (or (null gnus-read-active-file)
990 (eq gnus-read-active-file 'some))
991 (gnus-update-active-hashtb-from-killed))
993 ;; Validate agent covered methods now that gnus-server-alist has
997 ;; format to the current format. That enables the agent code
998 ;; within gnus-read-active-file to function correctly.
999 (if gnus-agent
1000 (gnus-agent-read-servers-validate))
1002 ;; Read the active file and create `gnus-active-hashtb'.
1003 ;; If `gnus-read-active-file' is nil, then we just create an empty
1005 ;; done in `gnus-get-unread-articles'.
1006 (and gnus-read-active-file
1008 (gnus-read-active-file nil dont-connect))
1010 (unless gnus-active-hashtb
1011 (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
1014 (when gnus-use-cache
1015 (gnus-cache-open))
1019 (or gnus-use-dribble-file gnus-slave)
1020 (gnus-dribble-eval-file))
1023 (when (and init gnus-slave)
1024 (gnus-dribble-clear))
1026 (gnus-update-format-specifications)
1029 (when (and (boundp 'gnus-group-line-format)
1030 (stringp gnus-group-line-format)
1032 (string-match "%[-,0-9]*D" gnus-group-line-format))
1033 (not gnus-description-hashtb)
1035 gnus-read-active-file)
1036 (gnus-read-all-descriptions-files))
1039 (when (and init gnus-check-new-newsgroups (not level)
1040 (gnus-check-server gnus-select-method)
1041 (not gnus-slave)
1042 gnus-plugged)
1043 (gnus-find-new-newsgroups))
1046 (when (and init gnus-check-bogus-newsgroups
1047 gnus-read-active-file (not level)
1048 (gnus-server-opened gnus-select-method))
1049 (gnus-check-bogus-newsgroups))
1053 gnus-use-nocem
1054 (or (and (numberp gnus-use-nocem)
1056 (>= level gnus-use-nocem))
1058 (gnus-nocem-scan-groups))
1061 (gnus-master-read-slave-newsrc)
1064 (let ((gnus-read-active-file (and (not level) gnus-read-active-file)))
1065 (gnus-get-unread-articles level))))
1067 (defun gnus-call-subscribe-functions (method group)
1069 If no function returns `non-nil', call `gnus-subscribe-zombies'."
1080 (gnus-subscribe-zombies group)))
1082 (defun gnus-find-new-newsgroups (&optional arg)
1084 Each new newsgroup will be treated with `gnus-subscribe-newsgroup-method'.
1092 (let* ((gnus-subscribe-newsgroup-method
1093 gnus-subscribe-newsgroup-method)
1096 (not (listp gnus-check-new-newsgroups)))
1097 (null gnus-read-active-file)
1098 (eq gnus-read-active-file 'some))
1101 (setq gnus-subscribe-newsgroup-method
1102 'gnus-subscribe-zombies)
1104 (t gnus-check-new-newsgroups))))
1105 (unless (gnus-check-first-time-used)
1109 (gnus-ask-server-for-new-groups)
1113 (gnus-message 5 "Looking for new newsgroups...")
1114 (unless gnus-have-read-active-file
1115 (gnus-read-active-file))
1116 (setq gnus-newsrc-last-checked-date (message-make-date))
1117 (unless gnus-killed-hashtb
1118 (gnus-make-hashtable-from-killed))
1119 ;; Go though every newsgroup in `gnus-active-hashtb' and compare
1120 ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'.
1126 (gnus-gethash group gnus-killed-hashtb)
1127 (gnus-gethash group gnus-newsrc-hashtb))
1129 (let ((do-sub (gnus-matches-options-n group)))
1133 (gnus-sethash group group gnus-killed-hashtb)
1134 (gnus-call-subscribe-functions
1135 gnus-subscribe-options-newsgroup-method group))
1140 (gnus-sethash group group gnus-killed-hashtb)
1141 (if gnus-subscribe-hierarchical-interactive
1143 (gnus-call-subscribe-functions
1144 gnus-subscribe-newsgroup-method group)))))))
1145 gnus-active-hashtb)
1147 (gnus-subscribe-hierarchical-interactive new-newsgroups))
1149 (gnus-message 5 "%d new newsgroup%s arrived."
1151 (gnus-message 5 "No new newsgroups.")))))))
1153 (defun gnus-matches-options-n (group)
1160 ((and gnus-options-subscribe
1161 (string-match gnus-options-subscribe group))
1163 ((and gnus-auto-subscribed-groups
1164 (string-match gnus-auto-subscribed-groups group))
1166 ((and gnus-options-not-subscribe
1167 (string-match gnus-options-not-subscribe group))
1174 (let ((regs gnus-newsrc-options-n))
1180 (defun gnus-ask-server-for-new-groups ()
1182 (date (or gnus-newsrc-last-checked-date new-date))
1183 (methods (cons gnus-select-method
1185 (when (gnus-archive-server-wanted-p)
1188 (and (consp gnus-check-new-newsgroups)
1189 gnus-check-new-newsgroups)
1190 gnus-secondary-select-methods))))
1193 gnus-override-subscribe-method)
1194 (unless gnus-killed-hashtb
1195 (gnus-make-hashtable-from-killed))
1198 (while (setq method (gnus-server-get-method nil (pop methods)))
1200 gnus-override-subscribe-method method)
1201 (when (and (gnus-check-server method)
1202 (gnus-request-newgroups date method))
1205 hashtb (gnus-make-hashtable 100))
1208 (gnus-active-to-gnus-format method hashtb 'ignore))
1215 (gnus-gethash group gnus-newsrc-hashtb)
1216 (member group gnus-zombie-list)
1217 (member group gnus-killed-list))
1222 (gnus-set-active group (symbol-value group-sym)))
1224 (let ((do-sub (gnus-matches-options-n group)))
1228 (gnus-sethash group group gnus-killed-hashtb)
1229 (gnus-call-subscribe-functions
1230 gnus-subscribe-options-newsgroup-method group))
1235 (gnus-sethash group group gnus-killed-hashtb)
1236 (if gnus-subscribe-hierarchical-interactive
1238 (gnus-call-subscribe-functions
1239 gnus-subscribe-newsgroup-method group)))))))
1242 (gnus-subscribe-hierarchical-interactive new-newsgroups)))
1244 (gnus-message 5 "%d new newsgroup%s arrived"
1246 (gnus-message 5 "No new newsgroups"))
1248 (setq gnus-newsrc-last-checked-date new-date))
1251 (defun gnus-check-first-time-used ()
1255 (dolist (file (list (concat gnus-current-startup-file ".el")
1256 (concat gnus-current-startup-file ".eld")
1257 (concat gnus-startup-file ".el")
1258 (concat gnus-startup-file ".eld")))
1261 (gnus-message 6 "First time user; subscribing you to default groups")
1262 (unless (gnus-read-active-file-p)
1263 (let ((gnus-read-active-file t))
1264 (gnus-read-active-file)))
1265 (setq gnus-newsrc-last-checked-date (message-make-date))
1267 (let ((groups (or gnus-default-subscribed-newsgroups
1268 gnus-backup-default-subscribed-newsgroups))
1275 (let ((do-sub (gnus-matches-options-n group)))
1278 (gnus-sethash group group gnus-killed-hashtb)
1279 (gnus-call-subscribe-functions
1280 gnus-subscribe-options-newsgroup-method group))
1284 (push group gnus-killed-list))))))
1285 gnus-active-hashtb)
1288 (when (gnus-active group)
1289 (gnus-group-change-level
1290 group gnus-level-default-subscribed gnus-level-killed)))
1292 (set-buffer gnus-group-buffer)
1295 (gnus-group-make-help-group t))
1296 (when gnus-novice-user
1297 (gnus-message 7 "`A k' to list killed groups"))))))
1299 (defun gnus-subscribe-group (group &optional previous method)
1301 (gnus-group-change-level
1303 (list t group gnus-level-default-subscribed nil nil method)
1305 gnus-level-default-subscribed gnus-level-killed previous t)
1308 ;; `gnus-group-change-level' is the fundamental function for changing
1319 ;; otherwise it's a list in the format of the `gnus-newsrc-hashtb'
1324 (defun gnus-group-change-level (entry level &optional oldlevel
1334 (< oldlevel gnus-level-zombie))
1335 (setq entry (gnus-gethash entry gnus-newsrc-hashtb)))
1338 (setq oldlevel (gnus-info-level (nth 2 entry)))
1339 (setq oldlevel (or oldlevel gnus-level-killed)))
1341 (setq previous (gnus-gethash previous gnus-newsrc-hashtb)))
1343 (if (and (>= oldlevel gnus-level-zombie)
1344 (gnus-gethash group gnus-newsrc-hashtb))
1349 (unless (gnus-ephemeral-group-p group)
1350 (gnus-dribble-enter
1351 (format "(gnus-group-change-level %S %S %S %S %S)"
1359 ((>= oldlevel gnus-level-zombie)
1361 (setq gnus-zombie-list (delete group gnus-zombie-list))
1362 (setq gnus-killed-list (delete group gnus-killed-list)))
1364 (when (and (>= level gnus-level-zombie)
1366 (gnus-sethash (car (nth 2 entry)) nil gnus-newsrc-hashtb)
1368 (setcdr (gnus-gethash (car (nth 3 entry))
1369 gnus-newsrc-hashtb)
1377 ((>= level gnus-level-zombie)
1379 (gnus-sethash group nil gnus-newsrc-hashtb)
1382 (unless (gnus-group-foreign-p group)
1383 (if (= level gnus-level-zombie)
1384 (push group gnus-zombie-list)
1385 (if (= oldlevel gnus-level-killed)
1387 (unintern group gnus-active-hashtb)
1389 (push group gnus-killed-list)))))
1394 (if (< oldlevel gnus-level-zombie)
1402 (setq active (gnus-active group))
1407 (let ((method (gnus-method-simplify
1408 (or gnus-override-subscribe-method
1409 (gnus-group-method group)))))
1415 (let ((p gnus-newsrc-alist))
1423 (gnus-sethash group (cons num (cdr previous))
1424 gnus-newsrc-hashtb))
1426 (gnus-sethash group (cons num previous)
1427 gnus-newsrc-hashtb))
1429 (setcdr (gnus-gethash (caadr entry) gnus-newsrc-hashtb) entry))
1430 (gnus-dribble-enter
1432 "(gnus-group-set-info '%S)" info)))))
1433 (when gnus-group-change-level-function
1434 (funcall gnus-group-change-level-function
1437 (defun gnus-kill-newsgroup (newsgroup)
1439 (gnus-group-change-level
1440 (gnus-gethash newsgroup gnus-newsrc-hashtb) gnus-level-killed))
1442 (defun gnus-check-bogus-newsgroups (&optional confirm)
1446 (let ((newsrc (cdr gnus-newsrc-alist))
1448 (gnus-message 5 "Checking bogus newsgroups...")
1449 (unless (gnus-read-active-file-p)
1450 (gnus-read-active-file t))
1451 (when (gnus-read-active-file-p)
1455 group (gnus-info-group info))
1456 (unless (or (gnus-active group) ; Active
1457 (and (gnus-info-method info)
1458 (not (gnus-secondary-method-p
1459 (gnus-info-method info))))) ; Foreign
1468 (when (setq entry (gnus-gethash group gnus-newsrc-hashtb))
1469 (gnus-group-change-level entry gnus-level-killed)
1470 (setq gnus-killed-list (delete group gnus-killed-list))))
1475 (when (setq entry (gnus-gethash group gnus-newsrc-hashtb))
1476 (gnus-group-change-level entry gnus-level-killed)
1477 (setq gnus-killed-list (delete group gnus-killed-list)))))
1480 (let ((dead-lists '(gnus-killed-list gnus-zombie-list))
1485 (unless (gnus-active (setq group (pop killed)))
1491 (gnus-run-hooks 'gnus-check-bogus-groups-hook)
1492 (gnus-message 5 "Checking bogus newsgroups...done"))))
1494 (defun gnus-check-duplicate-killed-groups ()
1497 (let ((killed gnus-killed-list))
1499 (gnus-message 9 "%d" (length killed))
1503 ;; We want to inline a function from gnus-cache, so we cheat here:
1505 (defvar gnus-cache-active-hashtb)
1506 (defun gnus-cache-possibly-alter-active (group active)
1508 (when gnus-cache-active-hashtb
1509 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
1516 (defun gnus-activate-group (group &optional scan dont-check method)
1519 (let ((method (or method (inline (gnus-find-method-for-group group))))
1521 (and (inline (gnus-check-server method))
1527 (gnus-check-backend-function 'request-scan (car method))
1528 (gnus-request-scan group method))
1531 (inline (gnus-request-group group dont-check method))
1533 (inline (gnus-request-group group dont-check method))
1539 (setq active (gnus-parse-active))
1546 (gnus-active group))
1547 (gnus-active group)
1550 (when gnus-use-cache
1551 (inline (gnus-cache-possibly-alter-active
1555 (when gnus-agent
1556 (gnus-agent-possibly-alter-active group active))
1558 (gnus-set-active group active)
1562 (defun gnus-get-unread-articles-in-group (info active &optional update)
1566 (gnus-request-update-info
1567 info (inline (gnus-find-method-for-group
1568 (gnus-info-group info)))))
1569 (gnus-activate-group (gnus-info-group info) nil t))
1571 (let* ((range (gnus-info-read info))
1574 ;; These checks are present in gnus-activate-group but skipped
1578 (when (and gnus-use-cache info)
1579 (inline (gnus-cache-possibly-alter-active
1580 (gnus-info-group info) active)))
1583 (when (and gnus-agent info)
1584 (gnus-agent-possibly-alter-active (gnus-info-group info) active info))
1653 (gnus-gethash (gnus-info-group info) gnus-newsrc-hashtb))
1654 (setcar (gnus-gethash (gnus-info-group info) gnus-newsrc-hashtb) num))
1657 ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
1659 (defun gnus-get-unread-articles (&optional level)
1660 (setq gnus-server-method-cache nil)
1661 (let* ((newsrc (cdr gnus-newsrc-alist))
1662 (level (or level gnus-activate-level (1+ gnus-level-subscribed)))
1665 (cond ((and gnus-activate-foreign-newsgroups
1666 (not (numberp gnus-activate-foreign-newsgroups)))
1667 (1+ gnus-level-subscribed))
1668 ((numberp gnus-activate-foreign-newsgroups)
1669 gnus-activate-foreign-newsgroups)
1676 (gnus-message 6 "Checking new news...")
1679 (setq active (gnus-active (setq group (gnus-info-group
1694 (when (setq method (gnus-info-method info))
1697 (setq cmethod (inline (gnus-server-get-method nil method)))
1704 ((gnus-secondary-method-p method)
1706 ((inline (gnus-server-equal gnus-select-method method))
1714 (when (and (<= (gnus-info-level info) foreign-level)
1715 (setq active (gnus-activate-group group 'scan)))
1717 (when (and gnus-agent active (gnus-online method))
1718 (gnus-agent-save-group-info
1719 method (gnus-group-real-name group) active))
1720 (unless (inline (gnus-virtual-group-p group))
1721 (inline (gnus-close-group group)))
1724 (inline (gnus-request-update-info info method)))))
1726 ((> (gnus-info-level info) level)
1730 ((not gnus-read-active-file)
1731 (if (gnus-check-backend-function 'retrieve-groups group)
1732 ;; if server support gnus-retrieve-groups we push
1752 (setq active (gnus-activate-group group))
1753 (setq active (gnus-activate-group group 'scan))
1756 (gnus-close-group group)))))
1764 (inline (gnus-get-unread-articles-in-group info active t)))
1768 (gnus-set-active group nil)
1769 (let ((tmp (gnus-gethash group gnus-newsrc-hashtb)))
1773 ;; iterate through groups on methods which support gnus-retrieve-groups
1776 (let ((method (or (car rg) gnus-select-method))
1778 (when (gnus-check-server method)
1780 (when (gnus-check-backend-function 'request-scan (car method))
1781 (gnus-request-scan nil method))
1782 (gnus-read-active-file-2
1783 (mapcar (lambda (group) (gnus-group-real-name group)) groups)
1787 ((setq active (gnus-active (gnus-info-group
1788 (setq info (gnus-get-info group)))))
1789 (inline (gnus-get-unread-articles-in-group info active t)))
1793 (gnus-set-active group nil)
1794 (setcar (gnus-gethash group gnus-newsrc-hashtb) t)))))))
1796 (gnus-message 6 "Checking new news...done")))
1800 (defun gnus-make-hashtable-from-newsrc-alist ()
1801 (let ((alist gnus-newsrc-alist)
1802 (ohashtb gnus-newsrc-hashtb)
1804 (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist)))
1806 (setq prev (setq gnus-newsrc-alist
1807 (if (equal (caar gnus-newsrc-alist)
1809 gnus-newsrc-alist
1812 (gnus-sethash
1815 (cons (and ohashtb (car (gnus-gethash (caar alist) ohashtb)))
1817 gnus-newsrc-hashtb)
1821 (defun gnus-make-hashtable-from-killed ()
1823 (let ((lists '(gnus-killed-list gnus-zombie-list))
1825 (setq gnus-killed-hashtb
1826 (gnus-make-hashtable
1827 (+ (length gnus-killed-list) (length gnus-zombie-list))))
1831 (gnus-sethash (car list) (pop list) gnus-killed-hashtb)))))
1833 (defun gnus-parse-active ()
1838 ;; Parse the result we got from `gnus-request-group'.
1841 (cons (read (current-buffer))
1842 (read (current-buffer))))))
1844 (defun gnus-make-articles-unread (group articles)
1846 (let* ((info (nth 2 (or (gnus-gethash group gnus-newsrc-hashtb)
1847 (gnus-gethash (gnus-group-real-name group)
1848 gnus-newsrc-hashtb))))
1849 (ranges (gnus-info-read info))
1850 news article)
1852 (when (gnus-member-of-range
1853 (setq article (pop articles)) ranges)
1854 (push article news)))
1857 (gnus-info-set-read
1858 info (gnus-remove-from-range (gnus-info-read info) (nreverse news)))
1860 ;; Set the number of unread articles in gnus-newsrc-hashtb.
1861 (gnus-get-unread-articles-in-group info (gnus-active group))
1864 (gnus-group-update-group group t))))
1866 (defun gnus-make-ascending-articles-unread (group articles)
1868 (let* ((entry (or (gnus-gethash group gnus-newsrc-hashtb)
1869 (gnus-gethash (gnus-group-real-name group)
1870 gnus-newsrc-hashtb)))
1872 (ranges (gnus-info-read info))
1877 (let ((article (pop articles))) ; get the next article to remove from ranges
1878 (while (let ((range (car ranges))) ; note the current range
1884 ((< range article)
1885 ;; this range preceeds the article. Leave the range unmodified.
1888 ((= range article)
1889 ;; this range exactly matches the article; REMOVE THE RANGE.
1907 ((< max article)
1908 ;; this range preceeds the article. Leave the range unmodified.
1911 ((< article min)
1912 ;; this article preceeds the range. Return null to move to the
1913 ;; next article
1916 ;; this article splits the range into two parts
1917 (setcdr ranges (cons (cons (1+ article) max) (cdr ranges)))
1918 (setcdr range (1- article))
1926 (gnus-info-set-read info r)
1928 ;; Set the number of unread articles in gnus-newsrc-hashtb.
1929 (gnus-get-unread-articles-in-group info (gnus-active group))
1932 (gnus-group-update-group group t))))
1935 (defun gnus-update-active-hashtb-from-killed ()
1936 (let ((hashtb (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
1937 (lists (list gnus-killed-list gnus-zombie-list))
1942 (gnus-sethash (car killed) nil hashtb)
1946 (defun gnus-get-killed-groups ()
1949 (unless (gnus-read-active-file-p)
1950 (let ((gnus-read-active-file t))
1951 (gnus-read-active-file)))
1952 (unless gnus-killed-hashtb
1953 (gnus-make-hashtable-from-killed))
1960 (gnus-gethash group gnus-killed-hashtb)
1961 (gnus-gethash group gnus-newsrc-hashtb))
1963 (let ((do-sub (gnus-matches-options-n group)))
1967 (push group gnus-killed-list)
1968 (gnus-sethash group group gnus-killed-hashtb))))))
1969 gnus-active-hashtb)
1970 (gnus-dribble-touch))
1973 (defun gnus-read-active-file (&optional force not-native)
1974 (gnus-group-set-mode-line)
1977 (lambda (m) (if (stringp m) (gnus-server-get-method nil m) m))
1980 (gnus-check-server gnus-select-method))
1982 (cons gnus-select-method gnus-secondary-select-methods)
1985 gnus-secondary-select-methods)
1987 (when (gnus-archive-server-wanted-p)
1990 (setq gnus-have-read-active-file nil)
1998 (gnus-read-active-file-1 method force)
2000 (gnus-read-active-file-1 method force)
2007 (defun gnus-read-active-file-1 (method force)
2014 (gnus-message 5 mesg)
2015 (when (gnus-check-server method)
2017 (when (gnus-check-backend-function 'request-scan (car method))
2018 (gnus-request-scan nil method))
2020 ((and (eq gnus-read-active-file 'some)
2021 (gnus-check-backend-function 'retrieve-groups (car method))
2023 (let ((newsrc (cdr gnus-newsrc-alist))
2024 (gmethod (gnus-server-get-method nil method))
2028 (gnus-server-equal
2030 (gnus-find-method-for-group
2031 (gnus-info-group info) info))
2033 (push (gnus-group-real-name (gnus-info-group info))
2035 (gnus-read-active-file-2 groups method)))
2039 (if (not (gnus-request-list method))
2040 (unless (equal method gnus-message-archive-method)
2041 (gnus-error 1 "Cannot read active file from %s server"
2043 (gnus-message 5 mesg)
2044 (gnus-active-to-gnus-format method gnus-active-hashtb nil t)
2046 (push method gnus-have-read-active-file)
2047 (gnus-message 5 "%sdone" mesg)))))))
2049 (defun gnus-read-active-file-2 (groups method)
2050 "Read an active file for GROUPS in METHOD using `gnus-retrieve-groups'."
2054 (gnus-check-server method)
2055 (let ((list-type (gnus-retrieve-groups groups method)))
2057 (gnus-error
2061 (gnus-active-to-gnus-format method gnus-active-hashtb nil t))
2063 (gnus-groups-to-gnus-format method gnus-active-hashtb t)))))))
2065 ;; Read an active file and place the results in `gnus-active-hashtb'.
2066 (defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors
2069 (setq method gnus-select-method))
2070 (let ((cur (current-buffer))
2072 (if (and gnus-active-hashtb
2073 (not (equal method gnus-select-method)))
2074 gnus-active-hashtb
2075 (setq gnus-active-hashtb
2076 (if (equal method gnus-select-method)
2077 (gnus-make-hashtable
2079 (gnus-make-hashtable 4096)))))))
2083 ((string= gnus-ignored-newsgroups "")
2086 (delete-matching-lines (concat "^to\\.\\|" gnus-ignored-newsgroups))))
2097 (when (and gnus-agent real-active (gnus-online method))
2098 (gnus-agent-save-active method))
2102 (when (not (gnus-server-equal
2103 (gnus-server-get-method nil method)
2104 (gnus-server-get-method nil gnus-select-method)))
2105 (let ((prefix (gnus-group-prefixed-name "" method)))
2119 (narrow-to-region (point) (gnus-point-at-eol))
2139 (unless gnus-moderated-hashtb
2140 (setq gnus-moderated-hashtb (gnus-make-hashtable)))
2141 (gnus-sethash (symbol-name group) t
2142 gnus-moderated-hashtb)))
2149 (gnus-message 3 "Warning - invalid active: %s"
2151 (gnus-point-at-bol) (gnus-point-at-eol))))))
2155 (defun gnus-groups-to-gnus-format (method &optional hashtb real-active)
2157 (let ((cur (current-buffer))
2159 (if (and method gnus-active-hashtb)
2160 gnus-active-hashtb
2161 (setq gnus-active-hashtb
2162 (gnus-make-hashtable
2165 (not (gnus-server-equal
2166 (gnus-server-get-method nil method)
2167 (gnus-server-get-method nil gnus-select-method)))
2168 (gnus-group-prefixed-name "" method))))
2171 (if (and gnus-agent
2173 (gnus-online method)
2174 (gnus-agent-method-p method))
2176 (gnus-agent-save-active method)
2177 (gnus-active-to-gnus-format method hashtb nil real-active))
2210 (defun gnus-read-newsrc-file (&optional force)
2214 (let ((variables (remove 'gnus-format-specs gnus-variable-list)))
2218 (let* ((newsrc-file gnus-current-startup-file)
2224 (gnus-read-newsrc-el-file quick-file)
2226 (when (and gnus-read-newsrc-file
2227 (file-exists-p gnus-current-startup-file)
2232 (not gnus-newsrc-alist)))
2235 ;; the `gnus-newsrc-hashtb' has been created. While reading
2241 (gnus-message 5 "Reading %s..." newsrc-file)
2244 (gnus-newsrc-to-gnus-format)
2245 (kill-buffer (current-buffer))
2246 (gnus-message 5 "Reading %s...done" newsrc-file)))
2249 (gnus-convert-old-newsrc))))
2251 (defun gnus-convert-old-newsrc ()
2252 "Convert old newsrc formats into the current format, if needed."
2253 (let ((fcv (and gnus-newsrc-file-version
2254 (gnus-continuum-version gnus-newsrc-file-version)))
2255 (gcv (gnus-continuum-version)))
2262 (cons (gnus-continuum-version (car date-func))
2265 ;; to bring the newsrc file up to the current
2269 ;; current gnus version (hardcoded so that it
2272 ;; previous version into the current version.
2274 gnus-convert-old-ticks)
2275 ("Oort Gnus v0.08" "legacy-gnus-agent"
2276 gnus-agent-convert-to-compressed-agentview)
2277 ("Gnus v5.10.7" "legacy-gnus-agent"
2278 gnus-agent-unlist-expire-days)
2279 ("Gnus v5.10.7" "legacy-gnus-agent"
2280 gnus-agent-unhook-expire-days)))
2298 (not (gnus-convert-converter-needs-prompt func))
2302 (message "Convert gnus from version '%s' to '%s'? (n/y/?)"
2303 gnus-newsrc-file-version gnus-version)
2307 (error "Can not start gnus without converting"))
2317 (gnus-message 3 "Ignoring unexpected input")
2322 (gnus-dribble-enter
2323 (format ";Converted gnus from version '%s' to '%s'."
2324 gnus-newsrc-file-version gnus-version)))))))
2326 (defun gnus-convert-mark-converter-prompt (converter no-prompt)
2327 "Indicate whether CONVERTER requires gnus-convert-old-newsrc to
2331 (put converter 'gnus-convert-no-prompt no-prompt))
2333 (defun gnus-convert-converter-needs-prompt (converter)
2334 (let ((no-prompt (get converter 'gnus-convert-no-prompt)))
2339 (defun gnus-convert-old-ticks (converting-to)
2340 (let ((newsrc (cdr gnus-newsrc-alist))
2343 (when (setq marks (gnus-info-marks info))
2347 (gnus-info-set-read
2349 (gnus-add-to-range
2350 (gnus-info-read info)
2351 (nconc (gnus-uncompress-range dormant)
2352 (gnus-uncompress-range ticked)))))))))
2354 (defun gnus-load (file)
2360 (let ((form (read (current-buffer))))
2367 (unless (gnus-yes-or-no-p (concat error "; continue? "))
2370 (defun gnus-read-newsrc-el-file (file)
2374 (gnus-message 5 "Reading %s..." ding-file)
2375 (let (gnus-newsrc-assoc)
2376 (let ((coding-system-for-read gnus-ding-file-coding-system))
2377 (gnus-load ding-file))
2378 ;; Older versions of `gnus-format-specs' are no longer valid
2381 (and gnus-newsrc-file-version
2382 (gnus-continuum-version gnus-newsrc-file-version))))
2385 (setq gnus-format-specs gnus-default-format-specs)))
2386 (when gnus-newsrc-assoc
2387 (setq gnus-newsrc-alist gnus-newsrc-assoc))))
2388 (gnus-make-hashtable-from-newsrc-alist)
2391 (gnus-message 5 "Reading %s..." file)
2394 (gnus-read-old-newsrc-el-file file)))
2395 (gnus-run-hooks 'gnus-read-newsrc-el-hook))
2398 (defun gnus-read-old-newsrc-el-file (file)
2401 (let ((gnus-killed-assoc nil)
2402 gnus-marked-assoc gnus-newsrc-alist gnus-newsrc-assoc)
2406 (setq newsrc gnus-newsrc-assoc
2407 killed gnus-killed-assoc
2408 marked gnus-marked-assoc)))
2409 (setq gnus-newsrc-alist nil)
2411 (if (setq info (gnus-get-info (car group)))
2413 (gnus-info-set-read info (cddr group))
2414 (gnus-info-set-level
2415 info (if (nth 1 group) gnus-level-default-subscribed
2416 gnus-level-default-unsubscribed))
2417 (push info gnus-newsrc-alist))
2420 (if (nth 1 group) gnus-level-default-subscribed
2421 gnus-level-default-unsubscribed)
2423 gnus-newsrc-alist))
2428 (gnus-info-set-marks
2429 info (list (cons 'tick (gnus-compress-sequence
2435 (setq gnus-killed-list killed))
2440 gnus-newsrc-options
2441 (when (not (string-match "^ *options" gnus-newsrc-options))
2442 (setq gnus-newsrc-options (concat "options " gnus-newsrc-options)))
2443 (when (not (string-match "\n$" gnus-newsrc-options))
2444 (setq gnus-newsrc-options (concat gnus-newsrc-options "\n")))
2446 (unless (string= gnus-newsrc-options "")
2447 (gnus-newsrc-parse-options gnus-newsrc-options)))
2449 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist))
2450 (gnus-make-hashtable-from-newsrc-alist)))
2452 (defun gnus-make-newsrc-file (file)
2455 (real-file (concat file "-" (nth 1 gnus-select-method))))
2462 (defun gnus-newsrc-to-gnus-format ()
2463 (setq gnus-newsrc-options "")
2464 (setq gnus-newsrc-options-n nil)
2466 (unless gnus-active-hashtb
2467 (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
2468 (let ((buf (current-buffer))
2469 (already-read (> (length gnus-newsrc-alist) 1))
2475 (set (setq options-symbol (intern "options" gnus-active-hashtb)) nil)
2476 (set (setq Options-symbol (intern "Options" gnus-active-hashtb)) nil)
2480 ;; then reading into `gnus-active-hashtb'. Most groups will
2489 (let ((obarray gnus-active-hashtb)) (read buf))))
2496 (setq gnus-newsrc-options
2501 (concat gnus-newsrc-options
2503 (gnus-point-at-bol)
2512 (setq symbol (intern (int-to-string symbol) gnus-active-hashtb)))
2573 (gnus-error 3.1 "Mangled line: %s"
2574 (buffer-substring (gnus-point-at-bol)
2575 (gnus-point-at-eol))))
2586 (let ((info (gnus-get-info group))
2591 (gnus-info-set-read info (nreverse reads))
2595 (setq level (gnus-info-level info))
2596 (cond ((and (<= level gnus-level-subscribed)
2599 gnus-level-default-unsubscribed
2600 (1+ gnus-level-default-unsubscribed))))
2601 ((and (> level gnus-level-subscribed) subscribed)
2602 (setq level gnus-level-default-subscribed)))
2603 (gnus-info-set-level info level))
2607 gnus-level-default-subscribed
2609 (1+ gnus-level-subscribed)
2610 gnus-level-default-unsubscribed))
2620 ;; have read from .newsrc, and `gnus-newsrc-alist', which is
2623 ;; gnus-newsrc-alist to the (native) group that precedes them.
2624 (let ((rc (cdr gnus-newsrc-alist))
2625 (prev gnus-newsrc-alist)
2637 (setq gnus-newsrc-alist newsrc)
2639 (gnus-make-hashtable-from-newsrc-alist)
2642 (unless (string= gnus-newsrc-options "")
2643 (gnus-newsrc-parse-options gnus-newsrc-options))))
2659 (defun gnus-newsrc-parse-options (options)
2662 (gnus-set-work-buffer)
2684 (and (re-search-forward "[ \t]-n" (gnus-point-at-eol) t)
2686 (gnus-point-at-eol)))
2705 (setq gnus-newsrc-options-n out))))
2708 (defalias 'gnus-long-file-names
2713 (defun gnus-save-newsrc-file (&optional force)
2716 ;; from the variable gnus-newsrc-alist.
2717 (when (and (or gnus-newsrc-alist gnus-killed-list)
2718 gnus-current-startup-file)
2720 (when gnus-agent
2721 (gnus-agent-save-local force))
2724 (if (and (or gnus-use-dribble-file gnus-slave)
2726 (or (not gnus-dribble-buffer)
2727 (not (buffer-name gnus-dribble-buffer))
2729 (set-buffer gnus-dribble-buffer)
2731 (gnus-message 4 "(No changes need to be saved)")
2732 (gnus-run-hooks 'gnus-save-newsrc-hook)
2733 (if gnus-slave
2734 (gnus-slave-save-newsrc)
2736 (when gnus-save-newsrc-file
2737 (gnus-message 8 "Saving %s..." gnus-current-startup-file)
2738 (gnus-gnus-to-newsrc-format)
2739 (gnus-message 8 "Saving %s...done" gnus-current-startup-file))
2742 (set-buffer (gnus-get-buffer-create " *Gnus-newsrc*"))
2744 (setq version-control gnus-backup-startup-file)
2746 (concat gnus-current-startup-file ".eld"))
2750 (gnus-message 5 "Saving %s.eld..." gnus-current-startup-file)
2752 (if gnus-save-startup-file-via-temp-buffer
2753 (let ((coding-system-for-write gnus-ding-file-coding-system)
2754 (standard-output (current-buffer)))
2755 (gnus-gnus-to-quick-newsrc-format)
2756 (gnus-run-hooks 'gnus-save-quick-newsrc-hook)
2758 (let ((coding-system-for-write gnus-ding-file-coding-system)
2759 (version-control gnus-backup-startup-file)
2760 (startup-file (concat gnus-current-startup-file ".eld"))
2761 (working-dir (file-name-directory gnus-current-startup-file))
2768 (not (gnus-long-file-names)))
2778 (gnus-with-output-to-file working-file
2779 (gnus-gnus-to-quick-newsrc-format)
2780 (gnus-run-hooks 'gnus-save-quick-newsrc-hook))
2782 ;; These bindings will mislead the current buffer
2789 ;; Backup the current version of the startup file.
2799 (gnus-kill-buffer (current-buffer))
2800 (gnus-message
2801 5 "Saving %s.eld...done" gnus-current-startup-file))
2802 (gnus-dribble-delete-file)
2803 (gnus-group-set-mode-line)))))
2805 (defun gnus-gnus-to-quick-newsrc-format (&optional minimal name &rest specific-variables)
2806 "Print Gnus variables such as `gnus-newsrc-alist' in Lisp format."
2816 (princ "(setq gnus-newsrc-file-version ")
2817 (princ (gnus-prin1-to-string gnus-version))
2828 (gnus-killed-list
2829 (if (and gnus-save-killed-list
2830 (stringp gnus-save-killed-list))
2831 (gnus-strip-killed-list)
2832 gnus-killed-list))
2835 (if gnus-save-killed-list gnus-variable-list
2836 ;; Remove the `gnus-killed-list' from the list of variables
2838 (delq 'gnus-killed-list (copy-sequence gnus-variable-list)))))
2840 (gnus-newsrc-alist (cdr gnus-newsrc-alist))
2852 (defun gnus-strip-killed-list ()
2853 "Return the killed list minus the groups that match `gnus-save-killed-list'."
2854 (let ((list gnus-killed-list)
2857 (when (string-match gnus-save-killed-list (car list))
2862 (defun gnus-gnus-to-newsrc-format ()
2865 (set-buffer (create-file-buffer gnus-current-startup-file))
2866 (let ((newsrc (cdr gnus-newsrc-alist))
2867 (standard-output (current-buffer))
2869 (setq buffer-file-name gnus-current-startup-file)
2874 (when gnus-newsrc-options
2875 (insert gnus-newsrc-options))
2879 (when (or (null (setq method (gnus-info-method info)))
2881 (inline (gnus-server-equal method gnus-select-method)))
2882 (insert (gnus-info-group info)
2883 (if (> (gnus-info-level info) gnus-level-subscribed)
2885 (when (setq ranges (gnus-info-read info))
2911 (if gnus-modtime-botch
2912 (delete-file gnus-startup-file)
2914 (gnus-run-hooks 'gnus-save-standard-newsrc-hook)
2916 (kill-buffer (current-buffer)))))
2924 (defvar gnus-slave-mode nil)
2926 (defun gnus-slave-mode ()
2928 (gnus-add-minor-mode 'gnus-slave-mode " Slave" (make-sparse-keymap))
2929 (gnus-run-hooks 'gnus-slave-mode-hook))
2931 (defun gnus-slave-save-newsrc ()
2933 (set-buffer gnus-dribble-buffer)
2935 (mm-make-temp-file (concat gnus-current-startup-file "-slave-")))
2937 (file-modes (concat gnus-current-startup-file ".eld")))))
2938 (let ((coding-system-for-write gnus-ding-file-coding-system))
2939 (gnus-write-buffer slave-name))
2943 (defun gnus-master-read-slave-newsrc ()
2946 (file-name-directory gnus-current-startup-file)
2950 (file-name-nondirectory gnus-current-startup-file)
2956 (gnus-message 7 "Reading slave newsrcs...")
2958 (set-buffer (gnus-get-buffer-create " *gnus slave*"))
2972 (eval-buffer (current-buffer))
2975 (gnus-error 3.2 "Possible error in %s" file)
2977 (unless gnus-slave ; Slaves shouldn't delete these files.
2981 (gnus-dribble-touch)
2982 (gnus-message 7 "Reading slave newsrcs...done"))))
2990 (defun gnus-read-all-descriptions-files ()
2991 (let ((methods (cons gnus-select-method
2993 (when (gnus-archive-server-wanted-p)
2995 gnus-secondary-select-methods))))
2997 (gnus-read-descriptions-file (car methods))
3001 (defun gnus-read-descriptions-file (&optional method)
3002 (let ((method (or method gnus-select-method))
3005 (setq method (gnus-server-to-method method)))
3008 (unless gnus-description-hashtb
3009 (setq gnus-description-hashtb
3010 (gnus-make-hashtable (length gnus-active-hashtb))))
3012 (gnus-sethash (gnus-group-prefixed-name "" method) "Has read"
3013 gnus-description-hashtb)
3015 (gnus-message 5 "Reading descriptions file via %s..." (car method))
3017 ((null (gnus-get-function method 'request-list-newsgroups t))
3019 ((not (gnus-check-server method))
3020 (gnus-message 1 "Couldn't open server")
3022 ((not (gnus-request-list-newsgroups method))
3023 (gnus-message 1 "Couldn't read newsgroups descriptions")
3037 (gnus-server-equal
3038 (gnus-server-get-method nil method)
3039 (gnus-server-get-method
3040 nil gnus-select-method))))
3041 (let ((prefix (gnus-group-prefixed-name "" method)))
3052 (let ((obarray gnus-description-hashtb))
3064 (or (gnus-group-name-charset method name)
3065 (gnus-parameter-charset name)
3066 gnus-default-charset)))
3072 (gnus-message 5 "Reading descriptions file...done")
3075 (defun gnus-group-get-description (group)
3077 (when (gnus-request-group-description group)
3085 (defun gnus-declare-backend (name &rest abilities)
3087 (setq gnus-valid-select-methods
3088 (nconc gnus-valid-select-methods
3090 (gnus-redefine-select-method-widget))
3092 (defun gnus-set-default-directory ()
3093 "Set the default directory in the current buffer to `gnus-default-directory'.
3096 (if (and gnus-default-directory
3097 (file-exists-p gnus-default-directory))
3098 (file-name-as-directory (expand-file-name gnus-default-directory))
3101 (defun gnus-display-time-event-handler ()
3103 (gnus-boundp 'display-time-timer))
3107 (defun gnus-fixup-nnimap-unread-after-getting-new-news ()
3112 (gnus-group-entry group)
3114 (gnus-sethash group (cons (nth 2 info) (cdr (gnus-group-entry group)))
3115 gnus-newsrc-hashtb)))
3121 (provide 'gnus-start)
3124 ;;; gnus-start.el ends here