1 ;;; gnus.el --- a newsreader for GNU Emacs
3 ;; Copyright (C) 1987-1990, 1993-1998, 2000-2015 Free Software
6 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
7 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; Keywords: news, mail
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
29 (eval '(run-hooks 'gnus-load-hook))
31 (eval-when-compile (require 'cl))
35 (require 'gnus-compat)
37 ;; These are defined afterwards with gnus-define-group-parameter
38 (defvar gnus-ham-process-destinations)
39 (defvar gnus-parameter-ham-marks-alist)
40 (defvar gnus-parameter-spam-marks-alist)
41 (defvar gnus-spam-autodetect)
42 (defvar gnus-spam-autodetect-methods)
43 (defvar gnus-spam-newsgroup-contents)
44 (defvar gnus-spam-process-destinations)
45 (defvar gnus-spam-resend-to)
46 (defvar gnus-ham-resend-to)
47 (defvar gnus-spam-process-newsgroups)
51 "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
55 (defgroup gnus-start nil
56 "Starting your favorite newsreader."
59 (defgroup gnus-format nil
60 "Dealing with formatting issues."
63 (defgroup gnus-charset nil
64 "Group character set issues."
65 :link '(custom-manual "(gnus)Charsets")
69 (defgroup gnus-cache nil
71 :link '(custom-manual "(gnus)Article Caching")
74 (defgroup gnus-registry nil
78 (defgroup gnus-start-server nil
79 "Server options at startup."
82 ;; These belong to gnus-group.el.
83 (defgroup gnus-group nil
85 :link '(custom-manual "(gnus)Group Buffer")
88 (defgroup gnus-group-foreign nil
90 :link '(custom-manual "(gnus)Foreign Groups")
93 (defgroup gnus-group-new nil
94 "Automatic subscription of new groups."
97 (defgroup gnus-group-levels nil
99 :link '(custom-manual "(gnus)Group Levels")
102 (defgroup gnus-group-select nil
104 :link '(custom-manual "(gnus)Selecting a Group")
107 (defgroup gnus-group-listing nil
108 "Showing slices of the group list."
109 :link '(custom-manual "(gnus)Listing Groups")
112 (defgroup gnus-group-visual nil
113 "Sorting the group buffer."
114 :link '(custom-manual "(gnus)Group Buffer Format")
118 (defgroup gnus-group-various nil
119 "Various group options."
120 :link '(custom-manual "(gnus)Scanning New Messages")
123 ;; These belong to gnus-sum.el.
124 (defgroup gnus-summary nil
126 :link '(custom-manual "(gnus)Summary Buffer")
129 (defgroup gnus-summary-exit nil
130 "Leaving summary buffers."
131 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
132 :group 'gnus-summary)
134 (defgroup gnus-summary-marks nil
135 "Marks used in summary buffers."
136 :link '(custom-manual "(gnus)Marking Articles")
137 :group 'gnus-summary)
139 (defgroup gnus-thread nil
140 "Ordering articles according to replies."
141 :link '(custom-manual "(gnus)Threading")
142 :group 'gnus-summary)
144 (defgroup gnus-summary-format nil
145 "Formatting of the summary buffer."
146 :link '(custom-manual "(gnus)Summary Buffer Format")
147 :group 'gnus-summary)
149 (defgroup gnus-summary-choose nil
151 :link '(custom-manual "(gnus)Choosing Articles")
152 :group 'gnus-summary)
154 (defgroup gnus-summary-maneuvering nil
155 "Summary movement commands."
156 :link '(custom-manual "(gnus)Summary Maneuvering")
157 :group 'gnus-summary)
159 (defgroup gnus-picon nil
160 "Show pictures of people, domains, and newsgroups."
163 (defgroup gnus-summary-mail nil
164 "Mail group commands."
165 :link '(custom-manual "(gnus)Mail Group Commands")
166 :group 'gnus-summary)
168 (defgroup gnus-summary-sort nil
169 "Sorting the summary buffer."
170 :link '(custom-manual "(gnus)Sorting the Summary Buffer")
171 :group 'gnus-summary)
173 (defgroup gnus-summary-visual nil
174 "Highlighting and menus in the summary buffer."
175 :link '(custom-manual "(gnus)Summary Highlighting")
177 :group 'gnus-summary)
179 (defgroup gnus-summary-various nil
180 "Various summary buffer options."
181 :link '(custom-manual "(gnus)Various Summary Stuff")
182 :group 'gnus-summary)
184 (defgroup gnus-summary-pick nil
185 "Pick mode in the summary buffer."
186 :link '(custom-manual "(gnus)Pick and Read")
188 :group 'gnus-summary)
190 (defgroup gnus-summary-tree nil
191 "Tree display of threads in the summary buffer."
192 :link '(custom-manual "(gnus)Tree Display")
194 :group 'gnus-summary)
196 ;; Belongs to gnus-uu.el
197 (defgroup gnus-extract-view nil
198 "Viewing extracted files."
199 :link '(custom-manual "(gnus)Viewing Files")
200 :group 'gnus-extract)
202 ;; Belongs to gnus-score.el
203 (defgroup gnus-score nil
204 "Score and kill file handling."
207 (defgroup gnus-score-kill nil
211 (defgroup gnus-score-adapt nil
212 "Adaptive score files."
215 (defgroup gnus-score-default nil
216 "Default values for score files."
219 (defgroup gnus-score-expire nil
220 "Expiring score rules."
223 (defgroup gnus-score-decay nil
224 "Decaying score rules."
227 (defgroup gnus-score-files nil
228 "Score and kill file names."
232 (defgroup gnus-score-various nil
233 "Various scoring and killing options."
237 (defgroup gnus-visual nil
238 "Options controlling the visual fluff."
242 (defgroup gnus-agent nil
243 "Offline support for Gnus."
246 (defgroup gnus-files nil
247 "Files used by Gnus."
250 (defgroup gnus-dribble-file nil
252 :link '(custom-manual "(gnus)Auto Save")
255 (defgroup gnus-newsrc nil
256 "Storing Gnus state."
259 (defgroup gnus-server nil
260 "Options related to newsservers and other servers used by Gnus."
263 (defgroup gnus-server-visual nil
264 "Highlighting and menus in the server buffer."
268 (defgroup gnus-message '((message custom-group))
269 "Composing replies and followups in Gnus."
272 (defgroup gnus-meta nil
273 "Meta variables controlling major portions of Gnus.
274 In general, modifying these variables does not take effect until Gnus
275 is restarted, and sometimes reloaded."
278 (defgroup gnus-various nil
279 "Other Gnus options."
280 :link '(custom-manual "(gnus)Various Various")
283 (defgroup gnus-exit nil
285 :link '(custom-manual "(gnus)Exiting Gnus")
288 (defgroup gnus-fun nil
289 "Frivolous Gnus extensions."
290 :link '(custom-manual "(gnus)Exiting Gnus")
293 (defconst gnus-version-number "0.14"
294 "Version number for this version of Gnus.")
296 (defconst gnus-version (format "Ma Gnus v%s" gnus-version-number)
297 "Version string for this version of Gnus.")
299 (defcustom gnus-inhibit-startup-message nil
300 "If non-nil, the startup message will not be displayed.
301 This variable is used before `.gnus.el' is loaded, so it should
302 be set in `.emacs' instead."
306 (unless (featurep 'gnus-xmas)
307 (defalias 'gnus-extent-detached-p 'ignore)
308 (defalias 'gnus-extent-start-open 'ignore)
309 (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
310 (defalias 'gnus-character-to-event 'identity)
311 (defalias 'gnus-assq-delete-all 'assq-delete-all)
312 (defalias 'gnus-add-text-properties 'add-text-properties)
313 (defalias 'gnus-put-text-property 'put-text-property)
314 (defvar gnus-mode-line-image-cache t)
315 (if (fboundp 'find-image)
316 (defun gnus-mode-line-buffer-identification (line)
317 (let ((str (car-safe line))
318 (load-path (append (mm-image-load-path) load-path)))
319 (if (and (display-graphic-p)
321 (string-match "^Gnus:" str))
322 (progn (add-text-properties
325 (if (eq t gnus-mode-line-image-cache)
326 (setq gnus-mode-line-image-cache
328 '((:type xpm :file "gnus-pointer.xpm"
330 (:type xbm :file "gnus-pointer.xbm"
332 gnus-mode-line-image-cache)
335 gnus-version (gnus-emacs-version)))
339 (defalias 'gnus-mode-line-buffer-identification 'identity))
340 (defalias 'gnus-deactivate-mark 'deactivate-mark)
341 (defalias 'gnus-window-edges 'window-edges)
342 (defalias 'gnus-key-press-event-p 'numberp)
343 ;;(defalias 'gnus-decode-rfc1522 'ignore)
346 ;; We define these group faces here to avoid the display
347 ;; update forced when creating new faces.
349 (defface gnus-group-news-1
352 (:foreground "PaleTurquoise" :bold t))
355 (:foreground "ForestGreen" :bold t))
358 "Level 1 newsgroup face."
360 ;; backward-compatibility alias
361 (put 'gnus-group-news-1-face 'face-alias 'gnus-group-news-1)
362 (put 'gnus-group-news-1-face 'obsolete-face "22.1")
364 (defface gnus-group-news-1-empty
367 (:foreground "PaleTurquoise"))
370 (:foreground "ForestGreen"))
373 "Level 1 empty newsgroup face."
375 ;; backward-compatibility alias
376 (put 'gnus-group-news-1-empty-face 'face-alias 'gnus-group-news-1-empty)
377 (put 'gnus-group-news-1-empty-face 'obsolete-face "22.1")
379 (defface gnus-group-news-2
382 (:foreground "turquoise" :bold t))
385 (:foreground "CadetBlue4" :bold t))
388 "Level 2 newsgroup face."
390 ;; backward-compatibility alias
391 (put 'gnus-group-news-2-face 'face-alias 'gnus-group-news-2)
392 (put 'gnus-group-news-2-face 'obsolete-face "22.1")
394 (defface gnus-group-news-2-empty
397 (:foreground "turquoise"))
400 (:foreground "CadetBlue4"))
403 "Level 2 empty newsgroup face."
405 ;; backward-compatibility alias
406 (put 'gnus-group-news-2-empty-face 'face-alias 'gnus-group-news-2-empty)
407 (put 'gnus-group-news-2-empty-face 'obsolete-face "22.1")
409 (defface gnus-group-news-3
418 "Level 3 newsgroup face."
420 ;; backward-compatibility alias
421 (put 'gnus-group-news-3-face 'face-alias 'gnus-group-news-3)
422 (put 'gnus-group-news-3-face 'obsolete-face "22.1")
424 (defface gnus-group-news-3-empty
433 "Level 3 empty newsgroup face."
435 ;; backward-compatibility alias
436 (put 'gnus-group-news-3-empty-face 'face-alias 'gnus-group-news-3-empty)
437 (put 'gnus-group-news-3-empty-face 'obsolete-face "22.1")
439 (defface gnus-group-news-4
448 "Level 4 newsgroup face."
450 ;; backward-compatibility alias
451 (put 'gnus-group-news-4-face 'face-alias 'gnus-group-news-4)
452 (put 'gnus-group-news-4-face 'obsolete-face "22.1")
454 (defface gnus-group-news-4-empty
463 "Level 4 empty newsgroup face."
465 ;; backward-compatibility alias
466 (put 'gnus-group-news-4-empty-face 'face-alias 'gnus-group-news-4-empty)
467 (put 'gnus-group-news-4-empty-face 'obsolete-face "22.1")
469 (defface gnus-group-news-5
478 "Level 5 newsgroup face."
480 ;; backward-compatibility alias
481 (put 'gnus-group-news-5-face 'face-alias 'gnus-group-news-5)
482 (put 'gnus-group-news-5-face 'obsolete-face "22.1")
484 (defface gnus-group-news-5-empty
493 "Level 5 empty newsgroup face."
495 ;; backward-compatibility alias
496 (put 'gnus-group-news-5-empty-face 'face-alias 'gnus-group-news-5-empty)
497 (put 'gnus-group-news-5-empty-face 'obsolete-face "22.1")
499 (defface gnus-group-news-6
508 "Level 6 newsgroup face."
510 ;; backward-compatibility alias
511 (put 'gnus-group-news-6-face 'face-alias 'gnus-group-news-6)
512 (put 'gnus-group-news-6-face 'obsolete-face "22.1")
514 (defface gnus-group-news-6-empty
523 "Level 6 empty newsgroup face."
525 ;; backward-compatibility alias
526 (put 'gnus-group-news-6-empty-face 'face-alias 'gnus-group-news-6-empty)
527 (put 'gnus-group-news-6-empty-face 'obsolete-face "22.1")
529 (defface gnus-group-news-low
532 (:foreground "DarkTurquoise" :bold t))
535 (:foreground "DarkGreen" :bold t))
538 "Low level newsgroup face."
540 ;; backward-compatibility alias
541 (put 'gnus-group-news-low-face 'face-alias 'gnus-group-news-low)
542 (put 'gnus-group-news-low-face 'obsolete-face "22.1")
544 (defface gnus-group-news-low-empty
547 (:foreground "DarkTurquoise"))
550 (:foreground "DarkGreen"))
553 "Low level empty newsgroup face."
555 ;; backward-compatibility alias
556 (put 'gnus-group-news-low-empty-face 'face-alias 'gnus-group-news-low-empty)
557 (put 'gnus-group-news-low-empty-face 'obsolete-face "22.1")
559 (defface gnus-group-mail-1
562 (:foreground "#e1ffe1" :bold t))
565 (:foreground "DeepPink3" :bold t))
568 "Level 1 mailgroup face."
570 ;; backward-compatibility alias
571 (put 'gnus-group-mail-1-face 'face-alias 'gnus-group-mail-1)
572 (put 'gnus-group-mail-1-face 'obsolete-face "22.1")
574 (defface gnus-group-mail-1-empty
577 (:foreground "#e1ffe1"))
580 (:foreground "DeepPink3"))
582 (:italic t :bold t)))
583 "Level 1 empty mailgroup face."
585 ;; backward-compatibility alias
586 (put 'gnus-group-mail-1-empty-face 'face-alias 'gnus-group-mail-1-empty)
587 (put 'gnus-group-mail-1-empty-face 'obsolete-face "22.1")
589 (defface gnus-group-mail-2
592 (:foreground "DarkSeaGreen1" :bold t))
595 (:foreground "HotPink3" :bold t))
598 "Level 2 mailgroup face."
600 ;; backward-compatibility alias
601 (put 'gnus-group-mail-2-face 'face-alias 'gnus-group-mail-2)
602 (put 'gnus-group-mail-2-face 'obsolete-face "22.1")
604 (defface gnus-group-mail-2-empty
607 (:foreground "DarkSeaGreen1"))
610 (:foreground "HotPink3"))
613 "Level 2 empty mailgroup face."
615 ;; backward-compatibility alias
616 (put 'gnus-group-mail-2-empty-face 'face-alias 'gnus-group-mail-2-empty)
617 (put 'gnus-group-mail-2-empty-face 'obsolete-face "22.1")
619 (defface gnus-group-mail-3
622 (:foreground "aquamarine1" :bold t))
625 (:foreground "magenta4" :bold t))
628 "Level 3 mailgroup face."
630 ;; backward-compatibility alias
631 (put 'gnus-group-mail-3-face 'face-alias 'gnus-group-mail-3)
632 (put 'gnus-group-mail-3-face 'obsolete-face "22.1")
634 (defface gnus-group-mail-3-empty
637 (:foreground "aquamarine1"))
640 (:foreground "magenta4"))
643 "Level 3 empty mailgroup face."
645 ;; backward-compatibility alias
646 (put 'gnus-group-mail-3-empty-face 'face-alias 'gnus-group-mail-3-empty)
647 (put 'gnus-group-mail-3-empty-face 'obsolete-face "22.1")
649 (defface gnus-group-mail-low
652 (:foreground "aquamarine2" :bold t))
655 (:foreground "DeepPink4" :bold t))
658 "Low level mailgroup face."
660 ;; backward-compatibility alias
661 (put 'gnus-group-mail-low-face 'face-alias 'gnus-group-mail-low)
662 (put 'gnus-group-mail-low-face 'obsolete-face "22.1")
664 (defface gnus-group-mail-low-empty
667 (:foreground "aquamarine2"))
670 (:foreground "DeepPink4"))
673 "Low level empty mailgroup face."
675 ;; backward-compatibility alias
676 (put 'gnus-group-mail-low-empty-face 'face-alias 'gnus-group-mail-low-empty)
677 (put 'gnus-group-mail-low-empty-face 'obsolete-face "22.1")
679 ;; Summary mode faces.
681 (defface gnus-summary-selected '((t (:underline t)))
682 "Face used for selected articles."
683 :group 'gnus-summary)
684 ;; backward-compatibility alias
685 (put 'gnus-summary-selected-face 'face-alias 'gnus-summary-selected)
686 (put 'gnus-summary-selected-face 'obsolete-face "22.1")
688 (defface gnus-summary-cancelled
690 (:foreground "yellow" :background "black")))
691 "Face used for canceled articles."
692 :group 'gnus-summary)
693 ;; backward-compatibility alias
694 (put 'gnus-summary-cancelled-face 'face-alias 'gnus-summary-cancelled)
695 (put 'gnus-summary-cancelled-face 'obsolete-face "22.1")
697 (defface gnus-summary-high-ticked
700 (:foreground "pink" :bold t))
703 (:foreground "firebrick" :bold t))
706 "Face used for high interest ticked articles."
707 :group 'gnus-summary)
708 ;; backward-compatibility alias
709 (put 'gnus-summary-high-ticked-face 'face-alias 'gnus-summary-high-ticked)
710 (put 'gnus-summary-high-ticked-face 'obsolete-face "22.1")
712 (defface gnus-summary-low-ticked
715 (:foreground "pink" :italic t))
718 (:foreground "firebrick" :italic t))
721 "Face used for low interest ticked articles."
722 :group 'gnus-summary)
723 ;; backward-compatibility alias
724 (put 'gnus-summary-low-ticked-face 'face-alias 'gnus-summary-low-ticked)
725 (put 'gnus-summary-low-ticked-face 'obsolete-face "22.1")
727 (defface gnus-summary-normal-ticked
730 (:foreground "pink"))
733 (:foreground "firebrick"))
736 "Face used for normal interest ticked articles."
737 :group 'gnus-summary)
738 ;; backward-compatibility alias
739 (put 'gnus-summary-normal-ticked-face 'face-alias 'gnus-summary-normal-ticked)
740 (put 'gnus-summary-normal-ticked-face 'obsolete-face "22.1")
742 (defface gnus-summary-high-ancient
745 (:foreground "SkyBlue" :bold t))
748 (:foreground "RoyalBlue" :bold t))
751 "Face used for high interest ancient articles."
752 :group 'gnus-summary)
753 ;; backward-compatibility alias
754 (put 'gnus-summary-high-ancient-face 'face-alias 'gnus-summary-high-ancient)
755 (put 'gnus-summary-high-ancient-face 'obsolete-face "22.1")
757 (defface gnus-summary-low-ancient
760 (:foreground "SkyBlue" :italic t))
763 (:foreground "RoyalBlue" :italic t))
766 "Face used for low interest ancient articles."
767 :group 'gnus-summary)
768 ;; backward-compatibility alias
769 (put 'gnus-summary-low-ancient-face 'face-alias 'gnus-summary-low-ancient)
770 (put 'gnus-summary-low-ancient-face 'obsolete-face "22.1")
772 (defface gnus-summary-normal-ancient
775 (:foreground "SkyBlue"))
778 (:foreground "RoyalBlue"))
781 "Face used for normal interest ancient articles."
782 :group 'gnus-summary)
783 ;; backward-compatibility alias
784 (put 'gnus-summary-normal-ancient-face 'face-alias 'gnus-summary-normal-ancient)
785 (put 'gnus-summary-normal-ancient-face 'obsolete-face "22.1")
787 (defface gnus-summary-high-undownloaded
790 (:bold t :foreground "cyan4"))
791 (((class color) (background dark))
792 (:bold t :foreground "LightGray"))
793 (t (:inverse-video t :bold t)))
794 "Face used for high interest uncached articles."
795 :group 'gnus-summary)
796 ;; backward-compatibility alias
797 (put 'gnus-summary-high-undownloaded-face 'face-alias 'gnus-summary-high-undownloaded)
798 (put 'gnus-summary-high-undownloaded-face 'obsolete-face "22.1")
800 (defface gnus-summary-low-undownloaded
803 (:italic t :foreground "cyan4" :bold nil))
804 (((class color) (background dark))
805 (:italic t :foreground "LightGray" :bold nil))
806 (t (:inverse-video t :italic t)))
807 "Face used for low interest uncached articles."
808 :group 'gnus-summary)
809 ;; backward-compatibility alias
810 (put 'gnus-summary-low-undownloaded-face 'face-alias 'gnus-summary-low-undownloaded)
811 (put 'gnus-summary-low-undownloaded-face 'obsolete-face "22.1")
813 (defface gnus-summary-normal-undownloaded
816 (:foreground "cyan4" :bold nil))
817 (((class color) (background dark))
818 (:foreground "LightGray" :bold nil))
819 (t (:inverse-video t)))
820 "Face used for normal interest uncached articles."
821 :group 'gnus-summary)
822 ;; backward-compatibility alias
823 (put 'gnus-summary-normal-undownloaded-face 'face-alias 'gnus-summary-normal-undownloaded)
824 (put 'gnus-summary-normal-undownloaded-face 'obsolete-face "22.1")
826 (defface gnus-summary-high-unread
829 "Face used for high interest unread articles."
830 :group 'gnus-summary)
831 ;; backward-compatibility alias
832 (put 'gnus-summary-high-unread-face 'face-alias 'gnus-summary-high-unread)
833 (put 'gnus-summary-high-unread-face 'obsolete-face "22.1")
835 (defface gnus-summary-low-unread
838 "Face used for low interest unread articles."
839 :group 'gnus-summary)
840 ;; backward-compatibility alias
841 (put 'gnus-summary-low-unread-face 'face-alias 'gnus-summary-low-unread)
842 (put 'gnus-summary-low-unread-face 'obsolete-face "22.1")
844 (defface gnus-summary-normal-unread
847 "Face used for normal interest unread articles."
848 :group 'gnus-summary)
849 ;; backward-compatibility alias
850 (put 'gnus-summary-normal-unread-face 'face-alias 'gnus-summary-normal-unread)
851 (put 'gnus-summary-normal-unread-face 'obsolete-face "22.1")
853 (defface gnus-summary-high-read
856 (:foreground "PaleGreen"
860 (:foreground "DarkGreen"
864 "Face used for high interest read articles."
865 :group 'gnus-summary)
866 ;; backward-compatibility alias
867 (put 'gnus-summary-high-read-face 'face-alias 'gnus-summary-high-read)
868 (put 'gnus-summary-high-read-face 'obsolete-face "22.1")
870 (defface gnus-summary-low-read
873 (:foreground "PaleGreen"
877 (:foreground "DarkGreen"
881 "Face used for low interest read articles."
882 :group 'gnus-summary)
883 ;; backward-compatibility alias
884 (put 'gnus-summary-low-read-face 'face-alias 'gnus-summary-low-read)
885 (put 'gnus-summary-low-read-face 'obsolete-face "22.1")
887 (defface gnus-summary-normal-read
890 (:foreground "PaleGreen"))
893 (:foreground "DarkGreen"))
896 "Face used for normal interest read articles."
897 :group 'gnus-summary)
898 ;; backward-compatibility alias
899 (put 'gnus-summary-normal-read-face 'face-alias 'gnus-summary-normal-read)
900 (put 'gnus-summary-normal-read-face 'obsolete-face "22.1")
907 (defvar gnus-buffers nil
908 "List of buffers handled by Gnus.")
910 (defun gnus-get-buffer-create (name)
911 "Do the same as `get-buffer-create', but store the created buffer."
912 (or (get-buffer name)
913 (car (push (get-buffer-create name) gnus-buffers))))
915 (defun gnus-add-buffer ()
916 "Add the current buffer to the list of Gnus buffers."
917 (push (current-buffer) gnus-buffers))
919 (defmacro gnus-kill-buffer (buffer)
920 "Kill BUFFER and remove from the list of Gnus buffers."
921 `(let ((buf ,buffer))
922 (when (gnus-buffer-exists-p buf)
923 (setq gnus-buffers (delete (get-buffer buf) gnus-buffers))
926 (defun gnus-buffers ()
927 "Return a list of live Gnus buffers."
928 (while (and gnus-buffers
929 (not (buffer-name (car gnus-buffers))))
931 (let ((buffers gnus-buffers))
933 (if (buffer-name (cadr buffers))
935 (setcdr buffers (cddr buffers)))))
940 (defvar gnus-group-buffer "*Group*"
941 "Name of the Gnus group buffer.")
946 (:foreground "#cccccc"))
949 (:foreground "#888888"))
952 "Face for the splash screen."
954 ;; backward-compatibility alias
955 (put 'gnus-splash-face 'face-alias 'gnus-splash)
956 (put 'gnus-splash-face 'obsolete-face "22.1")
958 (defun gnus-splash ()
960 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
961 (let ((buffer-read-only nil))
963 (unless gnus-inhibit-startup-message
964 (gnus-group-startup-message)
967 (defun gnus-indent-rigidly (start end arg)
968 "Indent rigidly using only spaces and no tabs."
971 (narrow-to-region start end)
973 (indent-rigidly start end arg)
974 ;; We translate tabs into spaces -- not everybody uses
975 ;; an 8-character tab.
976 (goto-char (point-min))
977 (while (search-forward "\t" nil t)
978 (replace-match " " t t))))))
980 ;;(format "%02x%02x%02x" 114 66 20) "724214"
982 (defvar gnus-logo-color-alist
983 '((flame "#cc3300" "#ff2200")
984 (pine "#c0cc93" "#f8ffb8")
985 (moss "#a1cc93" "#d2ffb8")
986 (irish "#04cc90" "#05ff97")
987 (sky "#049acc" "#05deff")
988 (tin "#6886cc" "#82b6ff")
989 (velvet "#7c68cc" "#8c82ff")
990 (grape "#b264cc" "#cf7df")
991 (labia "#cc64c2" "#fd7dff")
992 (berry "#cc6485" "#ff7db5")
993 (dino "#724214" "#1e3f03")
994 (oort "#cccccc" "#888888")
995 (storm "#666699" "#99ccff")
996 (pdino "#9999cc" "#99ccff")
997 (purp "#9999cc" "#666699")
998 (no "#ff0000" "#ffff00")
999 (neutral "#b4b4b4" "#878787")
1000 (ma "#2020e0" "#8080ff")
1001 (september "#bf9900" "#ffcc00"))
1002 "Color alist used for the Gnus logo.")
1004 (defcustom gnus-logo-color-style 'ma
1005 "*Color styles used for the Gnus logo."
1006 :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
1007 gnus-logo-color-alist))
1010 (defvar gnus-logo-colors
1011 (cdr (assq gnus-logo-color-style gnus-logo-color-alist))
1012 "Colors used for the Gnus logo.")
1014 (declare-function image-size "image.c" (spec &optional pixels frame))
1016 (defun gnus-group-startup-message (&optional x y)
1017 "Insert startup message in current buffer."
1018 ;; Insert the message.
1021 (fboundp 'find-image)
1023 ;; Make sure the library defining `image-load-path' is
1024 ;; loaded (`find-image' is autoloaded) (and discard the
1025 ;; result). Else, we may get "defvar ignored because
1026 ;; image-load-path is let-bound" when calling `find-image'
1028 (or (find-image '(nil (:type xpm :file "gnus.xpm"))) t)
1029 (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
1030 (image-load-path (cond (data-directory
1031 (list data-directory))
1032 ((boundp 'image-load-path)
1033 (symbol-value 'image-load-path))
1035 (image (gnus-splash-svg-color-symbols (find-image
1036 `((:type svg :file "gnus.svg"
1038 (("#bf9900" . ,(car gnus-logo-colors))
1039 ("#ffcc00" . ,(cadr gnus-logo-colors))))
1040 (:type xpm :file "gnus.xpm"
1042 (("thing" . ,(car gnus-logo-colors))
1043 ("shadow" . ,(cadr gnus-logo-colors))))
1044 (:type png :file "gnus.png")
1045 (:type pbm :file "gnus.pbm"
1046 ;; Account for the pbm's background.
1047 :background ,(face-foreground 'gnus-splash)
1048 :foreground ,(face-background 'default))
1049 (:type xbm :file "gnus.xbm"
1050 ;; Account for the xbm's background.
1051 :background ,(face-foreground 'gnus-splash)
1052 :foreground ,(face-background 'default)))))))
1054 (let ((size (image-size image)))
1055 (insert-char ?\n (max 0 (round (- (window-height)
1056 (or y (cdr size)) 1) 2)))
1057 (insert-char ?\ (max 0 (round (- (window-width)
1058 (or x (car size))) 2)))
1059 (insert-image image))
1060 (goto-char (point-min))
1065 _ ___ __ ___ __ _ ___
1083 ;; And then hack it.
1084 (gnus-indent-rigidly (point-min) (point-max)
1085 (/ (max (- (window-width) (or x 46)) 0) 2))
1086 (goto-char (point-min))
1088 (let* ((pheight (count-lines (point-min) (point-max)))
1089 (wheight (window-height))
1090 (rest (- wheight pheight)))
1091 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
1093 (put-text-property (point-min) (point-max) 'face 'gnus-splash)
1094 (goto-char (point-min))
1095 (setq mode-line-buffer-identification (concat " " gnus-version))
1096 (set-buffer-modified-p t)))
1098 (defun gnus-splash-svg-color-symbols (list)
1099 "Do color-symbol search-and-replace in svg file."
1100 (let ((type (plist-get (cdr list) :type))
1101 (file (plist-get (cdr list) :file))
1102 (color-symbols (plist-get (cdr list) :color-symbols)))
1103 (if (string= type "svg")
1104 (let ((data (with-temp-buffer (insert-file-contents file)
1106 (mapc (lambda (rule)
1107 (setq data (replace-regexp-in-string
1108 (concat "fill:" (car rule))
1109 (concat "fill:" (cdr rule)) data)))
1111 (cons (car list) (list :type type :data data)))
1115 (let ((command (format "%s" this-command)))
1116 (when (string-match "gnus" command)
1117 (if (string-match "gnus-other-frame" command)
1118 (gnus-get-buffer-create gnus-group-buffer)
1123 (require 'gnus-util)
1126 (defcustom gnus-parameters nil
1127 "Alist of group parameters.
1130 ((\"mail\\\\..*\" (gnus-show-threads nil)
1131 (gnus-use-scoring nil)
1132 (gnus-summary-line-format
1133 \"%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\\n\")
1136 (\"mail\\\\.me\" (gnus-use-scoring t))
1137 (\"list\\\\..*\" (total-expire . t)
1138 (broken-reply-to . t)))"
1140 :group 'gnus-group-various
1141 :type '(repeat (cons regexp
1144 (defcustom gnus-parameters-case-fold-search 'default
1145 "If it is t, ignore case of group names specified in `gnus-parameters'.
1146 If it is nil, don't ignore case. If it is `default', which is for the
1147 backward compatibility, use the value of `case-fold-search'."
1149 :group 'gnus-group-various
1150 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
1151 (const :tag "Use `case-fold-search'" default)
1155 (defvar gnus-group-parameters-more nil)
1157 (defmacro gnus-define-group-parameter (param &rest rest)
1158 "Define a group parameter PARAM.
1159 REST is a plist of following:
1160 :type One of `bool', `list' or nil.
1161 :function The name of the function.
1162 :function-document The documentation of the function.
1163 :parameter-type The type for customizing the parameter.
1164 :parameter-document The documentation for the parameter.
1165 :variable The name of the variable.
1166 :variable-document The documentation for the variable.
1167 :variable-group The group for customizing the variable.
1168 :variable-type The type for customizing the variable.
1169 :variable-default The default value of the variable."
1170 (let* ((type (plist-get rest :type))
1171 (parameter-type (plist-get rest :parameter-type))
1172 (parameter-document (plist-get rest :parameter-document))
1173 (function (or (plist-get rest :function)
1174 (intern (format "gnus-parameter-%s" param))))
1175 (function-document (or (plist-get rest :function-document) ""))
1176 (variable (or (plist-get rest :variable)
1177 (intern (format "gnus-parameter-%s-alist" param))))
1178 (variable-document (or (plist-get rest :variable-document) ""))
1179 (variable-group (plist-get rest :variable-group))
1180 (variable-type (or (plist-get rest :variable-type)
1182 (list (regexp :tag "Group")
1183 ,(car (cdr parameter-type)))))))
1184 (variable-default (plist-get rest :variable-default)))
1187 `(defcustom ,variable ,variable-default
1189 :group 'gnus-group-parameter
1190 :group ',variable-group
1191 :type ,variable-type)
1192 `(setq gnus-group-parameters-more
1193 (delq (assq ',param gnus-group-parameters-more)
1194 gnus-group-parameters-more))
1195 `(add-to-list 'gnus-group-parameters-more
1198 ,parameter-document))
1200 `(defun ,function (name)
1202 (let ((params (gnus-group-find-parameter name))
1205 ((memq ',param params)
1207 ((setq val (assq ',param params))
1209 ((stringp ,variable)
1210 (string-match ,variable name))
1212 (let ((alist ,variable)
1214 (while (setq elem (pop alist))
1216 (string-match (car elem) name))
1219 (if (consp value) (car value) value))))))
1220 `(defun ,function (name)
1223 (or (gnus-group-find-parameter name ',param ,(and type t))
1224 (let ((alist ,variable)
1226 (while (setq elem (pop alist))
1228 (string-match (car elem) name))
1233 '(if (consp value) (car value) value))))))))))
1235 (defcustom gnus-home-directory "~/"
1236 "Directory variable that specifies the \"home\" directory.
1237 All other Gnus file and directory variables are initialized from this variable.
1239 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1240 This means that other directory variables that are initialized
1241 from this variable won't be set properly if you set this variable
1242 in `.gnus.el'. Set this variable in `.emacs' instead."
1246 (defcustom gnus-directory (or (getenv "SAVEDIR")
1247 (nnheader-concat gnus-home-directory "News/"))
1248 "*Directory variable from which all other Gnus file variables are derived.
1250 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1251 This means that other directory variables that are initialized from
1252 this variable won't be set properly if you set this variable in `.gnus.el'.
1253 Set this variable in `.emacs' instead."
1257 (defcustom gnus-default-directory nil
1258 "*Default directory for all Gnus buffers."
1260 :type '(choice (const :tag "current" nil)
1263 ;; Site dependent variables.
1265 ;; Should this be obsolete?
1266 (defcustom gnus-default-nntp-server nil
1267 "The hostname of the default NNTP server.
1268 The empty string, or nil, means to use the local host.
1269 You may wish to set this on a site-wide basis.
1271 If you want to change servers, you should use `gnus-select-method'."
1273 :type '(choice (const :tag "local host" nil)
1274 (string :tag "host name")))
1276 (defcustom gnus-nntpserver-file "/etc/nntpserver"
1277 "A file with only the name of the nntp server in it."
1282 (defun gnus-getenv-nntpserver ()
1283 "Find default nntp server.
1284 Check the NNTPSERVER environment variable and the
1285 `gnus-nntpserver-file' file."
1286 (or (getenv "NNTPSERVER")
1287 (and (file-readable-p gnus-nntpserver-file)
1289 (insert-file-contents gnus-nntpserver-file)
1290 (when (re-search-forward "[^ \t\n\r]+" nil t)
1291 (match-string 0))))))
1293 ;; `M-x customize-variable RET gnus-select-method RET' should work without
1294 ;; starting or even loading Gnus.
1295 ;;;###autoload(when (fboundp 'custom-autoload)
1296 ;;;###autoload (custom-autoload 'gnus-select-method "gnus"))
1298 (defcustom gnus-select-method
1299 (list 'nntp (or (gnus-getenv-nntpserver)
1300 (when (and gnus-default-nntp-server
1301 (not (string= gnus-default-nntp-server "")))
1302 gnus-default-nntp-server)
1304 "Default method for selecting a newsgroup.
1305 This variable should be a list, where the first element is how the
1306 news is to be fetched, the second is the address.
1308 For instance, if you want to get your news via \"flab.flab.edu\" using
1309 NNTP, you could say:
1311 \(setq gnus-select-method \\='(nntp \"flab.flab.edu\"))
1313 If you want to use your local spool, say:
1315 \(setq gnus-select-method (list \\='nnspool (system-name)))
1317 If you use this variable, you must set `gnus-nntp-server' to nil.
1319 There is a lot more to know about select methods and virtual servers -
1320 see the manual for details."
1321 ;; Emacs has set-after since 22.1.
1322 ;set-after '(gnus-default-nntp-server)
1325 :initialize 'custom-initialize-default
1326 :type 'gnus-select-method)
1328 (defcustom gnus-message-archive-method "archive"
1329 "*Method used for archiving messages you've sent.
1330 This should be a mail method.
1332 See also `gnus-update-message-archive-method'."
1334 :group 'gnus-message
1335 :type '(choice (const :tag "Default archive method" "archive")
1336 gnus-select-method))
1338 (defcustom gnus-update-message-archive-method nil
1339 "Non-nil means always update the saved \"archive\" method.
1341 The archive method is initially set according to the value of
1342 `gnus-message-archive-method' and is saved in the \"~/.newsrc.eld\" file
1343 so that it may be used as a real method of the server which is named
1344 \"archive\" ever since. If it once has been saved, it will never be
1345 updated if the value of this variable is nil, even if you change the
1346 value of `gnus-message-archive-method' afterward. If you want the
1347 saved \"archive\" method to be updated whenever you change the value of
1348 `gnus-message-archive-method', set this variable to a non-nil value."
1351 :group 'gnus-message
1354 (defcustom gnus-message-archive-group '((format-time-string "sent.%Y-%m"))
1355 "*Name of the group in which to save the messages you've written.
1356 This can either be a string; a list of strings; or an alist
1357 of regexps/functions/forms to be evaluated to return a string (or a list
1358 of strings). The functions are called with the name of the current
1359 group (or nil) as a parameter.
1361 If you want to save your mail in one group and the news articles you
1362 write in another group, you could say something like:
1364 \(setq gnus-message-archive-group
1365 \\='((if (message-news-p)
1369 Normally the group names returned by this variable should be
1370 unprefixed -- which implicitly means \"store on the archive server\".
1371 However, you may wish to store the message on some other server. In
1372 that case, just return a fully prefixed name of the group --
1373 \"nnml+private:mail.misc\", for instance."
1375 :group 'gnus-message
1376 :type '(choice (const :tag "none" nil)
1377 (const :tag "Weekly" ((format-time-string "sent.%Yw%U")))
1378 (const :tag "Monthly" ((format-time-string "sent.%Y-%m")))
1379 (const :tag "Yearly" ((format-time-string "sent.%Y")))
1384 (defcustom gnus-secondary-servers nil
1385 "List of NNTP servers that the user can choose between interactively.
1386 To make Gnus query you for a server, you have to give `gnus' a
1387 non-numeric prefix - `C-u M-x gnus', in short."
1389 :type '(repeat string))
1390 (make-obsolete-variable 'gnus-secondary-servers 'gnus-select-method "24.1")
1392 (defcustom gnus-secondary-select-methods nil
1393 "A list of secondary methods that will be used for reading news.
1394 This is a list where each element is a complete select method (see
1395 `gnus-select-method').
1397 If, for instance, you want to read your mail with the nnml back end,
1398 you could set this variable:
1400 \(setq gnus-secondary-select-methods \\='((nnml \"\")))"
1402 :type '(repeat gnus-select-method))
1404 (defcustom gnus-local-domain nil
1405 "Local domain name without a host name.
1406 The DOMAINNAME environment variable is used instead if it is defined.
1407 If the function `system-name' returns the full Internet name, there is
1408 no need to set this variable."
1409 :group 'gnus-message
1410 :type '(choice (const :tag "default" nil)
1412 (make-obsolete-variable 'gnus-local-domain nil "Emacs 24.1")
1414 ;; Customization variables
1416 (defcustom gnus-refer-article-method 'current
1417 "Preferred method for fetching an article by Message-ID.
1418 The value of this variable must be a valid select method as discussed
1419 in the documentation of `gnus-select-method'.
1421 It can also be a list of select methods, as well as the special symbol
1422 `current', which means to use the current select method. If it is a
1423 list, Gnus will try all the methods in the list until it finds a match."
1426 :type '(choice (const :tag "default" nil)
1428 (const :tag "Google" (nnweb "refer" (nnweb-type google)))
1431 (repeat :menu-tag "Try multiple"
1433 :value (current (nnweb "refer" (nnweb-type google)))
1434 (choice :tag "Method"
1436 (const :tag "Google"
1437 (nnweb "refer" (nnweb-type google)))
1438 gnus-select-method))))
1440 (defcustom gnus-use-cross-reference t
1441 "*Non-nil means that cross referenced articles will be marked as read.
1442 If nil, ignore cross references. If t, mark articles as read in
1443 subscribed newsgroups. If neither t nor nil, mark as read in all
1446 :type '(choice (const :tag "off" nil)
1447 (const :tag "subscribed" t)
1451 (defcustom gnus-process-mark ?#
1453 :group 'gnus-group-visual
1454 :group 'gnus-summary-marks
1457 (defcustom gnus-large-newsgroup 200
1458 "*The number of articles which indicates a large newsgroup.
1459 If the number of articles in a newsgroup is greater than this value,
1460 confirmation is required for selecting the newsgroup.
1461 If it is nil, no confirmation is required.
1463 Also see `gnus-large-ephemeral-newsgroup'."
1464 :group 'gnus-group-select
1465 :type '(choice (const :tag "No limit" nil)
1468 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v)))
1469 "Non-nil means that the default name of a file to save articles in is the group name.
1470 If it's nil, the directory form of the group name is used instead.
1472 If this variable is a list, and the list contains the element
1473 `not-score', long file names will not be used for score files; if it
1474 contains the element `not-save', long file names will not be used for
1475 saving; and if it contains the element `not-kill', long file names
1476 will not be used for kill files.
1478 Note that the default for this variable varies according to what system
1479 type you're using. On `usg-unix-v' this variable defaults to nil while
1480 on all other systems it defaults to t."
1482 :type '(radio (sexp :format "Non-nil\n"
1483 :match (lambda (widget value)
1484 (and value (not (listp value))))
1487 (checklist (const :format "%v " not-score)
1488 (const :format "%v " not-save)
1491 (defcustom gnus-kill-files-directory gnus-directory
1492 "*Name of the directory where kill files will be stored (default \"~/News\")."
1493 :group 'gnus-score-files