Don't EXAMINE a group if it's already selected.
[gnus] / lisp / gnus.el
1 ;;; gnus.el --- a newsreader for GNU Emacs
2
3 ;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997,
4 ;;   1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
5 ;;   2010  Free Software Foundation, Inc.
6
7 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
8 ;;      Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; Keywords: news, mail
10
11 ;; This file is part of GNU Emacs.
12
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.
17
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.
22
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/>.
25
26 ;;; Commentary:
27
28 ;;; Code:
29
30 (eval '(run-hooks 'gnus-load-hook))
31
32 ;; For Emacs <22.2 and XEmacs.
33 (eval-and-compile
34   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
35
36 (eval-when-compile (require 'cl))
37 (require 'wid-edit)
38 (require 'mm-util)
39 (require 'nnheader)
40
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)
52
53
54 (defgroup gnus nil
55   "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
56   :group 'news
57   :group 'mail)
58
59 (defgroup gnus-start nil
60   "Starting your favorite newsreader."
61   :group 'gnus)
62
63 (defgroup gnus-format nil
64   "Dealing with formatting issues."
65   :group 'gnus)
66
67 (defgroup gnus-charset nil
68   "Group character set issues."
69   :link '(custom-manual "(gnus)Charsets")
70   :version "21.1"
71   :group 'gnus)
72
73 (defgroup gnus-cache nil
74   "Cache interface."
75   :link '(custom-manual "(gnus)Article Caching")
76   :group 'gnus)
77
78 (defgroup gnus-registry nil
79   "Article Registry."
80   :group 'gnus)
81
82 (defgroup gnus-start-server nil
83   "Server options at startup."
84   :group 'gnus-start)
85
86 ;; These belong to gnus-group.el.
87 (defgroup gnus-group nil
88   "Group buffers."
89   :link '(custom-manual "(gnus)Group Buffer")
90   :group 'gnus)
91
92 (defgroup gnus-group-foreign nil
93   "Foreign groups."
94   :link '(custom-manual "(gnus)Foreign Groups")
95   :group 'gnus-group)
96
97 (defgroup gnus-group-new nil
98   "Automatic subscription of new groups."
99   :group 'gnus-group)
100
101 (defgroup gnus-group-levels nil
102   "Group levels."
103   :link '(custom-manual "(gnus)Group Levels")
104   :group 'gnus-group)
105
106 (defgroup gnus-group-select nil
107   "Selecting a Group."
108   :link '(custom-manual "(gnus)Selecting a Group")
109   :group 'gnus-group)
110
111 (defgroup gnus-group-listing nil
112   "Showing slices of the group list."
113   :link '(custom-manual "(gnus)Listing Groups")
114   :group 'gnus-group)
115
116 (defgroup gnus-group-visual nil
117   "Sorting the group buffer."
118   :link '(custom-manual "(gnus)Group Buffer Format")
119   :group 'gnus-group
120   :group 'gnus-visual)
121
122 (defgroup gnus-group-various nil
123   "Various group options."
124   :link '(custom-manual "(gnus)Scanning New Messages")
125   :group 'gnus-group)
126
127 ;; These belong to gnus-sum.el.
128 (defgroup gnus-summary nil
129   "Summary buffers."
130   :link '(custom-manual "(gnus)Summary Buffer")
131   :group 'gnus)
132
133 (defgroup gnus-summary-exit nil
134   "Leaving summary buffers."
135   :link '(custom-manual "(gnus)Exiting the Summary Buffer")
136   :group 'gnus-summary)
137
138 (defgroup gnus-summary-marks nil
139   "Marks used in summary buffers."
140   :link '(custom-manual "(gnus)Marking Articles")
141   :group 'gnus-summary)
142
143 (defgroup gnus-thread nil
144   "Ordering articles according to replies."
145   :link '(custom-manual "(gnus)Threading")
146   :group 'gnus-summary)
147
148 (defgroup gnus-summary-format nil
149   "Formatting of the summary buffer."
150   :link '(custom-manual "(gnus)Summary Buffer Format")
151   :group 'gnus-summary)
152
153 (defgroup gnus-summary-choose nil
154   "Choosing Articles."
155   :link '(custom-manual "(gnus)Choosing Articles")
156   :group 'gnus-summary)
157
158 (defgroup gnus-summary-maneuvering nil
159   "Summary movement commands."
160   :link '(custom-manual "(gnus)Summary Maneuvering")
161   :group 'gnus-summary)
162
163 (defgroup gnus-picon nil
164   "Show pictures of people, domains, and newsgroups."
165   :group 'gnus-visual)
166
167 (defgroup gnus-summary-mail nil
168   "Mail group commands."
169   :link '(custom-manual "(gnus)Mail Group Commands")
170   :group 'gnus-summary)
171
172 (defgroup gnus-summary-sort nil
173   "Sorting the summary buffer."
174   :link '(custom-manual "(gnus)Sorting the Summary Buffer")
175   :group 'gnus-summary)
176
177 (defgroup gnus-summary-visual nil
178   "Highlighting and menus in the summary buffer."
179   :link '(custom-manual "(gnus)Summary Highlighting")
180   :group 'gnus-visual
181   :group 'gnus-summary)
182
183 (defgroup gnus-summary-various nil
184   "Various summary buffer options."
185   :link '(custom-manual "(gnus)Various Summary Stuff")
186   :group 'gnus-summary)
187
188 (defgroup gnus-summary-pick nil
189   "Pick mode in the summary buffer."
190   :link '(custom-manual "(gnus)Pick and Read")
191   :prefix "gnus-pick-"
192   :group 'gnus-summary)
193
194 (defgroup gnus-summary-tree nil
195   "Tree display of threads in the summary buffer."
196   :link '(custom-manual "(gnus)Tree Display")
197   :prefix "gnus-tree-"
198   :group 'gnus-summary)
199
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)
205
206 ;; Belongs to gnus-score.el
207 (defgroup gnus-score nil
208   "Score and kill file handling."
209   :group 'gnus)
210
211 (defgroup gnus-score-kill nil
212   "Kill files."
213   :group 'gnus-score)
214
215 (defgroup gnus-score-adapt nil
216   "Adaptive score files."
217   :group 'gnus-score)
218
219 (defgroup gnus-score-default nil
220   "Default values for score files."
221   :group 'gnus-score)
222
223 (defgroup gnus-score-expire nil
224   "Expiring score rules."
225   :group 'gnus-score)
226
227 (defgroup gnus-score-decay nil
228   "Decaying score rules."
229   :group 'gnus-score)
230
231 (defgroup gnus-score-files nil
232   "Score and kill file names."
233   :group 'gnus-score
234   :group 'gnus-files)
235
236 (defgroup gnus-score-various nil
237   "Various scoring and killing options."
238   :group 'gnus-score)
239
240 ;; Other
241 (defgroup gnus-visual nil
242   "Options controlling the visual fluff."
243   :group 'gnus
244   :group 'faces)
245
246 (defgroup gnus-agent nil
247   "Offline support for Gnus."
248   :group 'gnus)
249
250 (defgroup gnus-files nil
251   "Files used by Gnus."
252   :group 'gnus)
253
254 (defgroup gnus-dribble-file nil
255   "Auto save file."
256   :link '(custom-manual "(gnus)Auto Save")
257   :group 'gnus-files)
258
259 (defgroup gnus-newsrc nil
260   "Storing Gnus state."
261   :group 'gnus-files)
262
263 (defgroup gnus-server nil
264   "Options related to newsservers and other servers used by Gnus."
265   :group 'gnus)
266
267 (defgroup gnus-server-visual nil
268   "Highlighting and menus in the server buffer."
269   :group 'gnus-visual
270   :group 'gnus-server)
271
272 (defgroup gnus-message '((message custom-group))
273   "Composing replies and followups in Gnus."
274   :group 'gnus)
275
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."
280   :group 'gnus)
281
282 (defgroup gnus-various nil
283   "Other Gnus options."
284   :link '(custom-manual "(gnus)Various Various")
285   :group 'gnus)
286
287 (defgroup gnus-exit nil
288   "Exiting Gnus."
289   :link '(custom-manual "(gnus)Exiting Gnus")
290   :group 'gnus)
291
292 (defgroup gnus-fun nil
293   "Frivolous Gnus extensions."
294   :link '(custom-manual "(gnus)Exiting Gnus")
295   :group 'gnus)
296
297 (defconst gnus-version-number "0.11"
298   "Version number for this version of Gnus.")
299
300 (defconst gnus-version (format "No Gnus v%s" gnus-version-number)
301   "Version string for this version of Gnus.")
302
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."
307   :group 'gnus-start
308   :type 'boolean)
309
310 (unless (featurep 'gnus-xmas)
311   (defalias 'gnus-make-overlay 'make-overlay)
312   (defalias 'gnus-delete-overlay 'delete-overlay)
313   (defalias 'gnus-overlay-get 'overlay-get)
314   (defalias 'gnus-overlay-put 'overlay-put)
315   (defalias 'gnus-move-overlay 'move-overlay)
316   (defalias 'gnus-overlay-buffer 'overlay-buffer)
317   (defalias 'gnus-overlay-start 'overlay-start)
318   (defalias 'gnus-overlay-end 'overlay-end)
319   (defalias 'gnus-overlays-in 'overlays-in)
320   (defalias 'gnus-extent-detached-p 'ignore)
321   (defalias 'gnus-extent-start-open 'ignore)
322   (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
323   (defalias 'gnus-character-to-event 'identity)
324   (defalias 'gnus-assq-delete-all 'assq-delete-all)
325   (defalias 'gnus-add-text-properties 'add-text-properties)
326   (defalias 'gnus-put-text-property 'put-text-property)
327   (defvar gnus-mode-line-image-cache t)
328   (if (fboundp 'find-image)
329       (defun gnus-mode-line-buffer-identification (line)
330         (let ((str (car-safe line))
331               (load-path (mm-image-load-path)))
332           (if (and (stringp str)
333                    (string-match "^Gnus:" str))
334               (progn (add-text-properties
335                       0 5
336                       (list 'display
337                             (if (eq t gnus-mode-line-image-cache)
338                                 (setq gnus-mode-line-image-cache
339                                       (find-image
340                                        '((:type xpm :file "gnus-pointer.xpm"
341                                                 :ascent center)
342                                          (:type xbm :file "gnus-pointer.xbm"
343                                                 :ascent center))))
344                               gnus-mode-line-image-cache)
345                             'help-echo (format
346                                         "This is %s, %s."
347                                         gnus-version (gnus-emacs-version)))
348                       str)
349                      (list str))
350             line)))
351     (defalias 'gnus-mode-line-buffer-identification 'identity))
352   (defalias 'gnus-deactivate-mark 'deactivate-mark)
353   (defalias 'gnus-window-edges 'window-edges)
354   (defalias 'gnus-key-press-event-p 'numberp)
355   ;;(defalias 'gnus-decode-rfc1522 'ignore)
356   )
357
358 ;; We define these group faces here to avoid the display
359 ;; update forced when creating new faces.
360
361 (defface gnus-group-news-1
362   '((((class color)
363       (background dark))
364      (:foreground "PaleTurquoise" :bold t))
365     (((class color)
366       (background light))
367      (:foreground "ForestGreen" :bold t))
368     (t
369      ()))
370   "Level 1 newsgroup face."
371   :group 'gnus-group)
372 ;; backward-compatibility alias
373 (put 'gnus-group-news-1-face 'face-alias 'gnus-group-news-1)
374 (put 'gnus-group-news-1-face 'obsolete-face "22.1")
375
376 (defface gnus-group-news-1-empty
377   '((((class color)
378       (background dark))
379      (:foreground "PaleTurquoise"))
380     (((class color)
381       (background light))
382      (:foreground "ForestGreen"))
383     (t
384      ()))
385   "Level 1 empty newsgroup face."
386   :group 'gnus-group)
387 ;; backward-compatibility alias
388 (put 'gnus-group-news-1-empty-face 'face-alias 'gnus-group-news-1-empty)
389 (put 'gnus-group-news-1-empty-face 'obsolete-face "22.1")
390
391 (defface gnus-group-news-2
392   '((((class color)
393       (background dark))
394      (:foreground "turquoise" :bold t))
395     (((class color)
396       (background light))
397      (:foreground "CadetBlue4" :bold t))
398     (t
399      ()))
400   "Level 2 newsgroup face."
401   :group 'gnus-group)
402 ;; backward-compatibility alias
403 (put 'gnus-group-news-2-face 'face-alias 'gnus-group-news-2)
404 (put 'gnus-group-news-2-face 'obsolete-face "22.1")
405
406 (defface gnus-group-news-2-empty
407   '((((class color)
408       (background dark))
409      (:foreground "turquoise"))
410     (((class color)
411       (background light))
412      (:foreground "CadetBlue4"))
413     (t
414      ()))
415   "Level 2 empty newsgroup face."
416   :group 'gnus-group)
417 ;; backward-compatibility alias
418 (put 'gnus-group-news-2-empty-face 'face-alias 'gnus-group-news-2-empty)
419 (put 'gnus-group-news-2-empty-face 'obsolete-face "22.1")
420
421 (defface gnus-group-news-3
422   '((((class color)
423       (background dark))
424      (:bold t))
425     (((class color)
426       (background light))
427      (:bold t))
428     (t
429      ()))
430   "Level 3 newsgroup face."
431   :group 'gnus-group)
432 ;; backward-compatibility alias
433 (put 'gnus-group-news-3-face 'face-alias 'gnus-group-news-3)
434 (put 'gnus-group-news-3-face 'obsolete-face "22.1")
435
436 (defface gnus-group-news-3-empty
437   '((((class color)
438       (background dark))
439      ())
440     (((class color)
441       (background light))
442      ())
443     (t
444      ()))
445   "Level 3 empty newsgroup face."
446   :group 'gnus-group)
447 ;; backward-compatibility alias
448 (put 'gnus-group-news-3-empty-face 'face-alias 'gnus-group-news-3-empty)
449 (put 'gnus-group-news-3-empty-face 'obsolete-face "22.1")
450
451 (defface gnus-group-news-4
452   '((((class color)
453       (background dark))
454      (:bold t))
455     (((class color)
456       (background light))
457      (:bold t))
458     (t
459      ()))
460   "Level 4 newsgroup face."
461   :group 'gnus-group)
462 ;; backward-compatibility alias
463 (put 'gnus-group-news-4-face 'face-alias 'gnus-group-news-4)
464 (put 'gnus-group-news-4-face 'obsolete-face "22.1")
465
466 (defface gnus-group-news-4-empty
467   '((((class color)
468       (background dark))
469      ())
470     (((class color)
471       (background light))
472      ())
473     (t
474      ()))
475   "Level 4 empty newsgroup face."
476   :group 'gnus-group)
477 ;; backward-compatibility alias
478 (put 'gnus-group-news-4-empty-face 'face-alias 'gnus-group-news-4-empty)
479 (put 'gnus-group-news-4-empty-face 'obsolete-face "22.1")
480
481 (defface gnus-group-news-5
482   '((((class color)
483       (background dark))
484      (:bold t))
485     (((class color)
486       (background light))
487      (:bold t))
488     (t
489      ()))
490   "Level 5 newsgroup face."
491   :group 'gnus-group)
492 ;; backward-compatibility alias
493 (put 'gnus-group-news-5-face 'face-alias 'gnus-group-news-5)
494 (put 'gnus-group-news-5-face 'obsolete-face "22.1")
495
496 (defface gnus-group-news-5-empty
497   '((((class color)
498       (background dark))
499      ())
500     (((class color)
501       (background light))
502      ())
503     (t
504      ()))
505   "Level 5 empty newsgroup face."
506   :group 'gnus-group)
507 ;; backward-compatibility alias
508 (put 'gnus-group-news-5-empty-face 'face-alias 'gnus-group-news-5-empty)
509 (put 'gnus-group-news-5-empty-face 'obsolete-face "22.1")
510
511 (defface gnus-group-news-6
512   '((((class color)
513       (background dark))
514      (:bold t))
515     (((class color)
516       (background light))
517      (:bold t))
518     (t
519      ()))
520   "Level 6 newsgroup face."
521   :group 'gnus-group)
522 ;; backward-compatibility alias
523 (put 'gnus-group-news-6-face 'face-alias 'gnus-group-news-6)
524 (put 'gnus-group-news-6-face 'obsolete-face "22.1")
525
526 (defface gnus-group-news-6-empty
527   '((((class color)
528       (background dark))
529      ())
530     (((class color)
531       (background light))
532      ())
533     (t
534      ()))
535   "Level 6 empty newsgroup face."
536   :group 'gnus-group)
537 ;; backward-compatibility alias
538 (put 'gnus-group-news-6-empty-face 'face-alias 'gnus-group-news-6-empty)
539 (put 'gnus-group-news-6-empty-face 'obsolete-face "22.1")
540
541 (defface gnus-group-news-low
542   '((((class color)
543       (background dark))
544      (:foreground "DarkTurquoise" :bold t))
545     (((class color)
546       (background light))
547      (:foreground "DarkGreen" :bold t))
548     (t
549      ()))
550   "Low level newsgroup face."
551   :group 'gnus-group)
552 ;; backward-compatibility alias
553 (put 'gnus-group-news-low-face 'face-alias 'gnus-group-news-low)
554 (put 'gnus-group-news-low-face 'obsolete-face "22.1")
555
556 (defface gnus-group-news-low-empty
557   '((((class color)
558       (background dark))
559      (:foreground "DarkTurquoise"))
560     (((class color)
561       (background light))
562      (:foreground "DarkGreen"))
563     (t
564      ()))
565   "Low level empty newsgroup face."
566   :group 'gnus-group)
567 ;; backward-compatibility alias
568 (put 'gnus-group-news-low-empty-face 'face-alias 'gnus-group-news-low-empty)
569 (put 'gnus-group-news-low-empty-face 'obsolete-face "22.1")
570
571 (defface gnus-group-mail-1
572   '((((class color)
573       (background dark))
574      (:foreground "#e1ffe1" :bold t))
575     (((class color)
576       (background light))
577      (:foreground "DeepPink3" :bold t))
578     (t
579      (:bold t)))
580   "Level 1 mailgroup face."
581   :group 'gnus-group)
582 ;; backward-compatibility alias
583 (put 'gnus-group-mail-1-face 'face-alias 'gnus-group-mail-1)
584 (put 'gnus-group-mail-1-face 'obsolete-face "22.1")
585
586 (defface gnus-group-mail-1-empty
587   '((((class color)
588       (background dark))
589      (:foreground "#e1ffe1"))
590     (((class color)
591       (background light))
592      (:foreground "DeepPink3"))
593     (t
594      (:italic t :bold t)))
595   "Level 1 empty mailgroup face."
596   :group 'gnus-group)
597 ;; backward-compatibility alias
598 (put 'gnus-group-mail-1-empty-face 'face-alias 'gnus-group-mail-1-empty)
599 (put 'gnus-group-mail-1-empty-face 'obsolete-face "22.1")
600
601 (defface gnus-group-mail-2
602   '((((class color)
603       (background dark))
604      (:foreground "DarkSeaGreen1" :bold t))
605     (((class color)
606       (background light))
607      (:foreground "HotPink3" :bold t))
608     (t
609      (:bold t)))
610   "Level 2 mailgroup face."
611   :group 'gnus-group)
612 ;; backward-compatibility alias
613 (put 'gnus-group-mail-2-face 'face-alias 'gnus-group-mail-2)
614 (put 'gnus-group-mail-2-face 'obsolete-face "22.1")
615
616 (defface gnus-group-mail-2-empty
617   '((((class color)
618       (background dark))
619      (:foreground "DarkSeaGreen1"))
620     (((class color)
621       (background light))
622      (:foreground "HotPink3"))
623     (t
624      (:bold t)))
625   "Level 2 empty mailgroup face."
626   :group 'gnus-group)
627 ;; backward-compatibility alias
628 (put 'gnus-group-mail-2-empty-face 'face-alias 'gnus-group-mail-2-empty)
629 (put 'gnus-group-mail-2-empty-face 'obsolete-face "22.1")
630
631 (defface gnus-group-mail-3
632   '((((class color)
633       (background dark))
634      (:foreground "aquamarine1" :bold t))
635     (((class color)
636       (background light))
637      (:foreground "magenta4" :bold t))
638     (t
639      (:bold t)))
640   "Level 3 mailgroup face."
641   :group 'gnus-group)
642 ;; backward-compatibility alias
643 (put 'gnus-group-mail-3-face 'face-alias 'gnus-group-mail-3)
644 (put 'gnus-group-mail-3-face 'obsolete-face "22.1")
645
646 (defface gnus-group-mail-3-empty
647   '((((class color)
648       (background dark))
649      (:foreground "aquamarine1"))
650     (((class color)
651       (background light))
652      (:foreground "magenta4"))
653     (t
654      ()))
655   "Level 3 empty mailgroup face."
656   :group 'gnus-group)
657 ;; backward-compatibility alias
658 (put 'gnus-group-mail-3-empty-face 'face-alias 'gnus-group-mail-3-empty)
659 (put 'gnus-group-mail-3-empty-face 'obsolete-face "22.1")
660
661 (defface gnus-group-mail-low
662   '((((class color)
663       (background dark))
664      (:foreground "aquamarine2" :bold t))
665     (((class color)
666       (background light))
667      (:foreground "DeepPink4" :bold t))
668     (t
669      (:bold t)))
670   "Low level mailgroup face."
671   :group 'gnus-group)
672 ;; backward-compatibility alias
673 (put 'gnus-group-mail-low-face 'face-alias 'gnus-group-mail-low)
674 (put 'gnus-group-mail-low-face 'obsolete-face "22.1")
675
676 (defface gnus-group-mail-low-empty
677   '((((class color)
678       (background dark))
679      (:foreground "aquamarine2"))
680     (((class color)
681       (background light))
682      (:foreground "DeepPink4"))
683     (t
684      (:bold t)))
685   "Low level empty mailgroup face."
686   :group 'gnus-group)
687 ;; backward-compatibility alias
688 (put 'gnus-group-mail-low-empty-face 'face-alias 'gnus-group-mail-low-empty)
689 (put 'gnus-group-mail-low-empty-face 'obsolete-face "22.1")
690
691 ;; Summary mode faces.
692
693 (defface gnus-summary-selected '((t (:underline t)))
694   "Face used for selected articles."
695   :group 'gnus-summary)
696 ;; backward-compatibility alias
697 (put 'gnus-summary-selected-face 'face-alias 'gnus-summary-selected)
698 (put 'gnus-summary-selected-face 'obsolete-face "22.1")
699
700 (defface gnus-summary-cancelled
701   '((((class color))
702      (:foreground "yellow" :background "black")))
703   "Face used for cancelled articles."
704   :group 'gnus-summary)
705 ;; backward-compatibility alias
706 (put 'gnus-summary-cancelled-face 'face-alias 'gnus-summary-cancelled)
707 (put 'gnus-summary-cancelled-face 'obsolete-face "22.1")
708
709 (defface gnus-summary-high-ticked
710   '((((class color)
711       (background dark))
712      (:foreground "pink" :bold t))
713     (((class color)
714       (background light))
715      (:foreground "firebrick" :bold t))
716     (t
717      (:bold t)))
718   "Face used for high interest ticked articles."
719   :group 'gnus-summary)
720 ;; backward-compatibility alias
721 (put 'gnus-summary-high-ticked-face 'face-alias 'gnus-summary-high-ticked)
722 (put 'gnus-summary-high-ticked-face 'obsolete-face "22.1")
723
724 (defface gnus-summary-low-ticked
725   '((((class color)
726       (background dark))
727      (:foreground "pink" :italic t))
728     (((class color)
729       (background light))
730      (:foreground "firebrick" :italic t))
731     (t
732      (:italic t)))
733   "Face used for low interest ticked articles."
734   :group 'gnus-summary)
735 ;; backward-compatibility alias
736 (put 'gnus-summary-low-ticked-face 'face-alias 'gnus-summary-low-ticked)
737 (put 'gnus-summary-low-ticked-face 'obsolete-face "22.1")
738
739 (defface gnus-summary-normal-ticked
740   '((((class color)
741       (background dark))
742      (:foreground "pink"))
743     (((class color)
744       (background light))
745      (:foreground "firebrick"))
746     (t
747      ()))
748   "Face used for normal interest ticked articles."
749   :group 'gnus-summary)
750 ;; backward-compatibility alias
751 (put 'gnus-summary-normal-ticked-face 'face-alias 'gnus-summary-normal-ticked)
752 (put 'gnus-summary-normal-ticked-face 'obsolete-face "22.1")
753
754 (defface gnus-summary-high-ancient
755   '((((class color)
756       (background dark))
757      (:foreground "SkyBlue" :bold t))
758     (((class color)
759       (background light))
760      (:foreground "RoyalBlue" :bold t))
761     (t
762      (:bold t)))
763   "Face used for high interest ancient articles."
764   :group 'gnus-summary)
765 ;; backward-compatibility alias
766 (put 'gnus-summary-high-ancient-face 'face-alias 'gnus-summary-high-ancient)
767 (put 'gnus-summary-high-ancient-face 'obsolete-face "22.1")
768
769 (defface gnus-summary-low-ancient
770   '((((class color)
771       (background dark))
772      (:foreground "SkyBlue" :italic t))
773     (((class color)
774       (background light))
775      (:foreground "RoyalBlue" :italic t))
776     (t
777      (:italic t)))
778   "Face used for low interest ancient articles."
779   :group 'gnus-summary)
780 ;; backward-compatibility alias
781 (put 'gnus-summary-low-ancient-face 'face-alias 'gnus-summary-low-ancient)
782 (put 'gnus-summary-low-ancient-face 'obsolete-face "22.1")
783
784 (defface gnus-summary-normal-ancient
785   '((((class color)
786       (background dark))
787      (:foreground "SkyBlue"))
788     (((class color)
789       (background light))
790      (:foreground "RoyalBlue"))
791     (t
792      ()))
793   "Face used for normal interest ancient articles."
794   :group 'gnus-summary)
795 ;; backward-compatibility alias
796 (put 'gnus-summary-normal-ancient-face 'face-alias 'gnus-summary-normal-ancient)
797 (put 'gnus-summary-normal-ancient-face 'obsolete-face "22.1")
798
799 (defface gnus-summary-high-undownloaded
800    '((((class color)
801        (background light))
802       (:bold t :foreground "cyan4"))
803      (((class color) (background dark))
804       (:bold t :foreground "LightGray"))
805      (t (:inverse-video t :bold t)))
806   "Face used for high interest uncached articles."
807   :group 'gnus-summary)
808 ;; backward-compatibility alias
809 (put 'gnus-summary-high-undownloaded-face 'face-alias 'gnus-summary-high-undownloaded)
810 (put 'gnus-summary-high-undownloaded-face 'obsolete-face "22.1")
811
812 (defface gnus-summary-low-undownloaded
813    '((((class color)
814        (background light))
815       (:italic t :foreground "cyan4" :bold nil))
816      (((class color) (background dark))
817       (:italic t :foreground "LightGray" :bold nil))
818      (t (:inverse-video t :italic t)))
819   "Face used for low interest uncached articles."
820   :group 'gnus-summary)
821 ;; backward-compatibility alias
822 (put 'gnus-summary-low-undownloaded-face 'face-alias 'gnus-summary-low-undownloaded)
823 (put 'gnus-summary-low-undownloaded-face 'obsolete-face "22.1")
824
825 (defface gnus-summary-normal-undownloaded
826    '((((class color)
827        (background light))
828       (:foreground "cyan4" :bold nil))
829      (((class color) (background dark))
830       (:foreground "LightGray" :bold nil))
831      (t (:inverse-video t)))
832   "Face used for normal interest uncached articles."
833   :group 'gnus-summary)
834 ;; backward-compatibility alias
835 (put 'gnus-summary-normal-undownloaded-face 'face-alias 'gnus-summary-normal-undownloaded)
836 (put 'gnus-summary-normal-undownloaded-face 'obsolete-face "22.1")
837
838 (defface gnus-summary-high-unread
839   '((t
840      (:bold t)))
841   "Face used for high interest unread articles."
842   :group 'gnus-summary)
843 ;; backward-compatibility alias
844 (put 'gnus-summary-high-unread-face 'face-alias 'gnus-summary-high-unread)
845 (put 'gnus-summary-high-unread-face 'obsolete-face "22.1")
846
847 (defface gnus-summary-low-unread
848   '((t
849      (:italic t)))
850   "Face used for low interest unread articles."
851   :group 'gnus-summary)
852 ;; backward-compatibility alias
853 (put 'gnus-summary-low-unread-face 'face-alias 'gnus-summary-low-unread)
854 (put 'gnus-summary-low-unread-face 'obsolete-face "22.1")
855
856 (defface gnus-summary-normal-unread
857   '((t
858      ()))
859   "Face used for normal interest unread articles."
860   :group 'gnus-summary)
861 ;; backward-compatibility alias
862 (put 'gnus-summary-normal-unread-face 'face-alias 'gnus-summary-normal-unread)
863 (put 'gnus-summary-normal-unread-face 'obsolete-face "22.1")
864
865 (defface gnus-summary-high-read
866   '((((class color)
867       (background dark))
868      (:foreground "PaleGreen"
869                   :bold t))
870     (((class color)
871       (background light))
872      (:foreground "DarkGreen"
873                   :bold t))
874     (t
875      (:bold t)))
876   "Face used for high interest read articles."
877   :group 'gnus-summary)
878 ;; backward-compatibility alias
879 (put 'gnus-summary-high-read-face 'face-alias 'gnus-summary-high-read)
880 (put 'gnus-summary-high-read-face 'obsolete-face "22.1")
881
882 (defface gnus-summary-low-read
883   '((((class color)
884       (background dark))
885      (:foreground "PaleGreen"
886                   :italic t))
887     (((class color)
888       (background light))
889      (:foreground "DarkGreen"
890                   :italic t))
891     (t
892      (:italic t)))
893   "Face used for low interest read articles."
894   :group 'gnus-summary)
895 ;; backward-compatibility alias
896 (put 'gnus-summary-low-read-face 'face-alias 'gnus-summary-low-read)
897 (put 'gnus-summary-low-read-face 'obsolete-face "22.1")
898
899 (defface gnus-summary-normal-read
900   '((((class color)
901       (background dark))
902      (:foreground "PaleGreen"))
903     (((class color)
904       (background light))
905      (:foreground "DarkGreen"))
906     (t
907      ()))
908   "Face used for normal interest read articles."
909   :group 'gnus-summary)
910 ;; backward-compatibility alias
911 (put 'gnus-summary-normal-read-face 'face-alias 'gnus-summary-normal-read)
912 (put 'gnus-summary-normal-read-face 'obsolete-face "22.1")
913
914
915 ;;;
916 ;;; Gnus buffers
917 ;;;
918
919 (defvar gnus-buffers nil
920   "List of buffers handled by Gnus.")
921
922 (defun gnus-get-buffer-create (name)
923   "Do the same as `get-buffer-create', but store the created buffer."
924   (or (get-buffer name)
925       (car (push (get-buffer-create name) gnus-buffers))))
926
927 (defun gnus-add-buffer ()
928   "Add the current buffer to the list of Gnus buffers."
929   (push (current-buffer) gnus-buffers))
930
931 (defmacro gnus-kill-buffer (buffer)
932   "Kill BUFFER and remove from the list of Gnus buffers."
933   `(let ((buf ,buffer))
934      (when (gnus-buffer-exists-p buf)
935        (setq gnus-buffers (delete (get-buffer buf) gnus-buffers))
936        (kill-buffer buf))))
937
938 (defun gnus-buffers ()
939   "Return a list of live Gnus buffers."
940   (while (and gnus-buffers
941               (not (buffer-name (car gnus-buffers))))
942     (pop gnus-buffers))
943   (let ((buffers gnus-buffers))
944     (while (cdr buffers)
945       (if (buffer-name (cadr buffers))
946           (pop buffers)
947         (setcdr buffers (cddr buffers)))))
948   gnus-buffers)
949
950 ;;; Splash screen.
951
952 (defvar gnus-group-buffer "*Group*"
953   "Name of the Gnus group buffer.")
954
955 (defface gnus-splash
956   '((((class color)
957       (background dark))
958      (:foreground "#cccccc"))
959     (((class color)
960       (background light))
961      (:foreground "#888888"))
962     (t
963      ()))
964   "Face for the splash screen."
965   :group 'gnus-start)
966 ;; backward-compatibility alias
967 (put 'gnus-splash-face 'face-alias 'gnus-splash)
968 (put 'gnus-splash-face 'obsolete-face "22.1")
969
970 (defun gnus-splash ()
971   (save-excursion
972     (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
973     (let ((buffer-read-only nil))
974       (erase-buffer)
975       (unless gnus-inhibit-startup-message
976         (gnus-group-startup-message)
977         (sit-for 0)))))
978
979 (defun gnus-indent-rigidly (start end arg)
980   "Indent rigidly using only spaces and no tabs."
981   (save-excursion
982     (save-restriction
983       (narrow-to-region start end)
984       (let ((tab-width 8))
985         (indent-rigidly start end arg)
986         ;; We translate tabs into spaces -- not everybody uses
987         ;; an 8-character tab.
988         (goto-char (point-min))
989         (while (search-forward "\t" nil t)
990           (replace-match "        " t t))))))
991
992 ;;(format "%02x%02x%02x" 114 66 20) "724214"
993
994 (defvar gnus-logo-color-alist
995   '((flame "#cc3300" "#ff2200")
996     (pine "#c0cc93" "#f8ffb8")
997     (moss "#a1cc93" "#d2ffb8")
998     (irish "#04cc90" "#05ff97")
999     (sky "#049acc" "#05deff")
1000     (tin "#6886cc" "#82b6ff")
1001     (velvet "#7c68cc" "#8c82ff")
1002     (grape "#b264cc" "#cf7df")
1003     (labia "#cc64c2" "#fd7dff")
1004     (berry "#cc6485" "#ff7db5")
1005     (dino "#724214" "#1e3f03")
1006     (oort "#cccccc" "#888888")
1007     (storm "#666699" "#99ccff")
1008     (pdino "#9999cc" "#99ccff")
1009     (purp "#9999cc" "#666699")
1010     (no "#ff0000" "#ffff00")
1011     (neutral "#b4b4b4" "#878787")
1012     (september "#bf9900" "#ffcc00"))
1013   "Color alist used for the Gnus logo.")
1014
1015 (defcustom gnus-logo-color-style 'no
1016   "*Color styles used for the Gnus logo."
1017   :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
1018                            gnus-logo-color-alist))
1019   :group 'gnus-xmas)
1020
1021 (defvar gnus-logo-colors
1022   (cdr (assq gnus-logo-color-style gnus-logo-color-alist))
1023   "Colors used for the Gnus logo.")
1024
1025 (declare-function image-size "image.c" (spec &optional pixels frame))
1026
1027 (defun gnus-group-startup-message (&optional x y)
1028   "Insert startup message in current buffer."
1029   ;; Insert the message.
1030   (erase-buffer)
1031   (unless (and
1032            (fboundp 'find-image)
1033            (display-graphic-p)
1034            ;; Make sure the library defining `image-load-path' is
1035            ;; loaded (`find-image' is autoloaded) (and discard the
1036            ;; result).  Else, we may get "defvar ignored because
1037            ;; image-load-path is let-bound" when calling `find-image'
1038            ;; below.
1039            (or (find-image '(nil (:type xpm :file "gnus.xpm"))) t)
1040            (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
1041                   (image-load-path (cond (data-directory
1042                                           (list data-directory))
1043                                          ((boundp 'image-load-path)
1044                                           (symbol-value 'image-load-path))
1045                                          (t load-path)))
1046                   (image (find-image
1047                           `((:type xpm :file "gnus.xpm"
1048                                    :color-symbols
1049                                    (("thing" . ,(car gnus-logo-colors))
1050                                     ("shadow" . ,(cadr gnus-logo-colors))))
1051                             (:type svg :file "gnus.svg")
1052                             (:type png :file "gnus.png")
1053                             (:type pbm :file "gnus.pbm"
1054                                    ;; Account for the pbm's background.
1055                                    :background ,(face-foreground 'gnus-splash)
1056                                    :foreground ,(face-background 'default))
1057                             (:type xbm :file "gnus.xbm"
1058                                    ;; Account for the xbm's background.
1059                                    :background ,(face-foreground 'gnus-splash)
1060                                    :foreground ,(face-background 'default))))))
1061              (when image
1062                (let ((size (image-size image)))
1063                  (insert-char ?\n (max 0 (round (- (window-height)
1064                                                    (or y (cdr size)) 1) 2)))
1065                  (insert-char ?\  (max 0 (round (- (window-width)
1066                                                    (or x (car size))) 2)))
1067                  (insert-image image))
1068                (goto-char (point-min))
1069                t)))
1070     (insert
1071      (format "
1072           _    ___ _             _
1073           _ ___ __ ___  __    _ ___
1074           __   _     ___    __  ___
1075               _           ___     _
1076              _  _ __             _
1077              ___   __            _
1078                    __           _
1079                     _      _   _
1080                    _      _    _
1081                       _  _    _
1082                   __  ___
1083                  _   _ _     _
1084                 _   _
1085               _    _
1086              _    _
1087             _
1088           __
1089
1090 "))
1091     ;; And then hack it.
1092     (gnus-indent-rigidly (point-min) (point-max)
1093                          (/ (max (- (window-width) (or x 46)) 0) 2))
1094     (goto-char (point-min))
1095     (forward-line 1)
1096     (let* ((pheight (count-lines (point-min) (point-max)))
1097            (wheight (window-height))
1098            (rest (- wheight pheight)))
1099       (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
1100     ;; Fontify some.
1101     (put-text-property (point-min) (point-max) 'face 'gnus-splash)
1102     (goto-char (point-min))
1103     (setq mode-line-buffer-identification (concat " " gnus-version))
1104     (set-buffer-modified-p t)))
1105
1106 (eval-when (load)
1107   (let ((command (format "%s" this-command)))
1108     (when (string-match "gnus" command)
1109       (if (string-match "gnus-other-frame" command)
1110           (gnus-get-buffer-create gnus-group-buffer)
1111         (gnus-splash)))))
1112
1113 ;;; Do the rest.
1114
1115 (require 'gnus-util)
1116 (require 'nnheader)
1117
1118 (defcustom gnus-parameters nil
1119   "Alist of group parameters.
1120
1121 For example:
1122    ((\"mail\\\\..*\"  (gnus-show-threads nil)
1123                   (gnus-use-scoring nil)
1124                   (gnus-summary-line-format
1125                         \"%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\\n\")
1126                   (gcc-self . t)
1127                   (display . all))
1128      (\"mail\\\\.me\" (gnus-use-scoring  t))
1129      (\"list\\\\..*\" (total-expire . t)
1130                   (broken-reply-to . t)))"
1131   :version "22.1"
1132   :group 'gnus-group-various
1133   :type '(repeat (cons regexp
1134                        (repeat sexp))))
1135
1136 (defcustom gnus-parameters-case-fold-search 'default
1137   "If it is t, ignore case of group names specified in `gnus-parameters'.
1138 If it is nil, don't ignore case.  If it is `default', which is for the
1139 backward compatibility, use the value of `case-fold-search'."
1140   :version "22.1"
1141   :group 'gnus-group-various
1142   :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
1143                  (const :tag "Use `case-fold-search'" default)
1144                  (const nil)
1145                  (const t)))
1146
1147 (defvar gnus-group-parameters-more nil)
1148
1149 (defmacro gnus-define-group-parameter (param &rest rest)
1150   "Define a group parameter PARAM.
1151 REST is a plist of following:
1152 :type               One of `bool', `list' or nil.
1153 :function           The name of the function.
1154 :function-document  The documentation of the function.
1155 :parameter-type     The type for customizing the parameter.
1156 :parameter-document The documentation for the parameter.
1157 :variable           The name of the variable.
1158 :variable-document  The documentation for the variable.
1159 :variable-group     The group for customizing the variable.
1160 :variable-type      The type for customizing the variable.
1161 :variable-default   The default value of the variable."
1162   (let* ((type (plist-get rest :type))
1163          (parameter-type (plist-get rest :parameter-type))
1164          (parameter-document (plist-get rest :parameter-document))
1165          (function (or (plist-get rest :function)
1166                        (intern (format "gnus-parameter-%s" param))))
1167          (function-document (or (plist-get rest :function-document) ""))
1168          (variable (or (plist-get rest :variable)
1169                        (intern (format "gnus-parameter-%s-alist" param))))
1170          (variable-document (or (plist-get rest :variable-document) ""))
1171          (variable-group (plist-get rest :variable-group))
1172          (variable-type (or (plist-get rest :variable-type)
1173                             `(quote (repeat
1174                                      (list (regexp :tag "Group")
1175                                            ,(car (cdr parameter-type)))))))
1176          (variable-default (plist-get rest :variable-default)))
1177     (list
1178      'progn
1179      `(defcustom ,variable ,variable-default
1180         ,variable-document
1181         :group 'gnus-group-parameter
1182         :group ',variable-group
1183         :type ,variable-type)
1184      `(setq gnus-group-parameters-more
1185             (delq (assq ',param gnus-group-parameters-more)
1186                   gnus-group-parameters-more))
1187      `(add-to-list 'gnus-group-parameters-more
1188                    (list ',param
1189                          ,parameter-type
1190                          ,parameter-document))
1191      (if (eq type 'bool)
1192          `(defun ,function (name)
1193             ,function-document
1194             (let ((params (gnus-group-find-parameter name))
1195                   val)
1196               (cond
1197                ((memq ',param params)
1198                 t)
1199                ((setq val (assq ',param params))
1200                 (cdr val))
1201                ((stringp ,variable)
1202                 (string-match ,variable name))
1203                (,variable
1204                 (let ((alist ,variable)
1205                       elem value)
1206                   (while (setq elem (pop alist))
1207                     (when (and name
1208                                (string-match (car elem) name))
1209                       (setq alist nil
1210                             value (cdr elem))))
1211                   (if (consp value) (car value) value))))))
1212        `(defun ,function (name)
1213           ,function-document
1214           (and name
1215                (or (gnus-group-find-parameter name ',param ,(and type t))
1216                    (let ((alist ,variable)
1217                          elem value)
1218                      (while (setq elem (pop alist))
1219                        (when (and name
1220                                   (string-match (car elem) name))
1221                          (setq alist nil
1222                                value (cdr elem))))
1223                      ,(if type
1224                           'value
1225                         '(if (consp value) (car value) value))))))))))
1226
1227 (defcustom gnus-home-directory "~/"
1228   "Directory variable that specifies the \"home\" directory.
1229 All other Gnus file and directory variables are initialized from this variable."
1230   :group 'gnus-files
1231   :type 'directory)
1232
1233 (defcustom gnus-directory (or (getenv "SAVEDIR")
1234                               (nnheader-concat gnus-home-directory "News/"))
1235   "*Directory variable from which all other Gnus file variables are derived.
1236
1237 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1238 This means that other directory variables that are initialized from
1239 this variable won't be set properly if you set this variable in `.gnus.el'.
1240 Set this variable in `.emacs' instead."
1241   :group 'gnus-files
1242   :type 'directory)
1243
1244 (defcustom gnus-default-directory nil
1245   "*Default directory for all Gnus buffers."
1246   :group 'gnus-files
1247   :type '(choice (const :tag "current" nil)
1248                  directory))
1249
1250 ;; Site dependent variables.  These variables should be defined in
1251 ;; paths.el.
1252
1253 (defvar gnus-default-nntp-server nil
1254   "Specify a default NNTP server.
1255 This variable should be defined in paths.el, and should never be set
1256 by the user.
1257 If you want to change servers, you should use `gnus-select-method'.
1258 See the documentation to that variable.")
1259
1260 (defcustom gnus-nntpserver-file "/etc/nntpserver"
1261   "A file with only the name of the nntp server in it."
1262   :group 'gnus-files
1263   :group 'gnus-server
1264   :type 'file)
1265
1266 (defun gnus-getenv-nntpserver ()
1267   "Find default nntp server.
1268 Check the NNTPSERVER environment variable and the
1269 `gnus-nntpserver-file' file."
1270   (or (getenv "NNTPSERVER")
1271       (and (file-readable-p gnus-nntpserver-file)
1272            (with-temp-buffer
1273              (insert-file-contents gnus-nntpserver-file)
1274              (when (re-search-forward "[^ \t\n\r]+" nil t)
1275                (match-string 0))))))
1276
1277 ;; `M-x customize-variable RET gnus-select-method RET' should work without
1278 ;; starting or even loading Gnus.
1279 ;;;###autoload(when (fboundp 'custom-autoload)
1280 ;;;###autoload  (custom-autoload 'gnus-select-method "gnus"))
1281
1282 (defcustom gnus-select-method
1283   (list 'nntp (or (gnus-getenv-nntpserver)
1284                   (when (and gnus-default-nntp-server
1285                              (not (string= gnus-default-nntp-server "")))
1286                     gnus-default-nntp-server)
1287                   "news"))
1288   "Default method for selecting a newsgroup.
1289 This variable should be a list, where the first element is how the
1290 news is to be fetched, the second is the address.
1291
1292 For instance, if you want to get your news via \"flab.flab.edu\" using
1293 NNTP, you could say:
1294
1295 \(setq gnus-select-method '(nntp \"flab.flab.edu\"))
1296
1297 If you want to use your local spool, say:
1298
1299 \(setq gnus-select-method (list 'nnspool (system-name)))
1300
1301 If you use this variable, you must set `gnus-nntp-server' to nil.
1302
1303 There is a lot more to know about select methods and virtual servers -
1304 see the manual for details."
1305   :group 'gnus-server
1306   :group 'gnus-start
1307   :initialize 'custom-initialize-default
1308   :type 'gnus-select-method)
1309
1310 (defcustom gnus-message-archive-method "archive"
1311   "*Method used for archiving messages you've sent.
1312 This should be a mail method.
1313
1314 See also `gnus-update-message-archive-method'."
1315   :group 'gnus-server
1316   :group 'gnus-message
1317   :type '(choice (const :tag "Default archive method" "archive")
1318                  gnus-select-method))
1319
1320 (defcustom gnus-update-message-archive-method nil
1321   "Non-nil means always update the saved \"archive\" method.
1322
1323 The archive method is initially set according to the value of
1324 `gnus-message-archive-method' and is saved in the \"~/.newsrc.eld\" file
1325 so that it may be used as a real method of the server which is named
1326 \"archive\" ever since.  If it once has been saved, it will never be
1327 updated if the value of this variable is nil, even if you change the
1328 value of `gnus-message-archive-method' afterward.  If you want the
1329 saved \"archive\" method to be updated whenever you change the value of
1330 `gnus-message-archive-method', set this variable to a non-nil value."
1331   :version "23.1"
1332   :group 'gnus-server
1333   :group 'gnus-message
1334   :type 'boolean)
1335
1336 (defcustom gnus-message-archive-group '((format-time-string "sent.%Y-%m"))
1337   "*Name of the group in which to save the messages you've written.
1338 This can either be a string; a list of strings; or an alist
1339 of regexps/functions/forms to be evaluated to return a string (or a list
1340 of strings).  The functions are called with the name of the current
1341 group (or nil) as a parameter.
1342
1343 If you want to save your mail in one group and the news articles you
1344 write in another group, you could say something like:
1345
1346  \(setq gnus-message-archive-group
1347         '((if (message-news-p)
1348               \"misc-news\"
1349             \"misc-mail\")))
1350
1351 Normally the group names returned by this variable should be
1352 unprefixed -- which implicitly means \"store on the archive server\".
1353 However, you may wish to store the message on some other server.  In
1354 that case, just return a fully prefixed name of the group --
1355 \"nnml+private:mail.misc\", for instance."
1356   :version "24.1"
1357   :group 'gnus-message
1358   :type '(choice (const :tag "none" nil)
1359                  (const :tag "Weekly" ((format-time-string "sent.%Yw%U")))
1360                  (const :tag "Monthly" ((format-time-string "sent.%Y-%m")))
1361                  (const :tag "Yearly" ((format-time-string "sent.%Y")))
1362                  function
1363                  sexp
1364                  string))
1365
1366 (defcustom gnus-secondary-servers nil
1367   "List of NNTP servers that the user can choose between interactively.
1368 To make Gnus query you for a server, you have to give `gnus' a
1369 non-numeric prefix - `C-u M-x gnus', in short."
1370   :group 'gnus-server
1371   :type '(repeat string))
1372 (make-obsolete-variable 'gnus-secondary-servers 'gnus-select-method "24.1")
1373
1374 (defcustom gnus-nntp-server nil
1375   "The name of the host running the NNTP server."
1376   :group 'gnus-server
1377   :type '(choice (const :tag "disable" nil)
1378                  string))
1379 (make-obsolete-variable 'gnus-nntp-server 'gnus-select-method "24.1")
1380
1381 (defcustom gnus-secondary-select-methods nil
1382   "A list of secondary methods that will be used for reading news.
1383 This is a list where each element is a complete select method (see
1384 `gnus-select-method').
1385
1386 If, for instance, you want to read your mail with the nnml back end,
1387 you could set this variable:
1388
1389 \(setq gnus-secondary-select-methods '((nnml \"\")))"
1390   :group 'gnus-server
1391   :type '(repeat gnus-select-method))
1392
1393 (defcustom gnus-local-domain nil
1394   "Local domain name without a host name.
1395 The DOMAINNAME environment variable is used instead if it is defined.
1396 If the function `system-name' returns the full Internet name, there is
1397 no need to set this variable."
1398   :group 'gnus-message
1399   :type '(choice (const :tag "default" nil)
1400                  string))
1401 (make-obsolete-variable 'gnus-local-domain nil "Emacs 24.1")
1402
1403 (defvar gnus-local-organization nil
1404   "String with a description of what organization (if any) the user belongs to.
1405 Obsolete variable; use `message-user-organization' instead.")
1406
1407 ;; Customization variables
1408
1409 (defcustom gnus-refer-article-method 'current
1410   "Preferred method for fetching an article by Message-ID.
1411 If you are reading news from the local spool (with nnspool), fetching
1412 articles by Message-ID is painfully slow.  By setting this method to an
1413 nntp method, you might get acceptable results.
1414
1415 The value of this variable must be a valid select method as discussed
1416 in the documentation of `gnus-select-method'.
1417
1418 It can also be a list of select methods, as well as the special symbol
1419 `current', which means to use the current select method.  If it is a
1420 list, Gnus will try all the methods in the list until it finds a match."
1421   :version "24.1"
1422   :group 'gnus-server
1423   :type '(choice (const :tag "default" nil)
1424                  (const current)
1425                  (const :tag "Google" (nnweb "refer" (nnweb-type google)))
1426                  gnus-select-method
1427                  (repeat :menu-tag "Try multiple"
1428                          :tag "Multiple"
1429                          :value (current (nnweb "refer" (nnweb-type google)))
1430                          (choice :tag "Method"
1431                                  (const current)
1432                                  (const :tag "Google"
1433                                         (nnweb "refer" (nnweb-type google)))
1434                                  gnus-select-method))))
1435
1436 (defcustom gnus-use-cross-reference t
1437   "*Non-nil means that cross referenced articles will be marked as read.
1438 If nil, ignore cross references.  If t, mark articles as read in
1439 subscribed newsgroups.  If neither t nor nil, mark as read in all
1440 newsgroups."
1441   :group 'gnus-server
1442   :type '(choice (const :tag "off" nil)
1443                  (const :tag "subscribed" t)
1444                  (sexp :format "all"
1445                        :value always)))
1446
1447 (defcustom gnus-process-mark ?#
1448   "*Process mark."
1449   :group 'gnus-group-visual
1450   :group 'gnus-summary-marks
1451   :type 'character)
1452
1453 (defcustom gnus-large-newsgroup 200
1454   "*The number of articles which indicates a large newsgroup.
1455 If the number of articles in a newsgroup is greater than this value,
1456 confirmation is required for selecting the newsgroup.
1457 If it is nil, no confirmation is required.
1458
1459 Also see `gnus-large-ephemeral-newsgroup'."
1460   :group 'gnus-group-select
1461   :type '(choice (const :tag "No limit" nil)
1462                  integer))
1463
1464 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v)))
1465   "Non-nil means that the default name of a file to save articles in is the group name.
1466 If it's nil, the directory form of the group name is used instead.
1467
1468 If this variable is a list, and the list contains the element
1469 `not-score', long file names will not be used for score files; if it
1470 contains the element `not-save', long file names will not be used for
1471 saving; and if it contains the element `not-kill', long file names
1472 will not be used for kill files.
1473
1474 Note that the default for this variable varies according to what system
1475 type you're using.  On `usg-unix-v' this variable defaults to nil while
1476 on all other systems it defaults to t."
1477   :group 'gnus-start
1478   :type '(radio (sexp :format "Non-nil\n"
1479                       :match (lambda (widget value)
1480                                (and value (not (listp value))))
1481                       :value t)
1482                 (const nil)
1483                 (checklist (const :format "%v " not-score)
1484                            (const :format "%v " not-save)
1485                            (const not-kill))))
1486
1487 (defcustom gnus-kill-files-directory gnus-directory
1488   "*Name of the directory where kill files will be stored (default \"~/News\")."
1489   :group 'gnus-score-files
1490   :group 'gnus-score-kill
1491   :type 'directory)
1492
1493 (defcustom gnus-save-score nil
1494   "*If non-nil, save group scoring info."
1495   :group 'gnus-score-various
1496   :group 'gnus-start
1497   :type 'boolean)
1498
1499 (defcustom gnus-use-undo t
1500   "*If non-nil, allow undoing in Gnus group mode buffers."
1501   :group 'gnus-meta
1502   :type 'boolean)
1503
1504 (defcustom gnus-use-adaptive-scoring nil
1505   "*If non-nil, use some adaptive scoring scheme.
1506 If a list, then the values `word' and `line' are meaningful.  The
1507 former will perform adaption on individual words in the subject
1508 header while `line' will perform adaption on several headers."
1509   :group 'gnus-meta
1510   :group 'gnus-score-adapt
1511   :type '(set (const word) (const line)))
1512
1513 (defcustom gnus-use-cache 'passive
1514   "*If nil, Gnus will ignore the article cache.
1515 If `passive', it will allow entering (and reading) articles
1516 explicitly entered into the cache.  If anything else, use the
1517 cache to the full extent of the law."
1518   :group 'gnus-meta
1519   :group 'gnus-cache
1520   :type '(choice (const :tag "off" nil)
1521                  (const :tag "passive" passive)
1522                  (const :tag "active" t)))
1523
1524 (defcustom gnus-use-trees nil
1525   "*If non-nil, display a thread tree buffer."
1526   :group 'gnus-meta
1527   :type 'boolean)
1528
1529 (defcustom gnus-keep-backlog 20
1530   "*If non-nil, Gnus will keep read articles for later re-retrieval.
1531 If it is a number N, then Gnus will only keep the last N articles
1532 read.  If it is neither nil nor a number, Gnus will keep all read
1533 articles.  This is not a good idea."
1534   :group 'gnus-meta
1535   :type '(choice (const :tag "off" nil)
1536                  integer
1537                  (sexp :format "all"
1538                        :value t)))
1539
1540 (defcustom gnus-suppress-duplicates nil
1541   "*If non-nil, Gnus will mark duplicate copies of the same article as read."
1542   :group 'gnus-meta
1543   :type 'boolean)
1544
1545 (defcustom gnus-use-scoring t
1546   "*If non-nil, enable scoring."
1547   :group 'gnus-meta
1548   :type 'boolean)
1549
1550 (defcustom gnus-summary-prepare-exit-hook
1551   '(gnus-summary-expire-articles)
1552   "*A hook called when preparing to exit from the summary buffer.
1553 It calls `gnus-summary-expire-articles' by default."
1554   :group 'gnus-summary-exit
1555   :type 'hook)
1556
1557 (defcustom gnus-novice-user t
1558   "*Non-nil means that you are a Usenet novice.
1559 If non-nil, verbose messages may be displayed and confirmations may be
1560 required."
1561   :group 'gnus-meta
1562   :type 'boolean)
1563
1564 (defcustom gnus-expert-user nil
1565   "*Non-nil means that you will never be asked for confirmation about anything.
1566 That doesn't mean *anything* anything; particularly destructive
1567 commands will still require prompting."
1568   :group 'gnus-meta
1569   :type 'boolean)
1570
1571 (defcustom gnus-interactive-catchup t
1572   "*If non-nil, require your confirmation when catching up a group."
1573   :group 'gnus-group-select
1574   :type 'boolean)
1575
1576 (defcustom gnus-interactive-exit t
1577   "*If non-nil, require your confirmation when exiting Gnus."
1578   :group 'gnus-exit
1579   :type 'boolean)
1580
1581 (defcustom gnus-extract-address-components 'gnus-extract-address-components
1582   "*Function for extracting address components from a From header.
1583 Two pre-defined function exist: `gnus-extract-address-components',
1584 which is the default, quite fast, and too simplistic solution, and
1585 `mail-extract-address-components', which works much better, but is
1586 slower."
1587   :group 'gnus-summary-format
1588   :type '(radio (function-item gnus-extract-address-components)
1589                 (function-item mail-extract-address-components)
1590                 (function :tag "Other")))
1591
1592 (defcustom gnus-shell-command-separator ";"
1593   "String used to separate shell commands."
1594   :group 'gnus-files
1595   :type 'string)
1596
1597 (defcustom gnus-valid-select-methods
1598   '(("nntp" post address prompt-address physical-address)
1599     ("nnspool" post address)
1600     ("nnvirtual" post-mail virtual prompt-address)
1601     ("nnmbox" mail respool address)
1602     ("nnml" post-mail respool address)
1603     ("nnmh" mail respool address)
1604     ("nndir" post-mail prompt-address physical-address)
1605     ("nneething" none address prompt-address physical-address)
1606     ("nndoc" none address prompt-address)
1607     ("nnbabyl" mail address respool)
1608     ("nndraft" post-mail)
1609     ("nnfolder" mail respool address)
1610     ("nngateway" post-mail address prompt-address physical-address)
1611     ("nnweb" none)
1612     ("nnrss" none)
1613     ("nnagent" post-mail)
1614     ("nnimap" post-mail address prompt-address physical-address)
1615     ("nnmaildir" mail respool address)
1616     ("nnnil" none))
1617   "*An alist of valid select methods.
1618 The first element of each list lists should be a string with the name
1619 of the select method.  The other elements may be the category of
1620 this method (i. e., `post', `mail', `none' or whatever) or other
1621 properties that this method has (like being respoolable).
1622 If you implement a new select method, all you should have to change is
1623 this variable.  I think."
1624   :group 'gnus-server
1625   :type '(repeat (group (string :tag "Name")
1626                         (radio-button-choice (const :format "%v " post)
1627                                              (const :format "%v " mail)
1628                                              (const :format "%v " none)
1629                                              (const post-mail))
1630                         (checklist :inline t
1631                                    (const :format "%v " address)
1632                                    (const :format "%v " prompt-address)
1633                                    (const :format "%v " physical-address)
1634                                    (const :format "%v " virtual)
1635                                    (const respool))))
1636   :version "24.1")
1637
1638 (defun gnus-redefine-select-method-widget ()
1639   "Recomputes the select-method widget based on the value of
1640 `gnus-valid-select-methods'."
1641   (define-widget 'gnus-select-method 'list
1642     "Widget for entering a select method."
1643     :value '(nntp "")
1644     :tag "Select Method"
1645     :args `((choice :tag "Method"
1646                     ,@(mapcar (lambda (entry)
1647                                 (list 'const :format "%v\n"
1648                                       (intern (car entry))))
1649                               gnus-valid-select-methods)
1650                     (symbol :tag "other"))
1651             (string :tag "Address")
1652             (repeat :tag "Options"
1653                     :inline t
1654                     (list :format "%v"
1655                           variable
1656                           (sexp :tag "Value"))))))
1657
1658 (gnus-redefine-select-method-widget)
1659
1660 (defcustom gnus-updated-mode-lines '(group article summary tree)
1661   "List of buffers that should update their mode lines.
1662 The list may contain the symbols `group', `article', `tree' and
1663 `summary'.  If the corresponding symbol is present, Gnus will keep
1664 that mode line updated with information that may be pertinent.
1665 If this variable is nil, screen refresh may be quicker."
1666   :group 'gnus-various
1667   :type '(set (const group)
1668               (const article)
1669               (const summary)
1670               (const tree)))
1671
1672 (defcustom gnus-mode-non-string-length 30
1673   "*Max length of mode-line non-string contents.
1674 If this is nil, Gnus will take space as is needed, leaving the rest
1675 of the mode line intact."
1676   :version "24.1"
1677   :group 'gnus-various
1678   :type '(choice (const nil)
1679                  integer))
1680
1681 ;; There should be special validation for this.
1682 (define-widget 'gnus-email-address 'string
1683   "An email address.")
1684
1685 (gnus-define-group-parameter
1686  to-address
1687  :function-document
1688  "Return GROUP's to-address."
1689  :variable-document
1690  "*Alist of group regexps and correspondent to-addresses."
1691  :variable-group gnus-group-parameter
1692  :parameter-type '(gnus-email-address :tag "To Address")
1693  :parameter-document "\
1694 This will be used when doing followups and posts.
1695
1696 This is primarily useful in mail groups that represent closed
1697 mailing lists--mailing lists where it's expected that everybody that
1698 writes to the mailing list is subscribed to it.  Since using this
1699 parameter ensures that the mail only goes to the mailing list itself,
1700 it means that members won't receive two copies of your followups.
1701
1702 Using `to-address' will actually work whether the group is foreign or
1703 not.  Let's say there's a group on the server that is called
1704 `fa.4ad-l'.  This is a real newsgroup, but the server has gotten the
1705 articles from a mail-to-news gateway.  Posting directly to this group
1706 is therefore impossible--you have to send mail to the mailing list
1707 address instead.
1708
1709 The gnus-group-split mail splitting mechanism will behave as if this
1710 address was listed in gnus-group-split Addresses (see below).")
1711
1712 (gnus-define-group-parameter
1713  to-list
1714  :function-document
1715  "Return GROUP's to-list."
1716  :variable-document
1717  "*Alist of group regexps and correspondent to-lists."
1718  :variable-group gnus-group-parameter
1719  :parameter-type '(gnus-email-address :tag "To List")
1720  :parameter-document "\
1721 This address will be used when doing a `a' in the group.
1722
1723 It is totally ignored when doing a followup--except that if it is
1724 present in a news group, you'll get mail group semantics when doing
1725 `f'.
1726
1727 The gnus-group-split mail splitting mechanism will behave as if this
1728 address was listed in gnus-group-split Addresses (see below).")
1729
1730 (gnus-define-group-parameter
1731  subscribed
1732  :type bool
1733  :function-document
1734  "Return GROUP's subscription status."
1735  :variable-document
1736  "*Groups which are automatically considered subscribed."
1737  :variable-group gnus-group-parameter
1738  :parameter-type '(const :tag "Subscribed" t)
1739  :parameter-document "\
1740 Gnus assumed that you are subscribed to the To/List address.
1741
1742 When constructing a list of subscribed groups using
1743 `gnus-find-subscribed-addresses', Gnus includes the To address given
1744 above, or the list address (if the To address has not been set).")
1745
1746 (gnus-define-group-parameter
1747  auto-expire
1748  :type bool
1749  :function gnus-group-auto-expirable-p
1750  :function-document
1751  "Check whether GROUP is auto-expirable or not."
1752  :variable gnus-auto-expirable-newsgroups
1753  :variable-default nil
1754  :variable-document
1755  "*Groups in which to automatically mark read articles as expirable.
1756 If non-nil, this should be a regexp that should match all groups in
1757 which to perform auto-expiry.  This only makes sense for mail groups."
1758  :variable-group nnmail-expire
1759  :variable-type '(choice (const nil)
1760                          regexp)
1761  :parameter-type '(const :tag "Automatic Expire" t)
1762  :parameter-document
1763  "All articles that are read will be marked as expirable.")
1764
1765 (gnus-define-group-parameter
1766  total-expire
1767  :type bool
1768  :function gnus-group-total-expirable-p
1769  :function-document
1770  "Check whether GROUP is total-expirable or not."
1771  :variable gnus-total-expirable-newsgroups
1772  :variable-default nil
1773  :variable-document
1774  "*Groups in which to perform expiry of all read articles.
1775 Use with extreme caution.  All groups that match this regexp will be
1776 expiring - which means that all read articles will be deleted after
1777 \(say) one week.  (This only goes for mail groups and the like, of
1778 course.)"
1779  :variable-group nnmail-expire
1780  :variable-type '(choice (const nil)
1781                          regexp)
1782  :parameter-type '(const :tag "Total Expire" t)
1783  :parameter-document
1784  "All read articles will be put through the expiry process
1785
1786 This happens even if they are not marked as expirable.
1787 Use with caution.")
1788
1789 (gnus-define-group-parameter
1790  charset
1791  :function-document
1792  "Return the default charset of GROUP."
1793  :variable gnus-group-charset-alist
1794  :variable-default
1795  '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5)
1796    ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312)
1797    ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2)
1798    ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit)
1799    ("\\(^\\|:\\)relcom\\>" koi8-r)
1800    ("\\(^\\|:\\)fido7\\>" koi8-r)
1801    ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
1802    ("\\(^\\|:\\)israel\\>" iso-8859-1)
1803    ("\\(^\\|:\\)han\\>" euc-kr)
1804    ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5)