1 ;;; gnus.el --- a newsreader for GNU Emacs
2 ;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 2001,
3 ;; 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
5 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Tatsuya Ichikawa <t-ichi@po.shiojiri.ne.jp>
8 ;; Yoshiki Hayashi <t90553@mail.ecc.u-tokyo.ac.jp>
9 ;; Keywords: news, mail
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
32 (eval '(run-hooks 'gnus-load-hook))
34 (eval-when-compile (require 'cl))
35 (eval-when-compile (require 'static))
42 "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
46 (defgroup gnus-format nil
47 "Dealing with formatting issues."
51 (defgroup gnus-charset nil
52 "Group character set issues."
53 :link '(custom-manual "(gnus)Charsets")
57 (defgroup gnus-cache nil
61 (defgroup gnus-start nil
62 "Starting your favorite newsreader."
65 (defgroup gnus-start-server nil
66 "Server options at startup."
69 ;; These belong to gnus-group.el.
70 (defgroup gnus-group nil
72 :link '(custom-manual "(gnus)The Group Buffer")
75 (defgroup gnus-group-foreign nil
77 :link '(custom-manual "(gnus)Foreign Groups")
80 (defgroup gnus-group-new nil
81 "Automatic subscription of new groups."
84 (defgroup gnus-group-levels nil
86 :link '(custom-manual "(gnus)Group Levels")
89 (defgroup gnus-group-select nil
91 :link '(custom-manual "(gnus)Selecting a Group")
94 (defgroup gnus-group-listing nil
95 "Showing slices of the group list."
96 :link '(custom-manual "(gnus)Listing Groups")
99 (defgroup gnus-group-visual nil
100 "Sorting the group buffer."
101 :link '(custom-manual "(gnus)Group Buffer Format")
105 (defgroup gnus-group-various nil
106 "Various group options."
107 :link '(custom-manual "(gnus)Scanning New Messages")
110 ;; These belong to gnus-sum.el.
111 (defgroup gnus-summary nil
113 :link '(custom-manual "(gnus)The Summary Buffer")
116 (defgroup gnus-summary-exit nil
117 "Leaving summary buffers."
118 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
119 :group 'gnus-summary)
121 (defgroup gnus-summary-marks nil
122 "Marks used in summary buffers."
123 :link '(custom-manual "(gnus)Marking Articles")
124 :group 'gnus-summary)
126 (defgroup gnus-thread nil
127 "Ordering articles according to replies."
128 :link '(custom-manual "(gnus)Threading")
129 :group 'gnus-summary)
131 (defgroup gnus-summary-format nil
132 "Formatting of the summary buffer."
133 :link '(custom-manual "(gnus)Summary Buffer Format")
134 :group 'gnus-summary)
136 (defgroup gnus-summary-choose nil
138 :link '(custom-manual "(gnus)Choosing Articles")
139 :group 'gnus-summary)
141 (defgroup gnus-summary-maneuvering nil
142 "Summary movement commands."
143 :link '(custom-manual "(gnus)Summary Maneuvering")
144 :group 'gnus-summary)
146 (defgroup gnus-summary-mail nil
147 "Mail group commands."
148 :link '(custom-manual "(gnus)Mail Group Commands")
149 :group 'gnus-summary)
151 (defgroup gnus-summary-sort nil
152 "Sorting the summary buffer."
153 :link '(custom-manual "(gnus)Sorting")
154 :group 'gnus-summary)
156 (defgroup gnus-summary-visual nil
157 "Highlighting and menus in the summary buffer."
158 :link '(custom-manual "(gnus)Summary Highlighting")
160 :group 'gnus-summary)
162 (defgroup gnus-summary-various nil
163 "Various summary buffer options."
164 :link '(custom-manual "(gnus)Various Summary Stuff")
165 :group 'gnus-summary)
167 (defgroup gnus-summary-pick nil
168 "Pick mode in the summary buffer."
169 :link '(custom-manual "(gnus)Pick and Read")
171 :group 'gnus-summary)
173 (defgroup gnus-summary-tree nil
174 "Tree display of threads in the summary buffer."
175 :link '(custom-manual "(gnus)Tree Display")
177 :group 'gnus-summary)
179 ;; Belongs to gnus-uu.el
180 (defgroup gnus-extract-view nil
181 "Viewing extracted files."
182 :link '(custom-manual "(gnus)Viewing Files")
183 :group 'gnus-extract)
185 ;; Belongs to gnus-score.el
186 (defgroup gnus-score nil
187 "Score and kill file handling."
190 (defgroup gnus-score-kill nil
194 (defgroup gnus-score-adapt nil
195 "Adaptive score files."
198 (defgroup gnus-score-default nil
199 "Default values for score files."
202 (defgroup gnus-score-expire nil
203 "Expiring score rules."
206 (defgroup gnus-score-decay nil
207 "Decaying score rules."
210 (defgroup gnus-score-files nil
211 "Score and kill file names."
215 (defgroup gnus-score-various nil
216 "Various scoring and killing options."
220 (defgroup gnus-visual nil
221 "Options controling the visual fluff."
225 (defgroup gnus-agent nil
226 "Offline support for Gnus."
229 (defgroup gnus-files nil
230 "Files used by Gnus."
233 (defgroup gnus-dribble-file nil
235 :link '(custom-manual "(gnus)Auto Save")
238 (defgroup gnus-newsrc nil
239 "Storing Gnus state."
242 (defgroup gnus-server nil
243 "Options related to newsservers and other servers used by Gnus."
246 (defgroup gnus-server-visual nil
247 "Highlighting and menus in the server buffer."
251 (defgroup gnus-message '((message custom-group))
252 "Composing replies and followups in Gnus."
255 (defgroup gnus-meta nil
256 "Meta variables controling major portions of Gnus.
257 In general, modifying these variables does not take affect until Gnus
258 is restarted, and sometimes reloaded."
261 (defgroup gnus-various nil
262 "Other Gnus options."
263 :link '(custom-manual "(gnus)Various Various")
266 (defgroup gnus-mime nil
267 "Variables for controlling the Gnus MIME interface."
270 (defgroup gnus-exit nil
272 :link '(custom-manual "(gnus)Exiting Gnus")
275 (defcustom gnus-inhibit-startup-message nil
276 "If non-nil, the startup message will not be displayed.
277 This variable is used before `.gnus.el' is loaded, so it should
278 be set in `.emacs' instead."
282 (defcustom gnus-play-startup-jingle nil
283 "If non-nil, play the Gnus jingle at startup."
287 (unless (fboundp 'gnus-group-remove-excess-properties)
288 (defalias 'gnus-group-remove-excess-properties 'ignore))
290 (unless (fboundp 'gnus-set-text-properties)
291 (defalias 'gnus-set-text-properties 'set-text-properties))
293 (unless (featurep 'gnus-xmas)
294 (defalias 'gnus-make-overlay 'make-overlay)
295 (defalias 'gnus-delete-overlay 'delete-overlay)
296 (defalias 'gnus-overlay-put 'overlay-put)
297 (defalias 'gnus-move-overlay 'move-overlay)
298 (defalias 'gnus-overlay-buffer 'overlay-buffer)
299 (defalias 'gnus-overlay-start 'overlay-start)
300 (defalias 'gnus-overlay-end 'overlay-end)
301 (defalias 'gnus-extent-detached-p 'ignore)
302 (defalias 'gnus-extent-start-open 'ignore)
303 (defalias 'gnus-appt-select-lowest-window 'appt-select-lowest-window)
304 (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
305 (defalias 'gnus-character-to-event 'identity)
306 (defalias 'gnus-add-text-properties 'add-text-properties)
307 (defalias 'gnus-put-text-property 'put-text-property)
308 (defvar gnus-mode-line-image-cache t)
309 (if (fboundp 'find-image)
310 (defun gnus-mode-line-buffer-identification (line)
311 (let ((str (car-safe line)))
312 (if (and (stringp str)
313 (string-match "^Gnus:" str))
314 (progn (add-text-properties
317 (if (eq t gnus-mode-line-image-cache)
318 (setq gnus-mode-line-image-cache
320 '((:type xpm :file "gnus-pointer.xpm"
322 (:type xbm :file "gnus-pointer.xbm"
324 gnus-mode-line-image-cache)
325 'help-echo "This is Gnus")
329 (defalias 'gnus-mode-line-buffer-identification 'identity))
330 (defalias 'gnus-characterp 'numberp)
331 (defalias 'gnus-deactivate-mark 'deactivate-mark)
332 (defalias 'gnus-window-edges 'window-edges)
333 (defalias 'gnus-key-press-event-p 'numberp)
334 ;;(defalias 'gnus-decode-rfc1522 'ignore)
337 ;; We define these group faces here to avoid the display
338 ;; update forced when creating new faces.
340 (defface gnus-group-news-1-face
343 (:foreground "PaleTurquoise" :bold t))
346 (:foreground "ForestGreen" :bold t))
349 "Level 1 newsgroup face.")
351 (defface gnus-group-news-1-empty-face
354 (:foreground "PaleTurquoise"))
357 (:foreground "ForestGreen"))
360 "Level 1 empty newsgroup face.")
362 (defface gnus-group-news-2-face
365 (:foreground "turquoise" :bold t))
368 (:foreground "CadetBlue4" :bold t))
371 "Level 2 newsgroup face.")
373 (defface gnus-group-news-2-empty-face
376 (:foreground "turquoise"))
379 (:foreground "CadetBlue4"))
382 "Level 2 empty newsgroup face.")
384 (defface gnus-group-news-3-face
393 "Level 3 newsgroup face.")
395 (defface gnus-group-news-3-empty-face
404 "Level 3 empty newsgroup face.")
406 (defface gnus-group-news-4-face
415 "Level 4 newsgroup face.")
417 (defface gnus-group-news-4-empty-face
426 "Level 4 empty newsgroup face.")
428 (defface gnus-group-news-5-face
437 "Level 5 newsgroup face.")
439 (defface gnus-group-news-5-empty-face
448 "Level 5 empty newsgroup face.")
450 (defface gnus-group-news-6-face
459 "Level 6 newsgroup face.")
461 (defface gnus-group-news-6-empty-face
470 "Level 6 empty newsgroup face.")
472 (defface gnus-group-news-low-face
475 (:foreground "DarkTurquoise" :bold t))
478 (:foreground "DarkGreen" :bold t))
481 "Low level newsgroup face.")
483 (defface gnus-group-news-low-empty-face
486 (:foreground "DarkTurquoise"))
489 (:foreground "DarkGreen"))
492 "Low level empty newsgroup face.")
494 (defface gnus-group-mail-1-face
497 (:foreground "aquamarine1" :bold t))
500 (:foreground "DeepPink3" :bold t))
503 "Level 1 mailgroup face.")
505 (defface gnus-group-mail-1-empty-face
508 (:foreground "aquamarine1"))
511 (:foreground "DeepPink3"))
513 (:italic t :bold t)))
514 "Level 1 empty mailgroup face.")
516 (defface gnus-group-mail-2-face
519 (:foreground "aquamarine2" :bold t))
522 (:foreground "HotPink3" :bold t))
525 "Level 2 mailgroup face.")
527 (defface gnus-group-mail-2-empty-face
530 (:foreground "aquamarine2"))
533 (:foreground "HotPink3"))
536 "Level 2 empty mailgroup face.")
538 (defface gnus-group-mail-3-face
541 (:foreground "aquamarine3" :bold t))
544 (:foreground "magenta4" :bold t))
547 "Level 3 mailgroup face.")
549 (defface gnus-group-mail-3-empty-face
552 (:foreground "aquamarine3"))
555 (:foreground "magenta4"))
558 "Level 3 empty mailgroup face.")
560 (defface gnus-group-mail-low-face
563 (:foreground "aquamarine4" :bold t))
566 (:foreground "DeepPink4" :bold t))
569 "Low level mailgroup face.")
571 (defface gnus-group-mail-low-empty-face
574 (:foreground "aquamarine4"))
577 (:foreground "DeepPink4"))
580 "Low level empty mailgroup face.")
582 ;; Summary mode faces.
584 (defface gnus-summary-selected-face '((t
586 "Face used for selected articles.")
588 (defface gnus-summary-cancelled-face
590 (:foreground "yellow" :background "black")))
591 "Face used for cancelled articles.")
593 (defface gnus-summary-high-ticked-face
596 (:foreground "pink" :bold t))
599 (:foreground "firebrick" :bold t))
602 "Face used for high interest ticked articles.")
604 (defface gnus-summary-low-ticked-face
607 (:foreground "pink" :italic t))
610 (:foreground "firebrick" :italic t))
613 "Face used for low interest ticked articles.")
615 (defface gnus-summary-normal-ticked-face
618 (:foreground "pink"))
621 (:foreground "firebrick"))
624 "Face used for normal interest ticked articles.")
626 (defface gnus-summary-high-ancient-face
629 (:foreground "SkyBlue" :bold t))
632 (:foreground "RoyalBlue" :bold t))
635 "Face used for high interest ancient articles.")
637 (defface gnus-summary-low-ancient-face
640 (:foreground "SkyBlue" :italic t))
643 (:foreground "RoyalBlue" :italic t))
646 "Face used for low interest ancient articles.")
648 (defface gnus-summary-normal-ancient-face
651 (:foreground "SkyBlue"))
654 (:foreground "RoyalBlue"))
657 "Face used for normal interest ancient articles.")
659 (defface gnus-summary-high-unread-face
662 "Face used for high interest unread articles.")
664 (defface gnus-summary-low-unread-face
667 "Face used for low interest unread articles.")
669 (defface gnus-summary-normal-unread-face
672 "Face used for normal interest unread articles.")
674 (defface gnus-summary-incorporated-face
677 "Face used for incorporated articles.")
679 (defface gnus-summary-high-read-face
682 (:foreground "PaleGreen"
686 (:foreground "DarkGreen"
690 "Face used for high interest read articles.")
692 (defface gnus-summary-low-read-face
695 (:foreground "PaleGreen"
699 (:foreground "DarkGreen"
703 "Face used for low interest read articles.")
705 (defface gnus-summary-normal-read-face
708 (:foreground "PaleGreen"))
711 (:foreground "DarkGreen"))
714 "Face used for normal interest read articles.")
721 (defvar gnus-buffers nil)
723 (defun gnus-get-buffer-create (name)
724 "Do the same as `get-buffer-create', but store the created buffer."
725 (or (get-buffer name)
726 (car (push (get-buffer-create name) gnus-buffers))))
728 (defun gnus-add-buffer ()
729 "Add the current buffer to the list of Gnus buffers."
730 (push (current-buffer) gnus-buffers))
732 (defun gnus-buffers ()
733 "Return a list of live Gnus buffers."
734 (while (and gnus-buffers
735 (not (buffer-name (car gnus-buffers))))
737 (let ((buffers gnus-buffers))
739 (if (buffer-name (cadr buffers))
741 (setcdr buffers (cddr buffers)))))
746 (defvar gnus-group-buffer "*Group*")
749 (autoload 'gnus-play-jingle "gnus-audio"))
751 (defface gnus-splash-face
754 (:foreground "Brown"))
757 (:foreground "Brown"))
760 "Face for the splash screen.")
762 (defun gnus-splash ()
764 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
765 (let ((buffer-read-only nil))
767 (unless gnus-inhibit-startup-message
768 (gnus-group-startup-message)
770 (when gnus-play-startup-jingle
771 (gnus-play-jingle))))))
773 (defun gnus-indent-rigidly (start end arg)
774 "Indent rigidly using only spaces and no tabs."
777 (narrow-to-region start end)
779 (indent-rigidly start end arg)
780 ;; We translate tabs into spaces -- not everybody uses
781 ;; an 8-character tab.
782 (goto-char (point-min))
783 (while (search-forward "\t" nil t)
784 (replace-match " " t t))))))
786 (defvar gnus-simple-splash nil)
788 (defun gnus-group-startup-message (&optional x y)
789 "Insert startup message in current buffer."
790 ;; Insert the message.
793 ((and (fboundp 'find-image)
795 (let* ((bg (face-background 'default))
796 (fg (face-foreground 'gnus-splash-face))
798 `((:type xpm :file "gnus.xpm"
799 :color-symbols (("thing" . "#724214")
800 ("shadow" . "#1e3f03")
801 ("background" . ,bg)))
802 (:type pbm :file "gnus.pbm"
803 ;; Account for the pbm's blackground.
804 :background ,bg :foreground ,fg)
805 (:type xbm :file "gnus.xbm"
806 ;; Account for the xbm's blackground.
807 :background ,bg :foreground ,fg)))))
811 (concat gnus-product-name " " gnus-version-number
812 (if (zerop (string-to-number gnus-revision-number))
814 (concat " (r" gnus-revision-number ")"))
815 " based on " gnus-original-product-name " v"
816 gnus-original-version-number)
817 'face `(variable-pitch :background ,bg :foreground ,fg)))
818 (let ((fill-column (window-width)))
819 (center-region (point-min) (point)))
820 (let ((size (image-size image)))
821 (insert-char ?\n (max 1 (round (- (window-height)
822 (or y (cdr size))) 2)))
824 (propertize " " 'display
826 ,(max 0 (round (- (window-width)
827 (or x (car size))) 2)))))
828 (insert-image image))
829 (setq gnus-simple-splash nil)
834 _ ___ __ ___ __ _ ___
853 (goto-char (point-min))
854 (insert gnus-product-name " " gnus-version-number
855 (if (zerop (string-to-number gnus-revision-number))
857 (concat " (r" gnus-revision-number ")"))
858 " based on " gnus-original-product-name " v"
859 gnus-original-version-number)
860 (insert-char ?\ (prog1
861 (max 0 (/ (- (window-width) (point)) 2))
862 (goto-char (point-min))))
865 (gnus-indent-rigidly (point) (point-max)
866 (/ (max (- (window-width) (or x 46)) 0) 2))
867 (goto-char (point-min))
869 (let* ((pheight (count-lines (point-min) (point-max)))
870 (wheight (window-height))
871 (rest (- wheight pheight)))
872 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
874 (put-text-property (point-min) (point-max) 'face 'gnus-splash-face)
875 (setq gnus-simple-splash t)))
876 (goto-char (point-min))
877 (setq mode-line-buffer-identification (concat " " gnus-version))
878 (set-buffer-modified-p t))
881 (let ((command (format "%s" this-command)))
882 (if (and (string-match "gnus" command)
883 (not (string-match "gnus-other-frame" command)))
885 (gnus-get-buffer-create gnus-group-buffer))))
892 (defcustom gnus-parameters nil
893 "Alist of group parameters.
896 ((\"mail\\\\..*\" (gnus-show-threads nil)
897 (gnus-use-scoring nil)
898 (gnus-summary-line-format
899 \"%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\\n\")
902 (\"mail\\\\.me\" (gnus-use-scoring t))
903 (\"list\\\\..*\" (total-expire . t)
904 (broken-reply-to . t)))"
905 :group 'gnus-group-various
906 :type '(repeat (cons regexp
909 (defvar gnus-group-parameters-more nil)
911 (defvar gnus-colon-keywords
913 (when (boundp 'dgnushack-colon-keywords)
914 (symbol-value 'dgnushack-colon-keywords)))
915 "List of the colon keywords should be bound at run-time. This variable
916 defaults to a proper value only if this file is byte-compiled by make.")
918 (dolist (keyword gnus-colon-keywords)
919 (set keyword keyword))
921 (defmacro gnus-define-group-parameter (param &rest rest)
922 "Define a group parameter PARAM.
923 REST is a plist of following:
924 :type One of `bool', `list' or `nil'.
925 :function The name of the function.
926 :function-document The documentation of the function.
927 :parameter-type The type for customizing the parameter.
928 :parameter-document The documentation for the parameter.
929 :variable The name of the variable.
930 :variable-document The documentation for the variable.
931 :variable-group The group for customizing the variable.
932 :variable-type The type for customizing the variable.
933 :variable-default The default value of the variable."
934 (let* ((type (plist-get rest :type))
935 (parameter-type (plist-get rest :parameter-type))
936 (parameter-document (plist-get rest :parameter-document))
937 (function (or (plist-get rest :function)
938 (intern (format "gnus-parameter-%s" param))))
939 (function-document (or (plist-get rest :function-document) ""))
940 (variable (or (plist-get rest :variable)
941 (intern (format "gnus-parameter-%s-alist" param))))
942 (variable-document (or (plist-get rest :variable-document) ""))
943 (variable-group (plist-get rest :variable-group))
944 (variable-type (or (plist-get rest :variable-type)
946 (list (regexp :tag "Group")
947 ,(car (cdr parameter-type)))))))
948 (variable-default (plist-get rest :variable-default)))
951 `(defcustom ,variable ,variable-default
953 :group 'gnus-group-parameter
954 :group ',variable-group
955 :type ,variable-type)
956 `(setq gnus-group-parameters-more
957 (delq (assq ',param gnus-group-parameters-more)
958 gnus-group-parameters-more))
959 `(add-to-list 'gnus-group-parameters-more
962 ,parameter-document))
964 `(defun ,function (name)
966 (let ((params (gnus-group-find-parameter name))
969 ((memq ',param params)
971 ((setq val (assq ',param params))
974 (string-match ,variable name))
976 (let ((alist ,variable)
978 (while (setq elem (pop alist))
980 (string-match (car elem) name))
983 (if (consp value) (car value) value))))))
984 `(defun ,function (name)
987 (or (gnus-group-find-parameter name ',param ,(and type t))
988 (let ((alist ,variable)
990 (while (setq elem (pop alist))
992 (string-match (car elem) name))
997 '(if (consp value) (car value) value))))))))))
999 (defcustom gnus-home-directory "~/"
1000 "Directory variable that specifies the \"home\" directory.
1001 All other Gnus path variables are initialized from this variable."
1005 (defcustom gnus-directory (or (getenv "SAVEDIR")
1006 (nnheader-concat gnus-home-directory "News/"))
1007 "*Directory variable from which all other Gnus file variables are derived.
1009 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1010 This means that other directory variables that are initialized from
1011 this variable won't be set properly if you set this variable in `.gnus.el'.
1012 Set this variable in `.emacs' instead."
1016 (defcustom gnus-default-directory nil
1017 "*Default directory for all Gnus buffers."
1019 :type '(choice (const :tag "current" nil)
1022 ;; Site dependent variables. These variables should be defined in
1025 (defvar gnus-default-nntp-server nil
1026 "Specify a default NNTP server.
1027 This variable should be defined in paths.el, and should never be set
1029 If you want to change servers, you should use `gnus-select-method'.
1030 See the documentation to that variable.")
1032 ;; Don't touch this variable.
1033 (defvar gnus-nntp-service "nntp"
1034 "NNTP service name (\"nntp\" or 119).
1035 This is an obsolete variable, which is scarcely used. If you use an
1036 nntp server for your newsgroup and want to change the port number
1037 used to 899, you would say something along these lines:
1039 (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
1041 (defcustom gnus-nntpserver-file "/etc/nntpserver"
1042 "A file with only the name of the nntp server in it."
1047 ;; This function is used to check both the environment variable
1048 ;; NNTPSERVER and the /etc/nntpserver file to see whether one can find
1049 ;; an nntp server name default.
1050 (defun gnus-getenv-nntpserver ()
1051 (or (getenv "NNTPSERVER")
1052 (and (file-readable-p gnus-nntpserver-file)
1054 (set-buffer (gnus-get-buffer-create " *gnus nntp*"))
1055 (insert-file-contents gnus-nntpserver-file)
1056 (let ((name (buffer-string)))
1058 (if (string-match "\\'[ \t\n]*$" name)
1061 (kill-buffer (current-buffer))))))))
1063 (defcustom gnus-select-method
1066 (list 'nntp (or (condition-case nil
1067 (gnus-getenv-nntpserver)
1069 (when (and gnus-default-nntp-server
1070 (not (string= gnus-default-nntp-server "")))
1071 gnus-default-nntp-server)
1073 (if (or (null gnus-nntp-service)
1074 (equal gnus-nntp-service "nntp"))
1076 (list gnus-nntp-service)))
1078 "Default method for selecting a newsgroup.
1079 This variable should be a list, where the first element is how the
1080 news is to be fetched, the second is the address.
1082 For instance, if you want to get your news via NNTP from
1083 \"flab.flab.edu\", you could say:
1085 \(setq gnus-select-method '(nntp \"flab.flab.edu\"))
1087 If you want to use your local spool, say:
1089 \(setq gnus-select-method (list 'nnspool (system-name)))
1091 If you use this variable, you must set `gnus-nntp-server' to nil.
1093 There is a lot more to know about select methods and virtual servers -
1094 see the manual for details."
1096 :type 'gnus-select-method)
1098 (defcustom gnus-message-archive-method "archive"
1099 "*Method used for archiving messages you've sent.
1100 This should be a mail method."
1102 :group 'gnus-message
1103 :type 'gnus-select-method)
1105 (defcustom gnus-message-archive-group nil
1106 "*Name of the group in which to save the messages you've written.
1107 This can either be a string; a list of strings; or an alist
1108 of regexps/functions/forms to be evaluated to return a string (or a list
1109 of strings). The functions are called with the name of the current
1110 group (or nil) as a parameter.
1112 If you want to save your mail in one group and the news articles you
1113 write in another group, you could say something like:
1115 \(setq gnus-message-archive-group
1116 '((if (message-news-p)
1120 Normally the group names returned by this variable should be
1121 unprefixed -- which implicitly means \"store on the archive server\".
1122 However, you may wish to store the message on some other server. In
1123 that case, just return a fully prefixed name of the group --
1124 \"nnml+private:mail.misc\", for instance."
1125 :group 'gnus-message
1126 :type '(choice (const :tag "none" nil)
1131 (defcustom gnus-secondary-servers nil
1132 "List of NNTP servers that the user can choose between interactively.
1133 To make Gnus query you for a server, you have to give `gnus' a
1134 non-numeric prefix - `C-u M-x gnus', in short."
1136 :type '(repeat string))
1138 (defcustom gnus-nntp-server nil
1139 "*The name of the host running the NNTP server.
1140 This variable is semi-obsolete. Use the `gnus-select-method'
1143 :type '(choice (const :tag "disable" nil)
1146 (defcustom gnus-secondary-select-methods nil
1147 "A list of secondary methods that will be used for reading news.
1148 This is a list where each element is a complete select method (see
1149 `gnus-select-method').
1151 If, for instance, you want to read your mail with the nnml backend,
1152 you could set this variable:
1154 \(setq gnus-secondary-select-methods '((nnml \"\")))"
1156 :type '(repeat gnus-select-method))
1158 (defvar gnus-backup-default-subscribed-newsgroups
1159 '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
1160 "Default default new newsgroups the first time Gnus is run.
1161 Should be set in paths.el, and shouldn't be touched by the user.")
1163 (defcustom gnus-local-domain nil
1164 "Local domain name without a host name.
1165 The DOMAINNAME environment variable is used instead if it is defined.
1166 If the function `system-name' returns the full Internet name, there is
1167 no need to set this variable."
1168 :group 'gnus-message
1169 :type '(choice (const :tag "default" nil)
1172 (defvar gnus-local-organization nil
1173 "String with a description of what organization (if any) the user belongs to.
1174 Obsolete variable; use `message-user-organization' instead.")
1176 ;; Customization variables
1178 (defcustom gnus-refer-article-method nil
1179 "Preferred method for fetching an article by Message-ID.
1180 If you are reading news from the local spool (with nnspool), fetching
1181 articles by Message-ID is painfully slow. By setting this method to an
1182 nntp method, you might get acceptable results.
1184 The value of this variable must be a valid select method as discussed
1185 in the documentation of `gnus-select-method'.
1187 It can also be a list of select methods, as well as the special symbol
1188 `current', which means to use the current select method. If it is a
1189 list, Gnus will try all the methods in the list until it finds a match."
1191 :type '(choice (const :tag "default" nil)
1192 (const :tag "DejaNews" (nnweb "refer" (nnweb-type dejanews)))
1194 (repeat :menu-tag "Try multiple"
1196 :value (current (nnweb "refer" (nnweb-type dejanews)))
1197 (choice :tag "Method"
1199 (const :tag "DejaNews"
1200 (nnweb "refer" (nnweb-type dejanews)))
1201 gnus-select-method))))
1203 (defcustom gnus-group-faq-directory
1204 '("/ftp@mirrors.aol.com:/pub/rtfm/usenet/"
1205 "/ftp@sunsite.doc.ic.ac.uk:/pub/usenet/news-faqs/"
1206 "/ftp@src.doc.ic.ac.uk:/usenet/news-FAQS/"
1207 "/ftp@ftp.seas.gwu.edu:/pub/rtfm/"
1208 "/ftp@ftp.pasteur.fr:/pub/FAQ/"
1209 "/ftp@rtfm.mit.edu:/pub/usenet/"
1210 "/ftp@ftp.uni-paderborn.de:/pub/FAQ/"
1211 "/ftp@ftp.sunet.se:/pub/usenet/"
1212 "/ftp@nctuccca.edu.tw:/USENET/FAQ/"
1213 "/ftp@hwarang.postech.ac.kr:/pub/usenet/"
1214 "/ftp@ftp.hk.super.net:/mirror/faqs/")
1215 "*Directory where the group FAQs are stored.
1216 This will most commonly be on a remote machine, and the file will be
1217 fetched by ange-ftp.
1219 This variable can also be a list of directories. In that case, the
1220 first element in the list will be used by default. The others can
1221 be used when being prompted for a site.
1223 Note that Gnus uses an aol machine as the default directory. If this
1224 feels fundamentally unclean, just think of it as a way to finally get
1225 something of value back from them.
1227 If the default site is too slow, try one of these:
1229 North America: mirrors.aol.com /pub/rtfm/usenet
1230 ftp.seas.gwu.edu /pub/rtfm
1231 rtfm.mit.edu /pub/usenet
1232 Europe: ftp.uni-paderborn.de /pub/FAQ
1233 src.doc.ic.ac.uk /usenet/news-FAQS
1234 ftp.sunet.se /pub/usenet
1235 ftp.pasteur.fr /pub/FAQ
1236 Asia: nctuccca.edu.tw /USENET/FAQ
1237 hwarang.postech.ac.kr /pub/usenet
1238 ftp.hk.super.net /mirror/faqs"
1239 :group 'gnus-group-various
1240 :type '(choice directory
1241 (repeat directory)))
1243 (defcustom gnus-use-cross-reference t
1244 "*Non-nil means that cross referenced articles will be marked as read.
1245 If nil, ignore cross references. If t, mark articles as read in
1246 subscribed newsgroups. If neither t nor nil, mark as read in all
1249 :type '(choice (const :tag "off" nil)
1250 (const :tag "subscribed" t)
1254 (defcustom gnus-process-mark ?#
1256 :group 'gnus-group-visual
1257 :group 'gnus-summary-marks
1260 (defcustom gnus-large-newsgroup 200
1261 "*The number of articles which indicates a large newsgroup.
1262 If the number of articles in a newsgroup is greater than this value,
1263 confirmation is required for selecting the newsgroup.
1264 If it is `nil', no confirmation is required."
1265 :group 'gnus-group-select
1268 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
1269 "*Non-nil means that the default name of a file to save articles in is the group name.
1270 If it's nil, the directory form of the group name is used instead.
1272 If this variable is a list, and the list contains the element
1273 `not-score', long file names will not be used for score files; if it
1274 contains the element `not-save', long file names will not be used for
1275 saving; and if it contains the element `not-kill', long file names
1276 will not be used for kill files.
1278 Note that the default for this variable varies according to what system
1279 type you're using. On `usg-unix-v' and `xenix' this variable defaults
1280 to nil while on all other systems it defaults to t."
1284 (defcustom gnus-kill-files-directory gnus-directory
1285 "*Name of the directory where kill files will be stored (default \"~/News\")."
1286 :group 'gnus-score-files
1287 :group 'gnus-score-kill
1290 (defcustom gnus-save-score nil
1291 "*If non-nil, save group scoring info."
1292 :group 'gnus-score-various
1296 (defcustom gnus-use-undo t
1297 "*If non-nil, allow undoing in Gnus group mode buffers."
1301 (defcustom gnus-use-adaptive-scoring nil
1302 "*If non-nil, use some adaptive scoring scheme.
1303 If a list, then the values `word' and `line' are meaningful. The
1304 former will perform adaption on individual words in the subject
1305 header while `line' will perform adaption on several headers."
1307 :group 'gnus-score-adapt
1308 :type '(set (const word) (const line)))
1310 (defcustom gnus-use-cache 'passive
1311 "*If nil, Gnus will ignore the article cache.
1312 If `passive', it will allow entering (and reading) articles
1313 explicitly entered into the cache. If anything else, use the
1314 cache to the full extent of the law."
1317 :type '(choice (const :tag "off" nil)
1318 (const :tag "passive" passive)
1319 (const :tag "active" t)))
1321 (defcustom gnus-use-trees nil
1322 "*If non-nil, display a thread tree buffer."
1326 (defcustom gnus-use-grouplens nil
1327 "*If non-nil, use GroupLens ratings."
1331 (defcustom gnus-keep-backlog nil
1332 "*If non-nil, Gnus will keep read articles for later re-retrieval.
1333 If it is a number N, then Gnus will only keep the last N articles
1334 read. If it is neither nil nor a number, Gnus will keep all read
1335 articles. This is not a good idea."
1337 :type '(choice (const :tag "off" nil)
1342 (defcustom gnus-use-nocem nil
1343 "*If non-nil, Gnus will read NoCeM cancel messages."
1347 (defcustom gnus-suppress-duplicates nil
1348 "*If non-nil, Gnus will mark duplicate copies of the same article as read."
1352 (defcustom gnus-use-scoring t
1353 "*If non-nil, enable scoring."
1357 (defcustom gnus-use-picons nil
1358 "*If non-nil, display picons in a frame of their own."
1362 (defcustom gnus-summary-prepare-exit-hook
1363 '(gnus-summary-expire-articles)
1364 "*A hook called when preparing to exit from the summary buffer.
1365 It calls `gnus-summary-expire-articles' by default."
1366 :group 'gnus-summary-exit
1369 (defcustom gnus-novice-user t
1370 "*Non-nil means that you are a usenet novice.
1371 If non-nil, verbose messages may be displayed and confirmations may be
1376 (defcustom gnus-expert-user nil
1377 "*Non-nil means that you will never be asked for confirmation about anything.
1378 That doesn't mean *anything* anything; particularly destructive
1379 commands will still require prompting."
1383 (defcustom gnus-interactive-catchup t
1384 "*If non-nil, require your confirmation when catching up a group."
1385 :group 'gnus-group-select
1388 (defcustom gnus-interactive-exit t
1389 "*If non-nil, require your confirmation when exiting Gnus."
1393 (defcustom gnus-extract-address-components 'gnus-extract-address-components
1394 "Function for extracting address components from a From header.
1395 Three pre-defined functions exist: `gnus-extract-address-components',
1396 which is the default, quite fast, and too simplistic solution,
1397 `mail-extract-address-components', which works much better, but is
1398 slower, and `std11-extract-address-components'."
1399 :group 'gnus-summary-format
1400 :type '(radio (function-item gnus-extract-address-components)
1401 (function-item mail-extract-address-components)
1402 (function-item std11-extract-address-components)
1403 (function :tag "Other")))
1405 (defcustom gnus-carpal nil
1406 "*If non-nil, display clickable icons."
1410 (defcustom gnus-shell-command-separator ";"
1411 "String used to separate to shell commands."
1415 (defcustom gnus-valid-select-methods
1416 '(("nntp" post address prompt-address physical-address)
1417 ("nnspool" post address)
1418 ("nnvirtual" post-mail virtual prompt-address)
1419 ("nnmbox" mail respool address)
1420 ("nnml" post-mail respool address)
1421 ("nnmh" mail respool address)
1422 ("nndir" post-mail prompt-address physical-address)
1423 ("nneething" none address prompt-address physical-address)
1424 ("nndoc" none address prompt-address)
1425 ("nnbabyl" mail address respool)
1426 ("nnkiboze" post virtual)
1427 ("nnsoup" post-mail address)
1428 ("nndraft" post-mail)
1429 ("nnfolder" mail respool address)
1430 ("nngateway" post-mail address prompt-address physical-address)
1438 ("nnagent" post-mail)
1439 ("nnimap" post-mail address prompt-address physical-address))
1440 "*An alist of valid select methods.
1441 The first element of each list lists should be a string with the name
1442 of the select method. The other elements may be the category of
1443 this method (i. e., `post', `mail', `none' or whatever) or other
1444 properties that this method has (like being respoolable).
1445 If you implement a new select method, all you should have to change is
1446 this variable. I think."
1448 :type '(repeat (group (string :tag "Name")
1449 (radio-button-choice (const :format "%v " post)
1450 (const :format "%v " mail)
1451 (const :format "%v " none)
1453 (checklist :inline t
1454 (const :format "%v " address)
1455 (const :format "%v " prompt-address)
1456 (const :format "%v " physical-address)
1457 (const :format "%v " virtual)
1460 (defun gnus-redefine-select-method-widget ()
1461 "Recomputes the select-method widget based on the value of
1462 `gnus-valid-select-methods'."
1463 (define-widget 'gnus-select-method 'list
1464 "Widget for entering a select method."
1466 :tag "Select Method"
1467 :args `((choice :tag "Method"
1468 ,@(mapcar (lambda (entry)
1469 (list 'const :format "%v\n"
1470 (intern (car entry))))
1471 gnus-valid-select-methods)
1472 (symbol :tag "other"))
1473 (string :tag "Address")
1474 (repeat :tag "Options"
1478 (sexp :tag "Value"))))))
1480 (gnus-redefine-select-method-widget)
1482 (defcustom gnus-updated-mode-lines '(group article summary tree)
1483 "List of buffers that should update their mode lines.
1484 The list may contain the symbols `group', `article', `tree' and
1485 `summary'. If the corresponding symbol is present, Gnus will keep
1486 that mode line updated with information that may be pertinent.
1487 If this variable is nil, screen refresh may be quicker."
1488 :group 'gnus-various
1489 :type '(set (const group)
1494 ;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
1495 (defcustom gnus-mode-non-string-length nil
1496 "*Max length of mode-line non-string contents.
1497 If this is nil, Gnus will take space as is needed, leaving the rest
1498 of the modeline intact. Note that the default of nil is unlikely
1499 to be desirable; see the manual for further details."
1500 :group 'gnus-various
1501 :type '(choice (const nil)
1504 ;; There should be special validation for this.
1505 (define-widget 'gnus-email-address 'string
1508 (gnus-define-group-parameter
1511 "Return GROUP's to-address."
1513 "*Alist of group regexps and correspondent to-addresses."
1514 :parameter-type '(gnus-email-address :tag "To Address")
1515 :parameter-document "\
1516 This will be used when doing followups and posts.
1518 This is primarily useful in mail groups that represent closed
1519 mailing lists--mailing lists where it's expected that everybody that
1520 writes to the mailing list is subscribed to it. Since using this
1521 parameter ensures that the mail only goes to the mailing list itself,
1522 it means that members won't receive two copies of your followups.
1524 Using `to-address' will actually work whether the group is foreign or
1525 not. Let's say there's a group on the server that is called
1526 `fa.4ad-l'. This is a real newsgroup, but the server has gotten the
1527 articles from a mail-to-news gateway. Posting directly to this group
1528 is therefore impossible--you have to send mail to the mailing list
1531 The gnus-group-split mail splitting mechanism will behave as if this
1532 address was listed in gnus-group-split Addresses (see below).")
1534 (gnus-define-group-parameter
1537 "Return GROUP's to-list."
1539 "*Alist of group regexps and correspondent to-lists."
1540 :parameter-type '(gnus-email-address :tag "To List")
1541 :parameter-document "\
1542 This address will be used when doing a `a' in the group.
1544 It is totally ignored when doing a followup--except that if it is
1545 present in a news group, you'll get mail group semantics when doing
1548 The gnus-group-split mail splitting mechanism will behave as if this
1549 address was listed in gnus-group-split Addresses (see below).")
1551 (gnus-define-group-parameter
1554 :function gnus-group-auto-expirable-p
1556 "Check whether GROUP is auto-expirable or not."
1557 :variable gnus-auto-expirable-newsgroups
1558 :variable-default nil
1560 "*Groups in which to automatically mark read articles as expirable.
1561 If non-nil, this should be a regexp that should match all groups in
1562 which to perform auto-expiry. This only makes sense for mail groups."
1563 :variable-group nnmail-expire
1564 :variable-type '(choice (const nil)
1566 :parameter-type '(const :tag "Automatic Expire" t)
1568 "All articles that are read will be marked as expirable.")
1570 (gnus-define-group-parameter
1573 :function gnus-group-total-expirable-p
1575 "Check whether GROUP is total-expirable or not."
1576 :variable gnus-total-expirable-newsgroups
1577 :variable-default nil
1579 "*Groups in which to perform expiry of all read articles.
1580 Use with extreme caution. All groups that match this regexp will be
1581 expiring - which means that all read articles will be deleted after
1582 \(say) one week. (This only goes for mail groups and the like, of
1584 :variable-group nnmail-expire
1585 :variable-type '(choice (const nil)
1587 :parameter-type '(const :tag "Total Expire" t)
1589 "All read articles will be put through the expiry process
1591 This happens even if they are not marked as expirable.
1594 (gnus-define-group-parameter
1597 "Return the default charset of GROUP."
1598 :variable gnus-group-charset-alist
1600 '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5)
1601 ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312)
1602 ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2)
1603 ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit)
1604 ("\\(^\\|:\\)relcom\\>" koi8-r)
1605 ("\\(^\\|:\\)fido7\\>" koi8-r)
1606 ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
1607 ("\\(^\\|:\\)israel\\>" iso-8859-1)
1608 ("\\(^\\|:\\)han\\>" euc-kr)
1609 ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5)
1610 ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr)
1611 ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
1614 "Alist of regexps (to match group names) and default charsets to be used when reading."
1615 :variable-group gnus-charset
1616 :variable-type '(repeat (list (regexp :tag "Group")
1617 (symbol :tag "Charset")))
1618 :parameter-type '(symbol :tag "Charset")
1619 :parameter-document "\
1620 The default charset to use in the group.")
1622 (gnus-define-group-parameter
1626 "Return a posting method for GROUP."
1627 :variable gnus-post-method-alist
1629 "Alist of regexps (to match group names) and method to be used when
1630 posting an article."
1631 :variable-group gnus-group-foreign
1633 '(choice :tag "Posting Method"
1634 (const :tag "Use native server" native)
1635 (const :tag "Use current server" current)
1636 (list :convert-widget
1638 (list 'sexp :tag "Methods"
1639 :value gnus-select-method))))
1641 "Posting method for this group.")
1643 (defcustom gnus-group-uncollapsed-levels 1
1644 "Number of group name elements to leave alone when making a short group name."
1645 :group 'gnus-group-visual
1648 (defcustom gnus-group-use-permanent-levels nil
1649 "*If non-nil, once you set a level, Gnus will use this level."
1650 :group 'gnus-group-levels
1655 (defcustom gnus-load-hook nil
1656 "A hook run while Gnus is loaded."
1660 (defcustom gnus-apply-kill-hook '(gnus-apply-kill-file)
1661 "A hook called to apply kill files to a group.
1662 This hook is intended to apply a kill file to the selected newsgroup.
1663 The function `gnus-apply-kill-file' is called by default.
1665 Since a general kill file is too heavy to use only for a few
1666 newsgroups, I recommend you to use a lighter hook function. For
1667 example, if you'd like to apply a kill file to articles which contains
1668 a string `rmgroup' in subject in newsgroup `control', you can use the
1671 (setq gnus-apply-kill-hook
1674 (cond ((string-match \"control\" gnus-newsgroup-name)
1675 (gnus-kill \"Subject\" \"rmgroup\")
1676 (gnus-expunge \"X\"))))))"
1677 :group 'gnus-score-kill
1678 :options '(gnus-apply-kill-file)
1681 (defcustom gnus-group-change-level-function nil
1682 "Function run when a group level is changed.
1683 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
1684 :group 'gnus-group-levels
1689 (defcustom gnus-visual
1690 '(summary-highlight group-highlight article-highlight
1692 summary-menu group-menu article-menu
1693 tree-highlight menu highlight
1694 browse-menu server-menu
1695 page-marker tree-menu binary-menu pick-menu
1697 "*Enable visual features.
1698 If `visual' is disabled, there will be no menus and few faces. Most of
1699 the visual customization options below will be ignored. Gnus will use
1700 less space and be faster as a result.
1702 This variable can also be a list of visual elements to switch on. For
1703 instance, to switch off all visual things except menus, you can say:
1705 (setq gnus-visual '(menu))
1707 Valid elements include `summary-highlight', `group-highlight',
1708 `article-highlight', `mouse-face', `summary-menu', `group-menu',
1709 `article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
1710 `server-menu', `page-marker', `tree-menu', `binary-menu', `pick-menu',
1711 and `grouplens-menu'."
1714 :type '(set (const summary-highlight)
1715 (const group-highlight)
1716 (const article-highlight)
1718 (const summary-menu)
1720 (const article-menu)
1721 (const tree-highlight)
1730 (const grouplens-menu)))
1732 ;; Byte-compiler warning.
1733 (defvar gnus-visual)
1734 ;; Find out whether the gnus-visual TYPE is wanted.
1735 (defun gnus-visual-p (&optional type class)
1736 (and gnus-visual ; Has to be non-nil, at least.
1737 (if (not type) ; We don't care about type.
1739 (if (listp gnus-visual) ; It's a list, so we check it.
1740 (or (memq type gnus-visual)
1741 (memq class gnus-visual))
1744 (defcustom gnus-mouse-face
1746 (if (gnus-visual-p 'mouse-face 'highlight)
1747 (if (boundp 'gnus-mouse-face)
1748 (or gnus-mouse-face 'highlight)
1752 "*Face used for group or summary buffer mouse highlighting.
1753 The line beneath the mouse pointer will be highlighted with this
1758 (defcustom gnus-article-save-directory gnus-directory
1759 "*Name of the directory articles will be saved in (default \"~/News\")."
1760 :group 'gnus-article-saving
1763 (defvar gnus-plugged t
1764 "Whether Gnus is plugged or not.")
1766 (defcustom gnus-default-charset 'iso-8859-1
1767 "Default charset assumed to be used when viewing non-ASCII characters.
1768 This variable is overridden on a group-to-group basis by the
1769 gnus-group-charset-alist variable and is only used on groups not
1770 covered by that variable."
1772 :group 'gnus-charset)
1775 ;;; Internal variables
1777 (defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
1778 (defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
1779 (defvar gnus-draft-meta-information-header "X-Draft-From")
1780 (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
1781 (defvar gnus-original-article-buffer " *Original Article*")
1782 (defvar gnus-newsgroup-name nil)
1783 (defvar gnus-ephemeral-servers nil)
1785 (defvar gnus-agent nil
1786 "Whether we want to use the Gnus agent or not.")
1788 (defvar gnus-agent-fetching nil
1789 "Whether Gnus agent is in fetching mode.")
1791 (defvar gnus-command-method nil
1792 "Dynamically bound variable that says what the current backend is.")
1794 (defvar gnus-current-select-method nil
1795 "The current method for selecting a newsgroup.")
1797 (defvar gnus-tree-buffer "*Tree*"
1798 "Buffer where Gnus thread trees are displayed.")
1801 (defvar gnus-use-generic-from nil)
1803 ;; Variable holding the user answers to all method prompts.
1804 (defvar gnus-method-history nil)
1806 ;; Variable holding the user answers to all mail method prompts.
1807 (defvar gnus-mail-method-history nil)
1809 ;; Variable holding the user answers to all group prompts.
1810 (defvar gnus-group-history nil)
1812 (defvar gnus-server-alist nil
1813 "List of available servers.")
1815 (defcustom gnus-cache-directory
1816 (nnheader-concat gnus-directory "cache/")
1817 "*The directory where cached articles will be stored."
1821 (defvar gnus-predefined-server-alist
1824 (nnspool-spool-directory ,gnus-cache-directory)
1825 (nnspool-nov-directory ,gnus-cache-directory)
1826 (nnspool-active-file
1827 ,(nnheader-concat gnus-cache-directory "active"))))
1828 "List of predefined (convenience) servers.")
1830 (defvar gnus-topic-indentation "");; Obsolete variable.
1832 (defconst gnus-article-mark-lists
1833 '((marked . tick) (replied . reply)
1834 (expirable . expire) (killed . killed)
1835 (bookmarks . bookmark) (dormant . dormant)
1836 (scored . score) (saved . save)
1837 (cached . cache) (downloadable . download)
1838 (unsendable . unsend) (forwarded . forward)
1839 (recent . recent) (seen . seen)))
1841 (defconst gnus-article-special-mark-lists
1847 ;; Propagate flags to server, with the following exceptions:
1848 ;; `seen' is private to each gnus installation
1849 ;; `cache' is a internal gnus flag for each gnus installation
1850 ;; `download' is a agent flag private to each gnus installation
1851 ;; `unsend' are for nndraft groups only
1852 ;; `score' is not a proper mark
1853 (defconst gnus-article-unpropagated-mark-lists
1854 '(seen cache download unsend score)
1855 "Marks that shouldn't be propagated to backends.
1856 Typical marks are those that make no sense in a standalone backend,
1857 such as a mark that says whether an article is stored in the cache
1858 (which doesn't make sense in a standalone backend).")
1860 (defvar gnus-headers-retrieved-by nil)
1861 (defvar gnus-article-reply nil)
1862 (defvar gnus-override-method nil)
1863 (defvar gnus-article-check-size nil)
1864 (defvar gnus-opened-servers nil)
1866 (defvar gnus-current-kill-article nil)
1868 (defvar gnus-have-read-active-file nil)
1870 (defconst gnus-maintainer
1871 "semi-gnus-ja@meadowy.org (T-gnus Bugfixing Girls + Boys)"
1872 "The mail address of the T-gnus maintainers.")
1874 (defcustom gnus-info-filename nil
1875 "*Controls language of gnus Info.
1876 If nil and current-language-environment is Japanese, go to gnus-ja.
1877 Otherwise go to corresponding Info.
1878 This variable can be nil, gnus or gnus-ja."
1880 :type '(choice (const nil)
1881 (const :tag "English" gnus)
1882 (const :tag "Japanese" gnus-ja)))
1884 (defvar gnus-info-nodes
1885 '((gnus-group-mode "Group Buffer")
1886 (gnus-summary-mode "Summary Buffer")
1887 (gnus-article-mode "Article Buffer")
1888 (gnus-server-mode "Server Buffer")
1889 (gnus-browse-mode "Browse Foreign Server")
1890 (gnus-tree-mode "Tree Display"))
1891 "Alist of major modes and related Info nodes.")
1893 (defvar gnus-group-buffer "*Group*")
1894 (defvar gnus-summary-buffer "*Summary*")
1895 (defvar gnus-article-buffer "*Article*")
1896 (defvar gnus-server-buffer "*Server*")
1898 (defvar gnus-slave nil
1899 "Whether this Gnus is a slave or not.")
1901 (defvar gnus-batch-mode nil
1902 "Whether this Gnus is running in batch mode or not.")
1904 (defvar gnus-variable-list
1905 '(gnus-newsrc-options gnus-newsrc-options-n
1906 gnus-newsrc-last-checked-date
1907 gnus-newsrc-alist gnus-server-alist
1908 gnus-killed-list gnus-zombie-list
1909 gnus-topic-topology gnus-topic-alist)
1910 "Gnus variables saved in the quick startup file.")
1912 (defvar gnus-product-variable-file-list
1913 (let ((version (product-version (product-find 'gnus-vers)))
1914 (codesys (static-if (boundp 'MULE) '*ctext* 'ctext)))
1915 `(("strict-cache" ((product-version ,version) (emacs-version))
1917 gnus-format-specs-compiled)
1918 ("cache" ((product-version ,version) (emacs-version))
1920 gnus-format-specs)))
1921 "Gnus variables are saved in the produce depend quick startup files.")
1923 (defcustom gnus-compile-user-specs t
1924 "If non-nil, the user-defined format specs will be byte-compiled
1926 It has an effect on the values of `gnus-*-line-format-spec'."
1930 (defvar gnus-newsrc-alist nil
1931 "Assoc list of read articles.
1932 gnus-newsrc-hashtb should be kept so that both hold the same information.")
1934 (defvar gnus-newsrc-hashtb nil
1935 "Hashtable of gnus-newsrc-alist.")
1937 (defvar gnus-killed-list nil
1938 "List of killed newsgroups.")
1940 (defvar gnus-killed-hashtb nil
1941 "Hash table equivalent of gnus-killed-list.")
1943 (defvar gnus-zombie-list nil
1944 "List of almost dead newsgroups.")
1946 (defvar gnus-description-hashtb nil
1947 "Descriptions of newsgroups.")
1949 (defvar gnus-list-of-killed-groups nil
1950 "List of newsgroups that have recently been killed by the user.")
1952 (defvar gnus-active-hashtb nil
1953 "Hashtable of active articles.")
1955 (defvar gnus-moderated-hashtb nil
1956 "Hashtable of moderated newsgroups.")
1958 ;; Save window configuration.
1959 (defvar gnus-prev-winconf nil)
1961 (defvar gnus-reffed-article-number nil)
1963 ;;; Let the byte-compiler know that we know about this variable.
1964 (defvar rmail-default-rmail-file)
1966 (defvar gnus-dead-summary nil)
1968 (defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
1969 "Regexp matching invalid groups.")
1971 ;;; End of variables.
1973 ;; Define some autoload functions Gnus might use.
1976 ;; This little mapcar goes through the list below and marks the
1977 ;; symbols in question as autoloaded functions.
1980 (let ((interactive (nth 1 (memq ':interactive package))))
1984 (when (consp function)
1985 (setq keymap (car (memq 'keymap function)))
1986 (setq function (car function)))
1987 (unless (fboundp function)
1988 (autoload function (car package) nil interactive keymap))))
1989 (if (eq (nth 1 package) ':interactive)
1992 '(("info" :interactive t Info-goto-node)
1994 ("ps-print" ps-print-preprint)
1995 ("message" :interactive t
1996 message-send-and-exit message-yank-original)
1997 ("babel" babel-as-string)
1998 ("nnmail" nnmail-split-fancy nnmail-article-group)
1999 ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
2000 ("rmailout" rmail-output rmail-output-to-rmail-file)
2001 ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
2002 rmail-show-message rmail-summary-exists
2003 rmail-select-summary rmail-update-summary)
2004 ("gnus-audio" :interactive t gnus-audio-play)
2005 ("gnus-xmas" gnus-xmas-splash)
2006 ("gnus-soup" :interactive t
2007 gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
2008 gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
2009 ("nnsoup" nnsoup-pack-replies)
2010 ("score-mode" :interactive t gnus-score-mode)
2011 ("gnus-mh" gnus-summary-save-article-folder
2012 gnus-Folder-save-name gnus-folder-save-name)
2013 ("gnus-mh" :interactive t gnus-summary-save-in-folder)
2014 ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
2015 gnus-demon-add-rescan gnus-demon-add-scan-timestamps
2016 gnus-demon-add-disconnection gnus-demon-add-handler
2017 gnus-demon-remove-handler)
2018 ("gnus-demon" :interactive t
2019 gnus-demon-init gnus-demon-cancel)
2020 ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
2021 gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer)
2022 ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close
2023 gnus-nocem-unwanted-article-p)
2024 ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
2025 gnus-server-server-name)
2026 ("gnus-srvr" gnus-browse-foreign-server)
2027 ("gnus-cite" :interactive t
2028 gnus-article-highlight-citation gnus-article-hide-citation-maybe
2029 gnus-article-hide-citation gnus-article-fill-cited-article
2030 gnus-article-hide-citation-in-followups)
2031 ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
2032 gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
2033 gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
2034 ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
2035 gnus-cache-possibly-remove-articles gnus-cache-request-article
2036 gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
2037 gnus-cache-enter-remove-article gnus-cached-article-p
2038 gnus-cache-open gnus-cache-close gnus-cache-update-article
2039 gnus-cache-articles-in-group)
2040 ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
2041 gnus-cache-remove-article gnus-summary-insert-cached-articles)
2042 ("gnus-score" :interactive t
2043 gnus-summary-increase-score gnus-summary-set-score
2044 gnus-summary-raise-thread gnus-summary-raise-same-subject
2045 gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
2046 gnus-summary-lower-thread gnus-summary-lower-same-subject
2047 gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
2048 gnus-summary-current-score gnus-score-delta-default
2049 gnus-score-flush-cache gnus-score-close
2050 gnus-possibly-score-headers gnus-score-followup-article
2051 gnus-score-followup-thread)
2053 (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
2054 gnus-current-score-file-nondirectory gnus-score-adaptive
2055 gnus-score-find-trace gnus-score-file-name)
2056 ("gnus-cus" :interactive t gnus-custom-mode gnus-group-customize
2057 gnus-score-customize)
2058 ("gnus-topic" :interactive t gnus-topic-mode)
2059 ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2060 gnus-subscribe-topics)
2061 ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
2062 ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
2063 ("gnus-uu" :interactive t
2064 gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2065 gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2066 gnus-uu-mark-by-regexp gnus-uu-mark-all
2067 gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2068 gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2069 gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2070 gnus-uu-decode-binhex gnus-uu-decode-uu-view
2071 gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2072 gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
2073 gnus-uu-decode-binhex-view gnus-uu-unmark-thread
2074 gnus-uu-mark-over gnus-uu-post-news)
2075 ("gnus-uu" gnus-uu-delete-work-dir gnus-quote-arg-for-sh-or-csh
2076 gnus-uu-unmark-thread)
2077 ("gnus-msg" (gnus-summary-send-map keymap)
2078 gnus-article-mail gnus-copy-article-buffer gnus-following-method)
2079 ("gnus-msg" :interactive t
2080 gnus-group-post-news gnus-group-mail gnus-group-news
2081 gnus-summary-post-news gnus-summary-news-other-window
2082 gnus-summary-followup gnus-summary-followup-with-original
2083 gnus-summary-cancel-article gnus-summary-supersede-article
2084 gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2085 gnus-summary-mail-forward gnus-summary-mail-other-window
2086 gnus-summary-resend-message gnus-summary-resend-bounced-mail
2087 gnus-summary-wide-reply gnus-summary-followup-to-mail
2088 gnus-summary-followup-to-mail-with-original gnus-bug
2089 gnus-summary-wide-reply-with-original gnus-summary-post-forward
2090 gnus-summary-digest-mail-forward gnus-summary-digest-post-forward)
2091 ("gnus-picon" :interactive t gnus-article-display-picons
2092 gnus-group-display-picons)
2093 ("gnus-picon" gnus-picons-buffer-name)
2094 ("gnus-gl" bbb-login bbb-logout bbb-grouplens-group-p
2095 gnus-grouplens-mode)
2096 ("smiley" :interactive t gnus-smiley-display)
2097 ("gnus-win" gnus-configure-windows gnus-add-configuration)
2098 ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2099 gnus-list-of-unread-articles gnus-list-of-read-articles
2100 gnus-offer-save-summaries gnus-make-thread-indent-array
2101 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2102 gnus-summary-skip-intangible gnus-summary-article-number
2103 gnus-data-header gnus-data-find gnus-summary-jump-to-other-group)
2104 ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2105 gnus-group-list-groups gnus-group-first-unread-group
2106 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2107 gnus-group-setup-buffer gnus-group-get-new-news
2108 gnus-group-make-help-group gnus-group-update-group
2109 gnus-group-iterate gnus-group-group-name)
2110 ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2111 gnus-backlog-remove-article)
2112 ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2113 gnus-article-prepare gnus-article-set-window-start
2114 gnus-article-next-page gnus-article-prev-page
2115 gnus-request-article-this-buffer gnus-article-mode
2116 gnus-article-setup-buffer gnus-narrow-to-page
2117 gnus-article-delete-invisible-text gnus-treat-article)
2118 ("gnus-art" :interactive t
2119 gnus-article-hide-headers gnus-article-hide-boring-headers
2120 gnus-article-treat-overstrike
2121 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2122 gnus-article-display-x-face
2123 gnus-article-decode-HZ
2124 gnus-article-wash-html
2125 gnus-article-hide-pgp
2126 gnus-article-hide-pem gnus-article-hide-signature
2127 gnus-article-strip-leading-blank-lines gnus-article-date-local
2128 gnus-article-date-original gnus-article-date-lapsed
2129 gnus-article-show-all-headers gnus-article-show-all
2130 gnus-article-edit-mode gnus-article-edit-article
2131 gnus-article-edit-done article-decode-encoded-words
2132 gnus-start-date-timer gnus-stop-date-timer
2133 gnus-article-toggle-headers)
2134 ("gnus-int" gnus-request-type)
2135 ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
2136 gnus-dribble-enter gnus-read-init-file gnus-dribble-touch)
2137 ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2138 gnus-dup-enter-articles)
2139 ("gnus-range" gnus-copy-sequence)
2140 ("gnus-eform" gnus-edit-form)
2141 ("gnus-move" :interactive t
2142 gnus-group-move-group-to-server gnus-change-server)
2143 ("gnus-logic" gnus-score-advanced)
2144 ("gnus-undo" gnus-undo-mode gnus-undo-register)
2145 ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2146 gnus-async-prefetch-article gnus-async-prefetch-remove-group
2147 gnus-async-halt-prefetch)
2150 ("gnus-offline" :interactive t
2151 gnus-offline-toggle-plugged
2152 gnus-offline-set-unplugged-state
2153 gnus-offline-toggle-auto-hangup
2154 gnus-offline-toggle-on/off-send-mail
2155 gnus-offline-toggle-articles-to-fetch
2156 gnus-offline-set-interval-time
2157 gnus-offline-agent-expire)
2158 ("miee" :interactive t gnspool-get-news
2159 mail-spool-send news-spool-post)
2160 ("international/mw32misc" define-process-argument-editing
2161 general-process-argument-editing-function)
2162 ("gnus-agent" gnus-open-agent gnus-agent-get-function
2163 gnus-agent-save-groups gnus-agent-save-active gnus-agent-method-p
2164 gnus-agent-get-undownloaded-list gnus-agent-fetch-session
2165 gnus-summary-set-agent-mark gnus-agent-save-group-info)
2166 ("gnus-agent" :interactive t
2167 gnus-unplugged gnus-agentize gnus-agent-batch)
2168 ("gnus-vm" :interactive t gnus-summary-save-in-vm
2169 gnus-summary-save-article-vm)
2170 ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-drafts)
2171 ("gnus-mlspl" gnus-group-split gnus-group-split-fancy)
2172 ("gnus-mlspl" :interactive t gnus-group-split-setup
2173 gnus-group-split-update))))
2176 (unless (featurep 'xemacs)
2177 (if (>= emacs-major-version 21)
2178 (autoload 'x-face-decode-message-header "x-face-e21")
2179 (autoload 'gnus-smiley-display "gnus-bitmap" nil t)
2180 (autoload 'smiley-toggle-buffer "gnus-bitmap")
2181 (autoload 'x-face-mule-gnus-article-display-x-face "x-face-mule"))))
2183 (unless (and (fboundp 'base64-encode-string)
2184 (subrp (symbol-function 'base64-encode-string)))
2187 ;; To search articles with Namazu.
2188 (autoload 'gnus-namazu-search "gnus-namazu" nil t)
2190 ;; To make nnir groups.
2191 (autoload 'gnus-group-make-nnir-group "nnir" nil t)
2193 ;; To make shimbun groups.
2194 (autoload 'gnus-group-make-shimbun-group "nnshimbun" nil t)
2196 ;; A tool for the developers.
2197 (autoload 'find-cl-run-time-functions "gnus-clfns" nil t)
2199 ;;; gnus-sum.el thingies
2202 (defcustom gnus-summary-line-format "%U%R%z%I%(%[%4L: %-23,23n%]%) %s\n"
2203 "*The format specification of the lines in the summary buffer.
2205 It works along the same lines as a normal formatting string,
2206 with some simple extensions.
2208 %N Article number, left padded with spaces (string)
2210 %s Subject if it is at the root of a thread, and \"\" otherwise (string)
2211 %n Name of the poster (string)
2212 %a Extracted name of the poster (string)
2213 %A Extracted address of the poster (string)
2214 %F Contents of the From: header (string)
2215 %f Contents of the From: or To: headers (string)
2216 %x Contents of the Xref: header (string)
2217 %D Date of the article (string)
2218 %d Date of the article (string) in DD-MMM format
2219 %o Date of the article (string) in YYYYMMDD`T'HHMMSS format
2220 %M Message-id of the article (string)
2221 %r References of the article (string)
2222 %c Number of characters in the article (integer)
2223 %L Number of lines in the article (integer)
2224 %I Indentation based on thread level (a string of spaces)
2225 %B A complex trn-style thread tree (string)
2226 The variables `gnus-sum-thread-*' can be used for customization.
2227 %T A string with two possible values: 80 spaces if the article
2228 is on thread level two or larger and 0 spaces on level one
2229 %R \"A\" if this article has been replied to, \" \" otherwise (character)
2230 %U Status of this article (character, \"R\", \"K\", \"-\" or \" \")
2231 %[ Opening bracket (character, \"[\" or \"<\")
2232 %] Closing bracket (character, \"]\" or \">\")
2233 %> Spaces of length thread-level (string)
2234 %< Spaces of length (- 20 thread-level) (string)
2235 %i Article score (number)
2236 %z Article zcore (character)
2237 %t Number of articles under the current thread (number).
2238 %e Whether the thread is empty or not (character).
2239 %l GroupLens score (string).
2240 %V Total thread score (number).
2241 %P The line number (number).
2242 %O Download mark (character).
2243 %u User defined specifier. The next character in the format string should
2244 be a letter. Gnus will call the function gnus-user-format-function-X,
2245 where X is the letter following %u. The function will be passed the
2246 current header as argument. The function should return a string, which
2247 will be inserted into the summary just like information from any other
2250 Text between %( and %) will be highlighted with `gnus-mouse-face'
2251 when the mouse point is placed inside the area. There can only be one
2254 The %U (status), %R (replied) and %z (zcore) specs have to be handled
2255 with care. For reasons of efficiency, Gnus will compute what column
2256 these characters will end up in, and \"hard-code\" that. This means that
2257 it is invalid to have these specs after a variable-length spec. Well,
2258 you might not be arrested, but your summary buffer will look strange,
2259 which is bad enough.
2261 The smart choice is to have these specs as far to the left as
2264 This restriction may disappear in later versions of Gnus."
2266 :group 'gnus-summary-format)
2269 ;;; Skeleton keymaps
2272 (defun gnus-suppress-keymap (keymap)
2273 (suppress-keymap keymap)
2274 (let ((keys `([backspace] [delete] "\177" "\M-u"))) ;gnus-mouse-2
2276 (define-key keymap (pop keys) 'undefined))))
2278 (defvar gnus-article-mode-map
2279 (let ((keymap (make-sparse-keymap)))
2280 (gnus-suppress-keymap keymap)
2282 (defvar gnus-summary-mode-map
2283 (let ((keymap (make-keymap)))
2284 (gnus-suppress-keymap keymap)
2286 (defvar gnus-group-mode-map
2287 (let ((keymap (make-keymap)))
2288 (gnus-suppress-keymap keymap)
2293 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2294 ;; If you want the cursor to go somewhere else, set these two
2295 ;; functions in some startup hook to whatever you want.
2296 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
2297 (defalias 'gnus-group-position-point 'gnus-goto-colon)
2299 ;;; Various macros and substs.
2301 (defun gnus-header-from (header)
2302 (mail-header-from header))
2304 (defmacro gnus-gethash (string hashtable)
2305 "Get hash value of STRING in HASHTABLE."
2306 `(symbol-value (intern-soft ,string ,hashtable)))
2308 (defmacro gnus-sethash (string value hashtable)
2309 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
2310 `(set (intern ,string ,hashtable) ,value))
2311 (put 'gnus-sethash 'edebug-form-spec '(form form form))
2313 (defmacro gnus-group-unread (group)
2314 "Get the currently computed number of unread articles in GROUP."
2315 `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
2317 (defmacro gnus-group-entry (group)
2318 "Get the newsrc entry for GROUP."
2319 `(gnus-gethash ,group gnus-newsrc-hashtb))
2321 (defmacro gnus-active (group)
2322 "Get active info on GROUP."
2323 `(gnus-gethash ,group gnus-active-hashtb))
2325 (defmacro gnus-set-active (group active)
2326 "Set GROUP's active info."
2327 `(gnus-sethash ,group ,active gnus-active-hashtb))
2329 ;; Info access macros.
2331 (defmacro gnus-info-group (info)
2333 (defmacro gnus-info-rank (info)
2335 (defmacro gnus-info-read (info)
2337 (defmacro gnus-info-marks (info)
2339 (defmacro gnus-info-method (info)
2341 (defmacro gnus-info-params (info)
2344 (defmacro gnus-info-level (info)
2345 `(let ((rank (gnus-info-rank ,info)))
2349 (defmacro gnus-info-score (info)
2350 `(let ((rank (gnus-info-rank ,info)))
2351 (or (and (consp rank) (cdr rank)) 0)))
2353 (defmacro gnus-info-set-group (info group)
2354 `(setcar ,info ,group))
2355 (defmacro gnus-info-set-rank (info rank)
2356 `(setcar (nthcdr 1 ,info) ,rank))
2357 (defmacro gnus-info-set-read (info read)
2358 `(setcar (nthcdr 2 ,info) ,read))
2359 (defmacro gnus-info-set-marks (info marks &optional extend)
2361 `(gnus-info-set-entry ,info ,marks 3)
2362 `(setcar (nthcdr 3 ,info) ,marks)))
2363 (defmacro gnus-info-set-method (info method &optional extend)
2365 `(gnus-info-set-entry ,info ,method 4)
2366 `(setcar (nthcdr 4 ,info) ,method)))
2367 (defmacro gnus-info-set-params (info params &optional extend)
2369 `(gnus-info-set-entry ,info ,params 5)
2370 `(setcar (nthcdr 5 ,info) ,params)))
2372 (defun gnus-info-set-entry (info entry number)
2373 ;; Extend the info until we have enough elements.
2374 (while (<= (length info) number)
2375 (nconc info (list nil)))
2377 (setcar (nthcdr number info) entry))
2379 (defmacro gnus-info-set-level (info level)
2380 `(let ((rank (cdr ,info)))
2381 (if (consp (car rank))
2382 (setcar (car rank) ,level)
2383 (setcar rank ,level))))
2384 (defmacro gnus-info-set-score (info score)
2385 `(let ((rank (cdr ,info)))
2386 (if (consp (car rank))
2387 (setcdr (car rank) ,score)
2388 (setcar rank (cons (car rank) ,score)))))
2390 (defmacro gnus-get-info (group)
2391 `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
2393 ;;; Load the compatability functions.
2402 (defvar gnus-shutdown-alist nil)
2404 (defun gnus-add-shutdown (function &rest symbols)
2405 "Run FUNCTION whenever one of SYMBOLS is shut down."
2406 (push (cons function symbols) gnus-shutdown-alist))
2408 (defun gnus-shutdown (symbol)
2409 "Shut down everything that waits for SYMBOL."
2410 (let ((alist gnus-shutdown-alist)
2412 (while (setq entry (pop alist))
2413 (when (memq symbol (cdr entry))
2414 (funcall (car entry))))))
2418 ;;; Gnus Utility Functions
2421 (defun gnus-find-subscribed-addresses ()
2422 "Return a regexp matching the addresses of all subscribed mail groups.
2423 It consists of the `to-address' or `to-list' parameter of all groups
2424 with a `subscribed' parameter."
2426 (mapc (lambda (entry)
2427 (let ((group (car entry)))
2428 (when (gnus-group-find-parameter group 'subscribed)
2430 (gnus-group-fast-parameter group 'to-address)
2431 (gnus-group-fast-parameter group 'to-list))))
2433 (setq addresses (cons address addresses)))))))
2434 (cdr gnus-newsrc-alist))
2435 (list (mapconcat 'regexp-quote addresses "\\|"))))
2437 (defmacro gnus-string-or (&rest strings)
2438 "Return the first element of STRINGS that is a non-blank string.
2439 STRINGS will be evaluated in normal `or' order."
2440 `(gnus-string-or-1 ',strings))
2442 (defun gnus-string-or-1 (strings)
2445 (setq string (eval (pop strings)))
2446 (if (string-match "^[ \t]*$" string)
2448 (setq strings nil)))
2451 (defun gnus-info-find-node (&optional nodename)
2452 "Find Info documentation of Gnus."
2454 ;; Enlarge info window if needed.
2455 (let (gnus-info-buffer)
2458 (or gnus-info-filename
2459 (get-language-info current-language-environment 'gnus-info)
2462 (cadr (assq major-mode gnus-info-nodes))
2463 (and (eq (current-buffer) (get-buffer gnus-article-buffer))
2464 (cadr (assq 'gnus-article-mode gnus-info-nodes))))))
2465 (setq gnus-info-buffer (current-buffer))
2466 (gnus-configure-windows 'info)))
2469 ;;; gnus-interactive
2472 (defvar gnus-current-prefix-symbol nil
2473 "Current prefix symbol.")
2475 (defvar gnus-current-prefix-symbols nil
2476 "List of current prefix symbols.")
2478 (defun gnus-interactive (string &optional params)
2479 "Return a list that can be fed to `interactive'.
2480 See `interactive' for full documentation.
2482 Adds the following specs:
2484 y -- The current symbolic prefix.
2485 Y -- A list of the current symbolic prefix(es).
2486 A -- Article number.
2487 H -- Article header.
2491 (while (< i (length string))
2492 (string-match ".\\([^\n]*\\)\n?" string i)
2493 (setq c (aref string i))
2495 (setq prompt (match-string 1 string)))
2496 (setq i (match-end 0))
2497 ;; We basically emulate just about everything that
2498 ;; `interactive' does, but add the specs listed above.
2502 (completing-read prompt obarray 'fboundp t))
2504 (read-buffer prompt (current-buffer) t))
2506 (read-buffer prompt (other-buffer (current-buffer))))
2510 (completing-read prompt obarray 'commandp t))
2514 (read-file-name prompt nil default-directory 'lambda))
2516 (read-file-name prompt nil nil 'lambda))
2518 (read-file-name prompt))
2520 (read-key-sequence prompt))
2522 (error "Not implemented spec"))
2524 (error "Not implemented spec"))
2528 (error "Not implemented spec"))
2530 (string-to-number (read-from-minibuffer prompt)))
2532 (prefix-numeric-value current-prefix-arg))
2538 (read-string prompt))
2540 (intern (read-string prompt)))
2542 (read-variable prompt))
2544 (read-minibuffer prompt))
2546 (eval-minibuffer prompt))
2547 ;; And here the new specs come.
2549 gnus-current-prefix-symbol)
2551 gnus-current-prefix-symbols)
2553 (gnus-group-group-name))
2555 (gnus-summary-skip-intangible)
2556 (or (get-text-property (point) 'gnus-number)
2557 (gnus-summary-last-subject)))
2559 (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
2561 (error "Non-implemented spec")))
2565 (push (if (< (point) (mark)) (point) (mark)) out)
2566 (push (if (> (point) (mark)) (point) (mark)) out))))
2567 (setq out (delq 'gnus-prefix-nil out))
2570 (defun gnus-symbolic-argument (&optional arg)
2571 "Read a symbolic argument and a command, and then execute command."
2573 (let* ((in-command (this-command-keys))
2574 (command in-command)
2575 gnus-current-prefix-symbols
2576 gnus-current-prefix-symbol
2578 (while (equal in-command command)
2579 (message "%s-" (key-description (this-command-keys)))
2580 (push (intern (char-to-string (read-char))) syms)
2581 (setq command (read-key-sequence nil t)))
2582 (setq gnus-current-prefix-symbols (nreverse syms)
2583 gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
2584 (call-interactively (key-binding command t))))
2586 ;;; More various functions.
2588 (defsubst gnus-check-backend-function (func group)
2589 "Check whether GROUP supports function FUNC.
2590 GROUP can either be a string (a group name) or a select method."
2592 (let ((method (if (stringp group)
2593 (car (gnus-find-method-for-group group))
2595 (unless (featurep method)
2597 (fboundp (intern (format "%s-%s" method func))))))
2599 (defun gnus-group-read-only-p (&optional group)
2600 "Check whether GROUP supports editing or not.
2601 If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
2602 that that variable is buffer-local to the summary buffers."
2603 (let ((group (or group gnus-newsgroup-name)))
2604 (not (gnus-check-backend-function 'request-replace-article group))))
2606 (defun gnus-virtual-group-p (group)
2607 "Say whether GROUP is virtual or not."
2608 (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
2609 gnus-valid-select-methods)))
2611 (defun gnus-news-group-p (group &optional article)
2612 "Return non-nil if GROUP (and ARTICLE) come from a news server."
2613 (cond ((gnus-member-of-valid 'post group) ;Ordinary news group
2614 t) ;is news of course.
2615 ((not (gnus-member-of-valid 'post-mail group)) ;Non-combined.
2616 nil) ;must be mail then.
2617 ((vectorp article) ;Has header info.
2618 (eq (gnus-request-type group (mail-header-id article)) 'news))
2619 ((null article) ;Hasn't header info
2620 (eq (gnus-request-type group) 'news)) ;(unknown ==> mail)
2621 ((< article 0) ;Virtual message
2622 nil) ;we don't know, guess mail.
2623 (t ;Has positive number
2624 (eq (gnus-request-type group article) 'news)))) ;use it.
2626 ;; Returns a list of writable groups.
2627 (defun gnus-writable-groups ()
2628 (let ((alist gnus-newsrc-alist)
2630 (while (setq group (car (pop alist)))
2631 (unless (gnus-group-read-only-p group)
2632 (push group groups)))
2635 ;; Check whether to use long file names.
2636 (defun gnus-use-long-file-name (symbol)
2637 ;; The variable has to be set...
2638 (and gnus-use-long-file-name
2639 ;; If it isn't a list, then we return t.
2640 (or (not (listp gnus-use-long-file-name))
2641 ;; If it is a list, and the list contains `symbol', we
2643 (not (memq symbol gnus-use-long-file-name)))))
2645 ;; Generate a unique new group name.
2646 (defun gnus-generate-new-group-name (leaf)
2649 (while (gnus-gethash name gnus-newsrc-hashtb)
2650 (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
2653 (defun gnus-ephemeral-group-p (group)
2654 "Say whether GROUP is ephemeral or not."
2655 (gnus-group-get-parameter group 'quit-config t))
2657 (defun gnus-group-quit-config (group)
2658 "Return the quit-config of GROUP."
2659 (gnus-group-get-parameter group 'quit-config t))
2661 (defun gnus-kill-ephemeral-group (group)
2662 "Remove ephemeral GROUP from relevant structures."
2663 (gnus-sethash group nil gnus-newsrc-hashtb))
2665 (defun gnus-simplify-mode-line ()
2666 "Make mode lines a bit simpler."
2667 (setq mode-line-modified (cdr gnus-mode-line-modified))
2668 (when (listp mode-line-format)
2669 (make-local-variable 'mode-line-format)
2670 (setq mode-line-format (copy-sequence mode-line-format))
2671 (when (equal (nth 3 mode-line-format) " ")
2672 (setcar (nthcdr 3 mode-line-format) " "))))
2674 ;;; Servers and groups.
2676 (defsubst gnus-server-add-address (method)
2677 (let ((method-name (symbol-name (car method))))
2678 (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
2679 (not (assq (intern (concat method-name "-address")) method))
2680 (memq 'physical-address (assq (car method)
2681 gnus-valid-select-methods)))
2682 (append method (list (list (intern (concat method-name "-address"))
2686 (defsubst gnus-server-get-method (group method)
2687 ;; Input either a server name, and extended server name, or a
2688 ;; select method, and return a select method.
2689 (cond ((stringp method)
2690 (gnus-server-to-method method))
2691 ((equal method gnus-select-method)
2693 ((and (stringp (car method))
2695 (gnus-server-extend-method group method))
2698 (equal (cadr method) ""))
2701 (gnus-server-add-address method))))
2703 (defun gnus-server-to-method (server)
2704 "Map virtual server names to select methods."
2706 ;; Is this a method, perhaps?
2707 (and server (listp server) server)
2708 ;; Perhaps this is the native server?
2709 (and (equal server "native") gnus-select-method)
2710 ;; It should be in the server alist.
2711 (cdr (assoc server gnus-server-alist))
2712 ;; It could be in the predefined server alist.
2713 (cdr (assoc server gnus-predefined-server-alist))
2714 ;; If not, we look through all the opened server
2715 ;; to see whether we can find it there.
2716 (let ((opened gnus-opened-servers))
2718 (not (equal server (format "%s:%s" (caaar opened)
2722 ;; It could be a named method, search all servers
2723 (let ((servers gnus-secondary-select-methods))
2725 (not (equal server (format "%s:%s" (caar servers)
2730 (defmacro gnus-method-equal (ss1 ss2)
2731 "Say whether two servers are equal."
2735 (and (= (length s1) (length s2))
2737 (while (and s1 (member (car s1) s2))
2741 (defun gnus-methods-equal-p (m1 m2)
2742 (let ((m1 (or m1 gnus-select-method))
2743 (m2 (or m2 gnus-select-method)))
2745 (and (eq (car m1) (car m2))
2746 (or (not (memq 'address (assoc (symbol-name (car m1))
2747 gnus-valid-select-methods)))
2748 (equal (nth 1 m1) (nth 1 m2)))))))
2750 (defun gnus-server-equal (m1 m2)
2751 "Say whether two methods are equal."
2752 (let ((m1 (cond ((null m1) gnus-select-method)
2753 ((stringp m1) (gnus-server-to-method m1))
2755 (m2 (cond ((null m2) gnus-select-method)
2756 ((stringp m2) (gnus-server-to-method m2))
2758 (gnus-method-equal m1 m2)))
2760 (defun gnus-servers-using-backend (backend)
2761 "Return a list of known servers using BACKEND."
2762 (let ((opened gnus-opened-servers)
2765 (when (eq backend (caaar opened))
2766 (push (caar opened) out))
2770 (defun gnus-archive-server-wanted-p ()
2771 "Say whether the user wants to use the archive server."
2773 ((or (not gnus-message-archive-method)
2774 (not gnus-message-archive-group))
2776 ((and gnus-message-archive-method gnus-message-archive-group)
2779 (let ((active (cadr (assq 'nnfolder-active-file
2780 gnus-message-archive-method))))
2782 (file-exists-p active))))))
2784 (defsubst gnus-method-to-server-name (method)
2786 (format "%s" (car method))
2788 (or (assoc (format "%s" (car method))
2789 (gnus-methods-using 'address))
2790 (gnus-server-equal method gnus-message-archive-method))
2792 (not (string= (nth 1 method) "")))
2793 (concat "+" (nth 1 method)))))
2795 (defsubst gnus-method-to-full-server-name (method)
2796 (format "%s+%s" (car method) (nth 1 method)))
2798 (defun gnus-group-prefixed-name (group method)
2799 "Return the whole name from GROUP and METHOD."
2800 (and (stringp method) (setq method (gnus-server-to-method method)))
2801 (if (or (not method)
2802 (gnus-server-equal method "native"))
2804 (concat (gnus-method-to-server-name method) ":" group)))
2806 (defun gnus-group-real-prefix (group)
2807 "Return the prefix of the current group name."
2808 (if (string-match "^[^:]+:" group)
2809 (substring group 0 (match-end 0))
2812 (defun gnus-group-method (group)
2813 "Return the server or method used for selecting GROUP.
2814 You should probably use `gnus-find-method-for-group' instead."
2815 (let ((prefix (gnus-group-real-prefix group)))
2816 (if (equal prefix "")
2818 (let ((servers gnus-opened-servers)
2820 backend possible found)
2821 (if (string-match "^[^\\+]+\\+" prefix)
2822 (setq backend (intern (substring prefix 0 (1- (match-end 0))))
2823 server (substring prefix (match-end 0) (1- (length prefix))))
2824 (setq backend (intern (substring prefix 0 (1- (length prefix))))))
2826 (when (eq (caaar servers) backend)
2827 (setq possible (caar servers))
2828 (when (equal (cadaar servers) server)
2829 (setq found (caar servers))))
2831 (or (car (rassoc found gnus-server-alist))
2833 (car (rassoc possible gnus-server-alist))
2835 (list backend server))))))
2837 (defsubst gnus-native-method-p (method)
2838 "Return whether METHOD is the native select method."
2839 (gnus-method-equal method gnus-select-method))
2841 (defsubst gnus-secondary-method-p (method)
2842 "Return whether METHOD is a secondary select method."
2843 (let ((methods gnus-secondary-select-methods)
2844 (gmethod (gnus-server-get-method nil method)))
2846 (not (gnus-method-equal
2847 (gnus-server-get-method nil (car methods))
2849 (setq methods (cdr methods)))
2852 (defun gnus-method-simplify (method)
2853 "Return the shortest uniquely identifying string or method for METHOD."
2854 (cond ((stringp method)
2856 ((gnus-native-method-p method)
2858 ((gnus-secondary-method-p method)
2859 (format "%s:%s" (nth 0 method) (nth 1 method)))
2863 (defun gnus-groups-from-server (server)
2864 "Return a list of all groups that are fetched from SERVER."
2865 (let ((alist (cdr gnus-newsrc-alist))
2867 (while (setq info (pop alist))
2868 (when (gnus-server-equal (gnus-info-method info) server)
2869 (push (gnus-info-group info) groups)))
2870 (sort groups 'string<)))
2872 (defun gnus-group-foreign-p (group)
2873 "Say whether a group is foreign or not."
2874 (and (not (gnus-group-native-p group))
2875 (not (gnus-group-secondary-p group))))
2877 (defun gnus-group-native-p (group)
2878 "Say whether the group is native or not."
2879 (not (string-match ":" group)))
2881 (defun gnus-group-secondary-p (group)
2882 "Say whether the group is secondary or not."
2883 (gnus-secondary-method-p (gnus-find-method-for-group group)))
2885 (defun gnus-parameters-get-parameter (group)
2886 "Return the group parameters for GROUP from `gnus-parameters'."
2888 (dolist (elem gnus-parameters)
2889 (when (string-match (car elem) group)
2891 (nconc (gnus-expand-group-parameters
2892 (car elem) (cdr elem) group)
2896 (defun gnus-expand-group-parameter (match value group)
2897 "Use MATCH to expand VALUE in GROUP."
2900 (goto-char (point-min))
2901 (while (re-search-forward match nil t)
2902 (replace-match value))
2905 (defun gnus-expand-group-parameters (match parameters group)
2906 "Go through PARAMETERS and expand them according to the match data."
2908 (dolist (elem parameters)
2909 (if (and (stringp (cdr elem))
2910 (string-match "\\\\" (cdr elem)))
2911 (push (cons (car elem)
2912 (gnus-expand-group-parameter match (cdr elem) group))
2917 (defun gnus-group-fast-parameter (group symbol &optional allow-list)
2918 "For GROUP, return the value of SYMBOL.
2920 You should call this in the `gnus-group-buffer' buffer.
2921 The function `gnus-group-find-parameter' will do that for you."
2922 ;; The speed trick: No cons'ing and quit early.
2923 (or (let ((params (funcall gnus-group-get-parameter-function group)))
2924 ;; Start easy, check the "real" group parameters.
2925 (gnus-group-parameter-value params symbol allow-list))
2926 ;; We didn't found it there, try `gnus-parameters'.
2929 (tail gnus-parameters))
2930 ;; A good old-fashioned non-cl loop.
2932 (setq head (car tail)
2934 ;; The car is regexp matching for matching the group name.
2935 (when (string-match (car head) group)
2936 ;; The cdr is the parameters.
2937 (setq result (gnus-group-parameter-value (cdr head)
2940 ;; Expand if necessary.
2941 (if (and (stringp result) (string-match "\\\\" result))
2942 (setq result (gnus-expand-group-parameter (car head)
2944 ;; Exit the loop early.
2949 (defun gnus-group-find-parameter (group &optional symbol allow-list)
2950 "Return the group parameters for GROUP.
2951 If SYMBOL, return the value of that symbol in the group parameters.
2953 If you call this function inside a loop, consider using the faster
2954 `gnus-group-fast-parameter' instead."
2956 (set-buffer gnus-group-buffer)
2958 (gnus-group-fast-parameter group symbol allow-list)
2962 (funcall gnus-group-get-parameter-function group))
2963 (gnus-parameters-get-parameter group))))
2966 (defun gnus-group-get-parameter (group &optional symbol allow-list)
2967 "Return the group parameters for GROUP.
2968 If SYMBOL, return the value of that symbol in the group parameters.
2969 Most functions should use `gnus-group-find-parameter', which
2970 also examines the topic parameters."
2971 (let ((params (gnus-info-params (gnus-get-info group))))
2973 (gnus-group-parameter-value params symbol allow-list)
2976 (defun gnus-group-parameter-value (params symbol &optional allow-list)
2977 "Return the value of SYMBOL in group PARAMS."
2978 ;; We only wish to return group parameters (dotted lists) and
2979 ;; not local variables, which may have the same names.
2980 ;; But first we handle single elements...
2981 (or (car (memq symbol params))
2985 (while (setq elem (pop params))
2986 (when (and (consp elem)
2987 (eq (car elem) symbol)
2990 (throw 'found (cdr elem))))))))
2992 (defun gnus-group-add-parameter (group param)
2993 "Add parameter PARAM to GROUP."
2994 (let ((info (gnus-get-info group)))
2996 (gnus-group-remove-parameter group (if (consp param) (car param) param))
2997 ;; Cons the new param to the old one and update.
2998 (gnus-group-set-info (cons param (gnus-info-params info))
3001 (defun gnus-group-set-parameter (group name value)
3002 "Set parameter NAME to VALUE in GROUP."
3003 (let ((info (gnus-get-info group)))
3005 (gnus-group-remove-parameter group name)
3006 (let ((old-params (gnus-info-params info))
3007 (new-params (list (cons name value))))
3009 (when (or (not (listp (car old-params)))
3010 (not (eq (caar old-params) name)))
3011 (setq new-params (append new-params (list (car old-params)))))
3012 (setq old-params (cdr old-params)))
3013 (gnus-group-set-info new-params group 'params)))))
3015 (defun gnus-group-remove-parameter (group name)
3016 "Remove parameter NAME from GROUP."
3017 (let ((info (gnus-get-info group)))
3019 (let ((params (gnus-info-params info)))
3021 (setq params (delq name params))
3022 (while (assq name params)
3023 (gnus-pull name params))
3024 (gnus-info-set-params info params))))))
3026 (defun gnus-group-add-score (group &optional score)
3027 "Add SCORE to the GROUP score.
3028 If SCORE is nil, add 1 to the score of GROUP."
3029 (let ((info (gnus-get-info group)))
3031 (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
3033 (defun gnus-short-group-name (group &optional levels)
3034 "Collapse GROUP name LEVELS.
3035 Select methods are stripped and any remote host name is stripped down to
3036 just the host name."
3042 gnus-group-uncollapsed-levels
3044 (while (string-match "\\." group skip)
3045 (setq skip (match-end 0)
3048 ;; Separate foreign select method from group name and collapse.
3049 ;; If method contains a server, collapse to non-domain server name,
3050 ;; otherwise collapse to select method.
3051 (let* ((colon (string-match ":" group))
3052 (server (and colon (substring group 0 colon)))
3053 (plus (and server (string-match "+" server))))
3056 (setq foreign (substring server (+ 1 plus)
3057 (string-match "\\." server))
3058 group (substring group (+ 1 colon)))
3059 (setq foreign server
3060 group (substring group (+ 1 colon))))
3061 (setq foreign (concat foreign ":")))
3062 ;; Collapse group name leaving LEVELS uncollapsed elements
3063 (let* ((slist (split-string group "/"))
3064 (slen (length slist))
3065 (dlist (split-string group "\\."))
3066 (dlen (length dlist))
3078 (setq levels (- glen levels))
3080 (push (if (>= (decf levels) 0)
3081 (if (zerop (length g))
3086 (concat foreign (mapconcat 'identity (nreverse res) gsep))))))
3088 (defun gnus-narrow-to-body ()
3089 "Narrow to the body of an article."
3092 (goto-char (point-min))
3093 (or (search-forward "\n\n" nil t)
3099 ;;; Kill file handling.
3102 (defun gnus-apply-kill-file ()
3103 "Apply a kill file to the current newsgroup.
3104 Returns the number of articles marked as read."
3105 (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
3106 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3107 (gnus-apply-kill-file-internal)
3110 (defun gnus-kill-save-kill-buffer ()
3111 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3112 (when (get-file-buffer file)
3114 (set-buffer (get-file-buffer file))
3115 (when (buffer-modified-p)
3117 (kill-buffer (current-buffer))))))
3119 (defcustom gnus-kill-file-name "KILL"
3120 "Suffix of the kill files."
3121 :group 'gnus-score-kill
3122 :group 'gnus-score-files
3125 (defun gnus-newsgroup-kill-file (newsgroup)
3126 "Return the name of a kill file name for NEWSGROUP.
3127 If NEWSGROUP is nil, return the global kill file name instead."
3129 ;; The global KILL file is placed at top of the directory.
3130 ((or (null newsgroup)
3131 (string-equal newsgroup ""))
3132 (expand-file-name gnus-kill-file-name
3133 gnus-kill-files-directory))
3134 ;; Append ".KILL" to newsgroup name.
3135 ((gnus-use-long-file-name 'not-kill)
3136 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
3137 "." gnus-kill-file-name)
3138 gnus-kill-files-directory))
3139 ;; Place "KILL" under the hierarchical directory.
3141 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
3142 "/" gnus-kill-file-name)
3143 gnus-kill-files-directory))))
3147 (defun gnus-member-of-valid (symbol group)
3148 "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
3150 (symbol-name (car (gnus-find-method-for-group group)))
3151 gnus-valid-select-methods)))
3153 (defun gnus-method-option-p (method option)
3154 "Return non-nil if select METHOD has OPTION as a parameter."
3155 (when (stringp method)
3156 (setq method (gnus-server-to-method method)))
3157 (memq option (assoc (format "%s" (car method))
3158 gnus-valid-select-methods)))
3160 (defun gnus-similar-server-opened (method)
3161 (let ((opened gnus-opened-servers))
3162 (while (and method opened)
3163 (when (and (equal (cadr method) (cadaar opened))
3164 (equal (car method) (caaar opened))
3165 (not (equal method (caar opened))))
3170 (defun gnus-server-extend-method (group method)
3171 ;; This function "extends" a virtual server. If the server is
3172 ;; "hello", and the select method is ("hello" (my-var "something"))
3173 ;; in the group "alt.alt", this will result in a new virtual server
3174 ;; called "hello+alt.alt".
3175 (if (or (not (inline (gnus-similar-server-opened method)))
3176 (not (cddr method)))
3178 `(,(car method) ,(concat (cadr method) "+" group)
3179 (,(intern (format "%s-address" (car method))) ,(cadr method))
3182 (defun gnus-server-status (method)
3183 "Return the status of METHOD."
3184 (nth 1 (assoc method gnus-opened-servers)))
3186 (defun gnus-group-name-to-method (group)
3187 "Guess a select method based on GROUP."
3188 (if (string-match ":" group)
3189 (let ((server (substring group 0 (match-beginning 0))))
3190 (if (string-match "\\+" server)
3191 (list (intern (substring server 0 (match-beginning 0)))
3192 (substring server (match-end 0)))
3193 (list (intern server) "")))
3194 gnus-select-method))
3196 (defun gnus-server-string (server)
3197 "Return a readable string that describes SERVER."
3198 (let* ((server (gnus-server-to-method server))
3199 (address (nth 1 server)))
3201 (not (zerop (length address))))
3202 (format "%s via %s" address (car server))
3203 (format "%s" (car server)))))
3205 (defun gnus-find-method-for-group (group &optional info)
3206 "Find the select method that GROUP uses."
3207 (or gnus-override-method
3210 (and (not (gnus-group-entry group));; a new group
3211 (gnus-group-name-to-method group))
3212 (let ((info (or info (gnus-get-info group)))
3215 (not (setq method (gnus-info-method info)))
3216 (equal method "native"))
3219 (cond ((stringp method)
3220 (inline (gnus-server-to-method method)))
3221 ((stringp (cadr method))
3222 (inline (gnus-server-extend-method group method)))
3225 (cond ((equal (cadr method) "")
3227 ((null (cadr method))
3228 (list (car method) ""))
3230 (gnus-server-add-address method)))))))
3232 (defun gnus-methods-using (feature)
3233 "Find all methods that have FEATURE."
3234 (let ((valids gnus-valid-select-methods)
3237 (when (memq feature (car valids))
3238 (push (car valids) outs))
3239 (setq valids (cdr valids)))
3242 (defun gnus-read-group (prompt &optional default)
3243 "Prompt the user for a group name.
3244 Disallow invalid group names."
3249 gnus-invalid-group-regexp
3250 (setq group (read-string (concat prefix prompt)
3251 (cons (or default "") 0)
3252 'gnus-group-history)))
3253 (setq prefix (format "Invalid group name: \"%s\". " group)
3257 (defun gnus-read-method (prompt)
3258 "Prompt the user for a method.
3259 Allow completion over sensible values."
3260 (let* ((open-servers
3261 (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
3262 gnus-opened-servers))
3265 (dolist (method gnus-valid-select-methods)
3266 (if (or (memq 'prompt-address method)
3267 (not (assoc (format "%s:" (car method)) open-servers)))
3268 (push method methods)))
3271 (append valid-methods
3273 gnus-predefined-server-alist
3278 nil t nil 'gnus-method-history)))
3281 (setq method gnus-select-method))
3282 ((assoc method gnus-valid-select-methods)
3283 (let ((address (if (memq 'prompt-address
3284 (assoc method gnus-valid-select-methods))
3285 (read-string "Address: ")
3287 (or (cadr (assoc (format "%s:%s" method address) open-servers))
3288 (list (intern method) address))))
3289 ((assoc method servers)
3292 (list (intern method) "")))))
3294 ;;; User-level commands.
3297 (defun gnus-slave-no-server (&optional arg)
3298 "Read network news as a slave, without connecting to local server."
3300 (gnus-no-server arg t))
3303 (defun gnus-no-server (&optional arg slave)
3305 If ARG is a positive number, Gnus will use that as the
3306 startup level. If ARG is nil, Gnus will be started at level 2.
3307 If ARG is non-nil and not a positive number, Gnus will
3308 prompt the user for the name of an NNTP server to use.
3309 As opposed to `gnus', this command will not connect to the local server."
3311 (gnus-no-server-1 arg slave))
3314 (defun gnus-slave (&optional arg)
3315 "Read news as a slave."
3317 (gnus arg nil 'slave))
3319 (defcustom gnus-frame-properties nil
3320 "The properties of the frame in which gnus is displayed. Under XEmacs,
3321 the variable `toolbar-news-frame-plist' will be refered instead."
3322 :type '(repeat (cons :format "%v"
3323 (symbol :tag "Parameter")
3324 (sexp :tag "Value")))
3327 (defvar gnus-frame nil
3328 "The frame in which gnus is displayed. It is not used under XEmacs.")
3331 (defun gnus-other-frame (&optional arg)
3332 "Pop up a frame to read news."
3334 (static-if (featurep 'xemacs)
3335 (let ((toolbar-news-use-separate-frame t))
3337 (if (frame-live-p gnus-frame)
3338 (raise-frame gnus-frame)
3339 (setq gnus-frame (make-frame gnus-frame-properties))
3340 (if (and (gnus-buffer-live-p gnus-group-buffer)
3341 (save-current-buffer
3342 (set-buffer gnus-group-buffer)
3343 (eq 'gnus-group-mode major-mode)))
3345 (select-frame gnus-frame)
3346 (switch-to-buffer gnus-group-buffer))
3347 (add-hook 'gnus-exit-gnus-hook
3349 (when (and (frame-live-p gnus-frame)
3351 (delete-frame gnus-frame))
3352 (setq gnus-frame nil)))
3353 (select-frame gnus-frame)
3357 (defun gnus (&optional arg dont-connect slave)
3359 If ARG is non-nil and a positive number, Gnus will use that as the
3360 startup level. If ARG is non-nil and not a positive number, Gnus will
3361 prompt the user for the name of an NNTP server to use."
3363 (gnus-1 arg dont-connect slave))
3365 ;; Allow redefinition of Gnus functions.
3369 (product-provide (provide 'gnus) 'gnus-vers)
3371 ;;; gnus.el ends here