1 ;;; gnus.el --- a newsreader for GNU Emacs
2 ;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996,
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-charset nil
47 "Group character set issues."
48 :link '(custom-manual "(gnus)Charsets")
52 (defgroup gnus-cache nil
56 (defgroup gnus-start nil
57 "Starting your favorite newsreader."
60 (defgroup gnus-start-server nil
61 "Server options at startup."
64 ;; These belong to gnus-group.el.
65 (defgroup gnus-group nil
67 :link '(custom-manual "(gnus)The Group Buffer")
70 (defgroup gnus-group-foreign nil
72 :link '(custom-manual "(gnus)Foreign Groups")
75 (defgroup gnus-group-new nil
76 "Automatic subscription of new groups."
79 (defgroup gnus-group-levels nil
81 :link '(custom-manual "(gnus)Group Levels")
84 (defgroup gnus-group-select nil
86 :link '(custom-manual "(gnus)Selecting a Group")
89 (defgroup gnus-group-listing nil
90 "Showing slices of the group list."
91 :link '(custom-manual "(gnus)Listing Groups")
94 (defgroup gnus-group-visual nil
95 "Sorting the group buffer."
96 :link '(custom-manual "(gnus)Group Buffer Format")
100 (defgroup gnus-group-various nil
101 "Various group options."
102 :link '(custom-manual "(gnus)Scanning New Messages")
105 ;; These belong to gnus-sum.el.
106 (defgroup gnus-summary nil
108 :link '(custom-manual "(gnus)The Summary Buffer")
111 (defgroup gnus-summary-exit nil
112 "Leaving summary buffers."
113 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
114 :group 'gnus-summary)
116 (defgroup gnus-summary-marks nil
117 "Marks used in summary buffers."
118 :link '(custom-manual "(gnus)Marking Articles")
119 :group 'gnus-summary)
121 (defgroup gnus-thread nil
122 "Ordering articles according to replies."
123 :link '(custom-manual "(gnus)Threading")
124 :group 'gnus-summary)
126 (defgroup gnus-summary-format nil
127 "Formatting of the summary buffer."
128 :link '(custom-manual "(gnus)Summary Buffer Format")
129 :group 'gnus-summary)
131 (defgroup gnus-summary-choose nil
133 :link '(custom-manual "(gnus)Choosing Articles")
134 :group 'gnus-summary)
136 (defgroup gnus-summary-maneuvering nil
137 "Summary movement commands."
138 :link '(custom-manual "(gnus)Summary Maneuvering")
139 :group 'gnus-summary)
141 (defgroup gnus-summary-mail nil
142 "Mail group commands."
143 :link '(custom-manual "(gnus)Mail Group Commands")
144 :group 'gnus-summary)
146 (defgroup gnus-summary-sort nil
147 "Sorting the summary buffer."
148 :link '(custom-manual "(gnus)Sorting")
149 :group 'gnus-summary)
151 (defgroup gnus-summary-visual nil
152 "Highlighting and menus in the summary buffer."
153 :link '(custom-manual "(gnus)Summary Highlighting")
155 :group 'gnus-summary)
157 (defgroup gnus-summary-various nil
158 "Various summary buffer options."
159 :link '(custom-manual "(gnus)Various Summary Stuff")
160 :group 'gnus-summary)
162 (defgroup gnus-summary-pick nil
163 "Pick mode in the summary buffer."
164 :link '(custom-manual "(gnus)Pick and Read")
166 :group 'gnus-summary)
168 (defgroup gnus-summary-tree nil
169 "Tree display of threads in the summary buffer."
170 :link '(custom-manual "(gnus)Tree Display")
172 :group 'gnus-summary)
174 ;; Belongs to gnus-uu.el
175 (defgroup gnus-extract-view nil
176 "Viewing extracted files."
177 :link '(custom-manual "(gnus)Viewing Files")
178 :group 'gnus-extract)
180 ;; Belongs to gnus-score.el
181 (defgroup gnus-score nil
182 "Score and kill file handling."
185 (defgroup gnus-score-kill nil
189 (defgroup gnus-score-adapt nil
190 "Adaptive score files."
193 (defgroup gnus-score-default nil
194 "Default values for score files."
197 (defgroup gnus-score-expire nil
198 "Expiring score rules."
201 (defgroup gnus-score-decay nil
202 "Decaying score rules."
205 (defgroup gnus-score-files nil
206 "Score and kill file names."
210 (defgroup gnus-score-various nil
211 "Various scoring and killing options."
215 (defgroup gnus-visual nil
216 "Options controling the visual fluff."
220 (defgroup gnus-agent nil
221 "Offline support for Gnus."
224 (defgroup gnus-files nil
225 "Files used by Gnus."
228 (defgroup gnus-dribble-file nil
230 :link '(custom-manual "(gnus)Auto Save")
233 (defgroup gnus-newsrc nil
234 "Storing Gnus state."
237 (defgroup gnus-server nil
238 "Options related to newsservers and other servers used by Gnus."
241 (defgroup gnus-message '((message custom-group))
242 "Composing replies and followups in Gnus."
245 (defgroup gnus-meta nil
246 "Meta variables controling major portions of Gnus.
247 In general, modifying these variables does not take affect until Gnus
248 is restarted, and sometimes reloaded."
251 (defgroup gnus-various nil
252 "Other Gnus options."
253 :link '(custom-manual "(gnus)Various Various")
256 (defgroup gnus-mime nil
257 "Variables for controlling the Gnus MIME interface."
260 (defgroup gnus-exit nil
262 :link '(custom-manual "(gnus)Exiting Gnus")
265 (defcustom gnus-inhibit-startup-message nil
266 "If non-nil, the startup message will not be displayed.
267 This variable is used before `.gnus.el' is loaded, so it should
268 be set in `.emacs' instead."
272 (defcustom gnus-play-startup-jingle nil
273 "If non-nil, play the Gnus jingle at startup."
277 (unless (fboundp 'gnus-group-remove-excess-properties)
278 (defalias 'gnus-group-remove-excess-properties 'ignore))
280 (unless (fboundp 'gnus-set-text-properties)
281 (defalias 'gnus-set-text-properties 'set-text-properties))
283 (unless (featurep 'gnus-xmas)
284 (defalias 'gnus-make-overlay 'make-overlay)
285 (defalias 'gnus-delete-overlay 'delete-overlay)
286 (defalias 'gnus-overlay-put 'overlay-put)
287 (defalias 'gnus-move-overlay 'move-overlay)
288 (defalias 'gnus-overlay-buffer 'overlay-buffer)
289 (defalias 'gnus-overlay-start 'overlay-start)
290 (defalias 'gnus-overlay-end 'overlay-end)
291 (defalias 'gnus-extent-detached-p 'ignore)
292 (defalias 'gnus-extent-start-open 'ignore)
293 (defalias 'gnus-appt-select-lowest-window 'appt-select-lowest-window)
294 (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
295 (defalias 'gnus-character-to-event 'identity)
296 (defalias 'gnus-add-text-properties 'add-text-properties)
297 (defalias 'gnus-put-text-property 'put-text-property)
298 (defvar gnus-mode-line-image-cache t)
299 (if (fboundp 'find-image)
300 (defun gnus-mode-line-buffer-identification (line)
301 (let ((str (car-safe line)))
302 (if (and (stringp str)
303 (string-match "^Gnus:" str))
304 (progn (add-text-properties
307 (if (eq t gnus-mode-line-image-cache)
308 (setq gnus-mode-line-image-cache
310 '((:type xpm :file "gnus-pointer.xpm"
312 (:type xbm :file "gnus-pointer.xbm"
314 gnus-mode-line-image-cache)
315 'help-echo "This is Gnus")
319 (defalias 'gnus-mode-line-buffer-identification 'identity))
320 (defalias 'gnus-characterp 'numberp)
321 (defalias 'gnus-deactivate-mark 'deactivate-mark)
322 (defalias 'gnus-window-edges 'window-edges)
323 (defalias 'gnus-key-press-event-p 'numberp)
324 ;;(defalias 'gnus-decode-rfc1522 'ignore)
327 ;; We define these group faces here to avoid the display
328 ;; update forced when creating new faces.
330 (defface gnus-group-news-1-face
333 (:foreground "PaleTurquoise" :bold t))
336 (:foreground "ForestGreen" :bold t))
339 "Level 1 newsgroup face.")
341 (defface gnus-group-news-1-empty-face
344 (:foreground "PaleTurquoise"))
347 (:foreground "ForestGreen"))
350 "Level 1 empty newsgroup face.")
352 (defface gnus-group-news-2-face
355 (:foreground "turquoise" :bold t))
358 (:foreground "CadetBlue4" :bold t))
361 "Level 2 newsgroup face.")
363 (defface gnus-group-news-2-empty-face
366 (:foreground "turquoise"))
369 (:foreground "CadetBlue4"))
372 "Level 2 empty newsgroup face.")
374 (defface gnus-group-news-3-face
383 "Level 3 newsgroup face.")
385 (defface gnus-group-news-3-empty-face
394 "Level 3 empty newsgroup face.")
396 (defface gnus-group-news-4-face
405 "Level 4 newsgroup face.")
407 (defface gnus-group-news-4-empty-face
416 "Level 4 empty newsgroup face.")
418 (defface gnus-group-news-5-face
427 "Level 5 newsgroup face.")
429 (defface gnus-group-news-5-empty-face
438 "Level 5 empty newsgroup face.")
440 (defface gnus-group-news-6-face
449 "Level 6 newsgroup face.")
451 (defface gnus-group-news-6-empty-face
460 "Level 6 empty newsgroup face.")
462 (defface gnus-group-news-low-face
465 (:foreground "DarkTurquoise" :bold t))
468 (:foreground "DarkGreen" :bold t))
471 "Low level newsgroup face.")
473 (defface gnus-group-news-low-empty-face
476 (:foreground "DarkTurquoise"))
479 (:foreground "DarkGreen"))
482 "Low level empty newsgroup face.")
484 (defface gnus-group-mail-1-face
487 (:foreground "aquamarine1" :bold t))
490 (:foreground "DeepPink3" :bold t))
493 "Level 1 mailgroup face.")
495 (defface gnus-group-mail-1-empty-face
498 (:foreground "aquamarine1"))
501 (:foreground "DeepPink3"))
503 (:italic t :bold t)))
504 "Level 1 empty mailgroup face.")
506 (defface gnus-group-mail-2-face
509 (:foreground "aquamarine2" :bold t))
512 (:foreground "HotPink3" :bold t))
515 "Level 2 mailgroup face.")
517 (defface gnus-group-mail-2-empty-face
520 (:foreground "aquamarine2"))
523 (:foreground "HotPink3"))
526 "Level 2 empty mailgroup face.")
528 (defface gnus-group-mail-3-face
531 (:foreground "aquamarine3" :bold t))
534 (:foreground "magenta4" :bold t))
537 "Level 3 mailgroup face.")
539 (defface gnus-group-mail-3-empty-face
542 (:foreground "aquamarine3"))
545 (:foreground "magenta4"))
548 "Level 3 empty mailgroup face.")
550 (defface gnus-group-mail-low-face
553 (:foreground "aquamarine4" :bold t))
556 (:foreground "DeepPink4" :bold t))
559 "Low level mailgroup face.")
561 (defface gnus-group-mail-low-empty-face
564 (:foreground "aquamarine4"))
567 (:foreground "DeepPink4"))
570 "Low level empty mailgroup face.")
572 ;; Summary mode faces.
574 (defface gnus-summary-selected-face '((t
576 "Face used for selected articles.")
578 (defface gnus-summary-cancelled-face
580 (:foreground "yellow" :background "black")))
581 "Face used for cancelled articles.")
583 (defface gnus-summary-high-ticked-face
586 (:foreground "pink" :bold t))
589 (:foreground "firebrick" :bold t))
592 "Face used for high interest ticked articles.")
594 (defface gnus-summary-low-ticked-face
597 (:foreground "pink" :italic t))
600 (:foreground "firebrick" :italic t))
603 "Face used for low interest ticked articles.")
605 (defface gnus-summary-normal-ticked-face
608 (:foreground "pink"))
611 (:foreground "firebrick"))
614 "Face used for normal interest ticked articles.")
616 (defface gnus-summary-high-ancient-face
619 (:foreground "SkyBlue" :bold t))
622 (:foreground "RoyalBlue" :bold t))
625 "Face used for high interest ancient articles.")
627 (defface gnus-summary-low-ancient-face
630 (:foreground "SkyBlue" :italic t))
633 (:foreground "RoyalBlue" :italic t))
636 "Face used for low interest ancient articles.")
638 (defface gnus-summary-normal-ancient-face
641 (:foreground "SkyBlue"))
644 (:foreground "RoyalBlue"))
647 "Face used for normal interest ancient articles.")
649 (defface gnus-summary-high-unread-face
652 "Face used for high interest unread articles.")
654 (defface gnus-summary-low-unread-face
657 "Face used for low interest unread articles.")
659 (defface gnus-summary-normal-unread-face
662 "Face used for normal interest unread articles.")
664 (defface gnus-summary-incorporated-face
667 "Face used for incorporated articles.")
669 (defface gnus-summary-high-read-face
672 (:foreground "PaleGreen"
676 (:foreground "DarkGreen"
680 "Face used for high interest read articles.")
682 (defface gnus-summary-low-read-face
685 (:foreground "PaleGreen"
689 (:foreground "DarkGreen"
693 "Face used for low interest read articles.")
695 (defface gnus-summary-normal-read-face
698 (:foreground "PaleGreen"))
701 (:foreground "DarkGreen"))
704 "Face used for normal interest read articles.")
711 (defvar gnus-buffers nil)
713 (defun gnus-get-buffer-create (name)
714 "Do the same as `get-buffer-create', but store the created buffer."
715 (or (get-buffer name)
716 (car (push (get-buffer-create name) gnus-buffers))))
718 (defun gnus-add-buffer ()
719 "Add the current buffer to the list of Gnus buffers."
720 (push (current-buffer) gnus-buffers))
722 (defun gnus-buffers ()
723 "Return a list of live Gnus buffers."
724 (while (and gnus-buffers
725 (not (buffer-name (car gnus-buffers))))
727 (let ((buffers gnus-buffers))
729 (if (buffer-name (cadr buffers))
731 (setcdr buffers (cddr buffers)))))
736 (defvar gnus-group-buffer "*Group*")
739 (autoload 'gnus-play-jingle "gnus-audio"))
741 (defface gnus-splash-face
744 (:foreground "Brown"))
747 (:foreground "Brown"))
750 "Face of the splash screen.")
752 (defun gnus-splash ()
754 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
755 (let ((buffer-read-only nil))
757 (unless gnus-inhibit-startup-message
758 (gnus-group-startup-message)
760 (when gnus-play-startup-jingle
761 (gnus-play-jingle))))))
763 (defun gnus-indent-rigidly (start end arg)
764 "Indent rigidly using only spaces and no tabs."
767 (narrow-to-region start end)
769 (indent-rigidly start end arg)
770 ;; We translate tabs into spaces -- not everybody uses
771 ;; an 8-character tab.
772 (goto-char (point-min))
773 (while (search-forward "\t" nil t)
774 (replace-match " " t t))))))
776 (defvar gnus-simple-splash nil)
778 (defun gnus-group-startup-message (&optional x y)
779 "Insert startup message in current buffer."
780 ;; Insert the message.
783 ((and (fboundp 'find-image)
785 (let* ((bg (face-background 'default))
786 (fg (face-foreground 'gnus-splash-face))
788 `((:type xpm :file "gnus.xpm"
789 :color-symbols (("thing" . "#724214")
790 ("shadow" . "#1e3f03")
791 ("background" . ,bg)))
792 (:type pbm :file "gnus.pbm"
793 ;; Account for the pbm's blackground.
794 :background ,bg :foreground ,fg)
795 (:type xbm :file "gnus.xbm"
796 ;; Account for the xbm's blackground.
797 :background ,bg :foreground ,fg)))))
801 (concat gnus-product-name " " gnus-version-number
802 (if (zerop (string-to-number gnus-revision-number))
804 (concat " (r" gnus-revision-number ")"))
805 " based on " gnus-original-product-name " v"
806 gnus-original-version-number)
807 'face `(variable-pitch :background ,bg :foreground ,fg)))
808 (let ((fill-column (window-width)))
809 (center-region (point-min) (point)))
810 (let ((size (image-size image)))
811 (insert-char ?\n (max 1 (round (- (window-height)
812 (or y (cdr size))) 2)))
814 (propertize " " 'display
816 ,(max 0 (round (- (window-width)
817 (or x (car size))) 2)))))
818 (insert-image image))
819 (setq gnus-simple-splash nil)
824 _ ___ __ ___ __ _ ___
843 (goto-char (point-min))
844 (insert gnus-product-name " " gnus-version-number
845 (if (zerop (string-to-number gnus-revision-number))
847 (concat " (r" gnus-revision-number ")"))
848 " based on " gnus-original-product-name " v"
849 gnus-original-version-number)
850 (insert-char ?\ (prog1
851 (max 0 (/ (- (window-width) (point)) 2))
852 (goto-char (point-min))))
855 (gnus-indent-rigidly (point) (point-max)
856 (/ (max (- (window-width) (or x 46)) 0) 2))
857 (goto-char (point-min))
859 (let* ((pheight (count-lines (point-min) (point-max)))
860 (wheight (window-height))
861 (rest (- wheight pheight)))
862 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
864 (put-text-property (point-min) (point-max) 'face 'gnus-splash-face)
865 (setq gnus-simple-splash t)))
866 (goto-char (point-min))
867 (setq mode-line-buffer-identification (concat " " gnus-version))
868 (set-buffer-modified-p t))
871 (let ((command (format "%s" this-command)))
872 (if (and (string-match "gnus" command)
873 (not (string-match "gnus-other-frame" command)))
875 (gnus-get-buffer-create gnus-group-buffer))))
882 (defcustom gnus-parameters nil
883 "Alist of group parameters.
886 ((\"mail\\\\..*\" (gnus-show-threads nil)
887 (gnus-use-scoring nil)
888 (gnus-summary-line-format
889 \"%U%R%z%I%(%[%d:%ub%-20,20f%]%) %s\\n\")
892 (\"mail\\\\.me\" (gnus-use-scoring t))
893 (\"list\\\\..*\" (total-expire . t)
894 (broken-reply-to . t)))"
895 :group 'gnus-group-various
896 :type '(repeat (cons regexp
899 (defvar gnus-group-parameters-more nil)
901 (defvar gnus-colon-keywords
903 (when (boundp 'dgnushack-colon-keywords)
904 (symbol-value 'dgnushack-colon-keywords)))
905 "List of the colon keywords should be bound at run-time. This variable
906 defaults to a proper value only if this file is byte-compiled by make.")
908 (dolist (keyword gnus-colon-keywords)
909 (set keyword keyword))
911 (defmacro gnus-define-group-parameter (param &rest rest)
912 "Define a group parameter PARAM.
913 REST is a plist of following:
914 :type One of `bool', `list' or `nil'.
915 :function The name of the function.
916 :function-document The document of the function.
917 :parameter-type The type for customizing the parameter.
918 :parameter-document The document for the parameter.
919 :variable The name of the variable.
920 :variable-document The document for the variable.
921 :variable-group The group for customizing the variable.
922 :variable-type The type for customizing the variable.
923 :variable-default The default value of the variable."
924 (let* ((type (plist-get rest :type))
925 (parameter-type (plist-get rest :parameter-type))
926 (parameter-document (plist-get rest :parameter-document))
927 (function (or (plist-get rest :function)
928 (intern (format "gnus-parameter-%s" param))))
929 (function-document (or (plist-get rest :function-document) ""))
930 (variable (or (plist-get rest :variable)
931 (intern (format "gnus-parameter-%s-alist" param))))
932 (variable-document (or (plist-get rest :variable-document) ""))
933 (variable-group (plist-get rest :variable-group))
934 (variable-type (or (plist-get rest :variable-type)
936 (list (regexp :tag "Group")
937 ,(car (cdr parameter-type)))))))
938 (variable-default (plist-get rest :variable-default)))
941 `(defcustom ,variable ,variable-default
943 :group 'gnus-group-parameter
944 :group ',variable-group
945 :type ,variable-type)
946 `(setq gnus-group-parameters-more
947 (delq (assq ',param gnus-group-parameters-more)
948 gnus-group-parameters-more))
949 `(add-to-list 'gnus-group-parameters-more
952 ,parameter-document))
954 `(defun ,function (name)
956 (let ((params (gnus-group-find-parameter name))
959 ((memq ',param params)
961 ((setq val (assq ',param params))
964 (string-match ,variable name))
966 (let ((alist ,variable)
968 (while (setq elem (pop alist))
970 (string-match (car elem) name))
973 (if (consp value) (car value) value))))))
974 `(defun ,function (name)
977 (or (gnus-group-find-parameter name ',param ,(and type t))
978 (let ((alist ,variable)
980 (while (setq elem (pop alist))
982 (string-match (car elem) name))
987 '(if (consp value) (car value) value))))))))))
989 (defcustom gnus-home-directory "~/"
990 "Directory variable that specifies the \"home\" directory.
991 All other Gnus path variables are initialized from this variable."
995 (defcustom gnus-directory (or (getenv "SAVEDIR")
996 (nnheader-concat gnus-home-directory "News/"))
997 "*Directory variable from which all other Gnus file variables are derived.
999 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1000 This means that other directory variables that are initialized from
1001 this variable won't be set properly if you set this variable in `.gnus.el'.
1002 Set this variable in `.emacs' instead."
1006 (defcustom gnus-default-directory nil
1007 "*Default directory for all Gnus buffers."
1009 :type '(choice (const :tag "current" nil)
1012 ;; Site dependent variables. These variables should be defined in
1015 (defvar gnus-default-nntp-server nil
1016 "Specify a default NNTP server.
1017 This variable should be defined in paths.el, and should never be set
1019 If you want to change servers, you should use `gnus-select-method'.
1020 See the documentation to that variable.")
1022 ;; Don't touch this variable.
1023 (defvar gnus-nntp-service "nntp"
1024 "NNTP service name (\"nntp\" or 119).
1025 This is an obsolete variable, which is scarcely used. If you use an
1026 nntp server for your newsgroup and want to change the port number
1027 used to 899, you would say something along these lines:
1029 (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
1031 (defcustom gnus-nntpserver-file "/etc/nntpserver"
1032 "A file with only the name of the nntp server in it."
1037 ;; This function is used to check both the environment variable
1038 ;; NNTPSERVER and the /etc/nntpserver file to see whether one can find
1039 ;; an nntp server name default.
1040 (defun gnus-getenv-nntpserver ()
1041 (or (getenv "NNTPSERVER")
1042 (and (file-readable-p gnus-nntpserver-file)
1044 (set-buffer (gnus-get-buffer-create " *gnus nntp*"))
1045 (insert-file-contents gnus-nntpserver-file)
1046 (let ((name (buffer-string)))
1048 (if (string-match "\\'[ \t\n]*$" name)
1051 (kill-buffer (current-buffer))))))))
1053 (defcustom gnus-select-method
1056 (list 'nntp (or (condition-case nil
1057 (gnus-getenv-nntpserver)
1059 (when (and gnus-default-nntp-server
1060 (not (string= gnus-default-nntp-server "")))
1061 gnus-default-nntp-server)
1063 (if (or (null gnus-nntp-service)
1064 (equal gnus-nntp-service "nntp"))
1066 (list gnus-nntp-service)))
1068 "Default method for selecting a newsgroup.
1069 This variable should be a list, where the first element is how the
1070 news is to be fetched, the second is the address.
1072 For instance, if you want to get your news via NNTP from
1073 \"flab.flab.edu\", you could say:
1075 \(setq gnus-select-method '(nntp \"flab.flab.edu\"))
1077 If you want to use your local spool, say:
1079 \(setq gnus-select-method (list 'nnspool (system-name)))
1081 If you use this variable, you must set `gnus-nntp-server' to nil.
1083 There is a lot more to know about select methods and virtual servers -
1084 see the manual for details."
1086 :type 'gnus-select-method)
1088 (defcustom gnus-message-archive-method
1090 ;; Don't require it at top level to avoid circularity.
1094 (nnfolder-directory ,(nnheader-concat message-directory "archive"))
1095 (nnfolder-active-file
1096 ,(nnheader-concat message-directory "archive/active"))
1097 (nnfolder-get-new-mail nil)
1098 (nnfolder-inhibit-expiry t)))
1099 "*Method used for archiving messages you've sent.
1100 This should be a mail method.
1102 It's probably not very effective to change this variable once you've
1103 run Gnus once. After doing that, you must edit this server from the
1106 :group 'gnus-message
1107 :type 'gnus-select-method)
1109 (defcustom gnus-message-archive-group nil
1110 "*Name of the group in which to save the messages you've written.
1111 This can either be a string; a list of strings; or an alist
1112 of regexps/functions/forms to be evaluated to return a string (or a list
1113 of strings). The functions are called with the name of the current
1114 group (or nil) as a parameter.
1116 If you want to save your mail in one group and the news articles you
1117 write in another group, you could say something like:
1119 \(setq gnus-message-archive-group
1120 '((if (message-news-p)
1124 Normally the group names returned by this variable should be
1125 unprefixed -- which implicitly means \"store on the archive server\".
1126 However, you may wish to store the message on some other server. In
1127 that case, just return a fully prefixed name of the group --
1128 \"nnml+private:mail.misc\", for instance."
1129 :group 'gnus-message
1130 :type '(choice (const :tag "none" nil)
1135 (defcustom gnus-secondary-servers nil
1136 "List of NNTP servers that the user can choose between interactively.
1137 To make Gnus query you for a server, you have to give `gnus' a
1138 non-numeric prefix - `C-u M-x gnus', in short."
1140 :type '(repeat string))
1142 (defcustom gnus-nntp-server nil
1143 "*The name of the host running the NNTP server.
1144 This variable is semi-obsolete. Use the `gnus-select-method'
1147 :type '(choice (const :tag "disable" nil)
1150 (defcustom gnus-secondary-select-methods nil
1151 "A list of secondary methods that will be used for reading news.
1152 This is a list where each element is a complete select method (see
1153 `gnus-select-method').
1155 If, for instance, you want to read your mail with the nnml backend,
1156 you could set this variable:
1158 \(setq gnus-secondary-select-methods '((nnml \"\")))"
1160 :type '(repeat gnus-select-method))
1162 (defvar gnus-backup-default-subscribed-newsgroups
1163 '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
1164 "Default default new newsgroups the first time Gnus is run.
1165 Should be set in paths.el, and shouldn't be touched by the user.")
1167 (defcustom gnus-local-domain nil
1168 "Local domain name without a host name.
1169 The DOMAINNAME environment variable is used instead if it is defined.
1170 If the `system-name' function returns the full Internet name, there is
1171 no need to set this variable."
1172 :group 'gnus-message
1173 :type '(choice (const :tag "default" nil)
1176 (defvar gnus-local-organization nil
1177 "String with a description of what organization (if any) the user belongs to.
1178 Obsolete variable; use `message-user-organization' instead.")
1180 ;; Customization variables
1182 (defcustom gnus-refer-article-method nil
1183 "Preferred method for fetching an article by Message-ID.
1184 If you are reading news from the local spool (with nnspool), fetching
1185 articles by Message-ID is painfully slow. By setting this method to an
1186 nntp method, you might get acceptable results.
1188 The value of this variable must be a valid select method as discussed
1189 in the documentation of `gnus-select-method'.
1191 It can also be a list of select methods, as well as the special symbol
1192 `current', which means to use the current select method. If it is a
1193 list, Gnus will try all the methods in the list until it finds a match."
1195 :type '(choice (const :tag "default" nil)
1196 (const :tag "DejaNews" (nnweb "refer" (nnweb-type dejanews)))
1198 (repeat :menu-tag "Try multiple"
1200 :value (current (nnweb "refer" (nnweb-type dejanews)))
1201 (choice :tag "Method"
1203 (const :tag "DejaNews"
1204 (nnweb "refer" (nnweb-type dejanews)))
1205 gnus-select-method))))
1207 (defcustom gnus-group-faq-directory
1208 '("/ftp@mirrors.aol.com:/pub/rtfm/usenet/"
1209 "/ftp@sunsite.auc.dk:/pub/usenet/"
1210 "/ftp@sunsite.doc.ic.ac.uk:/pub/usenet/news-faqs/"
1211 "/ftp@src.doc.ic.ac.uk:/usenet/news-FAQS/"
1212 "/ftp@ftp.seas.gwu.edu:/pub/rtfm/"
1213 "/ftp@rtfm.mit.edu:/pub/usenet/"
1214 "/ftp@ftp.uni-paderborn.de:/pub/FAQ/"
1215 "/ftp@ftp.sunet.se:/pub/usenet/"
1216 "/ftp@nctuccca.edu.tw:/USENET/FAQ/"
1217 "/ftp@hwarang.postech.ac.kr:/pub/usenet/"
1218 "/ftp@ftp.hk.super.net:/mirror/faqs/")
1219 "*Directory where the group FAQs are stored.
1220 This will most commonly be on a remote machine, and the file will be
1221 fetched by ange-ftp.
1223 This variable can also be a list of directories. In that case, the
1224 first element in the list will be used by default. The others can
1225 be used when being prompted for a site.
1227 Note that Gnus uses an aol machine as the default directory. If this
1228 feels fundamentally unclean, just think of it as a way to finally get
1229 something of value back from them.
1231 If the default site is too slow, try one of these:
1233 North America: mirrors.aol.com /pub/rtfm/usenet
1234 ftp.seas.gwu.edu /pub/rtfm
1235 rtfm.mit.edu /pub/usenet
1236 Europe: ftp.uni-paderborn.de /pub/FAQ
1237 src.doc.ic.ac.uk /usenet/news-FAQS
1238 ftp.sunet.se /pub/usenet
1239 sunsite.auc.dk /pub/usenet
1240 Asia: nctuccca.edu.tw /USENET/FAQ
1241 hwarang.postech.ac.kr /pub/usenet
1242 ftp.hk.super.net /mirror/faqs"
1243 :group 'gnus-group-various
1244 :type '(choice directory
1245 (repeat directory)))
1247 (defcustom gnus-use-cross-reference t
1248 "*Non-nil means that cross referenced articles will be marked as read.
1249 If nil, ignore cross references. If t, mark articles as read in
1250 subscribed newsgroups. If neither t nor nil, mark as read in all
1253 :type '(choice (const :tag "off" nil)
1254 (const :tag "subscribed" t)
1258 (defcustom gnus-process-mark ?#
1260 :group 'gnus-group-visual
1261 :group 'gnus-summary-marks
1264 (defcustom gnus-large-newsgroup 200
1265 "*The number of articles which indicates a large newsgroup.
1266 If the number of articles in a newsgroup is greater than this value,
1267 confirmation is required for selecting the newsgroup.
1268 If it is `nil', no confirmation is required."
1269 :group 'gnus-group-select
1272 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
1273 "*Non-nil means that the default name of a file to save articles in is the group name.
1274 If it's nil, the directory form of the group name is used instead.
1276 If this variable is a list, and the list contains the element
1277 `not-score', long file names will not be used for score files; if it
1278 contains the element `not-save', long file names will not be used for
1279 saving; and if it contains the element `not-kill', long file names
1280 will not be used for kill files.
1282 Note that the default for this variable varies according to what system
1283 type you're using. On `usg-unix-v' and `xenix' this variable defaults
1284 to nil while on all other systems it defaults to t."
1288 (defcustom gnus-kill-files-directory gnus-directory
1289 "*Name of the directory where kill files will be stored (default \"~/News\")."
1290 :group 'gnus-score-files
1291 :group 'gnus-score-kill
1294 (defcustom gnus-save-score nil
1295 "*If non-nil, save group scoring info."
1296 :group 'gnus-score-various
1300 (defcustom gnus-use-undo t
1301 "*If non-nil, allow undoing in Gnus group mode buffers."
1305 (defcustom gnus-use-adaptive-scoring nil
1306 "*If non-nil, use some adaptive scoring scheme.
1307 If a list, then the values `word' and `line' are meaningful. The
1308 former will perform adaption on individual words in the subject
1309 header while `line' will perform adaption on several headers."
1311 :group 'gnus-score-adapt
1312 :type '(set (const word) (const line)))
1314 (defcustom gnus-use-cache 'passive
1315 "*If nil, Gnus will ignore the article cache.
1316 If `passive', it will allow entering (and reading) articles
1317 explicitly entered into the cache. If anything else, use the
1318 cache to the full extent of the law."
1321 :type '(choice (const :tag "off" nil)
1322 (const :tag "passive" passive)
1323 (const :tag "active" t)))
1325 (defcustom gnus-use-trees nil
1326 "*If non-nil, display a thread tree buffer."
1330 (defcustom gnus-use-grouplens nil
1331 "*If non-nil, use GroupLens ratings."
1335 (defcustom gnus-keep-backlog nil
1336 "*If non-nil, Gnus will keep read articles for later re-retrieval.
1337 If it is a number N, then Gnus will only keep the last N articles
1338 read. If it is neither nil nor a number, Gnus will keep all read
1339 articles. This is not a good idea."
1341 :type '(choice (const :tag "off" nil)
1346 (defcustom gnus-use-nocem nil
1347 "*If non-nil, Gnus will read NoCeM cancel messages."
1351 (defcustom gnus-suppress-duplicates nil
1352 "*If non-nil, Gnus will mark duplicate copies of the same article as read."
1356 (defcustom gnus-use-scoring t
1357 "*If non-nil, enable scoring."
1361 (defcustom gnus-use-picons nil
1362 "*If non-nil, display picons in a frame of their own."
1366 (defcustom gnus-summary-prepare-exit-hook
1367 '(gnus-summary-expire-articles)
1368 "*A hook called when preparing to exit from the summary buffer.
1369 It calls `gnus-summary-expire-articles' by default."
1370 :group 'gnus-summary-exit
1373 (defcustom gnus-novice-user t
1374 "*Non-nil means that you are a usenet novice.
1375 If non-nil, verbose messages may be displayed and confirmations may be
1380 (defcustom gnus-expert-user nil
1381 "*Non-nil means that you will never be asked for confirmation about anything.
1382 That doesn't mean *anything* anything; particularly destructive
1383 commands will still require prompting."
1387 (defcustom gnus-interactive-catchup t
1388 "*If non-nil, require your confirmation when catching up a group."
1389 :group 'gnus-group-select
1392 (defcustom gnus-interactive-exit t
1393 "*If non-nil, require your confirmation when exiting Gnus."
1397 (defcustom gnus-extract-address-components 'gnus-extract-address-components
1398 "Function for extracting address components from a From header.
1399 Three pre-defined functions exist: `gnus-extract-address-components',
1400 which is the default, quite fast, and too simplistic solution,
1401 `mail-extract-address-components', which works much better, but is
1402 slower, and `std11-extract-address-components'."
1403 :group 'gnus-summary-format
1404 :type '(radio (function-item gnus-extract-address-components)
1405 (function-item mail-extract-address-components)
1406 (function-item std11-extract-address-components)
1407 (function :tag "Other")))
1409 (defcustom gnus-carpal nil
1410 "*If non-nil, display clickable icons."
1414 (defcustom gnus-shell-command-separator ";"
1415 "String used to separate to shell commands."
1419 (defcustom gnus-valid-select-methods
1420 '(("nntp" post address prompt-address physical-address)
1421 ("nnspool" post address)
1422 ("nnvirtual" post-mail virtual prompt-address)
1423 ("nnmbox" mail respool address)
1424 ("nnml" post-mail respool address)
1425 ("nnmh" mail respool address)
1426 ("nndir" post-mail prompt-address physical-address)
1427 ("nneething" none address prompt-address physical-address)
1428 ("nndoc" none address prompt-address)
1429 ("nnbabyl" mail address respool)
1430 ("nnkiboze" post virtual)
1431 ("nnsoup" post-mail address)
1432 ("nndraft" post-mail)
1433 ("nnfolder" mail respool address)
1434 ("nngateway" post-mail address prompt-address physical-address)
1442 ("nnagent" post-mail)
1443 ("nnimap" post-mail address prompt-address physical-address))
1444 "*An alist of valid select methods.
1445 The first element of each list lists should be a string with the name
1446 of the select method. The other elements may be the category of
1447 this method (i. e., `post', `mail', `none' or whatever) or other
1448 properties that this method has (like being respoolable).
1449 If you implement a new select method, all you should have to change is
1450 this variable. I think."
1452 :type '(repeat (group (string :tag "Name")
1453 (radio-button-choice (const :format "%v " post)
1454 (const :format "%v " mail)
1455 (const :format "%v " none)
1457 (checklist :inline t
1458 (const :format "%v " address)
1459 (const :format "%v " prompt-address)
1460 (const :format "%v " physical-address)
1461 (const :format "%v " virtual)
1464 (defun gnus-redefine-select-method-widget ()
1465 "Recomputes the select-method widget based on the value of
1466 `gnus-valid-select-methods'."
1467 (define-widget 'gnus-select-method 'list
1468 "Widget for entering a select method."
1470 :tag "Select Method"
1471 :args `((choice :tag "Method"
1472 ,@(mapcar (lambda (entry)
1473 (list 'const :format "%v\n"
1474 (intern (car entry))))
1475 gnus-valid-select-methods)
1476 (symbol :tag "other"))
1477 (string :tag "Address")
1478 (repeat :tag "Options"
1482 (sexp :tag "Value"))))))
1484 (gnus-redefine-select-method-widget)
1486 (defcustom gnus-updated-mode-lines '(group article summary tree)
1487 "List of buffers that should update their mode lines.
1488 The list may contain the symbols `group', `article', `tree' and
1489 `summary'. If the corresponding symbol is present, Gnus will keep
1490 that mode line updated with information that may be pertinent.
1491 If this variable is nil, screen refresh may be quicker."
1492 :group 'gnus-various
1493 :type '(set (const group)
1498 ;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
1499 (defcustom gnus-mode-non-string-length nil
1500 "*Max length of mode-line non-string contents.
1501 If this is nil, Gnus will take space as is needed, leaving the rest
1502 of the modeline intact. Note that the default of nil is unlikely
1503 to be desirable; see the manual for further details."
1504 :group 'gnus-various
1505 :type '(choice (const nil)
1508 ;; There should be special validation for this.
1509 (define-widget 'gnus-email-address 'string
1512 (gnus-define-group-parameter
1515 "Return GROUP's to-address."
1517 "*Alist of group regexps and correspondent to-addresses."
1518 :parameter-type '(gnus-email-address :tag "To Address")
1519 :parameter-document "\
1520 This will be used when doing followups and posts.
1522 This is primarily useful in mail groups that represent closed
1523 mailing lists--mailing lists where it's expected that everybody that
1524 writes to the mailing list is subscribed to it. Since using this
1525 parameter ensures that the mail only goes to the mailing list itself,
1526 it means that members won't receive two copies of your followups.
1528 Using `to-address' will actually work whether the group is foreign or
1529 not. Let's say there's a group on the server that is called
1530 `fa.4ad-l'. This is a real newsgroup, but the server has gotten the
1531 articles from a mail-to-news gateway. Posting directly to this group
1532 is therefore impossible--you have to send mail to the mailing list
1535 The gnus-group-split mail splitting mechanism will behave as if this
1536 address was listed in gnus-group-split Addresses (see below).")
1538 (gnus-define-group-parameter
1541 "Return GROUP's to-list."
1543 "*Alist of group regexps and correspondent to-lists."
1544 :parameter-type '(gnus-email-address :tag "To List")
1545 :parameter-document "\
1546 This address will be used when doing a `a' in the group.
1548 It is totally ignored when doing a followup--except that if it is
1549 present in a news group, you'll get mail group semantics when doing
1552 The gnus-group-split mail splitting mechanism will behave as if this
1553 address was listed in gnus-group-split Addresses (see below).")
1555 (gnus-define-group-parameter
1558 :function gnus-group-auto-expirable-p
1560 "Check whether GROUP is auto-expirable or not."
1561 :variable gnus-auto-expirable-newsgroups
1562 :variable-default nil
1564 "*Groups in which to automatically mark read articles as expirable.
1565 If non-nil, this should be a regexp that should match all groups in
1566 which to perform auto-expiry. This only makes sense for mail groups."
1567 :variable-group nnmail-expire
1568 :variable-type '(choice (const nil)
1570 :parameter-type '(const :tag "Automatic Expire" t)
1572 "All articles that are read will be marked as expirable.")
1574 (gnus-define-group-parameter
1577 :function gnus-group-total-expirable-p
1579 "Check whether GROUP is total-expirable or not."
1580 :variable gnus-total-expirable-newsgroups
1581 :variable-default nil
1583 "*Groups in which to perform expiry of all read articles.
1584 Use with extreme caution. All groups that match this regexp will be
1585 expiring - which means that all read articles will be deleted after
1586 \(say) one week. (This only goes for mail groups and the like, of
1588 :variable-group nnmail-expire
1589 :variable-type '(choice (const nil)
1591 :parameter-type '(const :tag "Total Expire" t)
1593 "All read articles will be put through the expiry process
1595 This happens even if they are not marked as expirable.
1598 (gnus-define-group-parameter
1601 "Return the default charset of GROUP."
1602 :variable gnus-group-charset-alist
1604 '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5)
1605 ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312)
1606 ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2)
1607 ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit)
1608 ("\\(^\\|:\\)relcom\\>" koi8-r)
1609 ("\\(^\\|:\\)fido7\\>" koi8-r)
1610 ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
1611 ("\\(^\\|:\\)israel\\>" iso-8859-1)
1612 ("\\(^\\|:\\)han\\>" euc-kr)
1613 ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5)
1614 ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr)
1615 ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
1618 "Alist of regexps (to match group names) and default charsets to be used when reading."
1619 :variable-group gnus-charset
1620 :variable-type '(repeat (list (regexp :tag "Group")
1621 (symbol :tag "Charset")))
1622 :parameter-type '(symbol :tag "Charset")
1623 :parameter-document "\
1624 The default charset to use in the group.")
1626 (gnus-define-group-parameter
1630 "Return a posting method for GROUP."
1631 :variable gnus-post-method-alist
1633 "Alist of regexps (to match group names) and method to be used when
1634 posting an article."
1635 :variable-group gnus-group-foreign
1637 '(choice :tag "Posting Method"
1641 (list :convert-widget
1643 (list 'sexp :tag "Methods"
1644 :value gnus-select-method))))
1646 "Posting method for this group.")
1648 (defcustom gnus-group-uncollapsed-levels 1
1649 "Number of group name elements to leave alone when making a short group name."
1650 :group 'gnus-group-visual
1653 (defcustom gnus-group-use-permanent-levels nil
1654 "*If non-nil, once you set a level, Gnus will use this level."
1655 :group 'gnus-group-levels
1660 (defcustom gnus-load-hook nil
1661 "A hook run while Gnus is loaded."
1665 (defcustom gnus-apply-kill-hook '(gnus-apply-kill-file)
1666 "A hook called to apply kill files to a group.
1667 This hook is intended to apply a kill file to the selected newsgroup.
1668 The function `gnus-apply-kill-file' is called by default.
1670 Since a general kill file is too heavy to use only for a few
1671 newsgroups, I recommend you to use a lighter hook function. For
1672 example, if you'd like to apply a kill file to articles which contains
1673 a string `rmgroup' in subject in newsgroup `control', you can use the
1676 (setq gnus-apply-kill-hook
1679 (cond ((string-match \"control\" gnus-newsgroup-name)
1680 (gnus-kill \"Subject\" \"rmgroup\")
1681 (gnus-expunge \"X\"))))))"
1682 :group 'gnus-score-kill
1683 :options '(gnus-apply-kill-file)
1686 (defcustom gnus-group-change-level-function nil
1687 "Function run when a group level is changed.
1688 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
1689 :group 'gnus-group-levels
1694 (defcustom gnus-visual
1695 '(summary-highlight group-highlight article-highlight
1697 summary-menu group-menu article-menu
1698 tree-highlight menu highlight
1699 browse-menu server-menu
1700 page-marker tree-menu binary-menu pick-menu
1702 "*Enable visual features.
1703 If `visual' is disabled, there will be no menus and few faces. Most of
1704 the visual customization options below will be ignored. Gnus will use
1705 less space and be faster as a result.
1707 This variable can also be a list of visual elements to switch on. For
1708 instance, to switch off all visual things except menus, you can say:
1710 (setq gnus-visual '(menu))
1712 Valid elements include `summary-highlight', `group-highlight',
1713 `article-highlight', `mouse-face', `summary-menu', `group-menu',
1714 `article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
1715 `server-menu', `page-marker', `tree-menu', `binary-menu', `pick-menu',
1716 and `grouplens-menu'."
1719 :type '(set (const summary-highlight)
1720 (const group-highlight)
1721 (const article-highlight)
1723 (const summary-menu)
1725 (const article-menu)
1726 (const tree-highlight)
1735 (const grouplens-menu)))
1737 (defcustom gnus-mouse-face
1739 (if (gnus-visual-p 'mouse-face 'highlight)
1740 (if (boundp 'gnus-mouse-face)
1741 (or gnus-mouse-face 'highlight)
1745 "*Face used for group or summary buffer mouse highlighting.
1746 The line beneath the mouse pointer will be highlighted with this
1751 (defcustom gnus-article-save-directory gnus-directory
1752 "*Name of the directory articles will be saved in (default \"~/News\")."
1753 :group 'gnus-article-saving
1756 (defvar gnus-plugged t
1757 "Whether Gnus is plugged or not.")
1759 (defcustom gnus-default-charset 'iso-8859-1
1760 "Default charset assumed to be used when viewing non-ASCII characters.
1761 This variable is overridden on a group-to-group basis by the
1762 gnus-group-charset-alist variable and is only used on groups not
1763 covered by that variable."
1765 :group 'gnus-charset)
1768 ;;; Internal variables
1770 (defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
1771 (defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
1772 (defvar gnus-draft-meta-information-header "X-Draft-From")
1773 (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
1774 (defvar gnus-original-article-buffer " *Original Article*")
1775 (defvar gnus-newsgroup-name nil)
1776 (defvar gnus-ephemeral-servers nil)
1778 (defvar gnus-agent nil
1779 "Whether we want to use the Gnus agent or not.")
1781 (defvar gnus-agent-fetching nil
1782 "Whether Gnus agent is in fetching mode.")
1784 (defvar gnus-command-method nil
1785 "Dynamically bound variable that says what the current backend is.")
1787 (defvar gnus-current-select-method nil
1788 "The current method for selecting a newsgroup.")
1790 (defvar gnus-tree-buffer "*Tree*"
1791 "Buffer where Gnus thread trees are displayed.")
1794 (defvar gnus-use-generic-from nil)
1796 ;; Variable holding the user answers to all method prompts.
1797 (defvar gnus-method-history nil)
1799 ;; Variable holding the user answers to all mail method prompts.
1800 (defvar gnus-mail-method-history nil)
1802 ;; Variable holding the user answers to all group prompts.
1803 (defvar gnus-group-history nil)
1805 (defvar gnus-server-alist nil
1806 "List of available servers.")
1808 (defcustom gnus-cache-directory
1809 (nnheader-concat gnus-directory "cache/")
1810 "*The directory where cached articles will be stored."
1814 (defvar gnus-predefined-server-alist
1817 (nnspool-spool-directory ,gnus-cache-directory)
1818 (nnspool-nov-directory ,gnus-cache-directory)
1819 (nnspool-active-file
1820 ,(nnheader-concat gnus-cache-directory "active"))))
1821 "List of predefined (convenience) servers.")
1823 (defvar gnus-topic-indentation "");; Obsolete variable.
1825 (defconst gnus-article-mark-lists
1826 '((marked . tick) (replied . reply)
1827 (expirable . expire) (killed . killed)
1828 (bookmarks . bookmark) (dormant . dormant)
1829 (scored . score) (saved . save)
1830 (cached . cache) (downloadable . download)
1831 (unsendable . unsend) (forwarded . forward)))
1833 (defvar gnus-headers-retrieved-by nil)
1834 (defvar gnus-article-reply nil)
1835 (defvar gnus-override-method nil)
1836 (defvar gnus-article-check-size nil)
1837 (defvar gnus-opened-servers nil)
1839 (defvar gnus-current-kill-article nil)
1841 (defvar gnus-have-read-active-file nil)
1843 (defconst gnus-maintainer
1844 "semi-gnus-ja@meadowy.org (T-gnus Bugfixing Girls + Boys)"
1845 "The mail address of the T-gnus maintainers.")
1847 (defcustom gnus-info-filename nil
1848 "*Controls language of gnus Info.
1849 If nil and current-language-environment is Japanese, go to gnus-ja.
1850 Otherwise go to corresponding Info.
1851 This variable can be nil, gnus or gnus-ja."
1853 :type '(choice (const nil)
1854 (const :tag "English" gnus)
1855 (const :tag "Japanese" gnus-ja)))
1857 (defvar gnus-info-nodes
1858 '((gnus-group-mode "Group Buffer")
1859 (gnus-summary-mode "Summary Buffer")
1860 (gnus-article-mode "Article Buffer")
1861 (gnus-server-mode "Server Buffer")
1862 (gnus-browse-mode "Browse Foreign Server")
1863 (gnus-tree-mode "Tree Display"))
1864 "Alist of major modes and related Info nodes.")
1866 (defvar gnus-group-buffer "*Group*")
1867 (defvar gnus-summary-buffer "*Summary*")
1868 (defvar gnus-article-buffer "*Article*")
1869 (defvar gnus-server-buffer "*Server*")
1871 (defvar gnus-slave nil
1872 "Whether this Gnus is a slave or not.")
1874 (defvar gnus-batch-mode nil
1875 "Whether this Gnus is running in batch mode or not.")
1877 (defvar gnus-variable-list
1878 '(gnus-newsrc-options gnus-newsrc-options-n
1879 gnus-newsrc-last-checked-date
1880 gnus-newsrc-alist gnus-server-alist
1881 gnus-killed-list gnus-zombie-list
1882 gnus-topic-topology gnus-topic-alist)
1883 "Gnus variables saved in the quick startup file.")
1885 (defvar gnus-product-variable-file-list
1886 (let ((version (product-version (product-find 'gnus-vers)))
1887 (codesys (static-if (boundp 'MULE) '*ctext* 'ctext)))
1888 `(("strict-cache" ((product-version ,version) (emacs-version))
1890 gnus-format-specs-compiled)
1891 ("cache" ((product-version ,version) (emacs-version))
1893 gnus-format-specs)))
1894 "Gnus variables are saved in the produce depend quick startup files.")
1896 (defcustom gnus-compile-user-specs t
1897 "If non-nil, the user-defined format specs will be byte-compiled
1899 It has an effect on the values of `gnus-*-line-format-spec'."
1903 (defvar gnus-newsrc-alist nil
1904 "Assoc list of read articles.
1905 gnus-newsrc-hashtb should be kept so that both hold the same information.")
1907 (defvar gnus-newsrc-hashtb nil
1908 "Hashtable of gnus-newsrc-alist.")
1910 (defvar gnus-killed-list nil
1911 "List of killed newsgroups.")
1913 (defvar gnus-killed-hashtb nil
1914 "Hash table equivalent of gnus-killed-list.")
1916 (defvar gnus-zombie-list nil
1917 "List of almost dead newsgroups.")
1919 (defvar gnus-description-hashtb nil
1920 "Descriptions of newsgroups.")
1922 (defvar gnus-list-of-killed-groups nil
1923 "List of newsgroups that have recently been killed by the user.")
1925 (defvar gnus-active-hashtb nil
1926 "Hashtable of active articles.")
1928 (defvar gnus-moderated-hashtb nil
1929 "Hashtable of moderated newsgroups.")
1931 ;; Save window configuration.
1932 (defvar gnus-prev-winconf nil)
1934 (defvar gnus-reffed-article-number nil)
1936 ;;; Let the byte-compiler know that we know about this variable.
1937 (defvar rmail-default-rmail-file)
1939 (defvar gnus-dead-summary nil)
1941 (defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
1942 "Regexp matching invalid groups.")
1944 ;;; End of variables.
1946 ;; Define some autoload functions Gnus might use.
1949 ;; This little mapcar goes through the list below and marks the
1950 ;; symbols in question as autoloaded functions.
1953 (let ((interactive (nth 1 (memq ':interactive package))))
1957 (when (consp function)
1958 (setq keymap (car (memq 'keymap function)))
1959 (setq function (car function)))
1960 (unless (fboundp function)
1961 (autoload function (car package) nil interactive keymap))))
1962 (if (eq (nth 1 package) ':interactive)
1965 '(("info" :interactive t Info-goto-node)
1967 ("ps-print" ps-print-preprint)
1968 ("message" :interactive t
1969 message-send-and-exit message-yank-original)
1970 ("babel" babel-as-string)
1971 ("nnmail" nnmail-split-fancy nnmail-article-group)
1972 ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
1973 ("rmailout" rmail-output rmail-output-to-rmail-file)
1974 ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
1975 rmail-show-message rmail-summary-exists
1976 rmail-select-summary rmail-update-summary)
1977 ("gnus-audio" :interactive t gnus-audio-play)
1978 ("gnus-xmas" gnus-xmas-splash)
1979 ("gnus-soup" :interactive t
1980 gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
1981 gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
1982 ("nnsoup" nnsoup-pack-replies)
1983 ("score-mode" :interactive t gnus-score-mode)
1984 ("gnus-mh" gnus-summary-save-article-folder
1985 gnus-Folder-save-name gnus-folder-save-name)
1986 ("gnus-mh" :interactive t gnus-summary-save-in-folder)
1987 ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
1988 gnus-demon-add-rescan gnus-demon-add-scan-timestamps
1989 gnus-demon-add-disconnection gnus-demon-add-handler
1990 gnus-demon-remove-handler)
1991 ("gnus-demon" :interactive t
1992 gnus-demon-init gnus-demon-cancel)
1993 ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
1994 gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer)
1995 ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close
1996 gnus-nocem-unwanted-article-p)
1997 ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
1998 gnus-server-server-name)
1999 ("gnus-srvr" gnus-browse-foreign-server)
2000 ("gnus-cite" :interactive t
2001 gnus-article-highlight-citation gnus-article-hide-citation-maybe
2002 gnus-article-hide-citation gnus-article-fill-cited-article
2003 gnus-article-hide-citation-in-followups)
2004 ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
2005 gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
2006 gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
2007 ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
2008 gnus-cache-possibly-remove-articles gnus-cache-request-article
2009 gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
2010 gnus-cache-enter-remove-article gnus-cached-article-p
2011 gnus-cache-open gnus-cache-close gnus-cache-update-article
2012 gnus-cache-articles-in-group)
2013 ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
2014 gnus-cache-remove-article gnus-summary-insert-cached-articles)
2015 ("gnus-score" :interactive t
2016 gnus-summary-increase-score gnus-summary-set-score
2017 gnus-summary-raise-thread gnus-summary-raise-same-subject
2018 gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
2019 gnus-summary-lower-thread gnus-summary-lower-same-subject
2020 gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
2021 gnus-summary-current-score gnus-score-delta-default
2022 gnus-score-flush-cache gnus-score-close
2023 gnus-possibly-score-headers gnus-score-followup-article
2024 gnus-score-followup-thread)
2026 (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
2027 gnus-current-score-file-nondirectory gnus-score-adaptive
2028 gnus-score-find-trace gnus-score-file-name)
2029 ("gnus-cus" :interactive t gnus-custom-mode gnus-group-customize
2030 gnus-score-customize)
2031 ("gnus-topic" :interactive t gnus-topic-mode)
2032 ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2033 gnus-subscribe-topics)
2034 ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
2035 ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
2036 ("gnus-uu" :interactive t
2037 gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2038 gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2039 gnus-uu-mark-by-regexp gnus-uu-mark-all
2040 gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2041 gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2042 gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2043 gnus-uu-decode-binhex gnus-uu-decode-uu-view
2044 gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2045 gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
2046 gnus-uu-decode-binhex-view gnus-uu-unmark-thread
2047 gnus-uu-mark-over gnus-uu-post-news)
2048 ("gnus-uu" gnus-uu-delete-work-dir gnus-quote-arg-for-sh-or-csh
2049 gnus-uu-unmark-thread)
2050 ("gnus-msg" (gnus-summary-send-map keymap)
2051 gnus-article-mail gnus-copy-article-buffer gnus-following-method)
2052 ("gnus-msg" :interactive t
2053 gnus-group-post-news gnus-group-mail gnus-summary-post-news
2054 gnus-summary-followup gnus-summary-followup-with-original
2055 gnus-summary-cancel-article gnus-summary-supersede-article
2056 gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2057 gnus-summary-mail-forward gnus-summary-mail-other-window
2058 gnus-summary-resend-message gnus-summary-resend-bounced-mail
2059 gnus-summary-wide-reply gnus-summary-followup-to-mail
2060 gnus-summary-followup-to-mail-with-original gnus-bug
2061 gnus-summary-wide-reply-with-original gnus-summary-post-forward
2062 gnus-summary-digest-mail-forward gnus-summary-digest-post-forward)
2063 ("gnus-picon" :interactive t gnus-article-display-picons
2064 gnus-group-display-picons)
2065 ("gnus-picon" gnus-picons-buffer-name)
2066 ("gnus-gl" bbb-login bbb-logout bbb-grouplens-group-p
2067 gnus-grouplens-mode)
2068 ("smiley" :interactive t gnus-smiley-display)
2069 ("gnus-win" gnus-configure-windows gnus-add-configuration)
2070 ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2071 gnus-list-of-unread-articles gnus-list-of-read-articles
2072 gnus-offer-save-summaries gnus-make-thread-indent-array
2073 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2074 gnus-summary-skip-intangible gnus-summary-article-number
2075 gnus-data-header gnus-data-find gnus-summary-jump-to-other-group)
2076 ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2077 gnus-group-list-groups gnus-group-first-unread-group
2078 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2079 gnus-group-setup-buffer gnus-group-get-new-news
2080 gnus-group-make-help-group gnus-group-update-group
2081 gnus-group-iterate gnus-group-group-name)
2082 ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2083 gnus-backlog-remove-article)
2084 ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2085 gnus-article-prepare gnus-article-set-window-start
2086 gnus-article-next-page gnus-article-prev-page
2087 gnus-request-article-this-buffer gnus-article-mode
2088 gnus-article-setup-buffer gnus-narrow-to-page
2089 gnus-article-delete-invisible-text gnus-treat-article)
2090 ("gnus-art" :interactive t
2091 gnus-article-hide-headers gnus-article-hide-boring-headers
2092 gnus-article-treat-overstrike
2093 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2094 gnus-article-display-x-face
2095 gnus-article-decode-HZ
2096 gnus-article-wash-html
2097 gnus-article-hide-pgp
2098 gnus-article-hide-pem gnus-article-hide-signature
2099 gnus-article-strip-leading-blank-lines gnus-article-date-local
2100 gnus-article-date-original gnus-article-date-lapsed
2101 gnus-article-show-all-headers gnus-article-show-all
2102 gnus-article-edit-mode gnus-article-edit-article
2103 gnus-article-edit-done article-decode-encoded-words
2104 gnus-start-date-timer gnus-stop-date-timer
2105 gnus-article-toggle-headers)
2106 ("gnus-int" gnus-request-type)
2107 ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
2108 gnus-dribble-enter gnus-read-init-file gnus-dribble-touch)
2109 ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2110 gnus-dup-enter-articles)
2111 ("gnus-range" gnus-copy-sequence)
2112 ("gnus-eform" gnus-edit-form)
2113 ("gnus-move" :interactive t
2114 gnus-group-move-group-to-server gnus-change-server)
2115 ("gnus-logic" gnus-score-advanced)
2116 ("gnus-undo" gnus-undo-mode gnus-undo-register)
2117 ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2118 gnus-async-prefetch-article gnus-async-prefetch-remove-group
2119 gnus-async-halt-prefetch)
2122 ("gnus-offline" :interactive t
2123 gnus-offline-toggle-plugged
2124 gnus-offline-set-unplugged-state
2125 gnus-offline-toggle-auto-hangup
2126 gnus-offline-toggle-on/off-send-mail
2127 gnus-offline-toggle-articles-to-fetch
2128 gnus-offline-set-interval-time
2129 gnus-offline-agent-expire)
2130 ("miee" :interactive t gnspool-get-news
2131 mail-spool-send news-spool-post)
2132 ("international/mw32misc" define-process-argument-editing
2133 general-process-argument-editing-function)
2134 ("gnus-agent" gnus-open-agent gnus-agent-get-function
2135 gnus-agent-save-groups gnus-agent-save-active gnus-agent-method-p
2136 gnus-agent-get-undownloaded-list gnus-agent-fetch-session
2137 gnus-summary-set-agent-mark gnus-agent-save-group-info)
2138 ("gnus-agent" :interactive t
2139 gnus-unplugged gnus-agentize gnus-agent-batch)
2140 ("gnus-vm" :interactive t gnus-summary-save-in-vm
2141 gnus-summary-save-article-vm)
2142 ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-drafts)
2143 ("gnus-mlspl" gnus-group-split gnus-group-split-fancy)
2144 ("gnus-mlspl" :interactive t gnus-group-split-setup
2145 gnus-group-split-update))))
2148 (unless (featurep 'xemacs)
2149 (if (>= emacs-major-version 21)
2150 (autoload 'x-face-decode-message-header "x-face-e21")
2151 (autoload 'gnus-smiley-display "gnus-bitmap" nil t)
2152 (autoload 'smiley-toggle-buffer "gnus-bitmap")
2153 (autoload 'x-face-mule-gnus-article-display-x-face "x-face-mule"))))
2155 (unless (and (fboundp 'base64-encode-string)
2156 (subrp (symbol-function 'base64-encode-string)))
2159 ;; To make shimbun groups.
2160 (autoload 'gnus-group-make-shimbun-group "nnshimbun" nil t)
2162 ;; A tool for the developers.
2163 (autoload 'find-cl-run-time-functions "gnus-clfns" nil t)
2165 ;;; gnus-sum.el thingies
2168 (defcustom gnus-summary-line-format "%U%R%z%I%(%[%4L: %-20,20n%]%) %s\n"
2169 "*The format specification of the lines in the summary buffer.
2171 It works along the same lines as a normal formatting string,
2172 with some simple extensions.
2174 %N Article number, left padded with spaces (string)
2176 %s Subject if it is at the root of a thread, and \"\" otherwise (string)
2177 %n Name of the poster (string)
2178 %a Extracted name of the poster (string)
2179 %A Extracted address of the poster (string)
2180 %F Contents of the From: header (string)
2181 %f Contents of the From: or To: headers (string)
2182 %x Contents of the Xref: header (string)
2183 %D Date of the article (string)
2184 %d Date of the article (string) in DD-MMM format
2185 %o Date of the article (string) in YYYYMMDD`T'HHMMSS format
2186 %M Message-id of the article (string)
2187 %r References of the article (string)
2188 %c Number of characters in the article (integer)
2189 %L Number of lines in the article (integer)
2190 %I Indentation based on thread level (a string of spaces)
2191 %B A complex trn-style thread tree (string)
2192 The variables `gnus-sum-thread-*' can be used for customization.
2193 %T A string with two possible values: 80 spaces if the article
2194 is on thread level two or larger and 0 spaces on level one
2195 %R \"A\" if this article has been replied to, \" \" otherwise (character)
2196 %U Status of this article (character, \"R\", \"K\", \"-\" or \" \")
2197 %[ Opening bracket (character, \"[\" or \"<\")
2198 %] Closing bracket (character, \"]\" or \">\")
2199 %> Spaces of length thread-level (string)
2200 %< Spaces of length (- 20 thread-level) (string)
2201 %i Article score (number)
2202 %z Article zcore (character)
2203 %t Number of articles under the current thread (number).
2204 %e Whether the thread is empty or not (character).
2205 %l GroupLens score (string).
2206 %V Total thread score (number).
2207 %P The line number (number).
2208 %O Download mark (character).
2209 %u User defined specifier. The next character in the format string should
2210 be a letter. Gnus will call the function gnus-user-format-function-X,
2211 where X is the letter following %u. The function will be passed the
2212 current header as argument. The function should return a string, which
2213 will be inserted into the summary just like information from any other
2216 Text between %( and %) will be highlighted with `gnus-mouse-face'
2217 when the mouse point is placed inside the area. There can only be one
2220 The %U (status), %R (replied) and %z (zcore) specs have to be handled
2221 with care. For reasons of efficiency, Gnus will compute what column
2222 these characters will end up in, and \"hard-code\" that. This means that
2223 it is invalid to have these specs after a variable-length spec. Well,
2224 you might not be arrested, but your summary buffer will look strange,
2225 which is bad enough.
2227 The smart choice is to have these specs as far to the left as
2230 This restriction may disappear in later versions of Gnus."
2232 :group 'gnus-summary-format)
2235 ;;; Skeleton keymaps
2238 (defun gnus-suppress-keymap (keymap)
2239 (suppress-keymap keymap)
2240 (let ((keys `([backspace] [delete] "\177" "\M-u"))) ;gnus-mouse-2
2242 (define-key keymap (pop keys) 'undefined))))
2244 (defvar gnus-article-mode-map
2245 (let ((keymap (make-sparse-keymap)))
2246 (gnus-suppress-keymap keymap)
2248 (defvar gnus-summary-mode-map
2249 (let ((keymap (make-keymap)))
2250 (gnus-suppress-keymap keymap)
2252 (defvar gnus-group-mode-map
2253 (let ((keymap (make-keymap)))
2254 (gnus-suppress-keymap keymap)
2259 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2260 ;; If you want the cursor to go somewhere else, set these two
2261 ;; functions in some startup hook to whatever you want.
2262 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
2263 (defalias 'gnus-group-position-point 'gnus-goto-colon)
2265 ;;; Various macros and substs.
2267 (defun gnus-header-from (header)
2268 (mail-header-from header))
2270 (defmacro gnus-gethash (string hashtable)
2271 "Get hash value of STRING in HASHTABLE."
2272 `(symbol-value (intern-soft ,string ,hashtable)))
2274 (defmacro gnus-sethash (string value hashtable)
2275 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
2276 `(set (intern ,string ,hashtable) ,value))
2277 (put 'gnus-sethash 'edebug-form-spec '(form form form))
2279 (defmacro gnus-group-unread (group)
2280 "Get the currently computed number of unread articles in GROUP."
2281 `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
2283 (defmacro gnus-group-entry (group)
2284 "Get the newsrc entry for GROUP."
2285 `(gnus-gethash ,group gnus-newsrc-hashtb))
2287 (defmacro gnus-active (group)
2288 "Get active info on GROUP."
2289 `(gnus-gethash ,group gnus-active-hashtb))
2291 (defmacro gnus-set-active (group active)
2292 "Set GROUP's active info."
2293 `(gnus-sethash ,group ,active gnus-active-hashtb))
2295 ;; Info access macros.
2297 (defmacro gnus-info-group (info)
2299 (defmacro gnus-info-rank (info)
2301 (defmacro gnus-info-read (info)
2303 (defmacro gnus-info-marks (info)
2305 (defmacro gnus-info-method (info)
2307 (defmacro gnus-info-params (info)
2310 (defmacro gnus-info-level (info)
2311 `(let ((rank (gnus-info-rank ,info)))
2315 (defmacro gnus-info-score (info)
2316 `(let ((rank (gnus-info-rank ,info)))
2317 (or (and (consp rank) (cdr rank)) 0)))
2319 (defmacro gnus-info-set-group (info group)
2320 `(setcar ,info ,group))
2321 (defmacro gnus-info-set-rank (info rank)
2322 `(setcar (nthcdr 1 ,info) ,rank))
2323 (defmacro gnus-info-set-read (info read)
2324 `(setcar (nthcdr 2 ,info) ,read))
2325 (defmacro gnus-info-set-marks (info marks &optional extend)
2327 `(gnus-info-set-entry ,info ,marks 3)
2328 `(setcar (nthcdr 3 ,info) ,marks)))
2329 (defmacro gnus-info-set-method (info method &optional extend)
2331 `(gnus-info-set-entry ,info ,method 4)
2332 `(setcar (nthcdr 4 ,info) ,method)))
2333 (defmacro gnus-info-set-params (info params &optional extend)
2335 `(gnus-info-set-entry ,info ,params 5)
2336 `(setcar (nthcdr 5 ,info) ,params)))
2338 (defun gnus-info-set-entry (info entry number)
2339 ;; Extend the info until we have enough elements.
2340 (while (<= (length info) number)
2341 (nconc info (list nil)))
2343 (setcar (nthcdr number info) entry))
2345 (defmacro gnus-info-set-level (info level)
2346 `(let ((rank (cdr ,info)))
2347 (if (consp (car rank))
2348 (setcar (car rank) ,level)
2349 (setcar rank ,level))))
2350 (defmacro gnus-info-set-score (info score)
2351 `(let ((rank (cdr ,info)))
2352 (if (consp (car rank))
2353 (setcdr (car rank) ,score)
2354 (setcar rank (cons (car rank) ,score)))))
2356 (defmacro gnus-get-info (group)
2357 `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
2359 ;; Byte-compiler warning.
2360 (defvar gnus-visual)
2361 ;; Find out whether the gnus-visual TYPE is wanted.
2362 (defun gnus-visual-p (&optional type class)
2363 (and gnus-visual ; Has to be non-nil, at least.
2364 (if (not type) ; We don't care about type.
2366 (if (listp gnus-visual) ; It's a list, so we check it.
2367 (or (memq type gnus-visual)
2368 (memq class gnus-visual))
2371 ;;; Load the compatability functions.
2380 (defvar gnus-shutdown-alist nil)
2382 (defun gnus-add-shutdown (function &rest symbols)
2383 "Run FUNCTION whenever one of SYMBOLS is shut down."
2384 (push (cons function symbols) gnus-shutdown-alist))
2386 (defun gnus-shutdown (symbol)
2387 "Shut down everything that waits for SYMBOL."
2388 (let ((alist gnus-shutdown-alist)
2390 (while (setq entry (pop alist))
2391 (when (memq symbol (cdr entry))
2392 (funcall (car entry))))))
2396 ;;; Gnus Utility Functions
2400 (defmacro gnus-string-or (&rest strings)
2401 "Return the first element of STRINGS that is a non-blank string.
2402 STRINGS will be evaluated in normal `or' order."
2403 `(gnus-string-or-1 ',strings))
2405 (defun gnus-string-or-1 (strings)
2408 (setq string (eval (pop strings)))
2409 (if (string-match "^[ \t]*$" string)
2411 (setq strings nil)))
2414 (defun gnus-info-find-node ()
2415 "Find Info documentation of Gnus."
2417 ;; Enlarge info window if needed.
2418 (let (gnus-info-buffer)
2421 (or gnus-info-filename
2422 (get-language-info current-language-environment 'gnus-info)
2424 (or (cadr (assq major-mode gnus-info-nodes))
2425 (and (eq (current-buffer) (get-buffer gnus-article-buffer))
2426 (cadr (assq 'gnus-article-mode gnus-info-nodes))))))
2427 (setq gnus-info-buffer (current-buffer))
2428 (gnus-configure-windows 'info)))
2431 ;;; gnus-interactive
2434 (defvar gnus-current-prefix-symbol nil
2435 "Current prefix symbol.")
2437 (defvar gnus-current-prefix-symbols nil
2438 "List of current prefix symbols.")
2440 (defun gnus-interactive (string &optional params)
2441 "Return a list that can be fed to `interactive'.
2442 See `interactive' for full documentation.
2444 Adds the following specs:
2446 y -- The current symbolic prefix.
2447 Y -- A list of the current symbolic prefix(es).
2448 A -- Article number.
2449 H -- Article header.
2453 (while (< i (length string))
2454 (string-match ".\\([^\n]*\\)\n?" string i)
2455 (setq c (aref string i))
2457 (setq prompt (match-string 1 string)))
2458 (setq i (match-end 0))
2459 ;; We basically emulate just about everything that
2460 ;; `interactive' does, but add the specs listed above.
2464 (completing-read prompt obarray 'fboundp t))
2466 (read-buffer prompt (current-buffer) t))
2468 (read-buffer prompt (other-buffer (current-buffer))))
2472 (completing-read prompt obarray 'commandp t))
2476 (read-file-name prompt nil default-directory 'lambda))
2478 (read-file-name prompt nil nil 'lambda))
2480 (read-file-name prompt))
2482 (read-key-sequence prompt))
2484 (error "Not implemented spec"))
2486 (error "Not implemented spec"))
2490 (error "Not implemented spec"))
2492 (string-to-number (read-from-minibuffer prompt)))
2494 (prefix-numeric-value current-prefix-arg))
2500 (read-string prompt))
2502 (intern (read-string prompt)))
2504 (read-variable prompt))
2506 (read-minibuffer prompt))
2508 (eval-minibuffer prompt))
2509 ;; And here the new specs come.
2511 gnus-current-prefix-symbol)
2513 gnus-current-prefix-symbols)
2515 (gnus-group-group-name))
2517 (gnus-summary-skip-intangible)
2518 (or (get-text-property (point) 'gnus-number)
2519 (gnus-summary-last-subject)))
2521 (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
2523 (error "Non-implemented spec")))
2527 (push (if (< (point) (mark)) (point) (mark)) out)
2528 (push (if (> (point) (mark)) (point) (mark)) out))))
2529 (setq out (delq 'gnus-prefix-nil out))
2532 (defun gnus-symbolic-argument (&optional arg)
2533 "Read a symbolic argument and a command, and then execute command."
2535 (let* ((in-command (this-command-keys))
2536 (command in-command)
2537 gnus-current-prefix-symbols
2538 gnus-current-prefix-symbol
2540 (while (equal in-command command)
2541 (message "%s-" (key-description (this-command-keys)))
2542 (push (intern (char-to-string (read-char))) syms)
2543 (setq command (read-key-sequence nil t)))
2544 (setq gnus-current-prefix-symbols (nreverse syms)
2545 gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
2546 (call-interactively (key-binding command t))))
2548 ;;; More various functions.
2550 (defsubst gnus-check-backend-function (func group)
2551 "Check whether GROUP supports function FUNC.
2552 GROUP can either be a string (a group name) or a select method."
2554 (let ((method (if (stringp group)
2555 (car (gnus-find-method-for-group group))
2557 (unless (featurep method)
2559 (fboundp (intern (format "%s-%s" method func))))))
2561 (defun gnus-group-read-only-p (&optional group)
2562 "Check whether GROUP supports editing or not.
2563 If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
2564 that that variable is buffer-local to the summary buffers."
2565 (let ((group (or group gnus-newsgroup-name)))
2566 (not (gnus-check-backend-function 'request-replace-article group))))
2568 (defun gnus-virtual-group-p (group)
2569 "Say whether GROUP is virtual or not."
2570 (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
2571 gnus-valid-select-methods)))
2573 (defun gnus-news-group-p (group &optional article)
2574 "Return non-nil if GROUP (and ARTICLE) come from a news server."
2575 (or (gnus-member-of-valid 'post group) ; Ordinary news group.
2576 (and (gnus-member-of-valid 'post-mail group) ; Combined group.
2577 (if (or (null article)
2578 (not (< article 0)))
2579 (eq (gnus-request-type group article) 'news)
2580 (if (not (vectorp article))
2582 ;; It's a real article.
2583 (eq (gnus-request-type group (mail-header-id article))
2586 ;; Returns a list of writable groups.
2587 (defun gnus-writable-groups ()
2588 (let ((alist gnus-newsrc-alist)
2590 (while (setq group (car (pop alist)))
2591 (unless (gnus-group-read-only-p group)
2592 (push group groups)))
2595 ;; Check whether to use long file names.
2596 (defun gnus-use-long-file-name (symbol)
2597 ;; The variable has to be set...
2598 (and gnus-use-long-file-name
2599 ;; If it isn't a list, then we return t.
2600 (or (not (listp gnus-use-long-file-name))
2601 ;; If it is a list, and the list contains `symbol', we
2603 (not (memq symbol gnus-use-long-file-name)))))
2605 ;; Generate a unique new group name.
2606 (defun gnus-generate-new-group-name (leaf)
2609 (while (gnus-gethash name gnus-newsrc-hashtb)
2610 (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
2613 (defun gnus-ephemeral-group-p (group)
2614 "Say whether GROUP is ephemeral or not."
2615 (gnus-group-get-parameter group 'quit-config t))
2617 (defun gnus-group-quit-config (group)
2618 "Return the quit-config of GROUP."
2619 (gnus-group-get-parameter group 'quit-config t))
2621 (defun gnus-kill-ephemeral-group (group)
2622 "Remove ephemeral GROUP from relevant structures."
2623 (gnus-sethash group nil gnus-newsrc-hashtb))
2625 (defun gnus-simplify-mode-line ()
2626 "Make mode lines a bit simpler."
2627 (setq mode-line-modified (cdr gnus-mode-line-modified))
2628 (when (listp mode-line-format)
2629 (make-local-variable 'mode-line-format)
2630 (setq mode-line-format (copy-sequence mode-line-format))
2631 (when (equal (nth 3 mode-line-format) " ")
2632 (setcar (nthcdr 3 mode-line-format) " "))))
2634 ;;; Servers and groups.
2636 (defsubst gnus-server-add-address (method)
2637 (let ((method-name (symbol-name (car method))))
2638 (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
2639 (not (assq (intern (concat method-name "-address")) method))
2640 (memq 'physical-address (assq (car method)
2641 gnus-valid-select-methods)))
2642 (append method (list (list (intern (concat method-name "-address"))
2646 (defsubst gnus-server-get-method (group method)
2647 ;; Input either a server name, and extended server name, or a
2648 ;; select method, and return a select method.
2649 (cond ((stringp method)
2650 (gnus-server-to-method method))
2651 ((equal method gnus-select-method)
2653 ((and (stringp (car method))
2655 (gnus-server-extend-method group method))
2658 (equal (cadr method) ""))
2661 (gnus-server-add-address method))))
2663 (defun gnus-server-to-method (server)
2664 "Map virtual server names to select methods."
2666 ;; Is this a method, perhaps?
2667 (and server (listp server) server)
2668 ;; Perhaps this is the native server?
2669 (and (equal server "native") gnus-select-method)
2670 ;; It should be in the server alist.
2671 (cdr (assoc server gnus-server-alist))
2672 ;; It could be in the predefined server alist.
2673 (cdr (assoc server gnus-predefined-server-alist))
2674 ;; If not, we look through all the opened server
2675 ;; to see whether we can find it there.
2676 (let ((opened gnus-opened-servers))
2678 (not (equal server (format "%s:%s" (caaar opened)
2682 ;; It could be a named method, search all servers
2683 (let ((servers gnus-secondary-select-methods))
2685 (not (equal server (format "%s:%s" (caar servers)
2690 (defmacro gnus-method-equal (ss1 ss2)
2691 "Say whether two servers are equal."
2695 (and (= (length s1) (length s2))
2697 (while (and s1 (member (car s1) s2))
2701 (defun gnus-methods-equal-p (m1 m2)
2702 (let ((m1 (or m1 gnus-select-method))
2703 (m2 (or m2 gnus-select-method)))
2705 (and (eq (car m1) (car m2))
2706 (or (not (memq 'address (assoc (symbol-name (car m1))
2707 gnus-valid-select-methods)))
2708 (equal (nth 1 m1) (nth 1 m2)))))))
2710 (defun gnus-server-equal (m1 m2)
2711 "Say whether two methods are equal."
2712 (let ((m1 (cond ((null m1) gnus-select-method)
2713 ((stringp m1) (gnus-server-to-method m1))
2715 (m2 (cond ((null m2) gnus-select-method)
2716 ((stringp m2) (gnus-server-to-method m2))
2718 (gnus-method-equal m1 m2)))
2720 (defun gnus-servers-using-backend (backend)
2721 "Return a list of known servers using BACKEND."
2722 (let ((opened gnus-opened-servers)
2725 (when (eq backend (caaar opened))
2726 (push (caar opened) out))
2730 (defun gnus-archive-server-wanted-p ()
2731 "Say whether the user wants to use the archive server."
2733 ((or (not gnus-message-archive-method)
2734 (not gnus-message-archive-group))
2736 ((and gnus-message-archive-method gnus-message-archive-group)
2739 (let ((active (cadr (assq 'nnfolder-active-file
2740 gnus-message-archive-method))))
2742 (file-exists-p active))))))
2744 (defsubst gnus-method-to-server-name (method)
2746 (format "%s" (car method))
2748 (or (assoc (format "%s" (car method))
2749 (gnus-methods-using 'address))
2750 (gnus-server-equal method gnus-message-archive-method))
2752 (not (string= (nth 1 method) "")))
2753 (concat "+" (nth 1 method)))))
2755 (defun gnus-group-prefixed-name (group method)
2756 "Return the whole name from GROUP and METHOD."
2757 (and (stringp method) (setq method (gnus-server-to-method method)))
2758 (if (or (not method)
2759 (gnus-server-equal method "native"))
2761 (concat (gnus-method-to-server-name method) ":" group)))
2763 (defun gnus-group-real-prefix (group)
2764 "Return the prefix of the current group name."
2765 (if (string-match "^[^:]+:" group)
2766 (substring group 0 (match-end 0))
2769 (defun gnus-group-method (group)
2770 "Return the server or method used for selecting GROUP.
2771 You should probably use `gnus-find-method-for-group' instead."
2772 (let ((prefix (gnus-group-real-prefix group)))
2773 (if (equal prefix "")
2775 (let ((servers gnus-opened-servers)
2777 backend possible found)
2778 (if (string-match "^[^\\+]+\\+" prefix)
2779 (setq backend (intern (substring prefix 0 (1- (match-end 0))))
2780 server (substring prefix (match-end 0) (1- (length prefix))))
2781 (setq backend (intern (substring prefix 0 (1- (length prefix))))))
2783 (when (eq (caaar servers) backend)
2784 (setq possible (caar servers))
2785 (when (equal (cadaar servers) server)
2786 (setq found (caar servers))))
2788 (or (car (rassoc found gnus-server-alist))
2790 (car (rassoc possible gnus-server-alist))
2792 (list backend server))))))
2794 (defsubst gnus-native-method-p (method)
2795 "Return whether METHOD is the native select method."
2796 (gnus-method-equal method gnus-select-method))
2798 (defsubst gnus-secondary-method-p (method)
2799 "Return whether METHOD is a secondary select method."
2800 (let ((methods gnus-secondary-select-methods)
2801 (gmethod (gnus-server-get-method nil method)))
2803 (not (gnus-method-equal
2804 (gnus-server-get-method nil (car methods))
2806 (setq methods (cdr methods)))
2809 (defun gnus-method-simplify (method)
2810 "Return the shortest uniquely identifying string or method for METHOD."
2811 (cond ((stringp method)
2813 ((gnus-native-method-p method)
2815 ((gnus-secondary-method-p method)
2816 (format "%s:%s" (nth 0 method) (nth 1 method)))
2820 (defun gnus-groups-from-server (server)
2821 "Return a list of all groups that are fetched from SERVER."
2822 (let ((alist (cdr gnus-newsrc-alist))
2824 (while (setq info (pop alist))
2825 (when (gnus-server-equal (gnus-info-method info) server)
2826 (push (gnus-info-group info) groups)))
2827 (sort groups 'string<)))
2829 (defun gnus-group-foreign-p (group)
2830 "Say whether a group is foreign or not."
2831 (and (not (gnus-group-native-p group))
2832 (not (gnus-group-secondary-p group))))
2834 (defun gnus-group-native-p (group)
2835 "Say whether the group is native or not."
2836 (not (string-match ":" group)))
2838 (defun gnus-group-secondary-p (group)
2839 "Say whether the group is secondary or not."
2840 (gnus-secondary-method-p (gnus-find-method-for-group group)))
2842 (defun gnus-parameters-get-parameter (group)
2843 "Return the group parameters for GROUP from `gnus-parameters'."
2844 (let ((alist gnus-parameters)
2847 (when (string-match (caar alist) group)
2849 (nconc (copy-sequence (cdar alist))
2854 (defun gnus-group-find-parameter (group &optional symbol allow-list)
2855 "Return the group parameters for GROUP.
2856 If SYMBOL, return the value of that symbol in the group parameters."
2858 (set-buffer gnus-group-buffer)
2862 (funcall gnus-group-get-parameter-function group))
2863 (gnus-parameters-get-parameter group))))
2865 (gnus-group-parameter-value parameters symbol allow-list)
2868 (defun gnus-group-get-parameter (group &optional symbol allow-list)
2869 "Return the group parameters for GROUP.
2870 If SYMBOL, return the value of that symbol in the group parameters.
2871 Most functions should use `gnus-group-find-parameter', which
2872 also examines the topic parameters."
2873 (let ((params (gnus-info-params (gnus-get-info group))))
2875 (gnus-group-parameter-value params symbol allow-list)
2878 (defun gnus-group-parameter-value (params symbol &optional allow-list)
2879 "Return the value of SYMBOL in group PARAMS."
2880 ;; We only wish to return group parameters (dotted lists) and
2881 ;; not local variables, which may have the same names.
2882 ;; But first we handle single elements...
2883 (or (car (memq symbol params))
2887 (while (setq elem (pop params))
2888 (when (and (consp elem)
2889 (eq (car elem) symbol)
2892 (throw 'found (cdr elem))))))))
2894 (defun gnus-group-add-parameter (group param)
2895 "Add parameter PARAM to GROUP."
2896 (let ((info (gnus-get-info group)))
2898 (gnus-group-remove-parameter group (if (consp param) (car param) param))
2899 ;; Cons the new param to the old one and update.
2900 (gnus-group-set-info (cons param (gnus-info-params info))
2903 (defun gnus-group-set-parameter (group name value)
2904 "Set parameter NAME to VALUE in GROUP."
2905 (let ((info (gnus-get-info group)))
2907 (gnus-group-remove-parameter group name)
2908 (let ((old-params (gnus-info-params info))
2909 (new-params (list (cons name value))))
2911 (when (or (not (listp (car old-params)))
2912 (not (eq (caar old-params) name)))
2913 (setq new-params (append new-params (list (car old-params)))))
2914 (setq old-params (cdr old-params)))
2915 (gnus-group-set-info new-params group 'params)))))
2917 (defun gnus-group-remove-parameter (group name)
2918 "Remove parameter NAME from GROUP."
2919 (let ((info (gnus-get-info group)))
2921 (let ((params (gnus-info-params info)))
2923 (setq params (delq name params))
2924 (while (assq name params)
2925 (gnus-pull name params))
2926 (gnus-info-set-params info params))))))
2928 (defun gnus-group-add-score (group &optional score)
2929 "Add SCORE to the GROUP score.
2930 If SCORE is nil, add 1 to the score of GROUP."
2931 (let ((info (gnus-get-info group)))
2933 (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
2935 (defun gnus-short-group-name (group &optional levels)
2936 "Collapse GROUP name LEVELS.
2937 Select methods are stripped and any remote host name is stripped down to
2938 just the host name."
2944 gnus-group-uncollapsed-levels
2946 (while (string-match "\\." group skip)
2947 (setq skip (match-end 0)
2950 ;; Separate foreign select method from group name and collapse.
2951 ;; If method contains a server, collapse to non-domain server name,
2952 ;; otherwise collapse to select method.
2953 (let* ((colon (string-match ":" group))
2954 (server (and colon (substring group 0 colon)))
2955 (plus (and server (string-match "+" server))))
2958 (setq foreign (substring server (+ 1 plus)
2959 (string-match "\\." server))
2960 group (substring group (+ 1 colon)))
2961 (setq foreign server
2962 group (substring group (+ 1 colon))))
2963 (setq foreign (concat foreign ":")))
2964 ;; Collapse group name leaving LEVELS uncollapsed elements
2965 (let* ((slist (split-string group "/"))
2966 (slen (length slist))
2967 (dlist (split-string group "\\."))
2968 (dlen (length dlist))
2980 (setq levels (- glen levels))
2982 (push (if (>= (decf levels) 0)
2983 (if (zerop (length g))
2988 (concat foreign (mapconcat 'identity (nreverse res) gsep))))))
2990 (defun gnus-narrow-to-body ()
2991 "Narrow to the body of an article."
2994 (goto-char (point-min))
2995 (or (search-forward "\n\n" nil t)
3001 ;;; Kill file handling.
3004 (defun gnus-apply-kill-file ()
3005 "Apply a kill file to the current newsgroup.
3006 Returns the number of articles marked as read."
3007 (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
3008 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3009 (gnus-apply-kill-file-internal)
3012 (defun gnus-kill-save-kill-buffer ()
3013 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3014 (when (get-file-buffer file)
3016 (set-buffer (get-file-buffer file))
3017 (when (buffer-modified-p)
3019 (kill-buffer (current-buffer))))))
3021 (defcustom gnus-kill-file-name "KILL"
3022 "Suffix of the kill files."
3023 :group 'gnus-score-kill
3024 :group 'gnus-score-files
3027 (defun gnus-newsgroup-kill-file (newsgroup)
3028 "Return the name of a kill file name for NEWSGROUP.
3029 If NEWSGROUP is nil, return the global kill file name instead."
3031 ;; The global KILL file is placed at top of the directory.
3032 ((or (null newsgroup)
3033 (string-equal newsgroup ""))
3034 (expand-file-name gnus-kill-file-name
3035 gnus-kill-files-directory))
3036 ;; Append ".KILL" to newsgroup name.
3037 ((gnus-use-long-file-name 'not-kill)
3038 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
3039 "." gnus-kill-file-name)
3040 gnus-kill-files-directory))
3041 ;; Place "KILL" under the hierarchical directory.
3043 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
3044 "/" gnus-kill-file-name)
3045 gnus-kill-files-directory))))
3049 (defun gnus-member-of-valid (symbol group)
3050 "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
3052 (symbol-name (car (gnus-find-method-for-group group)))
3053 gnus-valid-select-methods)))
3055 (defun gnus-method-option-p (method option)
3056 "Return non-nil if select METHOD has OPTION as a parameter."
3057 (when (stringp method)
3058 (setq method (gnus-server-to-method method)))
3059 (memq option (assoc (format "%s" (car method))
3060 gnus-valid-select-methods)))
3062 (defun gnus-similar-server-opened (method)
3063 (let ((opened gnus-opened-servers))
3064 (while (and method opened)
3065 (when (and (equal (cadr method) (cadaar opened))
3066 (equal (car method) (caaar opened))
3067 (not (equal method (caar opened))))
3072 (defun gnus-server-extend-method (group method)
3073 ;; This function "extends" a virtual server. If the server is
3074 ;; "hello", and the select method is ("hello" (my-var "something"))
3075 ;; in the group "alt.alt", this will result in a new virtual server
3076 ;; called "hello+alt.alt".
3077 (if (or (not (inline (gnus-similar-server-opened method)))
3078 (not (cddr method)))
3080 `(,(car method) ,(concat (cadr method) "+" group)
3081 (,(intern (format "%s-address" (car method))) ,(cadr method))
3084 (defun gnus-server-status (method)
3085 "Return the status of METHOD."
3086 (nth 1 (assoc method gnus-opened-servers)))
3088 (defun gnus-group-name-to-method (group)
3089 "Guess a select method based on GROUP."
3090 (if (string-match ":" group)
3091 (let ((server (substring group 0 (match-beginning 0))))
3092 (if (string-match "\\+" server)
3093 (list (intern (substring server 0 (match-beginning 0)))
3094 (substring server (match-end 0)))
3095 (list (intern server) "")))
3096 gnus-select-method))
3098 (defun gnus-server-string (server)
3099 "Return a readable string that describes SERVER."
3100 (let* ((server (gnus-server-to-method server))
3101 (address (nth 1 server)))
3103 (not (zerop (length address))))
3104 (format "%s via %s" address (car server))
3105 (format "%s" (car server)))))
3107 (defun gnus-find-method-for-group (group &optional info)
3108 "Find the select method that GROUP uses."
3109 (or gnus-override-method
3112 (and (not (gnus-group-entry group));; a new group
3113 (gnus-group-name-to-method group))
3114 (let ((info (or info (gnus-get-info group)))
3117 (not (setq method (gnus-info-method info)))
3118 (equal method "native"))
3121 (cond ((stringp method)
3122 (inline (gnus-server-to-method method)))
3123 ((stringp (cadr method))
3124 (inline (gnus-server-extend-method group method)))
3127 (cond ((equal (cadr method) "")
3129 ((null (cadr method))
3130 (list (car method) ""))
3132 (gnus-server-add-address method)))))))
3134 (defun gnus-methods-using (feature)
3135 "Find all methods that have FEATURE."
3136 (let ((valids gnus-valid-select-methods)
3139 (when (memq feature (car valids))
3140 (push (car valids) outs))
3141 (setq valids (cdr valids)))
3144 (defun gnus-read-group (prompt &optional default)
3145 "Prompt the user for a group name.
3146 Disallow invalid group names."
3151 gnus-invalid-group-regexp
3152 (setq group (read-string (concat prefix prompt)
3153 (cons (or default "") 0)
3154 'gnus-group-history)))
3155 (setq prefix (format "Invalid group name: \"%s\". " group)
3159 (defun gnus-read-method (prompt)
3160 "Prompt the user for a method.
3161 Allow completion over sensible values."
3162 (let* ((open-servers
3163 (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
3164 gnus-opened-servers))
3167 (dolist (method gnus-valid-select-methods)
3168 (if (or (memq 'prompt-address method)
3169 (not (assoc (format "%s:" (car method)) open-servers)))
3170 (push method methods)))
3173 (append valid-methods
3175 gnus-predefined-server-alist
3180 nil t nil 'gnus-method-history)))
3183 (setq method gnus-select-method))
3184 ((assoc method gnus-valid-select-methods)
3185 (let ((address (if (memq 'prompt-address
3186 (assoc method gnus-valid-select-methods))
3187 (read-string "Address: ")
3189 (or (cadr (assoc (format "%s:%s" method address) open-servers))
3190 (list (intern method) address))))
3191 ((assoc method servers)
3194 (list (intern method) "")))))
3196 ;;; User-level commands.
3199 (defun gnus-slave-no-server (&optional arg)
3200 "Read network news as a slave, without connecting to local server."
3202 (gnus-no-server arg t))
3205 (defun gnus-no-server (&optional arg slave)
3207 If ARG is a positive number, Gnus will use that as the
3208 startup level. If ARG is nil, Gnus will be started at level 2.
3209 If ARG is non-nil and not a positive number, Gnus will
3210 prompt the user for the name of an NNTP server to use.
3211 As opposed to `gnus', this command will not connect to the local server."
3213 (gnus-no-server-1 arg slave))
3216 (defun gnus-slave (&optional arg)
3217 "Read news as a slave."
3219 (gnus arg nil 'slave))
3221 (defcustom gnus-frame-properties nil
3222 "The properties of the frame in which gnus is displayed. Under XEmacs,
3223 the variable `toolbar-news-frame-plist' will be refered instead."
3224 :type '(repeat (cons :format "%v"
3225 (symbol :tag "Parameter")
3226 (sexp :tag "Value")))
3229 (defvar gnus-frame nil
3230 "The frame in which gnus is displayed. It is not used under XEmacs.")
3233 (defun gnus-other-frame (&optional arg)
3234 "Pop up a frame to read news."
3236 (static-if (featurep 'xemacs)
3237 (let ((toolbar-news-use-separate-frame t))
3239 (if (frame-live-p gnus-frame)
3240 (raise-frame gnus-frame)
3241 (setq gnus-frame (make-frame gnus-frame-properties))
3242 (if (and (gnus-buffer-live-p gnus-group-buffer)
3243 (save-current-buffer
3244 (set-buffer gnus-group-buffer)
3245 (eq 'gnus-group-mode major-mode)))
3247 (select-frame gnus-frame)
3248 (switch-to-buffer gnus-group-buffer))
3249 (add-hook 'gnus-exit-gnus-hook
3251 (when (and (frame-live-p gnus-frame)
3253 (delete-frame gnus-frame))
3254 (setq gnus-frame nil)))
3255 (select-frame gnus-frame)
3259 (defun gnus (&optional arg dont-connect slave)
3261 If ARG is non-nil and a positive number, Gnus will use that as the
3262 startup level. If ARG is non-nil and not a positive number, Gnus will
3263 prompt the user for the name of an NNTP server to use."
3265 (gnus-1 arg dont-connect slave))
3267 ;; Allow redefinition of Gnus functions.
3271 (product-provide (provide 'gnus) 'gnus-vers)
3273 ;;; gnus.el ends here