1 ;;; gnus.el --- a newsreader for GNU Emacs -*- lexical-binding:t -*-
3 ;; Copyright (C) 1987-1990, 1993-1998, 2000-2018 Free Software
6 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
7 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; 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 3 of the License, or
16 ;; (at your option) any later version.
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. If not, see <https://www.gnu.org/licenses/>.
30 (run-hooks 'gnus-load-hook
)
32 (eval-when-compile (require 'cl-lib
))
38 ;; These are defined afterwards with gnus-define-group-parameter
39 (defvar gnus-ham-process-destinations
)
40 (defvar gnus-parameter-ham-marks-alist
)
41 (defvar gnus-parameter-spam-marks-alist
)
42 (defvar gnus-spam-autodetect
)
43 (defvar gnus-spam-autodetect-methods
)
44 (defvar gnus-spam-newsgroup-contents
)
45 (defvar gnus-spam-process-destinations
)
46 (defvar gnus-spam-resend-to
)
47 (defvar gnus-ham-resend-to
)
48 (defvar gnus-spam-process-newsgroups
)
52 "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
56 (defgroup gnus-start nil
57 "Starting your favorite newsreader."
60 (defgroup gnus-format nil
61 "Dealing with formatting issues."
64 (defgroup gnus-charset nil
65 "Group character set issues."
66 :link
'(custom-manual "(gnus)Charsets")
70 (defgroup gnus-cache nil
72 :link
'(custom-manual "(gnus)Article Caching")
75 (defgroup gnus-registry nil
79 (defgroup gnus-start-server nil
80 "Server options at startup."
83 ;; These belong to gnus-group.el.
84 (defgroup gnus-group nil
86 :link
'(custom-manual "(gnus)Group Buffer")
89 (defgroup gnus-group-foreign nil
91 :link
'(custom-manual "(gnus)Foreign Groups")
94 (defgroup gnus-group-new nil
95 "Automatic subscription of new groups."
98 (defgroup gnus-group-levels nil
100 :link
'(custom-manual "(gnus)Group Levels")
103 (defgroup gnus-group-select nil
105 :link
'(custom-manual "(gnus)Selecting a Group")
108 (defgroup gnus-group-listing nil
109 "Showing slices of the group list."
110 :link
'(custom-manual "(gnus)Listing Groups")
113 (defgroup gnus-group-visual nil
114 "Sorting the group buffer."
115 :link
'(custom-manual "(gnus)Group Buffer Format")
119 (defgroup gnus-group-various nil
120 "Various group options."
121 :link
'(custom-manual "(gnus)Scanning New Messages")
124 ;; These belong to gnus-sum.el.
125 (defgroup gnus-summary nil
127 :link
'(custom-manual "(gnus)Summary Buffer")
130 (defgroup gnus-summary-exit nil
131 "Leaving summary buffers."
132 :link
'(custom-manual "(gnus)Exiting the Summary Buffer")
133 :group
'gnus-summary
)
135 (defgroup gnus-summary-marks nil
136 "Marks used in summary buffers."
137 :link
'(custom-manual "(gnus)Marking Articles")
138 :group
'gnus-summary
)
140 (defgroup gnus-thread nil
141 "Ordering articles according to replies."
142 :link
'(custom-manual "(gnus)Threading")
143 :group
'gnus-summary
)
145 (defgroup gnus-summary-format nil
146 "Formatting of the summary buffer."
147 :link
'(custom-manual "(gnus)Summary Buffer Format")
148 :group
'gnus-summary
)
150 (defgroup gnus-summary-choose nil
152 :link
'(custom-manual "(gnus)Choosing Articles")
153 :group
'gnus-summary
)
155 (defgroup gnus-summary-maneuvering nil
156 "Summary movement commands."
157 :link
'(custom-manual "(gnus)Summary Maneuvering")
158 :group
'gnus-summary
)
160 (defgroup gnus-picon nil
161 "Show pictures of people, domains, and newsgroups."
164 (defgroup gnus-summary-mail nil
165 "Mail group commands."
166 :link
'(custom-manual "(gnus)Mail Group Commands")
167 :group
'gnus-summary
)
169 (defgroup gnus-summary-sort nil
170 "Sorting the summary buffer."
171 :link
'(custom-manual "(gnus)Sorting the Summary Buffer")
172 :group
'gnus-summary
)
174 (defgroup gnus-summary-visual nil
175 "Highlighting and menus in the summary buffer."
176 :link
'(custom-manual "(gnus)Summary Highlighting")
178 :group
'gnus-summary
)
180 (defgroup gnus-summary-various nil
181 "Various summary buffer options."
182 :link
'(custom-manual "(gnus)Various Summary Stuff")
183 :group
'gnus-summary
)
185 (defgroup gnus-summary-pick nil
186 "Pick mode in the summary buffer."
187 :link
'(custom-manual "(gnus)Pick and Read")
189 :group
'gnus-summary
)
191 (defgroup gnus-summary-tree nil
192 "Tree display of threads in the summary buffer."
193 :link
'(custom-manual "(gnus)Tree Display")
195 :group
'gnus-summary
)
197 ;; Belongs to gnus-uu.el
198 (defgroup gnus-extract-view nil
199 "Viewing extracted files."
200 :link
'(custom-manual "(gnus)Viewing Files")
201 :group
'gnus-extract
)
203 ;; Belongs to gnus-score.el
204 (defgroup gnus-score nil
205 "Score and kill file handling."
208 (defgroup gnus-score-kill nil
212 (defgroup gnus-score-adapt nil
213 "Adaptive score files."
216 (defgroup gnus-score-default nil
217 "Default values for score files."
220 (defgroup gnus-score-expire nil
221 "Expiring score rules."
224 (defgroup gnus-score-decay nil
225 "Decaying score rules."
228 (defgroup gnus-score-files nil
229 "Score and kill file names."
233 (defgroup gnus-score-various nil
234 "Various scoring and killing options."
238 (defgroup gnus-visual nil
239 "Options controlling the visual fluff."
243 (defgroup gnus-agent nil
244 "Offline support for Gnus."
247 (defgroup gnus-files nil
248 "Files used by Gnus."
251 (defgroup gnus-dribble-file nil
253 :link
'(custom-manual "(gnus)Auto Save")
256 (defgroup gnus-newsrc nil
257 "Storing Gnus state."
260 (defgroup gnus-server nil
261 "Options related to newsservers and other servers used by Gnus."
264 (defgroup gnus-server-visual nil
265 "Highlighting and menus in the server buffer."
269 (defgroup gnus-message
'((message custom-group
))
270 "Composing replies and followups in Gnus."
273 (defgroup gnus-meta nil
274 "Meta variables controlling major portions of Gnus.
275 In general, modifying these variables does not take effect until Gnus
276 is restarted, and sometimes reloaded."
279 (defgroup gnus-various nil
280 "Other Gnus options."
281 :link
'(custom-manual "(gnus)Various Various")
284 (defgroup gnus-exit nil
286 :link
'(custom-manual "(gnus)Exiting Gnus")
289 (defgroup gnus-fun nil
290 "Frivolous Gnus extensions."
291 :link
'(custom-manual "(gnus)Exiting Gnus")
294 (defconst gnus-version-number
"5.13"
295 "Version number for this version of Gnus.")
297 (defconst gnus-version
(format "Gnus v%s" gnus-version-number
)
298 "Version string for this version of Gnus.")
300 (defcustom gnus-inhibit-startup-message nil
301 "If non-nil, the startup message will not be displayed.
302 This variable is used before `.gnus.el' is loaded, so it should
303 be set in `.emacs' instead."
307 (defvar gnus-mode-line-image-cache t
)
310 (if (fboundp 'find-image
)
311 (defun gnus-mode-line-buffer-identification (line)
312 (let ((str (car-safe line
))
313 (load-path (append (mm-image-load-path) load-path
)))
314 (if (and (display-graphic-p)
316 (string-match "^Gnus:" str
))
317 (progn (add-text-properties
320 (if (eq t gnus-mode-line-image-cache
)
321 (setq gnus-mode-line-image-cache
323 '((:type xpm
:file
"gnus-pointer.xpm"
325 (:type xbm
:file
"gnus-pointer.xbm"
327 gnus-mode-line-image-cache
)
330 gnus-version
(gnus-emacs-version)))
334 (defalias 'gnus-mode-line-buffer-identification
'identity
)))
336 ;; We define these group faces here to avoid the display
337 ;; update forced when creating new faces.
339 (defface gnus-group-news-1-empty
342 (:foreground
"PaleTurquoise"))
345 (:foreground
"ForestGreen"))
348 "Level 1 empty newsgroup face."
351 (defface gnus-group-news-1
352 '((t (:inherit gnus-group-news-1-empty
:bold t
)))
353 "Level 1 newsgroup face."
356 (defface gnus-group-news-2-empty
359 (:foreground
"turquoise"))
362 (:foreground
"CadetBlue4"))
365 "Level 2 empty newsgroup face."
368 (defface gnus-group-news-2
369 '((t (:inherit gnus-group-news-2-empty
:bold t
)))
370 "Level 2 newsgroup face."
373 (defface gnus-group-news-3-empty
382 "Level 3 empty newsgroup face."
385 (defface gnus-group-news-3
386 '((t (:inherit gnus-group-news-3-empty
:bold t
)))
387 "Level 3 newsgroup face."
390 (defface gnus-group-news-4-empty
399 "Level 4 empty newsgroup face."
402 (defface gnus-group-news-4
403 '((t (:inherit gnus-group-news-4-empty
:bold t
)))
404 "Level 4 newsgroup face."
407 (defface gnus-group-news-5-empty
416 "Level 5 empty newsgroup face."
419 (defface gnus-group-news-5
420 '((t (:inherit gnus-group-news-5-empty
:bold t
)))
421 "Level 5 newsgroup face."
424 (defface gnus-group-news-6-empty
433 "Level 6 empty newsgroup face."
436 (defface gnus-group-news-6
437 '((t (:inherit gnus-group-news-6-empty
:bold t
)))
438 "Level 6 newsgroup face."
441 (defface gnus-group-news-low-empty
444 (:foreground
"DarkTurquoise"))
447 (:foreground
"DarkGreen"))
450 "Low level empty newsgroup face."
453 (defface gnus-group-news-low
454 '((t (:inherit gnus-group-news-low-empty
:bold t
)))
455 "Low level newsgroup face."
458 (defface gnus-group-mail-1-empty
461 (:foreground
"#e1ffe1"))
464 (:foreground
"DeepPink3"))
467 "Level 1 empty mailgroup face."
470 (defface gnus-group-mail-1
471 '((t (:inherit gnus-group-mail-1-empty
:bold t
)))
472 "Level 1 mailgroup face."
475 (defface gnus-group-mail-2-empty
478 (:foreground
"DarkSeaGreen1"))
481 (:foreground
"HotPink3"))
484 "Level 2 empty mailgroup face."
487 (defface gnus-group-mail-2
488 '((t (:inherit gnus-group-mail-2-empty
:bold t
)))
489 "Level 2 mailgroup face."
492 (defface gnus-group-mail-3-empty
495 (:foreground
"aquamarine1"))
498 (:foreground
"magenta4"))
501 "Level 3 empty mailgroup face."
504 (defface gnus-group-mail-3
505 '((t (:inherit gnus-group-mail-3-empty
:bold t
)))
506 "Level 3 mailgroup face."
509 (defface gnus-group-mail-low-empty
512 (:foreground
"aquamarine2"))
515 (:foreground
"DeepPink4"))
518 "Low level empty mailgroup face."
521 (defface gnus-group-mail-low
522 '((t (:inherit gnus-group-mail-low-empty
:bold t
)))
523 "Low level mailgroup face."
526 ;; Summary mode faces.
528 (defface gnus-summary-selected
'((t (:underline t
)))
529 "Face used for selected articles."
530 :group
'gnus-summary
)
532 (defface gnus-summary-cancelled
534 (:foreground
"yellow" :background
"black")))
535 "Face used for canceled articles."
536 :group
'gnus-summary
)
538 (defface gnus-summary-normal-ticked
541 (:foreground
"pink"))
544 (:foreground
"firebrick"))
547 "Face used for normal interest ticked articles."
548 :group
'gnus-summary
)
550 (defface gnus-summary-high-ticked
551 '((t (:inherit gnus-summary-normal-ticked
:bold t
)))
552 "Face used for high interest ticked articles."
553 :group
'gnus-summary
)
555 (defface gnus-summary-low-ticked
556 '((t (:inherit gnus-summary-normal-ticked
:italic t
)))
557 "Face used for low interest ticked articles."
558 :group
'gnus-summary
)
560 (defface gnus-summary-normal-ancient
563 (:foreground
"SkyBlue"))
566 (:foreground
"RoyalBlue"))
569 "Face used for normal interest ancient articles."
570 :group
'gnus-summary
)
572 (defface gnus-summary-high-ancient
573 '((t (:inherit gnus-summary-normal-ancient
:bold t
)))
574 "Face used for high interest ancient articles."
575 :group
'gnus-summary
)
577 (defface gnus-summary-low-ancient
578 '((t (:inherit gnus-summary-normal-ancient
:italic t
)))
579 "Face used for low interest ancient articles."
580 :group
'gnus-summary
)
582 (defface gnus-summary-normal-undownloaded
585 (:foreground
"cyan4" :bold nil
))
586 (((class color
) (background dark
))
587 (:foreground
"LightGray" :bold nil
))
588 (t (:inverse-video t
)))
589 "Face used for normal interest uncached articles."
590 :group
'gnus-summary
)
592 (defface gnus-summary-high-undownloaded
593 '((t (:inherit gnus-summary-normal-undownloaded
:bold t
)))
594 "Face used for high interest uncached articles."
595 :group
'gnus-summary
)
597 (defface gnus-summary-low-undownloaded
598 '((t (:inherit gnus-summary-normal-undownloaded
:italic t
)))
599 "Face used for low interest uncached articles."
600 :group
'gnus-summary
)
602 (defface gnus-summary-normal-unread
605 "Face used for normal interest unread articles."
606 :group
'gnus-summary
)
608 (defface gnus-summary-high-unread
609 '((t (:inherit gnus-summary-normal-unread
:bold t
)))
610 "Face used for high interest unread articles."
611 :group
'gnus-summary
)
613 (defface gnus-summary-low-unread
614 '((t (:inherit gnus-summary-normal-unread
:italic t
)))
615 "Face used for low interest unread articles."
616 :group
'gnus-summary
)
618 (defface gnus-summary-normal-read
621 (:foreground
"PaleGreen"))
624 (:foreground
"DarkGreen"))
627 "Face used for normal interest read articles."
628 :group
'gnus-summary
)
630 (defface gnus-summary-high-read
631 '((t (:inherit gnus-summary-normal-read
:bold t
)))
632 "Face used for high interest read articles."
633 :group
'gnus-summary
)
635 (defface gnus-summary-low-read
636 '((t (:inherit gnus-summary-normal-read
:italic t
)))
637 "Face used for low interest read articles."
638 :group
'gnus-summary
)
645 (defvar gnus-buffers nil
646 "List of buffers handled by Gnus.")
648 (defun gnus-get-buffer-create (name)
649 "Do the same as `get-buffer-create', but store the created buffer."
650 (or (get-buffer name
)
651 (car (push (get-buffer-create name
) gnus-buffers
))))
653 (defun gnus-add-buffer ()
654 "Add the current buffer to the list of Gnus buffers."
656 (push (current-buffer) gnus-buffers
))
658 (defmacro gnus-kill-buffer
(buffer)
659 "Kill BUFFER and remove from the list of Gnus buffers."
660 `(let ((buf ,buffer
))
661 (when (gnus-buffer-exists-p buf
)
663 (gnus-prune-buffers))))
665 (defun gnus-prune-buffers ()
666 (dolist (buf gnus-buffers
)
667 (unless (buffer-live-p buf
)
668 (setq gnus-buffers
(delete buf gnus-buffers
)))))
670 (defun gnus-buffers ()
671 "Return a list of live Gnus buffers."
672 (while (and gnus-buffers
673 (not (buffer-name (car gnus-buffers
))))
675 (let ((buffers gnus-buffers
))
677 (if (buffer-name (cadr buffers
))
679 (setcdr buffers
(cddr buffers
)))))
684 (defvar gnus-group-buffer
"*Group*"
685 "Name of the Gnus group buffer.")
690 (:foreground
"#cccccc"))
693 (:foreground
"#888888"))
696 "Face for the splash screen."
699 (defun gnus-splash ()
701 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer
))
702 (let ((buffer-read-only nil
))
704 (unless gnus-inhibit-startup-message
705 (gnus-group-startup-message)
708 (defun gnus-indent-rigidly (start end arg
)
709 "Indent rigidly using only spaces and no tabs."
712 (narrow-to-region start end
)
714 (indent-rigidly start end arg
)
715 ;; We translate tabs into spaces -- not everybody uses
716 ;; an 8-character tab.
717 (goto-char (point-min))
718 (while (search-forward "\t" nil t
)
719 (replace-match " " t t
))))))
721 ;;(format "%02x%02x%02x" 114 66 20) "724214"
723 (defvar gnus-logo-color-alist
724 '((flame "#cc3300" "#ff2200")
725 (pine "#c0cc93" "#f8ffb8")
726 (moss "#a1cc93" "#d2ffb8")
727 (irish "#04cc90" "#05ff97")
728 (sky "#049acc" "#05deff")
729 (tin "#6886cc" "#82b6ff")
730 (velvet "#7c68cc" "#8c82ff")
731 (grape "#b264cc" "#cf7df")
732 (labia "#cc64c2" "#fd7dff")
733 (berry "#cc6485" "#ff7db5")
734 (dino "#724214" "#1e3f03")
735 (oort "#cccccc" "#888888")
736 (storm "#666699" "#99ccff")
737 (pdino "#9999cc" "#99ccff")
738 (purp "#9999cc" "#666699")
739 (no "#ff0000" "#ffff00")
740 (neutral "#b4b4b4" "#878787")
741 (ma "#2020e0" "#8080ff")
742 (september "#bf9900" "#ffcc00"))
743 "Color alist used for the Gnus logo.")
745 (defcustom gnus-logo-color-style
'ma
746 "Color styles used for the Gnus logo."
747 :type
`(choice ,@(mapcar (lambda (elem) (list 'const
(car elem
)))
748 gnus-logo-color-alist
))
751 (defvar gnus-logo-colors
752 (cdr (assq gnus-logo-color-style gnus-logo-color-alist
))
753 "Colors used for the Gnus logo.")
755 (defvar image-load-path
)
756 (declare-function image-size
"image.c" (spec &optional pixels frame
))
758 (defun gnus-group-startup-message (&optional x y
)
759 "Insert startup message in current buffer."
760 ;; Insert the message.
763 (fboundp 'find-image
)
765 ;; Make sure the library defining `image-load-path' is
766 ;; loaded (`find-image' is autoloaded) (and discard the
767 ;; result). Else, we may get "defvar ignored because
768 ;; image-load-path is let-bound" when calling `find-image'
770 (or (find-image '(nil (:type xpm
:file
"gnus.xpm"))) t
)
771 (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
772 (image-load-path (cond (data-directory
773 (list data-directory
))
774 ((boundp 'image-load-path
)
775 (symbol-value 'image-load-path
))
777 (image (gnus-splash-svg-color-symbols (find-image
778 `((:type svg
:file
"gnus.svg"
780 (("#bf9900" .
,(car gnus-logo-colors
))
781 ("#ffcc00" .
,(cadr gnus-logo-colors
))))
782 (:type xpm
:file
"gnus.xpm"
784 (("thing" .
,(car gnus-logo-colors
))
785 ("shadow" .
,(cadr gnus-logo-colors
))))
786 (:type png
:file
"gnus.png")
787 (:type pbm
:file
"gnus.pbm"
788 ;; Account for the pbm's background.
789 :background
,(face-foreground 'gnus-splash
)
790 :foreground
,(face-background 'default
))
791 (:type xbm
:file
"gnus.xbm"
792 ;; Account for the xbm's background.
793 :background
,(face-foreground 'gnus-splash
)
794 :foreground
,(face-background 'default
)))))))
796 (let ((size (image-size image
)))
797 (insert-char ?
\n (max 0 (round (- (window-height)
798 (or y
(cdr size
)) 1) 2)))
799 (insert-char ?\
(max 0 (round (- (window-width)
800 (or x
(car size
))) 2)))
801 (insert-image image
))
802 (goto-char (point-min))
807 _ ___ __ ___ __ _ ___
826 (gnus-indent-rigidly (point-min) (point-max)
827 (/ (max (- (window-width) (or x
46)) 0) 2))
828 (goto-char (point-min))
830 (let* ((pheight (count-lines (point-min) (point-max)))
831 (wheight (window-height))
832 (rest (- wheight pheight
)))
833 (insert (make-string (max 0 (* 2 (/ rest
3))) ?
\n)))
835 (put-text-property (point-min) (point-max) 'face
'gnus-splash
)
836 (goto-char (point-min))
837 (setq mode-line-buffer-identification
(concat " " gnus-version
))
838 (set-buffer-modified-p t
)))
840 (defun gnus-splash-svg-color-symbols (list)
841 "Do color-symbol search-and-replace in svg file."
842 (let ((type (plist-get (cdr list
) :type
))
843 (file (plist-get (cdr list
) :file
))
844 (color-symbols (plist-get (cdr list
) :color-symbols
)))
845 (if (string= type
"svg")
846 (let ((data (with-temp-buffer (insert-file-contents file
)
849 (setq data
(replace-regexp-in-string
850 (concat "fill:" (car rule
))
851 (concat "fill:" (cdr rule
)) data
)))
853 (cons (car list
) (list :type type
:data data
)))
856 (let ((command (format "%s" this-command
)))
857 (when (string-match "gnus" command
)
858 (if (eq 'gnus-other-frame this-command
)
859 (gnus-get-buffer-create gnus-group-buffer
)
867 (defcustom gnus-parameters nil
868 "Alist of group parameters.
871 ((\"mail\\\\..*\" (gnus-show-threads nil)
872 (gnus-use-scoring nil)
873 (gnus-summary-line-format
874 \"%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\\n\")
877 (\"mail\\\\.me\" (gnus-use-scoring t))
878 (\"list\\\\..*\" (total-expire . t)
879 (broken-reply-to . t)))"
881 :group
'gnus-group-various
882 :type
'(repeat (cons regexp
885 (defcustom gnus-parameters-case-fold-search
'default
886 "If it is t, ignore case of group names specified in `gnus-parameters'.
887 If it is nil, don't ignore case. If it is `default', which is for the
888 backward compatibility, use the value of `case-fold-search'."
890 :group
'gnus-group-various
891 :type
'(choice :format
"%{%t%}:\n %[Value Menu%] %v"
892 (const :tag
"Use `case-fold-search'" default
)
896 (defvar gnus-group-parameters-more nil
)
898 (defmacro gnus-define-group-parameter
(param &rest rest
)
899 "Define a group parameter PARAM.
900 REST is a plist of following:
901 :type One of `bool', `list' or nil.
902 :function The name of the function.
903 :function-document The documentation of the function.
904 :parameter-type The type for customizing the parameter.
905 :parameter-document The documentation for the parameter.
906 :variable The name of the variable.
907 :variable-document The documentation for the variable.
908 :variable-group The group for customizing the variable.
909 :variable-type The type for customizing the variable.
910 :variable-default The default value of the variable."
911 (let* ((type (plist-get rest
:type
))
912 (parameter-type (plist-get rest
:parameter-type
))
913 (parameter-document (plist-get rest
:parameter-document
))
914 (function (or (plist-get rest
:function
)
915 (intern (format "gnus-parameter-%s" param
))))
916 (function-document (or (plist-get rest
:function-document
) ""))
917 (variable (or (plist-get rest
:variable
)
918 (intern (format "gnus-parameter-%s-alist" param
))))
919 (variable-document (or (plist-get rest
:variable-document
) ""))
920 (variable-group (plist-get rest
:variable-group
))
921 (variable-type (or (plist-get rest
:variable-type
)
923 (list (regexp :tag
"Group")
924 ,(car (cdr parameter-type
)))))))
925 (variable-default (plist-get rest
:variable-default
)))
928 `(defcustom ,variable
,variable-default
930 :group
'gnus-group-parameter
931 :group
',variable-group
932 :type
,variable-type
)
933 `(setq gnus-group-parameters-more
934 (delq (assq ',param gnus-group-parameters-more
)
935 gnus-group-parameters-more
))
936 `(add-to-list 'gnus-group-parameters-more
939 ,parameter-document
))
941 `(defun ,function
(name)
943 (let ((params (gnus-group-find-parameter name
))
946 ((memq ',param params
)
948 ((setq val
(assq ',param params
))
951 (string-match ,variable name
))
953 (let ((alist ,variable
)
955 (while (setq elem
(pop alist
))
957 (string-match (car elem
) name
))
960 (if (consp value
) (car value
) value
))))))
961 `(defun ,function
(name)
964 (or (gnus-group-find-parameter name
',param
,(and type t
))
965 (let ((alist ,variable
)
967 (while (setq elem
(pop alist
))
969 (string-match (car elem
) name
))
974 '(if (consp value
) (car value
) value
))))))))))
976 (defcustom gnus-home-directory
"~/"
977 "Directory variable that specifies the \"home\" directory.
978 All other Gnus file and directory variables are initialized from this variable.
980 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
981 This means that other directory variables that are initialized
982 from this variable won't be set properly if you set this variable
983 in `.gnus.el'. Set this variable in `.emacs' instead."
987 (defcustom gnus-directory
(or (getenv "SAVEDIR")
988 (nnheader-concat gnus-home-directory
"News/"))
989 "Directory variable from which all other Gnus file variables are derived.
991 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
992 This means that other directory variables that are initialized from
993 this variable won't be set properly if you set this variable in `.gnus.el'.
994 Set this variable in `.emacs' instead."
998 (defcustom gnus-default-directory nil
999 "Default directory for all Gnus buffers."
1001 :type
'(choice (const :tag
"current" nil
)
1004 ;; Site dependent variables.
1006 ;; Should this be obsolete?
1007 (defcustom gnus-default-nntp-server nil
1008 "The hostname of the default NNTP server.
1009 The empty string, or nil, means to use the local host.
1010 You may wish to set this on a site-wide basis.
1012 If you want to change servers, you should use `gnus-select-method'."
1014 :type
'(choice (const :tag
"local host" nil
)
1015 (string :tag
"host name")))
1017 (defcustom gnus-nntpserver-file
"/etc/nntpserver"
1018 "A file with only the name of the nntp server in it."
1023 (defun gnus-getenv-nntpserver ()
1024 "Find default nntp server.
1025 Check the NNTPSERVER environment variable and the
1026 `gnus-nntpserver-file' file."
1027 (or (getenv "NNTPSERVER")
1028 (and (file-readable-p gnus-nntpserver-file
)
1030 (insert-file-contents gnus-nntpserver-file
)
1031 (when (re-search-forward "[^ \t\n\r]+" nil t
)
1032 (match-string 0))))))
1034 ;; `M-x customize-variable RET gnus-select-method RET' should work without
1035 ;; starting or even loading Gnus.
1036 ;;;###autoload(when (fboundp 'custom-autoload)
1037 ;;;###autoload (custom-autoload 'gnus-select-method "gnus"))
1039 (defcustom gnus-select-method
1040 (list 'nntp
(or (gnus-getenv-nntpserver)
1041 (when (and gnus-default-nntp-server
1042 (not (string= gnus-default-nntp-server
"")))
1043 gnus-default-nntp-server
)
1045 "Default method for selecting a newsgroup.
1046 This variable should be a list, where the first element is how the
1047 news is to be fetched, the second is the address.
1049 For instance, if you want to get your news via \"flab.flab.edu\" using
1050 NNTP, you could say:
1052 \(setq gnus-select-method \\='(nntp \"flab.flab.edu\"))
1054 If you want to use your local spool, say:
1056 \(setq gnus-select-method (list \\='nnspool (system-name)))
1058 If you use this variable, you must set `gnus-nntp-server' to nil.
1060 There is a lot more to know about select methods and virtual servers -
1061 see the manual for details."
1062 ;; Emacs has set-after since 22.1.
1063 ;set-after '(gnus-default-nntp-server)
1066 :initialize
'custom-initialize-default
1067 :type
'gnus-select-method
)
1069 (defcustom gnus-message-archive-method
"archive"
1070 "Method used for archiving messages you've sent.
1071 This should be a mail method.
1073 See also `gnus-update-message-archive-method'."
1075 :group
'gnus-message
1076 :type
'(choice (const :tag
"Default archive method" "archive")
1077 gnus-select-method
))
1079 (defcustom gnus-update-message-archive-method nil
1080 "Non-nil means always update the saved \"archive\" method.
1082 The archive method is initially set according to the value of
1083 `gnus-message-archive-method' and is saved in the \"~/.newsrc.eld\" file
1084 so that it may be used as a real method of the server which is named
1085 \"archive\" ever since. If it once has been saved, it will never be
1086 updated if the value of this variable is nil, even if you change the
1087 value of `gnus-message-archive-method' afterward. If you want the
1088 saved \"archive\" method to be updated whenever you change the value of
1089 `gnus-message-archive-method', set this variable to a non-nil value."
1092 :group
'gnus-message
1095 (defcustom gnus-message-archive-group
'((format-time-string "sent.%Y-%m"))
1096 "Name of the group in which to save the messages you've written.
1097 This can either be a string; a list of strings; or an alist
1098 of regexps/functions/forms to be evaluated to return a string (or a list
1099 of strings). The functions are called with the name of the current
1100 group (or nil) as a parameter.
1102 If you want to save your mail in one group and the news articles you
1103 write in another group, you could say something like:
1105 (setq gnus-message-archive-group
1106 \\='((if (message-news-p)
1110 Normally the group names returned by this variable should be
1111 unprefixed -- which implicitly means \"store on the archive server\".
1112 However, you may wish to store the message on some other server. In
1113 that case, just return a fully prefixed name of the group --
1114 \"nnml+private:mail.misc\", for instance."
1116 :group
'gnus-message
1117 :type
'(choice (const :tag
"none" nil
)
1118 (const :tag
"Weekly" ((format-time-string "sent.%Yw%U")))
1119 (const :tag
"Monthly" ((format-time-string "sent.%Y-%m")))
1120 (const :tag
"Yearly" ((format-time-string "sent.%Y")))
1125 (defcustom gnus-secondary-servers nil
1126 "List of NNTP servers that the user can choose between interactively.
1127 To make Gnus query you for a server, you have to give `gnus' a
1128 non-numeric prefix - `C-u M-x gnus', in short."
1130 :type
'(repeat string
))
1131 (make-obsolete-variable 'gnus-secondary-servers
'gnus-select-method
"24.1")
1133 (defcustom gnus-secondary-select-methods nil
1134 "A list of secondary methods that will be used for reading news.
1135 This is a list where each element is a complete select method (see
1136 `gnus-select-method').
1138 If, for instance, you want to read your mail with the nnml back end,
1139 you could set this variable:
1141 \(setq gnus-secondary-select-methods \\='((nnml \"\")))"
1143 :type
'(repeat gnus-select-method
))
1145 (defcustom gnus-local-domain nil
1146 "Local domain name without a host name.
1147 The DOMAINNAME environment variable is used instead if it is defined.
1148 If the function `system-name' returns the full Internet name, there is
1149 no need to set this variable."
1150 :group
'gnus-message
1151 :type
'(choice (const :tag
"default" nil
)
1153 (make-obsolete-variable 'gnus-local-domain nil
"Emacs 24.1")
1155 ;; Customization variables
1157 (defcustom gnus-refer-article-method
'current
1158 "Preferred method for fetching an article by Message-ID.
1159 The value of this variable must be a valid select method as discussed
1160 in the documentation of `gnus-select-method'.
1162 It can also be a list of select methods, as well as the special symbol
1163 `current', which means to use the current select method. If it is a
1164 list, Gnus will try all the methods in the list until it finds a match."
1167 :type
'(choice (const :tag
"default" nil
)
1169 (const :tag
"Google" (nnweb "refer" (nnweb-type google
)))
1172 (repeat :menu-tag
"Try multiple"
1174 :value
(current (nnweb "refer" (nnweb-type google
)))
1175 (choice :tag
"Method"
1177 (const :tag
"Google"
1178 (nnweb "refer" (nnweb-type google
)))
1179 gnus-select-method
))))
1181 (defcustom gnus-use-cross-reference t
1182 "Non-nil means that cross referenced articles will be marked as read.
1183 If nil, ignore cross references. If t, mark articles as read in
1184 subscribed newsgroups. If neither t nor nil, mark as read in all
1187 :type
'(choice (const :tag
"off" nil
)
1188 (const :tag
"subscribed" t
)
1192 (defcustom gnus-process-mark ?
#
1194 :group
'gnus-group-visual
1195 :group
'gnus-summary-marks
1198 (defcustom gnus-large-newsgroup
200
1199 "The number of articles which indicates a large newsgroup.
1200 If the number of articles in a newsgroup is greater than this value,
1201 confirmation is required for selecting the newsgroup.
1202 If it is nil, no confirmation is required.
1204 Also see `gnus-large-ephemeral-newsgroup'."
1205 :group
'gnus-group-select
1206 :type
'(choice (const :tag
"No limit" nil
)
1209 (defcustom gnus-use-long-file-name
(not (memq system-type
'(usg-unix-v)))
1210 "Non-nil means that the default name of a file to save articles in is the group name.
1211 If it's nil, the directory form of the group name is used instead.
1213 If this variable is a list, and the list contains the element
1214 `not-score', long file names will not be used for score files; if it
1215 contains the element `not-save', long file names will not be used for
1216 saving; and if it contains the element `not-kill', long file names
1217 will not be used for kill files.
1219 Note that the default for this variable varies according to what system
1220 type you're using. On `usg-unix-v' this variable defaults to nil while
1221 on all other systems it defaults to t."
1223 :type
'(radio (sexp :format
"Non-nil\n"
1224 :match
(lambda (widget value
)
1225 (and value
(not (listp value
))))
1228 (checklist (const :format
"%v " not-score
)
1229 (const :format
"%v " not-save
)
1232 (defcustom gnus-kill-files-directory gnus-directory
1233 "Name of the directory where kill files will be stored (default \"~/News\")."
1234 :group
'gnus-score-files
1235 :group
'gnus-score-kill
1238 (defcustom gnus-save-score nil
1239 "If non-nil, save group scoring info."
1240 :group
'gnus-score-various
1244 (defcustom gnus-use-undo t
1245 "If non-nil, allow undoing in Gnus group mode buffers."
1249 (defcustom gnus-use-adaptive-scoring nil
1250 "If non-nil, use some adaptive scoring scheme.
1251 If a list, then the values `word' and `line' are meaningful. The
1252 former will perform adaption on individual words in the subject
1253 header while `line' will perform adaption on several headers."
1255 :group
'gnus-score-adapt
1256 :type
'(set (const word
) (const line
)))
1258 (defcustom gnus-use-cache
'passive
1259 "If nil, Gnus will ignore the article cache.
1260 If `passive', it will allow entering (and reading) articles
1261 explicitly entered into the cache. If anything else, use the
1262 cache to the full extent of the law."
1265 :type
'(choice (const :tag
"off" nil
)
1266 (const :tag
"passive" passive
)
1267 (const :tag
"active" t
)))
1269 (defcustom gnus-use-trees nil
1270 "If non-nil, display a thread tree buffer."
1274 (defcustom gnus-keep-backlog
20
1275 "If non-nil, Gnus will keep read articles for later re-retrieval.
1276 If it is a number N, then Gnus will only keep the last N articles
1277 read. If it is neither nil nor a number, Gnus will keep all read
1278 articles. This is not a good idea."
1280 :type
'(choice (const :tag
"off" nil
)
1285 (defcustom gnus-suppress-duplicates nil
1286 "If non-nil, Gnus will mark duplicate copies of the same article as read."
1290 (defcustom gnus-use-scoring t
1291 "If non-nil, enable scoring."
1295 (defcustom gnus-summary-prepare-exit-hook
1296 '(gnus-summary-expire-articles)
1297 "A hook called when preparing to exit from the summary buffer.
1298 It calls `gnus-summary-expire-articles' by default."
1299 :group
'gnus-summary-exit
1302 (defcustom gnus-novice-user t
1303 "Non-nil means that you are a Usenet novice.
1304 If non-nil, verbose messages may be displayed and confirmations may be
1309 (defcustom gnus-expert-user nil
1310 "Non-nil means that you will never be asked for confirmation about anything.
1311 That doesn't mean *anything* anything; particularly destructive
1312 commands will still require prompting."
1316 (defcustom gnus-interactive-catchup t
1317 "If non-nil, require your confirmation when catching up a group."
1318 :group
'gnus-group-select
1321 (defcustom gnus-interactive-exit t
1322 "If non-nil, require your confirmation when exiting Gnus.
1323 If `quiet', update any active summary buffers automatically
1324 first before exiting."
1326 :type
'(choice boolean
1329 (defcustom gnus-extract-address-components
'gnus-extract-address-components
1330 "Function for extracting address components from a From header.
1331 Two pre-defined function exist: `gnus-extract-address-components',
1332 which is the default, quite fast, and too simplistic solution, and
1333 `mail-extract-address-components', which works much better, but is
1335 :group
'gnus-summary-format
1336 :type
'(radio (function-item gnus-extract-address-components
)
1337 (function-item mail-extract-address-components
)
1338 (function :tag
"Other")))
1340 (defcustom gnus-shell-command-separator
";"
1341 "String used to separate shell commands."
1345 (defcustom gnus-valid-select-methods
1346 '(("nntp" post address prompt-address physical-address cloud
)
1347 ("nnspool" post address
)
1348 ("nnvirtual" post-mail virtual prompt-address
)
1349 ("nnmbox" mail respool address
)
1350 ("nnml" post-mail respool address
)
1351 ("nnmh" mail respool address
)
1352 ("nndir" post-mail prompt-address physical-address
)
1353 ("nneething" none address prompt-address physical-address
)
1354 ("nndoc" none address prompt-address
)
1355 ("nnbabyl" mail address respool
)
1356 ("nndraft" post-mail
)
1357 ("nnfolder" mail respool address
)
1358 ("nngateway" post-mail address prompt-address physical-address
)
1360 ("nnrss" none global
)
1361 ("nnagent" post-mail
)
1362 ("nnimap" post-mail address prompt-address physical-address respool
1364 ("nnmaildir" mail respool address server-marks
)
1366 "An alist of valid select methods.
1367 The first element of each list lists should be a string with the name
1368 of the select method. The other elements may be the category of
1369 this method (i. e., `post', `mail', `none' or whatever) or other
1370 properties that this method has (like being respoolable).
1371 If you implement a new select method, all you should have to change is
1372 this variable. I think."
1374 :type
'(repeat (group (string :tag
"Name")
1375 (radio-button-choice (const :format
"%v " post
)
1376 (const :format
"%v " mail
)
1377 (const :format
"%v " none
)
1379 (checklist :inline t
:greedy t
1380 (const :format
"%v " address
)
1383 (const :format
"%v " prompt-address
)
1384 (const :format
"%v " physical-address
)
1386 (const :format
"%v " respool
)
1387 (const server-marks
))))
1390 (defun gnus-redefine-select-method-widget ()
1391 "Recomputes the select-method widget based on the value of
1392 `gnus-valid-select-methods'."
1393 (define-widget 'gnus-select-method
'list
1394 "Widget for entering a select method."
1396 :tag
"Select Method"
1397 :args
`((choice :tag
"Method"
1398 ,@(mapcar (lambda (entry)
1399 (list 'const
:format
"%v\n"
1400 (intern (car entry
))))
1401 gnus-valid-select-methods
)
1402 (symbol :tag
"other"))
1403 (string :tag
"Address")
1404 (repeat :tag
"Options"
1408 (sexp :tag
"Value"))))))
1410 (gnus-redefine-select-method-widget)
1412 (defcustom gnus-updated-mode-lines
'(group article summary tree
)
1413 "List of buffers that should update their mode lines.
1414 The list may contain the symbols `group', `article', `tree' and
1415 `summary'. If the corresponding symbol is present, Gnus will keep
1416 that mode line updated with information that may be pertinent.
1417 If this variable is nil, screen refresh may be quicker."
1418 :group
'gnus-various
1419 :type
'(set (const group
)
1424 (defcustom gnus-mode-non-string-length
30
1425 "Max length of mode-line non-string contents.
1426 If this is nil, Gnus will take space as is needed, leaving the rest
1427 of the mode line intact."
1429 :group
'gnus-various
1430 :type
'(choice (const nil
)
1433 ;; There should be special validation for this.
1434 (define-widget 'gnus-email-address
'string
1435 "An email address.")
1437 (gnus-define-group-parameter
1440 "Return GROUP's to-address."
1442 "Alist of group regexps and correspondent to-addresses."
1443 :variable-group gnus-group-parameter
1444 :parameter-type
'(gnus-email-address :tag
"To Address")
1445 :parameter-document
"\
1446 This will be used when doing followups and posts.
1448 This is primarily useful in mail groups that represent closed
1449 mailing lists--mailing lists where it's expected that everybody that
1450 writes to the mailing list is subscribed to it. Since using this
1451 parameter ensures that the mail only goes to the mailing list itself,
1452 it means that members won't receive two copies of your followups.
1454 Using `to-address' will actually work whether the group is foreign or
1455 not. Let's say there's a group on the server that is called
1456 `fa.4ad-l'. This is a real newsgroup, but the server has gotten the
1457 articles from a mail-to-news gateway. Posting directly to this group
1458 is therefore impossible--you have to send mail to the mailing list
1461 The gnus-group-split mail splitting mechanism will behave as if this
1462 address was listed in gnus-group-split Addresses (see below).")
1464 (gnus-define-group-parameter
1467 "Return GROUP's to-list."
1469 "Alist of group regexps and correspondent to-lists."
1470 :variable-group gnus-group-parameter
1471 :parameter-type
'(gnus-email-address :tag
"To List")
1472 :parameter-document
"\
1473 This address will be used when doing a `a' in the group.
1475 It is totally ignored when doing a followup--except that if it is
1476 present in a news group, you'll get mail group semantics when doing
1479 The gnus-group-split mail splitting mechanism will behave as if this
1480 address was listed in gnus-group-split Addresses (see below).")
1482 (gnus-define-group-parameter
1486 "Return GROUP's subscription status."
1488 "Groups which are automatically considered subscribed."
1489 :variable-group gnus-group-parameter
1490 :parameter-type
'(const :tag
"Subscribed" t
)
1491 :parameter-document
"\
1492 Gnus assumed that you are subscribed to the To/List address.
1494 When constructing a list of subscribed groups using
1495 `gnus-find-subscribed-addresses', Gnus includes the To address given
1496 above, or the list address (if the To address has not been set).")
1498 (gnus-define-group-parameter
1501 :function gnus-group-auto-expirable-p
1503 "Check whether GROUP is auto-expirable or not."
1504 :variable gnus-auto-expirable-newsgroups
1505 :variable-default nil
1507 "Groups in which to automatically mark read articles as expirable.
1508 If non-nil, this should be a regexp that should match all groups in
1509 which to perform auto-expiry. This only makes sense for mail groups."
1510 :variable-group nnmail-expire
1511 :variable-type
'(choice (const nil
)
1513 :parameter-type
'(const :tag
"Automatic Expire" t
)
1515 "All articles that are read will be marked as expirable.")
1517 (gnus-define-group-parameter
1520 :function gnus-group-total-expirable-p
1522 "Check whether GROUP is total-expirable or not."
1523 :variable gnus-total-expirable-newsgroups
1524 :variable-default nil
1526 "Groups in which to perform expiry of all read articles.
1527 Use with extreme caution. All groups that match this regexp will be
1528 expiring - which means that all read articles will be deleted after
1529 \(say) one week. (This only goes for mail groups and the like, of
1531 :variable-group nnmail-expire
1532 :variable-type
'(choice (const nil
)
1534 :parameter-type
'(const :tag
"Total Expire" t
)
1536 "All read articles will be put through the expiry process
1538 This happens even if they are not marked as expirable.
1541 (gnus-define-group-parameter
1544 "Return the default charset of GROUP."
1545 :variable gnus-group-charset-alist
1547 '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5
)
1548 ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312
)
1549 ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2
)
1550 ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit
)
1551 ("\\(^\\|:\\)relcom\\>" koi8-r
)
1552 ("\\(^\\|:\\)fido7\\>" koi8-r
)
1553 ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2
)
1554 ("\\(^\\|:\\)israel\\>" iso-8859-1
)
1555 ("\\(^\\|:\\)han\\>" euc-kr
)
1556 ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5
)
1557 ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr
)
1558 ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1
))
1560 "Alist of regexps (to match group names) and default charsets to be used when reading."
1561 :variable-group gnus-charset
1562 :variable-type
'(repeat (list (regexp :tag
"Group")
1563 (symbol :tag
"Charset")))
1564 :parameter-type
'(symbol :tag
"Charset")
1565 :parameter-document
"\
1566 The default charset to use in the group.")
1568 (gnus-define-group-parameter
1572 "Return a posting method for GROUP."
1573 :variable gnus-post-method-alist
1575 "Alist of regexps (to match group names) and method to be used when
1576 posting an article."
1577 :variable-group gnus-group-foreign
1579 '(choice :tag
"Posting Method"
1580 (const :tag
"Use native server" native
)
1581 (const :tag
"Use current server" current
)
1582 (list :convert-widget
1584 (list 'sexp
:tag
"Methods"
1585 :value gnus-select-method
))))
1587 "Posting method for this group.")
1589 (gnus-define-group-parameter
1590 large-newsgroup-initial
1593 "Return GROUP's initial input of the number of articles."
1595 "Alist of group regexps and its initial input of the number of articles."
1596 :variable-group gnus-group-parameter
1597 :parameter-type
'(choice :tag
"Initial Input for Large Newsgroup"
1598 (const :tag
"All" nil
)
1600 :parameter-document
"\
1602 This number will be prompted as the initial value of the number of
1603 articles to list when the group is a large newsgroup (see
1604 `gnus-large-newsgroup'). If it is nil, the default value is the
1605 total number of articles in the group.")
1607 ;; The Gnus registry's ignored groups
1608 (gnus-define-group-parameter
1612 "Whether this group should be ignored by the registry."
1613 :variable gnus-registry-ignored-groups
1614 :variable-default
(mapcar
1615 (lambda (g) (list g t
))
1616 '("delayed$" "drafts$" "queue$" "INBOX$"
1617 "^nnmairix:" "^nnir:" "archive"))
1619 "Groups in which the registry should be turned off."
1620 :variable-group gnus-registry
1621 :variable-type
'(repeat
1623 (regexp :tag
"Group Name Regular Expression")
1624 (boolean :tag
"Ignored")))
1626 :parameter-type
'(boolean :tag
"Group Ignored by the Registry")
1628 "Whether the Gnus Registry should ignore this group.")
1630 ;; group parameters for spam processing added by Ted Zlatanov <tzz@lifelogs.com>
1631 (defcustom gnus-install-group-spam-parameters t
1632 "Disable the group parameters for spam detection.
1633 Enable if `G c' in XEmacs is giving you trouble, and make sure to submit a bug report."
1638 (when gnus-install-group-spam-parameters
1639 (defvar gnus-group-spam-classification-spam t
1640 "Spam group classification (requires spam.el).
1641 This group contains spam messages. On summary entry, unread messages
1642 will be marked as spam. On summary exit, the specified spam
1643 processors will be invoked on spam-marked messages, then those
1644 messages will be expired, so the spam processor will only see a
1645 spam-marked message once.")
1647 (defvar gnus-group-spam-classification-ham
'ask
1648 "The ham value for the spam group parameter (requires spam.el).
1649 On summary exit, the specified ham processors will be invoked on
1650 ham-marked messages. Exercise caution, since the ham processor will
1651 see the same message more than once because there is no ham message
1654 (gnus-define-group-parameter
1658 "The spam type (spam, ham, or neither) of the group."
1659 :variable gnus-spam-newsgroup-contents
1660 :variable-default nil
1662 "Group classification (spam, ham, or neither). Only
1663 meaningful when spam.el is loaded. If non-nil, this should be a
1664 list of group name regexps associated with a classification for
1665 each one. In spam groups, new articles are marked as spam on
1666 summary entry. There is other behavior associated with ham and
1667 no classification when spam.el is loaded - see the manual."
1668 :variable-group spam
1669 :variable-type
'(repeat
1670 (list :tag
"Group contents spam/ham classification"
1671 (regexp :tag
"Group")
1673 (variable-item gnus-group-spam-classification-spam
)
1674 (variable-item gnus-group-spam-classification-ham
)
1675 (const :tag
"Unclassified" nil
))))
1677 :parameter-type
'(list :tag
"Group contents spam/ham classification"
1678 (choice :tag
"Group contents classification for spam sorting"
1679 (variable-item gnus-group-spam-classification-spam
)
1680 (variable-item gnus-group-spam-classification-ham
)
1681 (const :tag
"Unclassified" nil
)))
1683 "The spam classification (spam, ham, or neither) of this group.
1684 When a spam group is entered, all unread articles are marked as
1685 spam. There is other behavior associated with ham and no
1686 classification when spam.el is loaded - see the manual.")
1688 (gnus-define-group-parameter
1692 "The address to get spam resent (through spam-report-resend)."
1693 :variable gnus-spam-resend-to
1694 :variable-default nil
1696 "The address to get spam resent (through spam-report-resend)."
1697 :variable-group spam
1698 :variable-type
'(repeat
1699 (list :tag
"Group address for resending spam"
1700 (regexp :tag
"Group")
1701 (string :tag
"E-mail address for resending spam (requires the spam-use-resend exit processor)")))
1702 :parameter-type
'string
:tag
"E-mail address for resending spam (requires the spam-use-resend exit processor)"
1704 "The address to get spam resent (through spam-report-resend).")
1706 (gnus-define-group-parameter
1710 "The address to get ham resent (through spam-report-resend)."
1711 :variable gnus-ham-resend-to
1712 :variable-default nil
1714 "The address to get ham resent (through spam-report-resend)."
1715 :variable-group spam
1716 :variable-type
'(repeat
1717 (list :tag
"Group address for resending ham"
1718 (regexp :tag
"Group")
1719 (string :tag
"E-mail address for resending ham (requires the spam-use-resend exit processor)")))
1720 :parameter-type
'string
:tag
"E-mail address for resending ham (requires the spam-use-resend exit processor)"
1722 "The address to get ham resent (through spam-report-resend).")
1724 (defvar gnus-group-spam-exit-processor-ifile
"ifile"
1725 "OBSOLETE: The ifile summary exit spam processor.")
1727 (defvar gnus-group-spam-exit-processor-stat
"stat"
1728 "OBSOLETE: The spam-stat summary exit spam processor.")
1730 (defvar gnus-group-spam-exit-processor-bogofilter
"bogofilter"
1731 "OBSOLETE: The Bogofilter summary exit spam processor.")
1733 (defvar gnus-group-spam-exit-processor-blacklist
"blacklist"
1734 "OBSOLETE: The Blacklist summary exit spam processor.")
1736 (defvar gnus-group-spam-exit-processor-report-gmane
"report-gmane"
1737 "OBSOLETE: The Gmane reporting summary exit spam processor.
1738 Only applicable to NNTP groups with articles from Gmane. See spam-report.el")
1740 (defvar gnus-group-spam-exit-processor-spamoracle
"spamoracle-spam"
1741 "OBSOLETE: The spamoracle summary exit spam processor.")
1743 (defvar gnus-group-ham-exit-processor-ifile
"ifile-ham"
1744 "OBSOLETE: The ifile summary exit ham processor.
1745 Only applicable to non-spam (unclassified and ham) groups.")
1747 (defvar gnus-group-ham-exit-processor-bogofilter
"bogofilter-ham"
1748 "OBSOLETE: The Bogofilter summary exit ham processor.
1749 Only applicable to non-spam (unclassified and ham) groups.")
1751 (defvar gnus-group-ham-exit-processor-stat
"stat-ham"
1752 "OBSOLETE: The spam-stat summary exit ham processor.
1753 Only applicable to non-spam (unclassified and ham) groups.")
1755 (defvar gnus-group-ham-exit-processor-whitelist
"whitelist"
1756 "OBSOLETE: The whitelist summary exit ham processor.
1757 Only applicable to non-spam (unclassified and ham) groups.")
1759 (defvar gnus-group-ham-exit-processor-BBDB
"bbdb"
1760 "OBSOLETE: The BBDB summary exit ham processor.
1761 Only applicable to non-spam (unclassified and ham) groups.")
1763 (defvar gnus-group-ham-exit-processor-copy
"copy"
1764 "OBSOLETE: The ham copy exit ham processor.
1765 Only applicable to non-spam (unclassified and ham) groups.")
1767 (defvar gnus-group-ham-exit-processor-spamoracle
"spamoracle-ham"
1768 "OBSOLETE: The spamoracle summary exit ham processor.
1769 Only applicable to non-spam (unclassified and ham) groups.")
1771 (gnus-define-group-parameter
1776 :tag
"Spam Summary Exit Processor"
1778 (list :tag
"Spam Summary Exit Processor Choices"
1780 (const :tag
"Spam: Bogofilter" (spam spam-use-bogofilter
))
1781 (const :tag
"Spam: Blacklist" (spam spam-use-blacklist
))
1782 (const :tag
"Spam: Bsfilter" (spam spam-use-bsfilter
))
1783 (const :tag
"Spam: Gmane Report" (spam spam-use-gmane
))
1784 (const :tag
"Spam: Resend Message"(spam spam-use-resend
))
1785 (const :tag
"Spam: ifile" (spam spam-use-ifile
))
1786 (const :tag
"Spam: Spam Oracle" (spam spam-use-spamoracle
))
1787 (const :tag
"Spam: Spam-stat" (spam spam-use-stat
))
1788 (const :tag
"Spam: SpamAssassin" (spam spam-use-spamassassin
))
1789 (const :tag
"Spam: CRM114" (spam spam-use-crm114
))
1790 (const :tag
"Ham: BBDB" (ham spam-use-BBDB
))
1791 (const :tag
"Ham: Bogofilter" (ham spam-use-bogofilter
))
1792 (const :tag
"Ham: Bsfilter" (ham spam-use-bsfilter
))
1793 (const :tag
"Ham: Copy" (ham spam-use-ham-copy
))
1794 (const :tag
"Ham: Resend Message" (ham spam-use-resend
))
1795 (const :tag
"Ham: ifile" (ham spam-use-ifile
))
1796 (const :tag
"Ham: Spam Oracle" (ham spam-use-spamoracle
))
1797 (const :tag
"Ham: Spam-stat" (ham spam-use-stat
))
1798 (const :tag
"Ham: SpamAssassin" (ham spam-use-spamassassin
))
1799 (const :tag
"Ham: CRM114" (ham spam-use-crm114
))
1800 (const :tag
"Ham: Whitelist" (ham spam-use-whitelist
))
1801 (variable-item gnus-group-spam-exit-processor-ifile
)
1802 (variable-item gnus-group-spam-exit-processor-stat
)
1803 (variable-item gnus-group-spam-exit-processor-bogofilter
)
1804 (variable-item gnus-group-spam-exit-processor-blacklist
)
1805 (variable-item gnus-group-spam-exit-processor-spamoracle
)
1806 (variable-item gnus-group-spam-exit-processor-report-gmane
)
1807 (variable-item gnus-group-ham-exit-processor-bogofilter
)
1808 (variable-item gnus-group-ham-exit-processor-ifile
)
1809 (variable-item gnus-group-ham-exit-processor-stat
)
1810 (variable-item gnus-group-ham-exit-processor-whitelist
)
1811 (variable-item gnus-group-ham-exit-processor-BBDB
)
1812 (variable-item gnus-group-ham-exit-processor-spamoracle
)
1813 (variable-item gnus-group-ham-exit-processor-copy
))))
1815 "Which spam or ham processors will be applied when the summary is exited."
1816 :variable gnus-spam-process-newsgroups
1817 :variable-default nil
1819 "Groups in which to automatically process spam or ham articles with
1820 a backend on summary exit. If non-nil, this should be a list of group
1821 name regexps that should match all groups in which to do automatic
1822 spam processing, associated with the appropriate processor."
1823 :variable-group spam
1825 '(repeat :tag
"Spam/Ham Processors"
1826 (list :tag
"Spam Summary Exit Processor Choices"
1827 (regexp :tag
"Group Regexp")
1829 :tag
"Spam/Ham Summary Exit Processor"
1830 (const :tag
"Spam: Bogofilter" (spam spam-use-bogofilter
))
1831 (const :tag
"Spam: Blacklist" (spam spam-use-blacklist
))
1832 (const :tag
"Spam: Bsfilter" (spam spam-use-bsfilter
))
1833 (const :tag
"Spam: Gmane Report" (spam spam-use-gmane
))
1834 (const :tag
"Spam: Resend Message"(spam spam-use-resend
))
1835 (const :tag
"Spam: ifile" (spam spam-use-ifile
))
1836 (const :tag
"Spam: Spam-stat" (spam spam-use-stat
))
1837 (const :tag
"Spam: Spam Oracle" (spam spam-use-spamoracle
))
1838 (const :tag
"Spam: SpamAssassin" (spam spam-use-spamassassin
))
1839 (const :tag
"Spam: CRM114" (spam spam-use-crm114
))
1840 (const :tag
"Ham: BBDB" (ham spam-use-BBDB
))
1841 (const :tag
"Ham: Bogofilter" (ham spam-use-bogofilter
))
1842 (const :tag
"Ham: Bsfilter" (ham spam-use-bsfilter
))
1843 (const :tag
"Ham: Copy" (ham spam-use-ham-copy
))
1844 (const :tag
"Ham: Resend Message" (ham spam-use-resend
))
1845 (const :tag
"Ham: ifile" (ham spam-use-ifile
))
1846 (const :tag
"Ham: Spam-stat" (ham spam-use-stat
))
1847 (const :tag
"Ham: Spam Oracle" (ham spam-use-spamoracle
))
1848 (const :tag
"Ham: SpamAssassin" (ham spam-use-spamassassin
))
1849 (const :tag
"Ham: CRM114" (ham spam-use-crm114
))
1850 (const :tag
"Ham: Whitelist" (ham spam-use-whitelist
))
1851 (variable-item gnus-group-spam-exit-processor-ifile
)
1852 (variable-item gnus-group-spam-exit-processor-stat
)
1853 (variable-item gnus-group-spam-exit-processor-bogofilter
)
1854 (variable-item gnus-group-spam-exit-processor-blacklist
)
1855 (variable-item gnus-group-spam-exit-processor-spamoracle
)
1856 (variable-item gnus-group-spam-exit-processor-report-gmane
)
1857 (variable-item gnus-group-ham-exit-processor-bogofilter
)
1858 (variable-item gnus-group-ham-exit-processor-ifile
)
1859 (variable-item gnus-group-ham-exit-processor-stat
)
1860 (variable-item gnus-group-ham-exit-processor-whitelist
)
1861 (variable-item gnus-group-ham-exit-processor-BBDB
)
1862 (variable-item gnus-group-ham-exit-processor-spamoracle
)
1863 (variable-item gnus-group-ham-exit-processor-copy
))))
1866 "Which spam or ham processors will be applied when the summary is exited.")
1868 (gnus-define-group-parameter
1872 '(boolean :tag
"Spam autodetection")
1874 "Should spam be autodetected (with spam-split) in this group?"
1875 :variable gnus-spam-autodetect
1876 :variable-default nil
1878 "Groups in which spam should be autodetected when they are entered.
1879 Only unseen articles will be examined, unless
1880 spam-autodetect-recheck-messages is set."
1881 :variable-group spam
1884 :tag
"Autodetection setting"
1886 (regexp :tag
"Group Regexp")
1889 "Spam autodetection.
1890 Only unseen articles will be examined, unless
1891 spam-autodetect-recheck-messages is set.")
1893 (gnus-define-group-parameter
1894 spam-autodetect-methods
1897 '(choice :tag
"Spam autodetection-specific methods"
1900 (set :tag
"Use specific methods"
1901 (variable-item spam-use-blacklist
)
1902 (variable-item spam-use-gmane-xref
)
1903 (variable-item spam-use-regex-headers
)
1904 (variable-item spam-use-regex-body
)
1905 (variable-item spam-use-whitelist
)
1906 (variable-item spam-use-BBDB
)
1907 (variable-item spam-use-ifile
)
1908 (variable-item spam-use-spamoracle
)
1909 (variable-item spam-use-crm114
)
1910 (variable-item spam-use-spamassassin
)
1911 (variable-item spam-use-spamassassin-headers
)
1912 (variable-item spam-use-bsfilter
)
1913 (variable-item spam-use-bsfilter-headers
)
1914 (variable-item spam-use-stat
)
1915 (variable-item spam-use-blackholes
)
1916 (variable-item spam-use-hashcash
)
1917 (variable-item spam-use-bogofilter-headers
)
1918 (variable-item spam-use-bogofilter
)))
1920 "Methods to be used for autodetection in each group"
1921 :variable gnus-spam-autodetect-methods
1922 :variable-default nil
1924 "Methods for autodetecting spam per group.
1925 Requires the spam-autodetect parameter. Only unseen articles
1926 will be examined, unless spam-autodetect-recheck-messages is
1928 :variable-group spam
1931 :tag
"Autodetection methods"
1933 (regexp :tag
"Group Regexp")
1937 (set :tag
"Use specific methods"
1938 (variable-item spam-use-blacklist
)
1939 (variable-item spam-use-gmane-xref
)
1940 (variable-item spam-use-regex-headers
)
1941 (variable-item spam-use-regex-body
)
1942 (variable-item spam-use-whitelist
)
1943 (variable-item spam-use-BBDB
)
1944 (variable-item spam-use-ifile
)
1945 (variable-item spam-use-spamoracle
)
1946 (variable-item spam-use-crm114
)
1947 (variable-item spam-use-stat
)
1948 (variable-item spam-use-blackholes
)
1949 (variable-item spam-use-hashcash
)
1950 (variable-item spam-use-spamassassin
)
1951 (variable-item spam-use-spamassassin-headers
)
1952 (variable-item spam-use-bsfilter
)
1953 (variable-item spam-use-bsfilter-headers
)
1954 (variable-item spam-use-bogofilter-headers
)
1955 (variable-item spam-use-bogofilter
)))))
1957 "Spam autodetection methods.
1958 Requires the spam-autodetect parameter. Only unseen articles
1959 will be examined, unless spam-autodetect-recheck-messages is
1962 (gnus-define-group-parameter
1963 spam-process-destination
1966 '(choice :tag
"Destination for spam-processed articles at summary exit"
1967 (string :tag
"Move to a group")
1968 (repeat :tag
"Move to multiple groups"
1969 (string :tag
"Destination group"))
1970 (const :tag
"Expire" nil
))
1972 "Where spam-processed articles will go at summary exit."
1973 :variable gnus-spam-process-destinations
1974 :variable-default nil
1976 "Groups in which to explicitly send spam-processed articles to
1977 another group, or expire them (the default). If non-nil, this should
1978 be a list of group name regexps that should match all groups in which
1979 to do spam-processed article moving, associated with the destination
1980 group or nil for explicit expiration. This only makes sense for
1982 :variable-group spam
1985 :tag
"Spam-processed articles destination"
1987 (regexp :tag
"Group Regexp")
1989 :tag
"Destination for spam-processed articles at summary exit"
1990 (string :tag
"Move to a group")
1991 (repeat :tag
"Move to multiple groups"
1992 (string :tag
"Destination group"))
1993 (const :tag
"Expire" nil
))))
1995 "Where spam-processed articles will go at summary exit.")
1997 (gnus-define-group-parameter
1998 ham-process-destination
2002 :tag
"Destination for ham articles at summary exit from a spam group"
2003 (string :tag
"Move to a group")
2004 (repeat :tag
"Move to multiple groups"
2005 (string :tag
"Destination group"))
2006 (const :tag
"Respool" respool
)
2007 (const :tag
"Do nothing" nil
))
2009 "Where ham articles will go at summary exit from a spam group."
2010 :variable gnus-ham-process-destinations
2011 :variable-default nil
2013 "Groups in which to explicitly send ham articles to
2014 another group, or do nothing (the default). If non-nil, this should
2015 be a list of group name regexps that should match all groups in which
2016 to do ham article moving, associated with the destination
2017 group or nil for explicit ignoring. This only makes sense for
2018 mail groups, and only works in spam groups."
2019 :variable-group spam
2022 :tag
"Ham articles destination"
2024 (regexp :tag
"Group Regexp")
2026 :tag
"Destination for ham articles at summary exit from spam group"
2027 (string :tag
"Move to a group")
2028 (repeat :tag
"Move to multiple groups"
2029 (string :tag
"Destination group"))
2030 (const :tag
"Respool" respool
)
2031 (const :tag
"Expire" nil
))))
2033 "Where ham articles will go at summary exit from a spam group.")
2035 (gnus-define-group-parameter
2038 :parameter-type
'(list :tag
"Ham mark choices"
2040 (variable-item gnus-del-mark
)
2041 (variable-item gnus-read-mark
)
2042 (variable-item gnus-ticked-mark
)
2043 (variable-item gnus-killed-mark
)
2044 (variable-item gnus-kill-file-mark
)
2045 (variable-item gnus-low-score-mark
)))
2048 "Marks considered ham (positively not spam). Such articles will be
2049 processed as ham (non-spam) on group exit. When nil, the global
2050 spam-ham-marks variable takes precedence."
2051 :variable-default
'((".*" ((gnus-del-mark
2055 gnus-low-score-mark
))))
2056 :variable-group spam
2058 "Groups in which to explicitly set the ham marks to some value.")
2060 (gnus-define-group-parameter
2063 :parameter-type
'(list :tag
"Spam mark choices"
2065 (variable-item gnus-spam-mark
)
2066 (variable-item gnus-killed-mark
)
2067 (variable-item gnus-kill-file-mark
)
2068 (variable-item gnus-low-score-mark
)))
2071 "Marks considered spam.
2072 Such articles will be processed as spam on group exit. When nil, the global
2073 spam-spam-marks variable takes precedence."
2074 :variable-default
'((".*" ((gnus-spam-mark))))
2075 :variable-group spam
2077 "Groups in which to explicitly set the spam marks to some value."))
2079 (defcustom gnus-group-uncollapsed-levels
1
2080 "Number of group name elements to leave alone when making a short group name."
2081 :group
'gnus-group-visual
2084 (defcustom gnus-group-use-permanent-levels nil
2085 "If non-nil, once you set a level, Gnus will use this level."
2086 :group
'gnus-group-levels
2091 (defcustom gnus-load-hook nil
2092 "A hook run while Gnus is loaded."
2096 (defcustom gnus-apply-kill-hook
'(gnus-apply-kill-file)
2097 "A hook called to apply kill files to a group.
2098 This hook is intended to apply a kill file to the selected newsgroup.
2099 The function `gnus-apply-kill-file' is called by default.
2101 Since a general kill file is too heavy to use only for a few
2102 newsgroups, I recommend you to use a lighter hook function. For
2103 example, if you'd like to apply a kill file to articles which contains
2104 a string `rmgroup' in subject in newsgroup `control', you can use the
2107 (setq gnus-apply-kill-hook
2110 (cond ((string-match \"control\" gnus-newsgroup-name)
2111 (gnus-kill \"Subject\" \"rmgroup\")
2112 (gnus-expunge \"X\"))))))"
2113 :group
'gnus-score-kill
2114 :options
'(gnus-apply-kill-file)
2117 (defcustom gnus-group-change-level-function nil
2118 "Function run when a group level is changed.
2119 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
2120 :group
'gnus-group-levels
2121 :type
'(choice (const nil
)
2126 (defcustom gnus-visual
2127 '(summary-highlight group-highlight article-highlight
2129 summary-menu group-menu article-menu
2130 tree-highlight menu highlight
2131 browse-menu server-menu
2132 page-marker tree-menu binary-menu pick-menu
)
2133 "Enable visual features.
2134 If `visual' is disabled, there will be no menus and few faces. Most of
2135 the visual customization options below will be ignored. Gnus will use
2136 less space and be faster as a result.
2138 This variable can also be a list of visual elements to switch on. For
2139 instance, to switch off all visual things except menus, you can say:
2141 (setq gnus-visual \\='(menu))
2143 Valid elements include `summary-highlight', `group-highlight',
2144 `article-highlight', `mouse-face', `summary-menu', `group-menu',
2145 `article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
2146 `server-menu', `page-marker', `tree-menu', `binary-menu', and`pick-menu'."
2149 :type
'(set (const summary-highlight
)
2150 (const group-highlight
)
2151 (const article-highlight
)
2153 (const summary-menu
)
2155 (const article-menu
)
2156 (const tree-highlight
)
2166 ;; Byte-compiler warning.
2167 (defvar gnus-visual
)
2168 ;; Find out whether the gnus-visual TYPE is wanted.
2169 (defun gnus-visual-p (&optional type class
)
2170 (and gnus-visual
; Has to be non-nil, at least.
2171 (if (not type
) ; We don't care about type.
2173 (if (listp gnus-visual
) ; It's a list, so we check it.
2174 (or (memq type gnus-visual
)
2175 (memq class gnus-visual
))
2178 (defcustom gnus-mouse-face
2180 (if (gnus-visual-p 'mouse-face
'highlight
)
2181 (if (boundp 'gnus-mouse-face
)
2182 (or gnus-mouse-face
'highlight
)
2186 "Face used for group or summary buffer mouse highlighting.
2187 The line beneath the mouse pointer will be highlighted with this
2192 (defcustom gnus-article-save-directory gnus-directory
2193 "Name of the directory articles will be saved in (default \"~/News\")."
2194 :group
'gnus-article-saving
2197 (defvar gnus-plugged t
2198 "Whether Gnus is plugged or not.")
2200 (defcustom gnus-agent-cache t
2201 "Controls use of the agent cache while plugged.
2202 When set, Gnus will prefer using the locally stored content rather
2203 than re-fetching it from the server. You also need to enable
2204 `gnus-agent' for this to have any affect."
2209 (defcustom gnus-default-charset
'undecided
2210 "Default charset assumed to be used when viewing non-ASCII characters.
2211 This variable is overridden on a group-to-group basis by the
2212 `gnus-group-charset-alist' variable and is only used on groups not
2213 covered by that variable."
2215 :group
'gnus-charset
)
2217 ;; Fixme: Doc reference to agent.
2218 (defcustom gnus-agent t
2219 "Whether we want to use the Gnus agent or not.
2221 You may customize gnus-agent to disable its use. However, some
2222 back ends have started to use the agent as a client-side cache.
2223 Disabling the agent may result in noticeable loss of performance."
2228 (defcustom gnus-other-frame-function
#'gnus
2229 "Function called by the command `gnus-other-frame' when starting Gnus."
2231 :type
'(choice (function-item gnus
)
2232 (function-item gnus-no-server
)
2233 (function-item gnus-slave
)
2234 (function-item gnus-slave-no-server
)))
2236 (declare-function gnus-group-get-new-news
"gnus-group")
2238 (defcustom gnus-other-frame-resume-function
#'gnus-group-get-new-news
2239 "Function called by the command `gnus-other-frame' when resuming Gnus."
2242 :type
'(choice (function-item gnus
)
2243 (function-item gnus-group-get-new-news
)
2244 (function-item gnus-no-server
)
2245 (function-item gnus-slave
)
2246 (function-item gnus-slave-no-server
)))
2248 (defcustom gnus-other-frame-parameters nil
2249 "Frame parameters used by `gnus-other-frame' to create a Gnus frame."
2251 :type
'(repeat (cons :format
"%v"
2252 (symbol :tag
"Parameter")
2253 (sexp :tag
"Value"))))
2255 (defcustom gnus-user-agent
'(emacs gnus type
)
2256 "Which information should be exposed in the User-Agent header.
2258 Can be a list of symbols or a string. Valid symbols are `gnus'
2259 \(show Gnus version) and `emacs' \(show Emacs version). In
2260 addition to the Emacs version, you can add `codename' \(show
2261 \(S)XEmacs codename) or either `config' \(show system
2262 configuration) or `type' \(show system type). If you set it to
2263 a string, be sure to use a valid format, see RFC 2616."
2266 :group
'gnus-message
2267 :type
'(choice (list (set :inline t
2268 (const gnus
:tag
"Gnus version")
2269 (const emacs
:tag
"Emacs version")
2270 (choice :tag
"system"
2271 (const type
:tag
"system type")
2272 (const config
:tag
"system configuration"))
2273 (const codename
:tag
"Emacs codename")))
2276 ;; Convert old (< 2005-01-10) symbol type values:
2277 (when (symbolp gnus-user-agent
)
2278 (setq gnus-user-agent
2279 (cond ((eq gnus-user-agent
'emacs-gnus-config
)
2280 '(emacs gnus config
))
2281 ((eq gnus-user-agent
'emacs-gnus-type
)
2283 ((eq gnus-user-agent
'emacs-gnus
)
2285 ((eq gnus-user-agent
'gnus
)
2287 (t gnus-user-agent
)))
2288 (gnus-message 1 "Converted `gnus-user-agent' to `%s'." gnus-user-agent
)
2290 (if (get 'gnus-user-agent
'saved-value
)
2291 (customize-save-variable 'gnus-user-agent gnus-user-agent
)
2292 (gnus-message 1 "Edit your init file to make this change permanent.")
2296 ;;; Internal variables
2298 (defvar gnus-agent-gcc-header
"X-Gnus-Agent-Gcc")
2299 (defvar gnus-agent-meta-information-header
"X-Gnus-Agent-Meta-Information")
2300 (defvar gnus-agent-method-p-cache nil
2301 ; Reset each time gnus-agent-covered-methods is changed else
2302 ; gnus-agent-method-p may mis-report a methods status.
2304 (defvar gnus-agent-target-move-group-header
"X-Gnus-Agent-Move-To")
2305 (defvar gnus-draft-meta-information-header
"X-Draft-From")
2306 (defvar gnus-group-get-parameter-function
#'gnus-group-get-parameter
)
2307 (defvar gnus-original-article-buffer
" *Original Article*")
2308 (defvar gnus-newsgroup-name nil
)
2309 (defvar gnus-ephemeral-servers nil
)
2310 (defvar gnus-server-method-cache nil
)
2311 (defvar gnus-extended-servers nil
)
2313 ;; The carpal mode has been removed, but define the variable for
2314 ;; backwards compatibility.
2315 (defvar gnus-carpal nil
)
2316 (make-obsolete-variable 'gnus-carpal nil
"Emacs 24.1")
2318 (defvar gnus-agent-fetching nil
2319 "Whether Gnus agent is in fetching mode.")
2321 (defvar gnus-agent-covered-methods nil
2322 "A list of servers, NOT methods, showing which servers are covered by the agent.")
2324 (defvar gnus-command-method nil
2325 "Dynamically bound variable that says what the current back end is.")
2327 (defvar gnus-current-select-method nil
2328 "The current method for selecting a newsgroup.")
2330 (defvar gnus-tree-buffer
"*Tree*"
2331 "Buffer where Gnus thread trees are displayed.")
2333 ;; Variable holding the user answers to all method prompts.
2334 (defvar gnus-method-history nil
)
2336 ;; Variable holding the user answers to all mail method prompts.
2337 (defvar gnus-mail-method-history nil
)
2339 ;; Variable holding the user answers to all group prompts.
2340 (defvar gnus-group-history nil
)
2342 (defvar gnus-server-alist nil
2343 "Servers created by Gnus, or via the server buffer.
2344 Servers defined in the user's config files do not appear here.
2345 This variable is persisted in the user's .newsrc.eld file.")
2347 (defcustom gnus-cache-directory
2348 (nnheader-concat gnus-directory
"cache/")
2349 "The directory where cached articles will be stored."
2353 (defvar gnus-predefined-server-alist
2356 (nnspool-spool-directory ,gnus-cache-directory
)
2357 (nnspool-nov-directory ,gnus-cache-directory
)
2358 (nnspool-active-file
2359 ,(nnheader-concat gnus-cache-directory
"active"))))
2360 "List of predefined (convenience) servers.")
2362 (defconst gnus-article-mark-lists
2363 '((marked . tick
) (replied . reply
)
2364 (expirable . expire
) (killed . killed
)
2365 (bookmarks . bookmark
) (dormant . dormant
)
2366 (scored . score
) (saved . save
)
2367 (cached . cache
) (downloadable . download
)
2368 (unsendable . unsend
) (forwarded . forward
)
2369 (seen . seen
) (unexist . unexist
)))
2371 (defconst gnus-article-special-mark-lists
2380 ;; Propagate flags to server, with the following exceptions:
2381 ;; `seen' is private to each gnus installation
2382 ;; `cache' is an internal gnus flag for each gnus installation
2383 ;; `download' is an agent flag private to each gnus installation
2384 ;; `unsend' are for nndraft groups only
2385 ;; `score' is not a proper mark
2386 ;; `bookmark': don't propagate it, or fix the bug in update-mark.
2387 (defconst gnus-article-unpropagated-mark-lists
2388 '(seen cache download unsend score bookmark unexist
)
2389 "Marks that shouldn't be propagated to back ends.
2390 Typical marks are those that make no sense in a standalone back end,
2391 such as a mark that says whether an article is stored in the cache
2392 \(which doesn't make sense in a standalone back end).")
2394 (defvar gnus-headers-retrieved-by nil
)
2395 (defvar gnus-article-reply nil
)
2396 (defvar gnus-override-method nil
)
2397 (defvar gnus-opened-servers nil
)
2399 (defvar gnus-current-kill-article nil
)
2401 (defvar gnus-have-read-active-file nil
)
2403 (defconst gnus-maintainer
2404 "submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)"
2405 "The mail address of the Gnus maintainers.")
2407 (defconst gnus-bug-package
2409 "The package to use in the bug submission.")
2411 (defvar gnus-info-nodes
2412 '((gnus-group-mode "(gnus)Group Buffer")
2413 (gnus-summary-mode "(gnus)Summary Buffer")
2414 (gnus-article-mode "(gnus)Article Buffer")
2415 (gnus-server-mode "(gnus)Server Buffer")
2416 (gnus-browse-mode "(gnus)Browse Foreign Server")
2417 (gnus-tree-mode "(gnus)Tree Display"))
2418 "Alist of major modes and related Info nodes.")
2420 (defvar gnus-summary-buffer
"*Summary*")
2421 (defvar gnus-article-buffer
"*Article*")
2422 (defvar gnus-server-buffer
"*Server*")
2424 (defvar gnus-slave nil
2425 "Whether this Gnus is a slave or not.")
2427 (defvar gnus-batch-mode nil
2428 "Whether this Gnus is running in batch mode or not.")
2430 (defvar gnus-variable-list
2431 '(gnus-newsrc-options gnus-newsrc-options-n
2432 gnus-newsrc-last-checked-date
2433 gnus-newsrc-alist gnus-server-alist
2434 gnus-killed-list gnus-zombie-list
2435 gnus-topic-topology gnus-topic-alist
2437 gnus-cloud-covered-servers
2438 gnus-cloud-file-timestamps
)
2439 "Gnus variables saved in the quick startup file.")
2441 (defvar gnus-newsrc-alist nil
2442 "Assoc list of read articles.
2443 `gnus-newsrc-hashtb' should be kept so that both hold the same information.")
2445 (defvar gnus-registry-alist nil
2446 "Assoc list of registry data.
2447 gnus-registry.el will populate this if it's loaded.")
2449 (defvar gnus-newsrc-hashtb nil
2450 "Hashtable of `gnus-newsrc-alist'.")
2452 (defvar gnus-killed-list nil
2453 "List of killed newsgroups.")
2455 (defvar gnus-killed-hashtb nil
2456 "Hash table equivalent of `gnus-killed-list'.")
2458 (defvar gnus-zombie-list nil
2459 "List of almost dead newsgroups.")
2461 (defvar gnus-description-hashtb nil
2462 "Descriptions of newsgroups.")
2464 (defvar gnus-list-of-killed-groups nil
2465 "List of newsgroups that have recently been killed by the user.")
2467 (defvar gnus-active-hashtb nil
2468 "Hashtable of active articles.")
2470 (defvar gnus-moderated-hashtb nil
2471 "Hashtable of moderated newsgroups.")
2473 ;; Save window configuration.
2474 (defvar gnus-prev-winconf nil
)
2476 (defvar gnus-reffed-article-number nil
)
2478 (defvar gnus-dead-summary nil
)
2480 (defvar gnus-invalid-group-regexp
"[: `'\"/]\\|^$"
2481 "Regexp matching invalid groups.")
2483 (defvar gnus-other-frame-object nil
2484 "A frame object which will be created by `gnus-other-frame'.")
2486 ;;; End of variables.
2488 ;; Define some autoload functions Gnus might use.
2491 ;; This little mapcar goes through the list below and marks the
2492 ;; symbols in question as autoloaded functions.
2495 (let ((interactive (nth 1 (memq ':interactive package
))))
2499 (when (consp function
)
2500 (setq keymap
(car (memq 'keymap function
)))
2501 (setq function
(car function
)))
2502 (unless (fboundp function
)
2503 (autoload function
(car package
) nil interactive keymap
))))
2504 (if (eq (nth 1 package
) ':interactive
)
2507 '(("info" :interactive t Info-goto-node
)
2508 ("qp" quoted-printable-decode-region quoted-printable-decode-string
)
2509 ("ps-print" ps-print-preprint
)
2510 ("message" :interactive t
2511 message-send-and-exit message-yank-original
)
2512 ("babel" babel-as-string
)
2513 ("nnmail" nnmail-split-fancy nnmail-article-group
)
2514 ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers
)
2515 ;; This is only used in message.el, which has an autoload.
2516 ("rmailout" rmail-output
)
2517 ;; Next two used in gnus-util, which has autoloads, and contrib/sendmail.
2518 ("rmail" rmail-count-new-messages rmail-show-message
2519 ;; Next two only used in gnus-util.
2520 rmail-summary-exists rmail-select-summary
)
2521 ;; Only used in gnus-util, which has an autoload.
2522 ("rmailsum" rmail-update-summary
)
2523 ("gnus-xmas" gnus-xmas-splash
)
2524 ("score-mode" :interactive t gnus-score-mode
)
2525 ("gnus-mh" gnus-summary-save-article-folder
2526 gnus-Folder-save-name gnus-folder-save-name
)
2527 ("gnus-mh" :interactive t gnus-summary-save-in-folder
)
2528 ("gnus-demon" gnus-demon-add-scanmail
2529 gnus-demon-add-rescan gnus-demon-add-scan-timestamps
2530 gnus-demon-add-disconnection gnus-demon-add-handler
2531 gnus-demon-remove-handler
)
2532 ("gnus-demon" :interactive t
2533 gnus-demon-init gnus-demon-cancel
)
2534 ("gnus-fun" gnus-convert-gray-x-face-to-xpm gnus-display-x-face-in-from
2535 gnus-convert-image-to-gray-x-face gnus-convert-face-to-png
2536 gnus-face-from-file
)
2537 ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
2538 gnus-tree-open gnus-tree-close
)
2539 ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
2540 gnus-server-server-name
)
2541 ("gnus-srvr" gnus-browse-foreign-server
)
2542 ("gnus-cite" :interactive t
2543 gnus-article-highlight-citation gnus-article-hide-citation-maybe
2544 gnus-article-hide-citation gnus-article-fill-cited-article
2545 gnus-article-hide-citation-in-followups
2546 gnus-article-fill-cited-long-lines
)
2547 ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
2548 gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
2549 gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score
)
2550 ("gnus-registry" gnus-try-warping-via-registry
2551 gnus-registry-handle-action
)
2552 ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
2553 gnus-cache-possibly-remove-articles gnus-cache-request-article
2554 gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
2555 gnus-cache-enter-remove-article gnus-cached-article-p
2556 gnus-cache-open gnus-cache-close gnus-cache-update-article
2557 gnus-cache-articles-in-group
)
2558 ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
2559 gnus-cache-remove-article gnus-summary-insert-cached-articles
)
2560 ("gnus-score" :interactive t
2561 gnus-summary-increase-score gnus-summary-set-score
2562 gnus-summary-raise-thread gnus-summary-raise-same-subject
2563 gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
2564 gnus-summary-lower-thread gnus-summary-lower-same-subject
2565 gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
2566 gnus-summary-current-score gnus-score-delta-default
2567 gnus-score-flush-cache gnus-score-close
2568 gnus-possibly-score-headers gnus-score-followup-article
2569 gnus-score-followup-thread
)
2571 (gnus-summary-score-map keymap
) gnus-score-save gnus-score-headers
2572 gnus-current-score-file-nondirectory gnus-score-adaptive
2573 gnus-score-find-trace gnus-score-file-name
)
2574 ("gnus-cus" :interactive t gnus-group-customize gnus-score-customize
)
2575 ("gnus-topic" :interactive t gnus-topic-mode
)
2576 ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2577 gnus-subscribe-topics
)
2578 ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode
)
2579 ("gnus-uu" (gnus-uu-extract-map keymap
) (gnus-uu-mark-map keymap
))
2580 ("gnus-uu" :interactive t
2581 gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2582 gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2583 gnus-uu-mark-by-regexp gnus-uu-mark-all
2584 gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2585 gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2586 gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2587 gnus-uu-decode-binhex gnus-uu-decode-uu-view
2588 gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2589 gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
2590 gnus-uu-decode-binhex-view gnus-uu-unmark-thread
2591 gnus-uu-mark-over gnus-uu-post-news gnus-uu-invert-processable
)
2592 ("gnus-uu" gnus-uu-delete-work-dir gnus-uu-unmark-thread
)
2593 ("gnus-msg" (gnus-summary-send-map keymap
)
2594 gnus-article-mail gnus-copy-article-buffer gnus-extended-version
)
2595 ("gnus-msg" :interactive t
2596 gnus-group-post-news gnus-group-mail gnus-group-news
2597 gnus-summary-post-news gnus-summary-news-other-window
2598 gnus-summary-followup gnus-summary-followup-with-original
2599 gnus-summary-cancel-article gnus-summary-supersede-article
2600 gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2601 gnus-summary-mail-forward gnus-summary-mail-other-window
2602 gnus-summary-resend-message gnus-summary-resend-bounced-mail
2603 gnus-summary-wide-reply gnus-summary-followup-to-mail
2604 gnus-summary-followup-to-mail-with-original gnus-bug
2605 gnus-summary-wide-reply-with-original
2606 gnus-summary-post-forward gnus-summary-wide-reply-with-original
2607 gnus-summary-post-forward
)
2608 ("gnus-picon" :interactive t gnus-treat-from-picon
)
2609 ("smiley" :interactive t smiley-region
)
2610 ("gnus-win" gnus-configure-windows gnus-add-configuration
)
2611 ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2612 gnus-list-of-unread-articles gnus-list-of-read-articles
2613 gnus-offer-save-summaries gnus-make-thread-indent-array
2614 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2615 gnus-summary-skip-intangible gnus-summary-article-number
2616 gnus-data-header gnus-data-find
)
2617 ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2618 gnus-group-list-groups gnus-group-first-unread-group
2619 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2620 gnus-group-setup-buffer gnus-group-get-new-news
2621 gnus-group-make-help-group gnus-group-update-group
2622 gnus-group-iterate gnus-group-group-name
)
2623 ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2624 gnus-backlog-remove-article
)
2625 ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2626 gnus-article-prepare gnus-article-set-window-start
2627 gnus-article-next-page gnus-article-prev-page
2628 gnus-request-article-this-buffer gnus-article-mode
2629 gnus-article-setup-buffer gnus-narrow-to-page
2630 gnus-article-delete-invisible-text gnus-treat-article
)
2631 ("gnus-art" :interactive t
2632 gnus-article-hide-headers gnus-article-hide-boring-headers
2633 gnus-article-treat-overstrike
2634 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2635 gnus-article-display-x-face gnus-article-de-quoted-unreadable
2636 gnus-article-de-base64-unreadable
2637 gnus-article-decode-HZ
2638 gnus-article-wash-html
2639 gnus-article-unsplit-urls
2640 gnus-article-hide-pem gnus-article-hide-signature
2641 gnus-article-strip-leading-blank-lines gnus-article-date-local
2642 gnus-article-date-original gnus-article-date-lapsed
2643 ;;gnus-article-show-all-headers
2644 gnus-article-edit-mode gnus-article-edit-article
2645 gnus-article-edit-done gnus-article-decode-encoded-words
2646 gnus-start-date-timer gnus-stop-date-timer
2647 gnus-mime-view-all-parts
)
2648 ("gnus-int" gnus-request-type
)
2649 ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
2650 gnus-dribble-enter gnus-read-init-file gnus-dribble-touch
2651 gnus-check-reasonable-setup
)
2652 ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2653 gnus-dup-enter-articles
)
2654 ("gnus-eform" gnus-edit-form
)
2655 ("gnus-logic" gnus-score-advanced
)
2656 ("gnus-undo" gnus-undo-mode gnus-undo-register
)
2657 ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2658 gnus-async-prefetch-article gnus-async-prefetch-remove-group
2659 gnus-async-halt-prefetch
)
2660 ("gnus-agent" gnus-open-agent gnus-agent-get-function
2661 gnus-agent-save-active gnus-agent-method-p
2662 gnus-agent-get-undownloaded-list gnus-agent-fetch-session
2663 gnus-summary-set-agent-mark gnus-agent-save-group-info
2664 gnus-agent-request-article gnus-agent-retrieve-headers
2665 gnus-agent-store-article gnus-agent-group-covered-p
)
2666 ("gnus-agent" :interactive t
2667 gnus-unplugged gnus-agentize gnus-agent-batch
)
2668 ("gnus-vm" :interactive t gnus-summary-save-in-vm
2669 gnus-summary-save-article-vm
)
2670 ("compface" uncompface
)
2671 ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-queue
)
2672 ("gnus-mlspl" gnus-group-split gnus-group-split-fancy
)
2673 ("gnus-mlspl" :interactive t gnus-group-split-setup
2674 gnus-group-split-update
)
2675 ("gnus-delay" gnus-delay-initialize
))))
2677 ;;; gnus-sum.el thingies
2680 (defcustom gnus-summary-line-format
"%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n"
2681 "The format specification of the lines in the summary buffer.
2683 It works along the same lines as a normal formatting string,
2684 with some simple extensions.
2686 %N Article number, left padded with spaces (string)
2688 %s Subject if it is at the root of a thread, and \"\"
2690 %n Name of the poster (string)
2691 %a Extracted name of the poster (string)
2692 %A Extracted address of the poster (string)
2693 %F Contents of the From: header (string)
2694 %f Contents of the From: or To: headers (string)
2695 %x Contents of the Xref: header (string)
2696 %D Date of the article (string)
2697 %d Date of the article (string) in DD-MMM format
2698 %o Date of the article (string) in YYYYMMDD`T'HHMMSS
2700 %M Message-id of the article (string)
2701 %r References of the article (string)
2702 %c Number of characters in the article (integer)
2703 %k Pretty-printed version of the above (string)
2704 For example, \"1.2k\" or \"0.4M\".
2705 %L Number of lines in the article (integer)
2706 %I Indentation based on thread level (a string of
2708 %B A complex trn-style thread tree (string)
2709 The variables `gnus-sum-thread-*' can be used for
2711 %T A string with two possible values: 80 spaces if the
2712 article is on thread level two or larger and 0 spaces
2714 %R \"A\" if this article has been replied to, \" \"
2715 otherwise (character)
2716 %U \"Read\" status of this article.
2717 See Info node `(gnus)Marking Articles'
2718 %[ Opening bracket (character, \"[\" or \"<\")
2719 %] Closing bracket (character, \"]\" or \">\")
2720 %> Spaces of length thread-level (string)
2721 %< Spaces of length (- 20 thread-level) (string)
2722 %i Article score (number)
2723 %z Article zcore (character)
2724 %t Number of articles under the current thread (number).
2725 %e Whether the thread is empty or not (character).
2726 %V Total thread score (number).
2727 %P The line number (number).
2728 %O Download mark (character).
2729 %* If present, indicates desired cursor position
2730 (instead of after first colon).
2731 %u User defined specifier. The next character in the
2732 format string should be a letter. Gnus will call the
2733 function gnus-user-format-function-X, where X is the
2734 letter following %u. The function will be passed the
2735 current header as argument. The function should
2736 return a string, which will be inserted into the
2737 summary just like information from any other summary
2739 &user-date; Age sensitive date format. Various date format is
2740 defined in `gnus-user-date-format-alist'.
2743 The %U (status), %R (replied) and %z (zcore) specs have to be handled
2744 with care. For reasons of efficiency, Gnus will compute what column
2745 these characters will end up in, and \"hard-code\" that. This means that
2746 it is invalid to have these specs after a variable-length spec. Well,
2747 you might not be arrested, but your summary buffer will look strange,
2748 which is bad enough.
2750 The smart choice is to have these specs as far to the left as
2753 This restriction may disappear in later versions of Gnus.
2755 General format specifiers can also be used.
2756 See Info node `(gnus)Formatting Variables'."
2757 :link
'(custom-manual "(gnus)Formatting Variables")
2759 :group
'gnus-summary-format
)
2762 ;;; Skeleton keymaps
2765 (defun gnus-suppress-keymap (keymap)
2766 (suppress-keymap keymap
)
2767 (let ((keys `([delete] "\177" "\M-u"))) ;[mouse-2]
2769 (define-key keymap (pop keys) 'undefined))))
2771 (defvar gnus-article-mode-map
2772 (let ((keymap (make-sparse-keymap)))
2773 (gnus-suppress-keymap keymap)
2775 (defvar gnus-summary-mode-map
2776 (let ((keymap (make-keymap)))
2777 (gnus-suppress-keymap keymap)
2779 (defvar gnus-group-mode-map
2780 (let ((keymap (make-keymap)))
2781 (gnus-suppress-keymap keymap)
2786 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2787 ;; If you want the cursor to go somewhere else, set these two
2788 ;; functions in some startup hook to whatever you want.
2789 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
2790 (defalias 'gnus-group-position-point 'gnus-goto-colon)
2792 ;;; Various macros and substs.
2794 (defun gnus-header-from (header)
2795 (mail-header-from header))
2797 (defmacro gnus-gethash (string hashtable)
2798 "Get hash value of STRING in HASHTABLE."
2799 `(symbol-value (intern-soft ,string ,hashtable)))
2801 (defmacro gnus-gethash-safe (string hashtable)
2802 "Get hash value of STRING in HASHTABLE.
2803 Return nil if not defined."
2804 `(let ((sym (intern-soft ,string ,hashtable)))
2805 (and (boundp sym) (symbol-value sym))))
2807 (defmacro gnus-sethash (string value hashtable)
2808 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
2809 `(set (intern ,string ,hashtable) ,value))
2810 (put 'gnus-sethash 'edebug-form-spec '(form form form))
2812 (defmacro gnus-group-unread (group)
2813 "Get the currently computed number of unread articles in GROUP."
2814 `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
2816 (defmacro gnus-group-entry (group)
2817 "Get the newsrc entry for GROUP."
2818 `(gnus-gethash ,group gnus-newsrc-hashtb))
2820 (defmacro gnus-active (group)
2821 "Get active info on GROUP."
2822 `(gnus-gethash ,group gnus-active-hashtb))
2824 (defmacro gnus-set-active (group active)
2825 "Set GROUP's active info."
2826 `(gnus-sethash ,group ,active gnus-active-hashtb))
2828 ;; Info access macros.
2830 (defmacro gnus-info-group (info)
2832 (defmacro gnus-info-rank (info)
2834 (defmacro gnus-info-read (info)
2836 (defmacro gnus-info-marks (info)
2838 (defmacro gnus-info-method (info)
2840 (defmacro gnus-info-params (info)
2843 (defmacro gnus-info-level (info)
2844 `(let ((rank (gnus-info-rank ,info)))
2848 (defmacro gnus-info-score (info)
2849 `(let ((rank (gnus-info-rank ,info)))
2850 (or (and (consp rank) (cdr rank)) 0)))
2852 (defmacro gnus-info-set-group (info group)
2853 `(setcar ,info ,group))
2854 (defmacro gnus-info-set-rank (info rank)
2855 `(setcar (nthcdr 1 ,info) ,rank))
2856 (defmacro gnus-info-set-read (info read)
2857 `(setcar (nthcdr 2 ,info) ,read))
2858 (defmacro gnus-info-set-marks (info marks &optional extend)
2860 `(gnus-info-set-entry ,info ,marks 3)
2861 `(setcar (nthcdr 3 ,info) ,marks)))
2862 (defmacro gnus-info-set-method (info method &optional extend)
2864 `(gnus-info-set-entry ,info ,method 4)
2865 `(setcar (nthcdr 4 ,info) ,method)))
2866 (defmacro gnus-info-set-params (info params &optional extend)
2868 `(gnus-info-set-entry ,info ,params 5)
2869 `(setcar (nthcdr 5 ,info) ,params)))
2871 (defun gnus-info-set-entry (info entry number)
2872 ;; Extend the info until we have enough elements.
2873 (while (<= (length info) number)
2874 (nconc info (list nil)))
2876 (setcar (nthcdr number info) entry))
2878 (defmacro gnus-info-set-level (info level)
2879 `(let ((rank (cdr ,info)))
2880 (if (consp (car rank))
2881 (setcar (car rank) ,level)
2882 (setcar rank ,level))))
2883 (defmacro gnus-info-set-score (info score)
2884 `(let ((rank (cdr ,info)))
2885 (if (consp (car rank))
2886 (setcdr (car rank) ,score)
2887 (setcar rank (cons (car rank) ,score)))))
2889 (defmacro gnus-get-info (group)
2890 `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
2892 (defun gnus-set-info (group info)
2893 (setcar (nthcdr 2 (gnus-gethash group gnus-newsrc-hashtb))
2901 (defvar gnus-shutdown-alist nil)
2903 (defun gnus-add-shutdown (function &rest symbols)
2904 "Run FUNCTION whenever one of SYMBOLS is shut down."
2905 (push (cons function symbols) gnus-shutdown-alist))
2907 (defun gnus-shutdown (symbol)
2908 "Shut down everything that waits for SYMBOL."
2909 (dolist (entry gnus-shutdown-alist)
2910 (when (memq symbol (cdr entry))
2911 (funcall (car entry)))))
2915 ;;; Gnus Utility Functions
2918 (defun gnus-find-subscribed-addresses ()
2919 "Return a regexp matching the addresses of all subscribed mail groups.
2920 It consists of the `to-address' or `to-list' parameter of all groups
2921 with a `subscribed' parameter."
2922 (let (group address addresses)
2923 (dolist (entry (cdr gnus-newsrc-alist))
2924 (setq group (car entry))
2925 (when (gnus-parameter-subscribed group)
2926 (setq address (mail-strip-quoted-names
2927 (or (gnus-group-fast-parameter group 'to-address)
2928 (gnus-group-fast-parameter group 'to-list))))
2930 (cl-pushnew address addresses :test #'equal))))
2932 (list (mapconcat #'regexp-quote addresses "\\|")))))
2934 (defmacro gnus-string-or (&rest strings)
2935 "Return the first element of STRINGS that is a non-blank string.
2936 STRINGS will be evaluated in normal `or' order."
2937 `(gnus-string-or-1 (list ,@strings)))
2939 (defun gnus-string-or-1 (strings)
2942 (setq string (pop strings))
2943 (if (string-match "^[ \t]*$" string)
2945 (setq strings nil)))
2948 (defun gnus-version (&optional arg)
2949 "Version number of this version of Gnus.
2950 If ARG, insert string at point."
2953 (insert (message gnus-version))
2954 (message gnus-version)))
2956 (defun gnus-continuum-version (&optional version)
2957 "Return VERSION as a floating point number."
2959 (setq version gnus-version))
2960 (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
2961 (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
2962 (let ((alpha (and (match-beginning 1) (match-string 1 version)))
2963 (number (match-string 2 version))
2965 (unless (string-match
2966 "\\([0-9]\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?" number)
2967 (error "Invalid version string: %s" version))
2968 (setq major (string-to-number (match-string 1 number))
2969 minor (string-to-number (match-string 2 number))
2970 least (if (match-beginning 3)
2971 (string-to-number (match-string 3 number))
2975 (format "%1.2f00%02d%02d"
2976 (if (member alpha '("(ding)" "d"))
2980 (- (aref (downcase alpha) 0) ?t)))
2983 (format "%d.%02d%02d" major minor least))))))
2985 (defvar gnus-info-buffer)
2987 (defun gnus-info-find-node (&optional nodename)
2988 "Find Info documentation of Gnus."
2990 ;; Enlarge info window if needed.
2991 (let (gnus-info-buffer)
2992 (Info-goto-node (or nodename (cadr (assq major-mode gnus-info-nodes))))
2993 (setq gnus-info-buffer (current-buffer))
2994 (gnus-configure-windows 'info)))
2997 ;;; gnus-interactive
3000 (defvar gnus-current-prefix-symbol nil
3001 "Current prefix symbol.")
3003 (defvar gnus-current-prefix-symbols nil
3004 "List of current prefix symbols.")
3006 (defun gnus-interactive (string)
3007 "Return a list that can be fed to `interactive'.
3008 See `interactive' for full documentation.
3010 Adds the following specs:
3012 y -- The current symbolic prefix.
3013 Y -- A list of the current symbolic prefix(es).
3014 A -- Article number.
3015 H -- Article header.
3019 (while (< i (length string))
3020 (string-match ".\\([^\n]*\\)\n?" string i)
3021 (setq c (aref string i))
3023 (setq prompt (match-string 1 string)))
3024 (setq i (match-end 0))
3025 ;; We basically emulate just about everything that
3026 ;; `interactive' does, but add the specs listed above.
3030 (completing-read prompt obarray 'fboundp t))
3032 (read-buffer prompt (current-buffer) t))
3034 (read-buffer prompt (other-buffer (current-buffer))))
3038 (completing-read prompt obarray 'commandp t))
3042 (read-directory-name prompt nil default-directory 'lambda))
3044 (read-file-name prompt nil nil 'lambda))
3046 (read-file-name prompt))
3048 (read-key-sequence prompt))
3050 (error "Not implemented spec"))
3052 (error "Not implemented spec"))
3056 (error "Not implemented spec"))
3058 (string-to-number (read-from-minibuffer prompt)))
3060 (prefix-numeric-value current-prefix-arg))
3066 (read-string prompt))
3068 (intern (read-string prompt)))
3070 (read-variable prompt))
3072 (read-minibuffer prompt))
3074 (eval-minibuffer prompt))
3075 ;; And here the new specs come.
3077 gnus-current-prefix-symbol)
3079 gnus-current-prefix-symbols)
3081 (gnus-group-group-name))
3083 (gnus-summary-skip-intangible)
3084 (or (get-text-property (point) 'gnus-number)
3085 (gnus-summary-last-subject)))
3087 (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
3089 (error "Non-implemented spec")))
3093 (push (if (< (point) (mark)) (point) (mark)) out)
3094 (push (if (> (point) (mark)) (point) (mark)) out))))
3095 (setq out (delq 'gnus-prefix-nil out))
3098 (defun gnus-symbolic-argument ()
3099 "Read a symbolic argument and a command, and then execute command."
3101 (let* ((in-command (this-command-keys))
3102 (command in-command)
3103 gnus-current-prefix-symbols
3104 gnus-current-prefix-symbol
3106 (while (equal in-command command)
3107 (message "%s-" (key-description (this-command-keys)))
3108 (push (intern (char-to-string (read-char))) syms)
3109 (setq command (read-key-sequence nil t)))
3110 (setq gnus-current-prefix-symbols (nreverse syms)
3111 gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
3112 (call-interactively (key-binding command t))))
3114 ;;; More various functions.
3116 (defsubst gnus-check-backend-function (func group)
3117 "Check whether GROUP supports function FUNC.
3118 GROUP can either be a string (a group name) or a select method."
3120 (let ((method (if (stringp group)
3121 (car (gnus-find-method-for-group group))
3123 (unless (featurep method)
3125 (fboundp (intern (format "%s-%s" method func))))))
3127 (defun gnus-group-read-only-p (&optional group)
3128 "Check whether GROUP supports editing or not.
3129 If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
3130 that that variable is buffer-local to the summary buffers."
3131 (let ((group (or group gnus-newsgroup-name)))
3132 (not (gnus-check-backend-function 'request-replace-article group))))
3134 (defun gnus-virtual-group-p (group)
3135 "Say whether GROUP is virtual or not."
3136 (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
3137 gnus-valid-select-methods)))
3139 (defun gnus-news-group-p (group &optional article)
3140 "Return non-nil if GROUP (and ARTICLE) come from a news server."
3141 (cond ((gnus-member-of-valid 'post group) ;Ordinary news group
3142 t) ;is news of course.
3143 ((not (gnus-member-of-valid 'post-mail group)) ;Non-combined.
3144 nil) ;must be mail then.
3145 ((vectorp article) ;Has header info.
3146 (eq (gnus-request-type group (mail-header-id article)) 'news))
3147 ((null article) ;Hasn't header info
3148 (eq (gnus-request-type group) 'news)) ;(unknown ==> mail)
3149 ((< article 0) ;Virtual message
3150 nil) ;we don't know, guess mail.
3151 (t ;Has positive number
3152 (eq (gnus-request-type group article) 'news)))) ;use it.
3154 ;; Check whether to use long file names.
3155 (defun gnus-use-long-file-name (symbol)
3156 ;; The variable has to be set...
3157 (and gnus-use-long-file-name
3158 ;; If it isn't a list, then we return t.
3159 (or (not (listp gnus-use-long-file-name))
3160 ;; If it is a list, and the list contains `symbol', we
3162 (not (memq symbol gnus-use-long-file-name)))))
3164 ;; Generate a unique new group name.
3165 (defun gnus-generate-new-group-name (leaf)
3168 (while (gnus-group-entry name)
3169 (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
3172 (defun gnus-ephemeral-group-p (group)
3173 "Say whether GROUP is ephemeral or not."
3174 (gnus-group-get-parameter group 'quit-config t))
3176 (defun gnus-group-quit-config (group)
3177 "Return the quit-config of GROUP."
3178 (gnus-group-get-parameter group 'quit-config t))
3180 (defun gnus-kill-ephemeral-group (group)
3181 "Remove ephemeral GROUP from relevant structures."
3182 (gnus-sethash group nil gnus-newsrc-hashtb))
3184 (defun gnus-simplify-mode-line ()
3185 "Make mode lines a bit simpler."
3186 (setq mode-line-modified "--")
3187 (when (listp mode-line-format)
3188 (make-local-variable 'mode-line-format)
3189 (setq mode-line-format (copy-sequence mode-line-format))
3190 (when (equal (nth 3 mode-line-format) " ")
3191 (setcar (nthcdr 3 mode-line-format) " "))))
3193 ;;; Servers and groups.
3195 (defsubst gnus-server-add-address (method)
3196 (let ((method-name (symbol-name (car method))))
3197 (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
3198 (not (assq (intern (concat method-name "-address")) method))
3199 (memq 'physical-address (assq (car method)
3200 gnus-valid-select-methods)))
3201 (append method (list (list (intern (concat method-name "-address"))
3205 (defsubst gnus-method-to-server (method &optional nocache no-enter-cache)
3207 (setq method (or method gnus-select-method))
3209 ;; Perhaps it is already in the cache.
3211 (mapc (lambda (name-method)
3212 (if (equal (cdr name-method) method)
3213 (throw 'server-name (car name-method))))
3214 gnus-server-method-cache))
3216 (dolist (server-alist
3217 (list gnus-server-alist
3218 gnus-predefined-server-alist))
3219 (mapc (lambda (name-method)
3220 (when (gnus-methods-equal-p (cdr name-method) method)
3221 (unless (member name-method gnus-server-method-cache)
3222 (push name-method gnus-server-method-cache))
3223 (throw 'server-name (car name-method))))
3226 (let* ((name (if (member (cadr method) '(nil ""))
3227 (format "%s" (car method))
3228 (format "%s:%s" (car method) (cadr method))))
3229 (name-method (cons name method)))
3230 (when (and (not (member name-method gnus-server-method-cache))
3231 (not no-enter-cache)
3232 (not (assoc (car name-method) gnus-server-method-cache)))
3233 (push name-method gnus-server-method-cache))
3236 (defsubst gnus-server-to-method (server)
3237 "Map virtual server names to select methods."
3238 (or (and server (listp server) server)
3239 (cdr (assoc server gnus-server-method-cache))
3242 ;; Perhaps this is the native server?
3243 (and (equal server "native") gnus-select-method)
3244 ;; It should be in the server alist.
3245 (cdr (assoc server gnus-server-alist))
3246 ;; It could be in the predefined server alist.
3247 (cdr (assoc server gnus-predefined-server-alist))
3248 ;; If not, we look through all the opened server
3249 ;; to see whether we can find it there.
3250 (let ((opened gnus-opened-servers))
3252 (not (equal server (format "%s:%s" (caaar opened)
3256 ;; It could be a named method, search all servers
3257 (let ((servers gnus-secondary-select-methods))
3259 (not (equal server (format "%s:%s" (caar servers)
3263 ;; This could be some sort of foreign server that I
3264 ;; simply haven't opened (yet). Do a brute-force scan
3265 ;; of the entire gnus-newsrc-alist for the server name
3266 ;; of every method. As a side-effect, loads the
3267 ;; gnus-server-method-cache so this only happens once,
3269 (let ((alist (cdr gnus-newsrc-alist))
3272 (setq method (gnus-info-method (pop alist)))
3273 (when (and (not (stringp method))
3275 (gnus-method-to-server method nil t)))
3280 (not (assoc server gnus-server-method-cache)))
3281 (push (cons server result) gnus-server-method-cache))
3284 (defsubst gnus-server-get-method (group method)
3285 ;; Input either a server name, and extended server name, or a
3286 ;; select method, and return a select method.
3287 (cond ((stringp method)
3288 (gnus-server-to-method method))
3289 ((equal method gnus-select-method)
3291 ((and (stringp (car method))
3293 (gnus-server-extend-method group method))
3296 (equal (cadr method) ""))
3299 (gnus-server-add-address method))))
3301 (defmacro gnus-method-equal (ss1 ss2)
3302 "Say whether two servers are equal."
3306 (and (= (length s1) (length s2))
3308 (while (and s1 (member (car s1) s2))
3312 (defun gnus-methods-equal-p (m1 m2)
3313 (let ((m1 (or m1 gnus-select-method))
3314 (m2 (or m2 gnus-select-method)))
3316 (and (eq (car m1) (car m2))
3317 (or (not (memq 'address (assoc (symbol-name (car m1))
3318 gnus-valid-select-methods)))
3319 (equal (nth 1 m1) (nth 1 m2)))))))
3321 (defsubst gnus-sloppily-equal-method-parameters (m1 m2)
3322 ;; Check parameters for sloppy equality.
3323 (let ((p1 (copy-sequence (cddr m1)))
3324 (p2 (copy-sequence (cddr m2)))
3327 (while (setq e1 (pop p1))
3328 (unless (setq e2 (assq (car e1) p2))
3329 ;; The parameter doesn't exist in p2.
3331 (setq p2 (delq e2 p2))
3332 (unless (equal e1 e2)
3333 (if (not (and (stringp (cadr e1))
3334 (stringp (cadr e2))))
3336 ;; Special-case string parameter comparison so that we
3337 ;; can uniquify them.
3338 (let ((s1 (cadr e1))
3340 (when (string-match "/\\'" s1)
3341 (setq s1 (directory-file-name s1)))
3342 (when (string-match "/\\'" s2)
3343 (setq s2 (directory-file-name s2)))
3344 (unless (equal s1 s2)
3345 (cl-return nil))))))
3346 ;; If p2 now is empty, they were equal.
3349 (defun gnus-method-ephemeral-p (method)
3351 (dolist (ephemeral gnus-ephemeral-servers)
3352 (when (gnus-sloppily-equal-method-parameters method ephemeral)
3356 (defun gnus-methods-sloppily-equal (m1 m2)
3360 ;; Type and name are equal.
3362 (eq (car m1) (car m2))
3363 (equal (cadr m1) (cadr m2))
3364 (gnus-sloppily-equal-method-parameters m1 m2))))
3366 (defun gnus-server-equal (m1 m2)
3367 "Say whether two methods are equal."
3368 (let ((m1 (cond ((null m1) gnus-select-method)
3369 ((stringp m1) (gnus-server-to-method m1))
3371 (m2 (cond ((null m2) gnus-select-method)
3372 ((stringp m2) (gnus-server-to-method m2))
3374 (gnus-method-equal m1 m2)))
3376 (defun gnus-servers-using-backend (backend)
3377 "Return a list of known servers using BACKEND."
3378 (let ((opened gnus-opened-servers)
3381 (when (eq backend (caaar opened))
3382 (push (caar opened) out))
3386 (defun gnus-archive-server-wanted-p ()
3387 "Say whether the user wants to use the archive server."
3389 ((or (not gnus-message-archive-method)
3390 (not gnus-message-archive-group))
3392 ((and gnus-message-archive-method gnus-message-archive-group)
3395 (let ((active (cadr (assq 'nnfolder-active-file
3396 gnus-message-archive-method))))
3398 (file-exists-p active))))))
3400 (defsubst gnus-method-to-server-name (method)
3402 (format "%s" (car method))
3404 (or (assoc (format "%s" (car method))
3405 (gnus-methods-using 'address))
3406 (gnus-server-equal method gnus-message-archive-method))
3408 (not (string= (nth 1 method) "")))
3409 (concat "+" (nth 1 method)))))
3411 (defsubst gnus-method-to-full-server-name (method)
3412 (format "%s+%s" (car method) (nth 1 method)))
3414 (defun gnus-group-prefixed-name (group method &optional full)
3415 "Return the whole name from GROUP and METHOD.
3416 Call with full set to get the fully qualified group name (even if the
3418 (when (stringp method)
3419 (setq method (gnus-server-to-method method)))
3420 (if (or (not method)
3421 (and (not full) (gnus-server-equal method "native"))
3422 ;;;!!! This might not be right. We'll see...
3423 ;(string-match ":" group)
3426 (concat (gnus-method-to-server-name method) ":" group)))
3428 (defun gnus-group-full-name (group method)
3429 "Return the full name from GROUP and METHOD, even if the method is native."
3430 (gnus-group-prefixed-name group method t))
3432 (defun gnus-group-guess-full-name-from-command-method (group)
3433 "Guess the full name from GROUP, even if the method is native."
3434 (if (gnus-group-prefixed-p group)
3436 (gnus-group-full-name group gnus-command-method)))
3438 (defun gnus-group-real-prefix (group)
3439 "Return the prefix of the current group name."
3441 (if (string-match "^[^:]+:" group)
3442 (substring group 0 (match-end 0))
3446 (defun gnus-group-short-name (group)
3447 "Return the short group name."
3448 (let ((prefix (gnus-group-real-prefix group)))
3449 (if (< 0 (length prefix))
3450 (substring group (length prefix) nil)
3453 (defun gnus-group-prefixed-p (group)
3454 "Return the prefix of the current group name."
3455 (< 0 (length (gnus-group-real-prefix group))))
3457 (declare-function gnus-group-decoded-name "gnus-group" (string))
3459 (defun gnus-summary-buffer-name (group)
3460 "Return the summary buffer name of GROUP."
3461 (concat "*Summary " (gnus-group-decoded-name group) "*"))
3463 (defun gnus-group-method (group)
3464 "Return the server or method used for selecting GROUP.
3465 You should probably use `gnus-find-method-for-group' instead."
3466 (let ((prefix (gnus-group-real-prefix group)))
3467 (if (equal prefix "")
3469 (let ((servers gnus-opened-servers)
3471 backend possible found)
3472 (if (string-match "^[^\\+]+\\+" prefix)
3473 (setq backend (intern (substring prefix 0 (1- (match-end 0))))
3474 server (substring prefix (match-end 0) (1- (length prefix))))
3475 (setq backend (intern (substring prefix 0 (1- (length prefix))))))
3477 (when (eq (caaar servers) backend)
3478 (setq possible (caar servers))
3479 (when (equal (cadaar servers) server)
3480 (setq found (caar servers))))
3482 (or (car (rassoc found gnus-server-alist))
3484 (car (rassoc possible gnus-server-alist))
3486 (list backend server))))))
3488 (defsubst gnus-native-method-p (method)
3489 "Return whether METHOD is the native select method."
3490 (gnus-method-equal method gnus-select-method))
3492 (defsubst gnus-secondary-method-p (method)
3493 "Return whether METHOD is a secondary select method."
3494 (let ((methods gnus-secondary-select-methods)
3495 (gmethod (inline (gnus-server-get-method nil method))))
3497 (not (gnus-method-equal
3498 (inline (gnus-server-get-method nil (car methods)))
3500 (setq methods (cdr methods)))
3503 (defun gnus-method-simplify (method)
3504 "Return the shortest uniquely identifying string or method for METHOD."
3505 (cond ((stringp method)
3507 ((gnus-native-method-p method)
3509 ((gnus-secondary-method-p method)
3510 (format "%s:%s" (nth 0 method) (nth 1 method)))
3514 (defun gnus-groups-from-server (server)
3515 "Return a list of all groups that are fetched from SERVER."
3516 (let ((alist (cdr gnus-newsrc-alist))
3518 (while (setq info (pop alist))
3519 (when (gnus-server-equal (gnus-info-method info) server)
3520 (push (gnus-info-group info) groups)))
3521 (sort groups 'string<)))
3523 (defun gnus-group-foreign-p (group)
3524 "Say whether a group is foreign or not."
3525 (and (not (gnus-group-native-p group))
3526 (not (gnus-group-secondary-p group))))
3528 (defun gnus-group-native-p (group)
3529 "Say whether the group is native or not."
3530 (not (string-match ":" group)))
3532 (defun gnus-group-secondary-p (group)
3533 "Say whether the group is secondary or not."
3534 (gnus-secondary-method-p (gnus-find-method-for-group group)))
3536 (defun gnus-parameters-get-parameter (group)
3537 "Return the group parameters for GROUP from `gnus-parameters'."
3538 (let ((case-fold-search (if (eq gnus-parameters-case-fold-search 'default)
3540 gnus-parameters-case-fold-search))
3542 (dolist (elem gnus-parameters)
3543 (when (string-match (car elem) group)
3545 (nconc (gnus-expand-group-parameters
3546 (car elem) (cdr elem) group)
3550 (defun gnus-expand-group-parameter (match value group)
3551 "Use MATCH to expand VALUE in GROUP."
3552 (let ((start (string-match match group)))
3554 (let ((matched-string (substring group start (match-end 0))))
3555 ;; Build match groups
3556 (string-match match matched-string)
3557 (replace-match value nil nil matched-string))
3560 (defun gnus-expand-group-parameters (match parameters group)
3561 "Go through PARAMETERS and expand them according to the match data."
3563 (dolist (elem parameters)
3565 ((and (stringp (cdr elem))
3566 (string-match "\\\\[0-9&]" (cdr elem)))
3567 (push (cons (car elem)
3568 (gnus-expand-group-parameter match (cdr elem) group))
3570 ;; For `sieve' group parameters, perform substitutions for every
3571 ;; string within the match rule. This allows for parameters such
3573 ;; ("list\\.\\(.*\\)"
3574 ;; (sieve header :is "list-id" "<\\1.domain.org>"))
3575 ((eq 'sieve (car elem))
3576 (push (mapcar (lambda (sieve-elem)
3577 (if (and (stringp sieve-elem)
3578 (string-match "\\\\[0-9&]" sieve-elem))
3579 (gnus-expand-group-parameter match sieve-elem
3588 (defun gnus-group-fast-parameter (group symbol &optional allow-list)
3589 "For GROUP, return the value of SYMBOL.
3591 You should call this in the `gnus-group-buffer' buffer.
3592 The function `gnus-group-find-parameter' will do that for you."
3593 ;; The speed trick: No cons'ing and quit early.
3594 (let* ((params (funcall gnus-group-get-parameter-function group))
3595 ;; Start easy, check the "real" group parameters.
3597 (gnus-group-parameter-value params symbol allow-list t)))
3599 ;; Found results; return them.
3600 (car simple-results)
3601 ;; We didn't find it there, try `gnus-parameters'.
3604 (tail gnus-parameters))
3605 ;; A good old-fashioned non-cl loop.
3607 (setq head (car tail)
3609 ;; The car is regexp matching for matching the group name.
3610 (when (string-match (car head) group)
3611 ;; The cdr is the parameters.
3613 (gnus-group-parameter-value (cdr head) symbol allow-list t)))
3615 (setq result (car this-result))
3616 ;; Expand if necessary.
3618 ((and (stringp result) (string-match "\\\\[0-9&]" result))
3619 (setq result (gnus-expand-group-parameter
3620 (car head) result group)))
3621 ;; For `sieve' group parameters, perform substitutions
3622 ;; for every string within the match rule (see above).
3625 (mapcar (lambda (elem)
3627 (gnus-expand-group-parameter (car head)
3634 (defun gnus-group-find-parameter (group &optional symbol allow-list)
3635 "Return the group parameters for GROUP.
3636 If SYMBOL, return the value of that symbol in the group parameters.
3638 If you call this function inside a loop, consider using the faster
3639 `gnus-group-fast-parameter' instead."
3640 (with-current-buffer (if (buffer-live-p (get-buffer gnus-group-buffer))
3644 (gnus-group-fast-parameter group symbol allow-list)
3647 (funcall gnus-group-get-parameter-function group))
3648 (gnus-parameters-get-parameter group)))))
3650 (defun gnus-group-get-parameter (group &optional symbol allow-list)
3651 "Return the group parameters for GROUP.
3652 If SYMBOL, return the value of that symbol in the group parameters.
3653 If ALLOW-LIST, also allow list as a result.
3654 Most functions should use `gnus-group-find-parameter', which
3655 also examines the topic parameters."
3656 (let ((params (gnus-info-params (gnus-get-info group))))
3658 (gnus-group-parameter-value params symbol allow-list)
3661 (defun gnus-group-parameter-value (params symbol &optional
3662 allow-list present-p)
3663 "Return the value of SYMBOL in group PARAMS.
3664 If ALLOW-LIST, also allow list as a result."
3665 ;; We only wish to return group parameters (dotted lists) and
3666 ;; not local variables, which may have the same names.
3667 ;; But first we handle single elements...
3668 (or (car (memq symbol params))
3672 (while (setq elem (pop params))
3673 (when (and (consp elem)
3674 (eq (car elem) symbol)
3677 (throw 'found (if present-p (list (cdr elem))
3680 (defun gnus-group-add-parameter (group param)
3681 "Add parameter PARAM to GROUP."
3682 (let ((info (gnus-get-info group)))
3684 (gnus-group-remove-parameter group (if (consp param) (car param) param))
3685 ;; Cons the new param to the old one and update.
3686 (gnus-group-set-info (cons param (gnus-info-params info))
3689 (defun gnus-group-set-parameter (group name value)
3690 "Set parameter NAME to VALUE in GROUP.
3691 GROUP can also be an INFO structure."
3692 (let ((info (if (listp group)
3694 (gnus-get-info group))))
3696 (gnus-group-remove-parameter group name)
3697 (let ((old-params (gnus-info-params info))
3698 (new-params (list (cons name value))))
3700 (when (or (not (listp (car old-params)))
3701 (not (eq (caar old-params) name)))
3702 (setq new-params (append new-params (list (car old-params)))))
3703 (setq old-params (cdr old-params)))
3705 (gnus-info-set-params info new-params t)
3706 (gnus-group-set-info new-params (gnus-info-group info) 'params))))))
3708 (defun gnus-group-remove-parameter (group name)
3709 "Remove parameter NAME from GROUP.
3710 GROUP can also be an INFO structure."
3711 (let ((info (if (listp group)
3713 (gnus-get-info group))))
3715 (let ((params (gnus-info-params info)))
3717 (setq params (delq name params))
3718 (while (assq name params)
3719 (gnus-alist-pull name params))
3720 (gnus-info-set-params info params))))))
3722 (defun gnus-group-add-score (group &optional score)
3723 "Add SCORE to the GROUP score.
3724 If SCORE is nil, add 1 to the score of GROUP."
3725 (let ((info (gnus-get-info group)))
3727 (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
3729 (defun gnus-short-group-name (group &optional levels)
3730 "Collapse GROUP name LEVELS.
3731 Select methods are stripped and any remote host name is stripped down to
3732 just the host name."
3737 gnus-group-uncollapsed-levels
3739 (while (string-match "\\." group skip)
3740 (setq skip (match-end 0)
3743 ;; Separate foreign select method from group name and collapse.
3744 ;; If method contains a server, collapse to non-domain server name,
3745 ;; otherwise collapse to select method.
3746 (let* ((colon (string-match ":" group))
3747 (server (and colon (substring group 0 colon)))
3748 (plus (and server (string-match "+" server))))
3751 (setq foreign (substring server (+ 1 plus)
3752 (string-match "\\." server))
3753 group (substring group (+ 1 colon)))
3754 (setq foreign server
3755 group (substring group (+ 1 colon))))
3756 (setq foreign (concat foreign ":")))
3757 ;; Collapse group name leaving LEVELS uncollapsed elements
3758 (let* ((slist (split-string group "/"))
3759 (slen (length slist))
3760 (dlist (split-string group "\\."))
3761 (dlen (length dlist))
3773 (setq levels (- glen levels))
3775 (push (if (>= (cl-decf levels) 0)
3776 (if (zerop (length g))
3781 (concat foreign (mapconcat #'identity (nreverse res) gsep))))))
3783 (defun gnus-narrow-to-body ()
3784 "Narrow to the body of an article."
3787 (goto-char (point-min))
3788 (or (search-forward "\n\n" nil t)
3794 ;;; Kill file handling.
3797 (defun gnus-apply-kill-file ()
3798 "Apply a kill file to the current newsgroup.
3799 Returns the number of articles marked as read."
3800 (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
3801 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3802 (gnus-apply-kill-file-internal)
3805 (defun gnus-kill-save-kill-buffer ()
3806 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3807 (when (get-file-buffer file)
3808 (with-current-buffer (get-file-buffer file)
3809 (when (buffer-modified-p)
3811 (kill-buffer (current-buffer))))))
3813 (defcustom gnus-kill-file-name "KILL"
3814 "Suffix of the kill files."
3815 :group 'gnus-score-kill
3816 :group 'gnus-score-files
3819 (defun gnus-newsgroup-kill-file (newsgroup)
3820 "Return the name of a kill file name for NEWSGROUP.
3821 If NEWSGROUP is nil, return the global kill file name instead."
3823 ;; The global KILL file is placed at top of the directory.
3824 ((or (null newsgroup)
3825 (string-equal newsgroup ""))
3826 (expand-file-name gnus-kill-file-name
3827 gnus-kill-files-directory))
3828 ;; Append ".KILL" to newsgroup name.
3829 ((gnus-use-long-file-name 'not-kill)
3830 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
3831 "." gnus-kill-file-name)
3832 gnus-kill-files-directory))
3833 ;; Place "KILL" under the hierarchical directory.
3835 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
3836 "/" gnus-kill-file-name)
3837 gnus-kill-files-directory))))
3841 (defun gnus-member-of-valid (symbol group)
3842 "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
3844 (symbol-name (car (gnus-find-method-for-group group)))
3845 gnus-valid-select-methods)))
3847 (defun gnus-method-option-p (method option)
3848 "Return non-nil if select METHOD has OPTION as a parameter."
3849 (when (stringp method)
3850 (setq method (gnus-server-to-method method)))
3851 (memq option (assoc (format "%s" (car method))
3852 gnus-valid-select-methods)))
3854 (defun gnus-similar-server-opened (method)
3855 "Return non-nil if we have a similar server opened.
3856 This is defined as a server with the same name, but different
3858 (let ((opened gnus-opened-servers)
3860 (while (and method opened)
3861 (setq open (car (pop opened)))
3862 ;; Type and name are the same...
3863 (when (and (equal (car method) (car open))
3864 (equal (cadr method) (cadr open))
3865 ;; ... but the rest of the parameters differ.
3866 (not (gnus-methods-sloppily-equal method open)))
3870 (defun gnus-server-extend-method (group method)
3871 ;; This function "extends" a virtual server. If the server is
3872 ;; "hello", and the select method is ("hello" (my-var "something"))
3873 ;; in the group "alt.alt", this will result in a new virtual server
3874 ;; called "hello+alt.alt".
3875 (if (or (not (inline (gnus-similar-server-opened method)))
3876 (not (cddr method)))
3879 (intern (format "%s-address" (car method)))))
3881 (if (assq address-slot (cddr method))
3882 `(,(car method) ,(concat (cadr method) "+" group)
3884 `(,(car method) ,(concat (cadr method) "+" group)
3885 (,address-slot ,(cadr method))
3887 (push method gnus-extended-servers)
3890 (defun gnus-server-status (method)
3891 "Return the status of METHOD."
3892 (nth 1 (assoc method gnus-opened-servers)))
3894 (defun gnus-group-name-to-method (group)
3895 "Guess a select method based on GROUP."
3896 (if (string-match ":" group)
3897 (let ((server (substring group 0 (match-beginning 0))))
3898 (if (string-match "\\+" server)
3899 (list (intern (substring server 0 (match-beginning 0)))
3900 (substring server (match-end 0)))
3901 (list (intern server) "")))
3902 gnus-select-method))
3904 (defun gnus-server-string (server)
3905 "Return a readable string that describes SERVER."
3906 (let* ((server (gnus-server-to-method server))
3907 (address (nth 1 server)))
3909 (not (zerop (length address))))
3910 (format "%s using %s" address (car server))
3911 (format "%s" (car server)))))
3913 (defun gnus-same-method-different-name (method)
3914 (let ((slot (intern (concat (symbol-name (car method)) "-address"))))
3915 (unless (assq slot (cddr method))
3917 (append method (list (list slot (nth 1 method)))))))
3918 (let ((methods gnus-extended-servers)
3920 (while (and (not found)
3921 (setq open (pop methods)))
3922 (when (and (eq (car method) (car open))
3923 (gnus-sloppily-equal-method-parameters method open))
3927 (defun gnus-find-method-for-group (group &optional info)
3928 "Find the select method that GROUP uses."
3929 (or gnus-override-method
3932 (and (not (gnus-group-entry group))
3933 ;; Killed or otherwise unknown group.
3935 ;; If we know a virtual server by that name, return its method.
3936 (gnus-server-to-method (gnus-group-server group))
3937 ;; Guess a new method as last resort.
3938 (gnus-group-name-to-method group)))
3939 (let ((info (or info (gnus-get-info group)))
3942 (not (setq method (gnus-info-method info)))
3943 (equal method "native"))
3946 (cond ((stringp method)
3947 (inline (gnus-server-to-method method)))
3948 ((stringp (cadr method))
3951 (gnus-same-method-different-name method))
3952 (inline (gnus-server-extend-method group method))))
3955 (cond ((equal (cadr method) "")
3957 ((null (cadr method))
3958 (list (car method) ""))
3960 (gnus-server-add-address method)))))))
3962 (defun gnus-methods-using (feature)
3963 "Find all methods that have FEATURE."
3964 (let ((valids gnus-valid-select-methods)
3967 (when (memq feature (car valids))
3968 (push (car valids) outs))
3969 (setq valids (cdr valids)))
3972 (autoload 'message-y-or-n-p "message" nil nil 'macro)
3974 (defun gnus-read-group (prompt &optional default)
3975 "Prompt the user for a group name.
3976 Disallow invalid group names."
3981 gnus-invalid-group-regexp
3982 (setq group (read-string (concat prefix prompt)
3983 (cons (or default "") 0)
3984 'gnus-group-history)))
3985 (let ((match (match-string 0 group)))
3986 ;; Might be okay (e.g. for nnimap), so ask the user:
3987 (unless (and (not (string-match "^$\\|:" match))
3989 "Proceed and create group anyway? " t
3990 "The group name \"" group "\" contains a forbidden character: \"" match "\".
3992 Usually, it's dangerous to create a group with this name, because it's not
3993 supported by all back ends and servers. On IMAP servers it should work,
3994 though. If you are really sure, you can proceed anyway and create the group.
3996 You may customize the variable `gnus-invalid-group-regexp', which currently is
3997 set to \"" gnus-invalid-group-regexp
3998 "\", if you want to get rid of this query permanently."))
3999 (setq prefix (format "Invalid group name: \"%s\". " group)
4003 (defun gnus-read-method (prompt)
4004 "Prompt the user for a method.
4005 Allow completion over sensible values."
4006 (let* ((open-servers
4007 (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
4008 gnus-opened-servers))
4011 (dolist (method gnus-valid-select-methods)
4012 (if (or (memq 'prompt-address method)
4013 (not (assoc (format "%s:" (car method)) open-servers)))
4014 (push method methods)))
4017 (append valid-methods
4019 gnus-predefined-server-alist
4022 (gnus-completing-read
4023 prompt (mapcar #'car servers)
4024 t nil 'gnus-method-history)))
4027 (setq method gnus-select-method))
4028 ((assoc method gnus-valid-select-methods)
4029 (let ((address (if (memq 'prompt-address
4030 (assoc method gnus-valid-select-methods))
4031 (read-string "Address: ")
4033 (or (cadr (assoc (format "%s:%s" method address) open-servers))
4034 (list (intern method) address))))
4035 ((assoc method servers)
4038 (list (intern method) "")))))
4042 (defun gnus-agent-method-p (method-or-server)
4043 "Say whether METHOD is covered by the agent."
4044 (or (eq (car gnus-agent-method-p-cache) method-or-server)
4045 (let* ((method (if (stringp method-or-server)
4046 (gnus-server-to-method method-or-server)
4048 (server (gnus-method-to-server method t)))
4049 (setq gnus-agent-method-p-cache
4050 (cons method-or-server
4051 (member server gnus-agent-covered-methods)))))
4052 (cdr gnus-agent-method-p-cache))
4054 (defun gnus-online (method)
4057 (eq (cadr (assoc method gnus-opened-servers)) 'offline)
4058 (gnus-agent-method-p method))))
4060 ;;; User-level commands.
4063 (defun gnus-slave-no-server (&optional arg)
4064 "Read network news as a slave, without connecting to the local server."
4066 (gnus-no-server arg t))
4069 (defun gnus-no-server (&optional arg slave)
4071 If ARG is a positive number, Gnus will use that as the startup
4072 level. If ARG is nil, Gnus will be started at level 2. If ARG is
4073 non-nil and not a positive number, Gnus will prompt the user for the
4074 name of an NNTP server to use.
4075 As opposed to `gnus', this command will not connect to the local
4078 (gnus-no-server-1 arg slave))
4081 (defun gnus-slave (&optional arg)
4082 "Read news as a slave."
4084 (gnus arg nil 'slave))
4086 (defun gnus-delete-gnus-frame ()
4087 "Delete gnus frame unless it is the only one.
4088 Used for `gnus-exit-gnus-hook' in `gnus-other-frame'."
4089 (when (and (frame-live-p gnus-other-frame-object)
4091 (delete-frame gnus-other-frame-object))
4092 (setq gnus-other-frame-object nil))
4095 (defun gnus-other-frame (&optional arg display)
4096 "Pop up a frame to read news.
4097 This will call one of the Gnus commands which is specified by the user
4098 option `gnus-other-frame-function' (default `gnus') with the argument
4099 ARG if Gnus is not running, otherwise pop up a Gnus frame and run the
4100 command specified by `gnus-other-frame-resume-function'.
4101 The optional second argument DISPLAY should be a standard display string
4102 such as \"unix:0\" to specify where to pop up a frame. If DISPLAY is
4103 omitted or the function `make-frame-on-display' is not available, the
4104 current display is used."
4106 (if (fboundp 'make-frame-on-display)
4108 (setq display (gnus-frame-or-window-display-name (selected-frame))))
4110 (let ((alive (gnus-alive-p)))
4115 (when (and (or (not display)
4117 (gnus-frame-or-window-display-name
4119 (with-current-buffer (window-buffer window)
4120 (string-match "\\`gnus-"
4121 (symbol-name major-mode))))
4122 (select-frame-set-input-focus
4123 (setq gnus-other-frame-object (window-frame window)))
4124 (select-window window)
4127 (select-frame-set-input-focus
4128 (setq gnus-other-frame-object
4130 (make-frame-on-display display gnus-other-frame-parameters)
4131 (make-frame gnus-other-frame-parameters))))
4133 (progn (switch-to-buffer gnus-group-buffer)
4134 (funcall gnus-other-frame-resume-function arg))
4135 (funcall gnus-other-frame-function arg)
4136 (add-hook 'gnus-exit-gnus-hook #'gnus-delete-gnus-frame)
4137 ;; One might argue that `gnus-delete-gnus-frame' should not be called
4138 ;; from `gnus-suspend-gnus-hook', but, on the other hand, one might
4139 ;; argue that it should. No matter what you think, for the sake of
4140 ;; those who want it to be called from it, please keep (defun
4141 ;; gnus-delete-gnus-frame) even if you remove the next `add-hook'.
4142 (add-hook 'gnus-suspend-gnus-hook #'gnus-delete-gnus-frame)))))
4145 (defun gnus (&optional arg dont-connect slave)
4147 If ARG is non-nil and a positive number, Gnus will use that as the
4148 startup level. If ARG is non-nil and not a positive number, Gnus will
4149 prompt the user for the name of an NNTP server to use."
4151 ;; When using the development version of Gnus, load the gnus-load
4153 (unless (string-match "^Gnus" gnus-version)
4154 (load "gnus-load" nil t))
4155 (unless (byte-code-function-p (symbol-function 'gnus))
4156 (message "You should byte-compile Gnus")
4158 (let ((gnus-action-message-log (list nil)))
4159 (gnus-1 arg dont-connect slave)
4160 (gnus-final-warning)))
4162 (declare-function debbugs-gnu "ext:debbugs-gnu"
4163 (severities &optional packages archivedp suppress tags))
4165 (defun gnus-list-debbugs ()
4166 "List all open Gnus bug reports."
4168 (require 'debbugs-gnu)
4169 (debbugs-gnu nil "gnus"))
4173 ;;; gnus.el ends here