1 ;;; gnus.el --- a newsreader for GNU Emacs
3 ;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998,
4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
5 ;; Free Software Foundation, Inc.
7 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
8 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; Keywords: news, mail
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
30 (eval '(run-hooks 'gnus-load-hook))
34 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
36 (eval-when-compile (require 'cl))
41 ;; These are defined afterwards with gnus-define-group-parameter
42 (defvar gnus-ham-process-destinations)
43 (defvar gnus-parameter-ham-marks-alist)
44 (defvar gnus-parameter-spam-marks-alist)
45 (defvar gnus-spam-autodetect)
46 (defvar gnus-spam-autodetect-methods)
47 (defvar gnus-spam-newsgroup-contents)
48 (defvar gnus-spam-process-destinations)
49 (defvar gnus-spam-resend-to)
50 (defvar gnus-ham-resend-to)
51 (defvar gnus-spam-process-newsgroups)
55 "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
59 (defgroup gnus-start nil
60 "Starting your favorite newsreader."
63 (defgroup gnus-format nil
64 "Dealing with formatting issues."
67 (defgroup gnus-charset nil
68 "Group character set issues."
69 :link '(custom-manual "(gnus)Charsets")
73 (defgroup gnus-cache nil
75 :link '(custom-manual "(gnus)Article Caching")
78 (defgroup gnus-registry nil
82 (defgroup gnus-start-server nil
83 "Server options at startup."
86 ;; These belong to gnus-group.el.
87 (defgroup gnus-group nil
89 :link '(custom-manual "(gnus)Group Buffer")
92 (defgroup gnus-group-foreign nil
94 :link '(custom-manual "(gnus)Foreign Groups")
97 (defgroup gnus-group-new nil
98 "Automatic subscription of new groups."
101 (defgroup gnus-group-levels nil
103 :link '(custom-manual "(gnus)Group Levels")
106 (defgroup gnus-group-select nil
108 :link '(custom-manual "(gnus)Selecting a Group")
111 (defgroup gnus-group-listing nil
112 "Showing slices of the group list."
113 :link '(custom-manual "(gnus)Listing Groups")
116 (defgroup gnus-group-visual nil
117 "Sorting the group buffer."
118 :link '(custom-manual "(gnus)Group Buffer Format")
122 (defgroup gnus-group-various nil
123 "Various group options."
124 :link '(custom-manual "(gnus)Scanning New Messages")
127 ;; These belong to gnus-sum.el.
128 (defgroup gnus-summary nil
130 :link '(custom-manual "(gnus)Summary Buffer")
133 (defgroup gnus-summary-exit nil
134 "Leaving summary buffers."
135 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
136 :group 'gnus-summary)
138 (defgroup gnus-summary-marks nil
139 "Marks used in summary buffers."
140 :link '(custom-manual "(gnus)Marking Articles")
141 :group 'gnus-summary)
143 (defgroup gnus-thread nil
144 "Ordering articles according to replies."
145 :link '(custom-manual "(gnus)Threading")
146 :group 'gnus-summary)
148 (defgroup gnus-summary-format nil
149 "Formatting of the summary buffer."
150 :link '(custom-manual "(gnus)Summary Buffer Format")
151 :group 'gnus-summary)
153 (defgroup gnus-summary-choose nil
155 :link '(custom-manual "(gnus)Choosing Articles")
156 :group 'gnus-summary)
158 (defgroup gnus-summary-maneuvering nil
159 "Summary movement commands."
160 :link '(custom-manual "(gnus)Summary Maneuvering")
161 :group 'gnus-summary)
163 (defgroup gnus-picon nil
164 "Show pictures of people, domains, and newsgroups."
167 (defgroup gnus-summary-mail nil
168 "Mail group commands."
169 :link '(custom-manual "(gnus)Mail Group Commands")
170 :group 'gnus-summary)
172 (defgroup gnus-summary-sort nil
173 "Sorting the summary buffer."
174 :link '(custom-manual "(gnus)Sorting the Summary Buffer")
175 :group 'gnus-summary)
177 (defgroup gnus-summary-visual nil
178 "Highlighting and menus in the summary buffer."
179 :link '(custom-manual "(gnus)Summary Highlighting")
181 :group 'gnus-summary)
183 (defgroup gnus-summary-various nil
184 "Various summary buffer options."
185 :link '(custom-manual "(gnus)Various Summary Stuff")
186 :group 'gnus-summary)
188 (defgroup gnus-summary-pick nil
189 "Pick mode in the summary buffer."
190 :link '(custom-manual "(gnus)Pick and Read")
192 :group 'gnus-summary)
194 (defgroup gnus-summary-tree nil
195 "Tree display of threads in the summary buffer."
196 :link '(custom-manual "(gnus)Tree Display")
198 :group 'gnus-summary)
200 ;; Belongs to gnus-uu.el
201 (defgroup gnus-extract-view nil
202 "Viewing extracted files."
203 :link '(custom-manual "(gnus)Viewing Files")
204 :group 'gnus-extract)
206 ;; Belongs to gnus-score.el
207 (defgroup gnus-score nil
208 "Score and kill file handling."
211 (defgroup gnus-score-kill nil
215 (defgroup gnus-score-adapt nil
216 "Adaptive score files."
219 (defgroup gnus-score-default nil
220 "Default values for score files."
223 (defgroup gnus-score-expire nil
224 "Expiring score rules."
227 (defgroup gnus-score-decay nil
228 "Decaying score rules."
231 (defgroup gnus-score-files nil
232 "Score and kill file names."
236 (defgroup gnus-score-various nil
237 "Various scoring and killing options."
241 (defgroup gnus-visual nil
242 "Options controlling the visual fluff."
246 (defgroup gnus-agent nil
247 "Offline support for Gnus."
250 (defgroup gnus-files nil
251 "Files used by Gnus."
254 (defgroup gnus-dribble-file nil
256 :link '(custom-manual "(gnus)Auto Save")
259 (defgroup gnus-newsrc nil
260 "Storing Gnus state."
263 (defgroup gnus-server nil
264 "Options related to newsservers and other servers used by Gnus."
267 (defgroup gnus-server-visual nil
268 "Highlighting and menus in the server buffer."
272 (defgroup gnus-message '((message custom-group))
273 "Composing replies and followups in Gnus."
276 (defgroup gnus-meta nil
277 "Meta variables controlling major portions of Gnus.
278 In general, modifying these variables does not take affect until Gnus
279 is restarted, and sometimes reloaded."
282 (defgroup gnus-various nil
283 "Other Gnus options."
284 :link '(custom-manual "(gnus)Various Various")
287 (defgroup gnus-exit nil
289 :link '(custom-manual "(gnus)Exiting Gnus")
292 (defgroup gnus-fun nil
293 "Frivolous Gnus extensions."
294 :link '(custom-manual "(gnus)Exiting Gnus")
297 (defconst gnus-version-number "0.11"
298 "Version number for this version of Gnus.")
300 (defconst gnus-version (format "No Gnus v%s" gnus-version-number)
301 "Version string for this version of Gnus.")
303 (defcustom gnus-inhibit-startup-message nil
304 "If non-nil, the startup message will not be displayed.
305 This variable is used before `.gnus.el' is loaded, so it should
306 be set in `.emacs' instead."
310 (defcustom gnus-play-startup-jingle nil
311 "If non-nil, play the Gnus jingle at startup."
315 (unless (fboundp 'gnus-group-remove-excess-properties)
316 (defalias 'gnus-group-remove-excess-properties 'ignore))
318 (unless (featurep 'gnus-xmas)
319 (defalias 'gnus-make-overlay 'make-overlay)
320 (defalias 'gnus-delete-overlay 'delete-overlay)
321 (defalias 'gnus-overlay-put 'overlay-put)
322 (defalias 'gnus-move-overlay 'move-overlay)
323 (defalias 'gnus-overlay-buffer 'overlay-buffer)
324 (defalias 'gnus-overlay-start 'overlay-start)
325 (defalias 'gnus-overlay-end 'overlay-end)
326 (defalias 'gnus-extent-detached-p 'ignore)
327 (defalias 'gnus-extent-start-open 'ignore)
328 (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
329 (defalias 'gnus-character-to-event 'identity)
330 (defalias 'gnus-assq-delete-all 'assq-delete-all)
331 (defalias 'gnus-add-text-properties 'add-text-properties)
332 (defalias 'gnus-put-text-property 'put-text-property)
333 (defvar gnus-mode-line-image-cache t)
334 (if (fboundp 'find-image)
335 (defun gnus-mode-line-buffer-identification (line)
336 (let ((str (car-safe line))
337 (load-path (mm-image-load-path)))
338 (if (and (stringp str)
339 (string-match "^Gnus:" str))
340 (progn (add-text-properties
343 (if (eq t gnus-mode-line-image-cache)
344 (setq gnus-mode-line-image-cache
346 '((:type xpm :file "gnus-pointer.xpm"
348 (:type xbm :file "gnus-pointer.xbm"
350 gnus-mode-line-image-cache)
353 gnus-version (gnus-emacs-version)))
357 (defalias 'gnus-mode-line-buffer-identification 'identity))
358 (defalias 'gnus-characterp 'numberp)
359 (defalias 'gnus-deactivate-mark 'deactivate-mark)
360 (defalias 'gnus-window-edges 'window-edges)
361 (defalias 'gnus-key-press-event-p 'numberp)
362 ;;(defalias 'gnus-decode-rfc1522 'ignore)
365 ;; We define these group faces here to avoid the display
366 ;; update forced when creating new faces.
368 (defface gnus-group-news-1
371 (:foreground "PaleTurquoise" :bold t))
374 (:foreground "ForestGreen" :bold t))
377 "Level 1 newsgroup face."
379 ;; backward-compatibility alias
380 (put 'gnus-group-news-1-face 'face-alias 'gnus-group-news-1)
382 (defface gnus-group-news-1-empty
385 (:foreground "PaleTurquoise"))
388 (:foreground "ForestGreen"))
391 "Level 1 empty newsgroup face."
393 ;; backward-compatibility alias
394 (put 'gnus-group-news-1-empty-face 'face-alias 'gnus-group-news-1-empty)
396 (defface gnus-group-news-2
399 (:foreground "turquoise" :bold t))
402 (:foreground "CadetBlue4" :bold t))
405 "Level 2 newsgroup face."
407 ;; backward-compatibility alias
408 (put 'gnus-group-news-2-face 'face-alias 'gnus-group-news-2)
410 (defface gnus-group-news-2-empty
413 (:foreground "turquoise"))
416 (:foreground "CadetBlue4"))
419 "Level 2 empty newsgroup face."
421 ;; backward-compatibility alias
422 (put 'gnus-group-news-2-empty-face 'face-alias 'gnus-group-news-2-empty)
424 (defface gnus-group-news-3
433 "Level 3 newsgroup face."
435 ;; backward-compatibility alias
436 (put 'gnus-group-news-3-face 'face-alias 'gnus-group-news-3)
438 (defface gnus-group-news-3-empty
447 "Level 3 empty newsgroup face."
449 ;; backward-compatibility alias
450 (put 'gnus-group-news-3-empty-face 'face-alias 'gnus-group-news-3-empty)
452 (defface gnus-group-news-4
461 "Level 4 newsgroup face."
463 ;; backward-compatibility alias
464 (put 'gnus-group-news-4-face 'face-alias 'gnus-group-news-4)
466 (defface gnus-group-news-4-empty
475 "Level 4 empty newsgroup face."
477 ;; backward-compatibility alias
478 (put 'gnus-group-news-4-empty-face 'face-alias 'gnus-group-news-4-empty)
480 (defface gnus-group-news-5
489 "Level 5 newsgroup face."
491 ;; backward-compatibility alias
492 (put 'gnus-group-news-5-face 'face-alias 'gnus-group-news-5)
494 (defface gnus-group-news-5-empty
503 "Level 5 empty newsgroup face."
505 ;; backward-compatibility alias
506 (put 'gnus-group-news-5-empty-face 'face-alias 'gnus-group-news-5-empty)
508 (defface gnus-group-news-6
517 "Level 6 newsgroup face."
519 ;; backward-compatibility alias
520 (put 'gnus-group-news-6-face 'face-alias 'gnus-group-news-6)
522 (defface gnus-group-news-6-empty
531 "Level 6 empty newsgroup face."
533 ;; backward-compatibility alias
534 (put 'gnus-group-news-6-empty-face 'face-alias 'gnus-group-news-6-empty)
536 (defface gnus-group-news-low
539 (:foreground "DarkTurquoise" :bold t))
542 (:foreground "DarkGreen" :bold t))
545 "Low level newsgroup face."
547 ;; backward-compatibility alias
548 (put 'gnus-group-news-low-face 'face-alias 'gnus-group-news-low)
550 (defface gnus-group-news-low-empty
553 (:foreground "DarkTurquoise"))
556 (:foreground "DarkGreen"))
559 "Low level empty newsgroup face."
561 ;; backward-compatibility alias
562 (put 'gnus-group-news-low-empty-face 'face-alias 'gnus-group-news-low-empty)
564 (defface gnus-group-mail-1
567 (:foreground "#e1ffe1" :bold t))
570 (:foreground "DeepPink3" :bold t))
573 "Level 1 mailgroup face."
575 ;; backward-compatibility alias
576 (put 'gnus-group-mail-1-face 'face-alias 'gnus-group-mail-1)
578 (defface gnus-group-mail-1-empty
581 (:foreground "#e1ffe1"))
584 (:foreground "DeepPink3"))
586 (:italic t :bold t)))
587 "Level 1 empty mailgroup face."
589 ;; backward-compatibility alias
590 (put 'gnus-group-mail-1-empty-face 'face-alias 'gnus-group-mail-1-empty)
592 (defface gnus-group-mail-2
595 (:foreground "DarkSeaGreen1" :bold t))
598 (:foreground "HotPink3" :bold t))
601 "Level 2 mailgroup face."
603 ;; backward-compatibility alias
604 (put 'gnus-group-mail-2-face 'face-alias 'gnus-group-mail-2)
606 (defface gnus-group-mail-2-empty
609 (:foreground "DarkSeaGreen1"))
612 (:foreground "HotPink3"))
615 "Level 2 empty mailgroup face."
617 ;; backward-compatibility alias
618 (put 'gnus-group-mail-2-empty-face 'face-alias 'gnus-group-mail-2-empty)
620 (defface gnus-group-mail-3
623 (:foreground "aquamarine1" :bold t))
626 (:foreground "magenta4" :bold t))
629 "Level 3 mailgroup face."
631 ;; backward-compatibility alias
632 (put 'gnus-group-mail-3-face 'face-alias 'gnus-group-mail-3)
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)
648 (defface gnus-group-mail-low
651 (:foreground "aquamarine2" :bold t))
654 (:foreground "DeepPink4" :bold t))
657 "Low level mailgroup face."
659 ;; backward-compatibility alias
660 (put 'gnus-group-mail-low-face 'face-alias 'gnus-group-mail-low)
662 (defface gnus-group-mail-low-empty
665 (:foreground "aquamarine2"))
668 (:foreground "DeepPink4"))
671 "Low level empty mailgroup face."
673 ;; backward-compatibility alias
674 (put 'gnus-group-mail-low-empty-face 'face-alias 'gnus-group-mail-low-empty)
676 ;; Summary mode faces.
678 (defface gnus-summary-selected '((t (:underline t)))
679 "Face used for selected articles."
680 :group 'gnus-summary)
681 ;; backward-compatibility alias
682 (put 'gnus-summary-selected-face 'face-alias 'gnus-summary-selected)
684 (defface gnus-summary-cancelled
686 (:foreground "yellow" :background "black")))
687 "Face used for cancelled articles."
688 :group 'gnus-summary)
689 ;; backward-compatibility alias
690 (put 'gnus-summary-cancelled-face 'face-alias 'gnus-summary-cancelled)
692 (defface gnus-summary-high-ticked
695 (:foreground "pink" :bold t))
698 (:foreground "firebrick" :bold t))
701 "Face used for high interest ticked articles."
702 :group 'gnus-summary)
703 ;; backward-compatibility alias
704 (put 'gnus-summary-high-ticked-face 'face-alias 'gnus-summary-high-ticked)
706 (defface gnus-summary-low-ticked
709 (:foreground "pink" :italic t))
712 (:foreground "firebrick" :italic t))
715 "Face used for low interest ticked articles."
716 :group 'gnus-summary)
717 ;; backward-compatibility alias
718 (put 'gnus-summary-low-ticked-face 'face-alias 'gnus-summary-low-ticked)
720 (defface gnus-summary-normal-ticked
723 (:foreground "pink"))
726 (:foreground "firebrick"))
729 "Face used for normal interest ticked articles."
730 :group 'gnus-summary)
731 ;; backward-compatibility alias
732 (put 'gnus-summary-normal-ticked-face 'face-alias 'gnus-summary-normal-ticked)
734 (defface gnus-summary-high-ancient
737 (:foreground "SkyBlue" :bold t))
740 (:foreground "RoyalBlue" :bold t))
743 "Face used for high interest ancient articles."
744 :group 'gnus-summary)
745 ;; backward-compatibility alias
746 (put 'gnus-summary-high-ancient-face 'face-alias 'gnus-summary-high-ancient)
748 (defface gnus-summary-low-ancient
751 (:foreground "SkyBlue" :italic t))
754 (:foreground "RoyalBlue" :italic t))
757 "Face used for low interest ancient articles."
758 :group 'gnus-summary)
759 ;; backward-compatibility alias
760 (put 'gnus-summary-low-ancient-face 'face-alias 'gnus-summary-low-ancient)
762 (defface gnus-summary-normal-ancient
765 (:foreground "SkyBlue"))
768 (:foreground "RoyalBlue"))
771 "Face used for normal interest ancient articles."
772 :group 'gnus-summary)
773 ;; backward-compatibility alias
774 (put 'gnus-summary-normal-ancient-face 'face-alias 'gnus-summary-normal-ancient)
776 (defface gnus-summary-high-undownloaded
779 (:bold t :foreground "cyan4"))
780 (((class color) (background dark))
781 (:bold t :foreground "LightGray"))
782 (t (:inverse-video t :bold t)))
783 "Face used for high interest uncached articles."
784 :group 'gnus-summary)
785 ;; backward-compatibility alias
786 (put 'gnus-summary-high-undownloaded-face 'face-alias 'gnus-summary-high-undownloaded)
788 (defface gnus-summary-low-undownloaded
791 (:italic t :foreground "cyan4" :bold nil))
792 (((class color) (background dark))
793 (:italic t :foreground "LightGray" :bold nil))
794 (t (:inverse-video t :italic t)))
795 "Face used for low interest uncached articles."
796 :group 'gnus-summary)
797 ;; backward-compatibility alias
798 (put 'gnus-summary-low-undownloaded-face 'face-alias 'gnus-summary-low-undownloaded)
800 (defface gnus-summary-normal-undownloaded
803 (:foreground "cyan4" :bold nil))
804 (((class color) (background dark))
805 (:foreground "LightGray" :bold nil))
806 (t (:inverse-video t)))
807 "Face used for normal interest uncached articles."
808 :group 'gnus-summary)
809 ;; backward-compatibility alias
810 (put 'gnus-summary-normal-undownloaded-face 'face-alias 'gnus-summary-normal-undownloaded)
812 (defface gnus-summary-high-unread
815 "Face used for high interest unread articles."
816 :group 'gnus-summary)
817 ;; backward-compatibility alias
818 (put 'gnus-summary-high-unread-face 'face-alias 'gnus-summary-high-unread)
820 (defface gnus-summary-low-unread
823 "Face used for low interest unread articles."
824 :group 'gnus-summary)
825 ;; backward-compatibility alias
826 (put 'gnus-summary-low-unread-face 'face-alias 'gnus-summary-low-unread)
828 (defface gnus-summary-normal-unread
831 "Face used for normal interest unread articles."
832 :group 'gnus-summary)
833 ;; backward-compatibility alias
834 (put 'gnus-summary-normal-unread-face 'face-alias 'gnus-summary-normal-unread)
836 (defface gnus-summary-high-read
839 (:foreground "PaleGreen"
843 (:foreground "DarkGreen"
847 "Face used for high interest read articles."
848 :group 'gnus-summary)
849 ;; backward-compatibility alias
850 (put 'gnus-summary-high-read-face 'face-alias 'gnus-summary-high-read)
852 (defface gnus-summary-low-read
855 (:foreground "PaleGreen"
859 (:foreground "DarkGreen"
863 "Face used for low interest read articles."
864 :group 'gnus-summary)
865 ;; backward-compatibility alias
866 (put 'gnus-summary-low-read-face 'face-alias 'gnus-summary-low-read)
868 (defface gnus-summary-normal-read
871 (:foreground "PaleGreen"))
874 (:foreground "DarkGreen"))
877 "Face used for normal interest read articles."
878 :group 'gnus-summary)
879 ;; backward-compatibility alias
880 (put 'gnus-summary-normal-read-face 'face-alias 'gnus-summary-normal-read)
887 (defvar gnus-buffers nil)
889 (defun gnus-get-buffer-create (name)
890 "Do the same as `get-buffer-create', but store the created buffer."
891 (or (get-buffer name)
892 (car (push (get-buffer-create name) gnus-buffers))))
894 (defun gnus-add-buffer ()
895 "Add the current buffer to the list of Gnus buffers."
896 (push (current-buffer) gnus-buffers))
898 (defmacro gnus-kill-buffer (buffer)
899 "Kill BUFFER and remove from the list of Gnus buffers."
900 `(let ((buf ,buffer))
901 (when (gnus-buffer-exists-p buf)
902 (setq gnus-buffers (delete (get-buffer buf) gnus-buffers))
905 (defun gnus-buffers ()
906 "Return a list of live Gnus buffers."
907 (while (and gnus-buffers
908 (not (buffer-name (car gnus-buffers))))
910 (let ((buffers gnus-buffers))
912 (if (buffer-name (cadr buffers))
914 (setcdr buffers (cddr buffers)))))
919 (defvar gnus-group-buffer "*Group*")
921 (autoload 'gnus-play-jingle "gnus-audio")
926 (:foreground "#cccccc"))
929 (:foreground "#888888"))
932 "Face for the splash screen."
934 ;; backward-compatibility alias
935 (put 'gnus-splash-face 'face-alias 'gnus-splash)
937 (defun gnus-splash ()
939 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
940 (let ((buffer-read-only nil))
942 (unless gnus-inhibit-startup-message
943 (gnus-group-startup-message)
945 (when gnus-play-startup-jingle
946 (gnus-play-jingle))))))
948 (defun gnus-indent-rigidly (start end arg)
949 "Indent rigidly using only spaces and no tabs."
952 (narrow-to-region start end)
954 (indent-rigidly start end arg)
955 ;; We translate tabs into spaces -- not everybody uses
956 ;; an 8-character tab.
957 (goto-char (point-min))
958 (while (search-forward "\t" nil t)
959 (replace-match " " t t))))))
961 (defvar gnus-simple-splash nil)
963 ;;(format "%02x%02x%02x" 114 66 20) "724214"
965 (defvar gnus-logo-color-alist
966 '((flame "#cc3300" "#ff2200")
967 (pine "#c0cc93" "#f8ffb8")