* configure.ac: Fix minimum Jansson version requirement.
[emacs.git] / lisp / gnus / gnus.el
blob3458fdea7181bace1704c0df93318c5e67c846a5
1 ;;; gnus.el --- a newsreader for GNU Emacs -*- lexical-binding:t -*-
3 ;; Copyright (C) 1987-1990, 1993-1998, 2000-2017 Free Software
4 ;; Foundation, Inc.
6 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
7 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; Keywords: news, mail
9 ;; Version: 5.13
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
26 ;;; Commentary:
28 ;;; Code:
30 (run-hooks 'gnus-load-hook)
32 (eval-when-compile (require 'cl-lib))
33 (require 'wid-edit)
34 (require 'mm-util)
35 (require 'nnheader)
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)
50 (defgroup gnus nil
51 "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
52 :group 'news
53 :group 'mail)
55 (defgroup gnus-start nil
56 "Starting your favorite newsreader."
57 :group 'gnus)
59 (defgroup gnus-format nil
60 "Dealing with formatting issues."
61 :group 'gnus)
63 (defgroup gnus-charset nil
64 "Group character set issues."
65 :link '(custom-manual "(gnus)Charsets")
66 :version "21.1"
67 :group 'gnus)
69 (defgroup gnus-cache nil
70 "Cache interface."
71 :link '(custom-manual "(gnus)Article Caching")
72 :group 'gnus)
74 (defgroup gnus-registry nil
75 "Article Registry."
76 :group 'gnus)
78 (defgroup gnus-start-server nil
79 "Server options at startup."
80 :group 'gnus-start)
82 ;; These belong to gnus-group.el.
83 (defgroup gnus-group nil
84 "Group buffers."
85 :link '(custom-manual "(gnus)Group Buffer")
86 :group 'gnus)
88 (defgroup gnus-group-foreign nil
89 "Foreign groups."
90 :link '(custom-manual "(gnus)Foreign Groups")
91 :group 'gnus-group)
93 (defgroup gnus-group-new nil
94 "Automatic subscription of new groups."
95 :group 'gnus-group)
97 (defgroup gnus-group-levels nil
98 "Group levels."
99 :link '(custom-manual "(gnus)Group Levels")
100 :group 'gnus-group)
102 (defgroup gnus-group-select nil
103 "Selecting a Group."
104 :link '(custom-manual "(gnus)Selecting a Group")
105 :group 'gnus-group)
107 (defgroup gnus-group-listing nil
108 "Showing slices of the group list."
109 :link '(custom-manual "(gnus)Listing Groups")
110 :group 'gnus-group)
112 (defgroup gnus-group-visual nil
113 "Sorting the group buffer."
114 :link '(custom-manual "(gnus)Group Buffer Format")
115 :group 'gnus-group
116 :group 'gnus-visual)
118 (defgroup gnus-group-various nil
119 "Various group options."
120 :link '(custom-manual "(gnus)Scanning New Messages")
121 :group 'gnus-group)
123 ;; These belong to gnus-sum.el.
124 (defgroup gnus-summary nil
125 "Summary buffers."
126 :link '(custom-manual "(gnus)Summary Buffer")
127 :group 'gnus)
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
150 "Choosing Articles."
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."
161 :group 'gnus-visual)
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")
176 :group 'gnus-visual
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")
187 :prefix "gnus-pick-"
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")
193 :prefix "gnus-tree-"
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."
205 :group 'gnus)
207 (defgroup gnus-score-kill nil
208 "Kill files."
209 :group 'gnus-score)
211 (defgroup gnus-score-adapt nil
212 "Adaptive score files."
213 :group 'gnus-score)
215 (defgroup gnus-score-default nil
216 "Default values for score files."
217 :group 'gnus-score)
219 (defgroup gnus-score-expire nil
220 "Expiring score rules."
221 :group 'gnus-score)
223 (defgroup gnus-score-decay nil
224 "Decaying score rules."
225 :group 'gnus-score)
227 (defgroup gnus-score-files nil
228 "Score and kill file names."
229 :group 'gnus-score
230 :group 'gnus-files)
232 (defgroup gnus-score-various nil
233 "Various scoring and killing options."
234 :group 'gnus-score)
236 ;; Other
237 (defgroup gnus-visual nil
238 "Options controlling the visual fluff."
239 :group 'gnus
240 :group 'faces)
242 (defgroup gnus-agent nil
243 "Offline support for Gnus."
244 :group 'gnus)
246 (defgroup gnus-files nil
247 "Files used by Gnus."
248 :group 'gnus)
250 (defgroup gnus-dribble-file nil
251 "Auto save file."
252 :link '(custom-manual "(gnus)Auto Save")
253 :group 'gnus-files)
255 (defgroup gnus-newsrc nil
256 "Storing Gnus state."
257 :group 'gnus-files)
259 (defgroup gnus-server nil
260 "Options related to newsservers and other servers used by Gnus."
261 :group 'gnus)
263 (defgroup gnus-server-visual nil
264 "Highlighting and menus in the server buffer."
265 :group 'gnus-visual
266 :group 'gnus-server)
268 (defgroup gnus-message '((message custom-group))
269 "Composing replies and followups in Gnus."
270 :group '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."
276 :group 'gnus)
278 (defgroup gnus-various nil
279 "Other Gnus options."
280 :link '(custom-manual "(gnus)Various Various")
281 :group 'gnus)
283 (defgroup gnus-exit nil
284 "Exiting Gnus."
285 :link '(custom-manual "(gnus)Exiting Gnus")
286 :group 'gnus)
288 (defgroup gnus-fun nil
289 "Frivolous Gnus extensions."
290 :link '(custom-manual "(gnus)Exiting Gnus")
291 :group 'gnus)
293 (defconst gnus-version-number "5.13"
294 "Version number for this version of Gnus.")
296 (defconst gnus-version (format "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."
303 :group 'gnus-start
304 :type 'boolean)
306 (defvar gnus-mode-line-image-cache t)
308 (eval-and-compile
309 (if (fboundp 'find-image)
310 (defun gnus-mode-line-buffer-identification (line)
311 (let ((str (car-safe line))
312 (load-path (append (mm-image-load-path) load-path)))
313 (if (and (display-graphic-p)
314 (stringp str)
315 (string-match "^Gnus:" str))
316 (progn (add-text-properties
318 (list 'display
319 (if (eq t gnus-mode-line-image-cache)
320 (setq gnus-mode-line-image-cache
321 (find-image
322 '((:type xpm :file "gnus-pointer.xpm"
323 :ascent center)
324 (:type xbm :file "gnus-pointer.xbm"
325 :ascent center))))
326 gnus-mode-line-image-cache)
327 'help-echo (format
328 "This is %s, %s."
329 gnus-version (gnus-emacs-version)))
330 str)
331 (list str))
332 line)))
333 (defalias 'gnus-mode-line-buffer-identification 'identity)))
335 ;; We define these group faces here to avoid the display
336 ;; update forced when creating new faces.
338 (defface gnus-group-news-1-empty
339 '((((class color)
340 (background dark))
341 (:foreground "PaleTurquoise"))
342 (((class color)
343 (background light))
344 (:foreground "ForestGreen"))
346 ()))
347 "Level 1 empty newsgroup face."
348 :group 'gnus-group)
349 ;; backward-compatibility alias
350 (put 'gnus-group-news-1-empty-face 'face-alias 'gnus-group-news-1-empty)
351 (put 'gnus-group-news-1-empty-face 'obsolete-face "22.1")
353 (defface gnus-group-news-1
354 '((t (:inherit gnus-group-news-1-empty :bold t)))
355 "Level 1 newsgroup face."
356 :group 'gnus-group)
357 ;; backward-compatibility alias
358 (put 'gnus-group-news-1-face 'face-alias 'gnus-group-news-1)
359 (put 'gnus-group-news-1-face 'obsolete-face "22.1")
361 (defface gnus-group-news-2-empty
362 '((((class color)
363 (background dark))
364 (:foreground "turquoise4"))
365 (((class color)
366 (background light))
367 (:foreground "CadetBlue4"))
369 ()))
370 "Level 2 empty newsgroup face."
371 :group 'gnus-group)
372 ;; backward-compatibility alias
373 (put 'gnus-group-news-2-empty-face 'face-alias 'gnus-group-news-2-empty)
374 (put 'gnus-group-news-2-empty-face 'obsolete-face "22.1")
376 (defface gnus-group-news-2
377 '((t (:inherit gnus-group-news-2-empty :bold t)))
378 "Level 2 newsgroup face."
379 :group 'gnus-group)
380 ;; backward-compatibility alias
381 (put 'gnus-group-news-2-face 'face-alias 'gnus-group-news-2)
382 (put 'gnus-group-news-2-face 'obsolete-face "22.1")
384 (defface gnus-group-news-3-empty
385 '((((class color)
386 (background dark))
387 (:foreground "turquoise3"))
388 (((class color)
389 (background light))
390 (:foreground "DeepSkyBlue4"))
392 ()))
393 "Level 3 empty newsgroup face."
394 :group 'gnus-group)
395 ;; backward-compatibility alias
396 (put 'gnus-group-news-3-empty-face 'face-alias 'gnus-group-news-3-empty)
397 (put 'gnus-group-news-3-empty-face 'obsolete-face "22.1")
399 (defface gnus-group-news-3
400 '((t (:inherit gnus-group-news-3-empty :bold t)))
401 "Level 3 newsgroup face."
402 :group 'gnus-group)
403 ;; backward-compatibility alias
404 (put 'gnus-group-news-3-face 'face-alias 'gnus-group-news-3)
405 (put 'gnus-group-news-3-face 'obsolete-face "22.1")
407 (defface gnus-group-news-4-empty
408 '((((class color)
409 (background dark))
410 (:foreground "turquoise2"))
411 (((class color)
412 (background light))
413 (:foreground "DeepSkyBlue3"))
415 ()))
416 "Level 4 empty newsgroup face."
417 :group 'gnus-group)
418 ;; backward-compatibility alias
419 (put 'gnus-group-news-4-empty-face 'face-alias 'gnus-group-news-4-empty)
420 (put 'gnus-group-news-4-empty-face 'obsolete-face "22.1")
422 (defface gnus-group-news-4
423 '((t (:inherit gnus-group-news-4-empty :bold t)))
424 "Level 4 newsgroup face."
425 :group 'gnus-group)
426 ;; backward-compatibility alias
427 (put 'gnus-group-news-4-face 'face-alias 'gnus-group-news-4)
428 (put 'gnus-group-news-4-face 'obsolete-face "22.1")
430 (defface gnus-group-news-5-empty
431 '((((class color)
432 (background dark))
433 (:foreground "turquoise1"))
434 (((class color)
435 (background light))
436 (:foreground "DeepSkyBlue2"))
438 ()))
439 "Level 5 empty newsgroup face."
440 :group 'gnus-group)
441 ;; backward-compatibility alias
442 (put 'gnus-group-news-5-empty-face 'face-alias 'gnus-group-news-5-empty)
443 (put 'gnus-group-news-5-empty-face 'obsolete-face "22.1")
445 (defface gnus-group-news-5
446 '((t (:inherit gnus-group-news-5-empty :bold t)))
447 "Level 5 newsgroup face."
448 :group 'gnus-group)
449 ;; backward-compatibility alias
450 (put 'gnus-group-news-5-face 'face-alias 'gnus-group-news-5)
451 (put 'gnus-group-news-5-face 'obsolete-face "22.1")
453 (defface gnus-group-news-6-empty
454 '((((class color)
455 (background dark))
457 (((class color)
458 (background light))
461 ()))
462 "Level 6 empty newsgroup face."
463 :group 'gnus-group)
464 ;; backward-compatibility alias
465 (put 'gnus-group-news-6-empty-face 'face-alias 'gnus-group-news-6-empty)
466 (put 'gnus-group-news-6-empty-face 'obsolete-face "22.1")
468 (defface gnus-group-news-6
469 '((t (:inherit gnus-group-news-6-empty :bold t)))
470 "Level 6 newsgroup face."
471 :group 'gnus-group)
472 ;; backward-compatibility alias
473 (put 'gnus-group-news-6-face 'face-alias 'gnus-group-news-6)
474 (put 'gnus-group-news-6-face 'obsolete-face "22.1")
476 (defface gnus-group-news-low-empty
477 '((((class color)
478 (background dark))
479 (:foreground "DarkTurquoise"))
480 (((class color)
481 (background light))
482 (:foreground "DarkGreen"))
484 ()))
485 "Low level empty newsgroup face."
486 :group 'gnus-group)
487 ;; backward-compatibility alias
488 (put 'gnus-group-news-low-empty-face 'face-alias 'gnus-group-news-low-empty)
489 (put 'gnus-group-news-low-empty-face 'obsolete-face "22.1")
491 (defface gnus-group-news-low
492 '((t (:inherit gnus-group-news-low-empty :bold t)))
493 "Low level newsgroup face."
494 :group 'gnus-group)
495 ;; backward-compatibility alias
496 (put 'gnus-group-news-low-face 'face-alias 'gnus-group-news-low)
497 (put 'gnus-group-news-low-face 'obsolete-face "22.1")
499 (defface gnus-group-mail-1-empty
500 '((((class color)
501 (background dark))
502 (:foreground "#e1ffe1"))
503 (((class color)
504 (background light))
505 (:foreground "DeepPink3"))
507 (:italic t)))
508 "Level 1 empty mailgroup face."
509 :group 'gnus-group)
510 ;; backward-compatibility alias
511 (put 'gnus-group-mail-1-empty-face 'face-alias 'gnus-group-mail-1-empty)
512 (put 'gnus-group-mail-1-empty-face 'obsolete-face "22.1")
514 (defface gnus-group-mail-1
515 '((t (:inherit gnus-group-mail-1-empty :bold t)))
516 "Level 1 mailgroup face."
517 :group 'gnus-group)
518 ;; backward-compatibility alias
519 (put 'gnus-group-mail-1-face 'face-alias 'gnus-group-mail-1)
520 (put 'gnus-group-mail-1-face 'obsolete-face "22.1")
522 (defface gnus-group-mail-2-empty
523 '((((class color)
524 (background dark))
525 (:foreground "DarkSeaGreen1"))
526 (((class color)
527 (background light))
528 (:foreground "HotPink3"))
530 (:italic t)))
531 "Level 2 empty mailgroup face."
532 :group 'gnus-group)
533 ;; backward-compatibility alias
534 (put 'gnus-group-mail-2-empty-face 'face-alias 'gnus-group-mail-2-empty)
535 (put 'gnus-group-mail-2-empty-face 'obsolete-face "22.1")
537 (defface gnus-group-mail-2
538 '((t (:inherit gnus-group-mail-2-empty :bold t)))
539 "Level 2 mailgroup face."
540 :group 'gnus-group)
541 ;; backward-compatibility alias
542 (put 'gnus-group-mail-2-face 'face-alias 'gnus-group-mail-2)
543 (put 'gnus-group-mail-2-face 'obsolete-face "22.1")
545 (defface gnus-group-mail-3-empty
546 '((((class color)
547 (background dark))
548 (:foreground "aquamarine1"))
549 (((class color)
550 (background light))
551 (:foreground "magenta4"))
553 ()))
554 "Level 3 empty mailgroup face."
555 :group 'gnus-group)
556 ;; backward-compatibility alias
557 (put 'gnus-group-mail-3-empty-face 'face-alias 'gnus-group-mail-3-empty)
558 (put 'gnus-group-mail-3-empty-face 'obsolete-face "22.1")
560 (defface gnus-group-mail-3
561 '((t (:inherit gnus-group-mail-3-empty :bold t)))
562 "Level 3 mailgroup face."
563 :group 'gnus-group)
564 ;; backward-compatibility alias
565 (put 'gnus-group-mail-3-face 'face-alias 'gnus-group-mail-3)
566 (put 'gnus-group-mail-3-face 'obsolete-face "22.1")
568 (defface gnus-group-mail-low-empty
569 '((((class color)
570 (background dark))
571 (:foreground "aquamarine2"))
572 (((class color)
573 (background light))
574 (:foreground "DeepPink4"))
576 (:bold t)))
577 "Low level empty mailgroup face."
578 :group 'gnus-group)
579 ;; backward-compatibility alias
580 (put 'gnus-group-mail-low-empty-face 'face-alias 'gnus-group-mail-low-empty)
581 (put 'gnus-group-mail-low-empty-face 'obsolete-face "22.1")
583 (defface gnus-group-mail-low
584 '((t (:inherit gnus-group-mail-low-empty :bold t)))
585 "Low level mailgroup face."
586 :group 'gnus-group)
587 ;; backward-compatibility alias
588 (put 'gnus-group-mail-low-face 'face-alias 'gnus-group-mail-low)
589 (put 'gnus-group-mail-low-face 'obsolete-face "22.1")
591 ;; Summary mode faces.
593 (defface gnus-summary-selected '((t (:underline t)))
594 "Face used for selected articles."
595 :group 'gnus-summary)
596 ;; backward-compatibility alias
597 (put 'gnus-summary-selected-face 'face-alias 'gnus-summary-selected)
598 (put 'gnus-summary-selected-face 'obsolete-face "22.1")
600 (defface gnus-summary-cancelled
601 '((((class color))
602 (:foreground "yellow" :background "black")))
603 "Face used for canceled articles."
604 :group 'gnus-summary)
605 ;; backward-compatibility alias
606 (put 'gnus-summary-cancelled-face 'face-alias 'gnus-summary-cancelled)
607 (put 'gnus-summary-cancelled-face 'obsolete-face "22.1")
609 (defface gnus-summary-normal-ticked
610 '((((class color)
611 (background dark))
612 (:foreground "pink"))
613 (((class color)
614 (background light))
615 (:foreground "firebrick"))
617 ()))
618 "Face used for normal interest ticked articles."
619 :group 'gnus-summary)
620 ;; backward-compatibility alias
621 (put 'gnus-summary-normal-ticked-face 'face-alias 'gnus-summary-normal-ticked)
622 (put 'gnus-summary-normal-ticked-face 'obsolete-face "22.1")
624 (defface gnus-summary-high-ticked
625 '((t (:inherit gnus-summary-normal-ticked :bold t)))
626 "Face used for high interest ticked articles."
627 :group 'gnus-summary)
628 ;; backward-compatibility alias
629 (put 'gnus-summary-high-ticked-face 'face-alias 'gnus-summary-high-ticked)
630 (put 'gnus-summary-high-ticked-face 'obsolete-face "22.1")
632 (defface gnus-summary-low-ticked
633 '((t (:inherit gnus-summary-normal-ticked :italic t)))
634 "Face used for low interest ticked articles."
635 :group 'gnus-summary)
636 ;; backward-compatibility alias
637 (put 'gnus-summary-low-ticked-face 'face-alias 'gnus-summary-low-ticked)
638 (put 'gnus-summary-low-ticked-face 'obsolete-face "22.1")
640 (defface gnus-summary-normal-ancient
641 '((((class color)
642 (background dark))
643 (:foreground "SkyBlue"))
644 (((class color)
645 (background light))
646 (:foreground "RoyalBlue"))
648 ()))
649 "Face used for normal interest ancient articles."
650 :group 'gnus-summary)
651 ;; backward-compatibility alias
652 (put 'gnus-summary-normal-ancient-face 'face-alias 'gnus-summary-normal-ancient)
653 (put 'gnus-summary-normal-ancient-face 'obsolete-face "22.1")
655 (defface gnus-summary-high-ancient
656 '((t (:inherit gnus-summary-normal-ancient :bold t)))
657 "Face used for high interest ancient articles."
658 :group 'gnus-summary)
659 ;; backward-compatibility alias
660 (put 'gnus-summary-high-ancient-face 'face-alias 'gnus-summary-high-ancient)
661 (put 'gnus-summary-high-ancient-face 'obsolete-face "22.1")
663 (defface gnus-summary-low-ancient
664 '((t (:inherit gnus-summary-normal-ancient :italic t)))
665 "Face used for low interest ancient articles."
666 :group 'gnus-summary)
667 ;; backward-compatibility alias
668 (put 'gnus-summary-low-ancient-face 'face-alias 'gnus-summary-low-ancient)
669 (put 'gnus-summary-low-ancient-face 'obsolete-face "22.1")
671 (defface gnus-summary-normal-undownloaded
672 '((((class color)
673 (background light))
674 (:foreground "cyan4" :bold nil))
675 (((class color) (background dark))
676 (:foreground "LightGray" :bold nil))
677 (t (:inverse-video t)))
678 "Face used for normal interest uncached articles."
679 :group 'gnus-summary)
680 ;; backward-compatibility alias
681 (put 'gnus-summary-normal-undownloaded-face 'face-alias 'gnus-summary-normal-undownloaded)
682 (put 'gnus-summary-normal-undownloaded-face 'obsolete-face "22.1")
684 (defface gnus-summary-high-undownloaded
685 '((t (:inherit gnus-summary-normal-undownloaded :bold t)))
686 "Face used for high interest uncached articles."
687 :group 'gnus-summary)
688 ;; backward-compatibility alias
689 (put 'gnus-summary-high-undownloaded-face 'face-alias 'gnus-summary-high-undownloaded)
690 (put 'gnus-summary-high-undownloaded-face 'obsolete-face "22.1")
692 (defface gnus-summary-low-undownloaded
693 '((t (:inherit gnus-summary-normal-undownloaded :italic t)))
694 "Face used for low interest uncached articles."
695 :group 'gnus-summary)
696 ;; backward-compatibility alias
697 (put 'gnus-summary-low-undownloaded-face 'face-alias 'gnus-summary-low-undownloaded)
698 (put 'gnus-summary-low-undownloaded-face 'obsolete-face "22.1")
700 (defface gnus-summary-normal-unread
701 '((t
702 ()))
703 "Face used for normal interest unread articles."
704 :group 'gnus-summary)
705 ;; backward-compatibility alias
706 (put 'gnus-summary-normal-unread-face 'face-alias 'gnus-summary-normal-unread)
707 (put 'gnus-summary-normal-unread-face 'obsolete-face "22.1")
709 (defface gnus-summary-high-unread
710 '((t (:inherit gnus-summary-normal-unread :bold t)))
711 "Face used for high interest unread articles."
712 :group 'gnus-summary)
713 ;; backward-compatibility alias
714 (put 'gnus-summary-high-unread-face 'face-alias 'gnus-summary-high-unread)
715 (put 'gnus-summary-high-unread-face 'obsolete-face "22.1")
717 (defface gnus-summary-low-unread
718 '((t (:inherit gnus-summary-normal-unread :italic t)))
719 "Face used for low interest unread articles."
720 :group 'gnus-summary)
721 ;; backward-compatibility alias
722 (put 'gnus-summary-low-unread-face 'face-alias 'gnus-summary-low-unread)
723 (put 'gnus-summary-low-unread-face 'obsolete-face "22.1")
725 (defface gnus-summary-normal-read
726 '((((class color)
727 (background dark))
728 (:foreground "PaleGreen"))
729 (((class color)
730 (background light))
731 (:foreground "DarkGreen"))
733 ()))
734 "Face used for normal interest read articles."
735 :group 'gnus-summary)
736 ;; backward-compatibility alias
737 (put 'gnus-summary-normal-read-face 'face-alias 'gnus-summary-normal-read)
738 (put 'gnus-summary-normal-read-face 'obsolete-face "22.1")
740 (defface gnus-summary-high-read
741 '((t (:inherit gnus-summary-normal-read :bold t)))
742 "Face used for high interest read articles."
743 :group 'gnus-summary)
744 ;; backward-compatibility alias
745 (put 'gnus-summary-high-read-face 'face-alias 'gnus-summary-high-read)
746 (put 'gnus-summary-high-read-face 'obsolete-face "22.1")
748 (defface gnus-summary-low-read
749 '((t (:inherit gnus-summary-normal-read :italic t)))
750 "Face used for low interest read articles."
751 :group 'gnus-summary)
752 ;; backward-compatibility alias
753 (put 'gnus-summary-low-read-face 'face-alias 'gnus-summary-low-read)
754 (put 'gnus-summary-low-read-face 'obsolete-face "22.1")
758 ;;; Gnus buffers
761 (defvar gnus-buffers nil
762 "List of buffers handled by Gnus.")
764 (defun gnus-get-buffer-create (name)
765 "Do the same as `get-buffer-create', but store the created buffer."
766 (or (get-buffer name)
767 (car (push (get-buffer-create name) gnus-buffers))))
769 (defun gnus-add-buffer ()
770 "Add the current buffer to the list of Gnus buffers."
771 (gnus-prune-buffers)
772 (push (current-buffer) gnus-buffers))
774 (defmacro gnus-kill-buffer (buffer)
775 "Kill BUFFER and remove from the list of Gnus buffers."
776 `(let ((buf ,buffer))
777 (when (gnus-buffer-exists-p buf)
778 (kill-buffer buf)
779 (gnus-prune-buffers))))
781 (defun gnus-prune-buffers ()
782 (dolist (buf gnus-buffers)
783 (unless (buffer-live-p buf)
784 (setq gnus-buffers (delete buf gnus-buffers)))))
786 (defun gnus-buffers ()
787 "Return a list of live Gnus buffers."
788 (while (and gnus-buffers
789 (not (buffer-name (car gnus-buffers))))
790 (pop gnus-buffers))
791 (let ((buffers gnus-buffers))
792 (while (cdr buffers)
793 (if (buffer-name (cadr buffers))
794 (pop buffers)
795 (setcdr buffers (cddr buffers)))))
796 gnus-buffers)
798 ;;; Splash screen.
800 (defvar gnus-group-buffer "*Group*"
801 "Name of the Gnus group buffer.")
803 (defface gnus-splash
804 '((((class color)
805 (background dark))
806 (:foreground "#cccccc"))
807 (((class color)
808 (background light))
809 (:foreground "#888888"))
811 ()))
812 "Face for the splash screen."
813 :group 'gnus-start)
814 ;; backward-compatibility alias
815 (put 'gnus-splash-face 'face-alias 'gnus-splash)
816 (put 'gnus-splash-face 'obsolete-face "22.1")
818 (defun gnus-splash ()
819 (save-excursion
820 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
821 (let ((buffer-read-only nil))
822 (erase-buffer)
823 (unless gnus-inhibit-startup-message
824 (gnus-group-startup-message)
825 (sit-for 0)))))
827 (defun gnus-indent-rigidly (start end arg)
828 "Indent rigidly using only spaces and no tabs."
829 (save-excursion
830 (save-restriction
831 (narrow-to-region start end)
832 (let ((tab-width 8))
833 (indent-rigidly start end arg)
834 ;; We translate tabs into spaces -- not everybody uses
835 ;; an 8-character tab.
836 (goto-char (point-min))
837 (while (search-forward "\t" nil t)
838 (replace-match " " t t))))))
840 ;;(format "%02x%02x%02x" 114 66 20) "724214"
842 (defvar gnus-logo-color-alist
843 '((flame "#cc3300" "#ff2200")
844 (pine "#c0cc93" "#f8ffb8")
845 (moss "#a1cc93" "#d2ffb8")
846 (irish "#04cc90" "#05ff97")
847 (sky "#049acc" "#05deff")
848 (tin "#6886cc" "#82b6ff")
849 (velvet "#7c68cc" "#8c82ff")
850 (grape "#b264cc" "#cf7df")
851 (labia "#cc64c2" "#fd7dff")
852 (berry "#cc6485" "#ff7db5")
853 (dino "#724214" "#1e3f03")
854 (oort "#cccccc" "#888888")
855 (storm "#666699" "#99ccff")
856 (pdino "#9999cc" "#99ccff")
857 (purp "#9999cc" "#666699")
858 (no "#ff0000" "#ffff00")
859 (neutral "#b4b4b4" "#878787")
860 (ma "#2020e0" "#8080ff")
861 (september "#bf9900" "#ffcc00"))
862 "Color alist used for the Gnus logo.")
864 (defcustom gnus-logo-color-style 'ma
865 "Color styles used for the Gnus logo."
866 :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
867 gnus-logo-color-alist))
868 :group 'gnus-xmas)
870 (defvar gnus-logo-colors
871 (cdr (assq gnus-logo-color-style gnus-logo-color-alist))
872 "Colors used for the Gnus logo.")
874 (declare-function image-size "image.c" (spec &optional pixels frame))
876 (defun gnus-group-startup-message (&optional x y)
877 "Insert startup message in current buffer."
878 ;; Insert the message.
879 (erase-buffer)
880 (unless (and
881 (fboundp 'find-image)
882 (display-graphic-p)
883 ;; Make sure the library defining `image-load-path' is
884 ;; loaded (`find-image' is autoloaded) (and discard the
885 ;; result). Else, we may get "defvar ignored because
886 ;; image-load-path is let-bound" when calling `find-image'
887 ;; below.
888 (or (find-image '(nil (:type xpm :file "gnus.xpm"))) t)
889 (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
890 (image-load-path (cond (data-directory
891 (list data-directory))
892 ((boundp 'image-load-path)
893 (symbol-value 'image-load-path))
894 (t load-path)))
895 (image (gnus-splash-svg-color-symbols (find-image
896 `((:type svg :file "gnus.svg"
897 :color-symbols
898 (("#bf9900" . ,(car gnus-logo-colors))
899 ("#ffcc00" . ,(cadr gnus-logo-colors))))
900 (:type xpm :file "gnus.xpm"
901 :color-symbols
902 (("thing" . ,(car gnus-logo-colors))
903 ("shadow" . ,(cadr gnus-logo-colors))))
904 (:type png :file "gnus.png")
905 (:type pbm :file "gnus.pbm"
906 ;; Account for the pbm's background.
907 :background ,(face-foreground 'gnus-splash)
908 :foreground ,(face-background 'default))
909 (:type xbm :file "gnus.xbm"
910 ;; Account for the xbm's background.
911 :background ,(face-foreground 'gnus-splash)
912 :foreground ,(face-background 'default)))))))
913 (when image
914 (let ((size (image-size image)))
915 (insert-char ?\n (max 0 (round (- (window-height)
916 (or y (cdr size)) 1) 2)))
917 (insert-char ?\ (max 0 (round (- (window-width)
918 (or x (car size))) 2)))
919 (insert-image image))
920 (goto-char (point-min))
921 t)))
922 (insert
923 (format "
924 _ ___ _ _
925 _ ___ __ ___ __ _ ___
926 __ _ ___ __ ___
927 _ ___ _
928 _ _ __ _
929 ___ __ _
930 __ _
931 _ _ _
932 _ _ _
933 _ _ _
934 __ ___
935 _ _ _ _
943 ;; And then hack it.
944 (gnus-indent-rigidly (point-min) (point-max)
945 (/ (max (- (window-width) (or x 46)) 0) 2))
946 (goto-char (point-min))
947 (forward-line 1)
948 (let* ((pheight (count-lines (point-min) (point-max)))
949 (wheight (window-height))
950 (rest (- wheight pheight)))
951 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
952 ;; Fontify some.
953 (put-text-property (point-min) (point-max) 'face 'gnus-splash)
954 (goto-char (point-min))
955 (setq mode-line-buffer-identification (concat " " gnus-version))
956 (set-buffer-modified-p t)))
958 (defun gnus-splash-svg-color-symbols (list)
959 "Do color-symbol search-and-replace in svg file."
960 (let ((type (plist-get (cdr list) :type))
961 (file (plist-get (cdr list) :file))
962 (color-symbols (plist-get (cdr list) :color-symbols)))
963 (if (string= type "svg")
964 (let ((data (with-temp-buffer (insert-file-contents file)
965 (buffer-string))))
966 (mapc (lambda (rule)
967 (setq data (replace-regexp-in-string
968 (concat "fill:" (car rule))
969 (concat "fill:" (cdr rule)) data)))
970 color-symbols)
971 (cons (car list) (list :type type :data data)))
972 list)))
974 (let ((command (format "%s" this-command)))
975 (when (string-match "gnus" command)
976 (if (eq 'gnus-other-frame this-command)
977 (gnus-get-buffer-create gnus-group-buffer)
978 (gnus-splash))))
980 ;;; Do the rest.
982 (require 'gnus-util)
983 (require 'nnheader)
985 (defcustom gnus-parameters nil
986 "Alist of group parameters.
988 For example:
989 ((\"mail\\\\..*\" (gnus-show-threads nil)
990 (gnus-use-scoring nil)
991 (gnus-summary-line-format
992 \"%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\\n\")
993 (gcc-self . t)
994 (display . all))
995 (\"mail\\\\.me\" (gnus-use-scoring t))
996 (\"list\\\\..*\" (total-expire . t)
997 (broken-reply-to . t)))"
998 :version "22.1"
999 :group 'gnus-group-various
1000 :type '(repeat (cons regexp
1001 (repeat sexp))))
1003 (defcustom gnus-parameters-case-fold-search 'default
1004 "If it is t, ignore case of group names specified in `gnus-parameters'.
1005 If it is nil, don't ignore case. If it is `default', which is for the
1006 backward compatibility, use the value of `case-fold-search'."
1007 :version "22.1"
1008 :group 'gnus-group-various
1009 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
1010 (const :tag "Use `case-fold-search'" default)
1011 (const nil)
1012 (const t)))
1014 (defvar gnus-group-parameters-more nil)
1016 (defmacro gnus-define-group-parameter (param &rest rest)
1017 "Define a group parameter PARAM.
1018 REST is a plist of following:
1019 :type One of `bool', `list' or nil.
1020 :function The name of the function.
1021 :function-document The documentation of the function.
1022 :parameter-type The type for customizing the parameter.
1023 :parameter-document The documentation for the parameter.
1024 :variable The name of the variable.
1025 :variable-document The documentation for the variable.
1026 :variable-group The group for customizing the variable.
1027 :variable-type The type for customizing the variable.
1028 :variable-default The default value of the variable."
1029 (let* ((type (plist-get rest :type))
1030 (parameter-type (plist-get rest :parameter-type))
1031 (parameter-document (plist-get rest :parameter-document))
1032 (function (or (plist-get rest :function)
1033 (intern (format "gnus-parameter-%s" param))))
1034 (function-document (or (plist-get rest :function-document) ""))
1035 (variable (or (plist-get rest :variable)
1036 (intern (format "gnus-parameter-%s-alist" param))))
1037 (variable-document (or (plist-get rest :variable-document) ""))
1038 (variable-group (plist-get rest :variable-group))
1039 (variable-type (or (plist-get rest :variable-type)
1040 `(quote (repeat
1041 (list (regexp :tag "Group")
1042 ,(car (cdr parameter-type)))))))
1043 (variable-default (plist-get rest :variable-default)))
1044 (list
1045 'progn
1046 `(defcustom ,variable ,variable-default
1047 ,variable-document
1048 :group 'gnus-group-parameter
1049 :group ',variable-group
1050 :type ,variable-type)
1051 `(setq gnus-group-parameters-more
1052 (delq (assq ',param gnus-group-parameters-more)
1053 gnus-group-parameters-more))
1054 `(add-to-list 'gnus-group-parameters-more
1055 (list ',param
1056 ,parameter-type
1057 ,parameter-document))
1058 (if (eq type 'bool)
1059 `(defun ,function (name)
1060 ,function-document
1061 (let ((params (gnus-group-find-parameter name))
1062 val)
1063 (cond
1064 ((memq ',param params)
1066 ((setq val (assq ',param params))
1067 (cdr val))
1068 ((stringp ,variable)
1069 (string-match ,variable name))
1070 (,variable
1071 (let ((alist ,variable)
1072 elem value)
1073 (while (setq elem (pop alist))
1074 (when (and name
1075 (string-match (car elem) name))
1076 (setq alist nil
1077 value (cdr elem))))
1078 (if (consp value) (car value) value))))))
1079 `(defun ,function (name)
1080 ,function-document
1081 (and name
1082 (or (gnus-group-find-parameter name ',param ,(and type t))
1083 (let ((alist ,variable)
1084 elem value)
1085 (while (setq elem (pop alist))
1086 (when (and name
1087 (string-match (car elem) name))
1088 (setq alist nil
1089 value (cdr elem))))
1090 ,(if type
1091 'value
1092 '(if (consp value) (car value) value))))))))))
1094 (defcustom gnus-home-directory "~/"
1095 "Directory variable that specifies the \"home\" directory.
1096 All other Gnus file and directory variables are initialized from this variable.
1098 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1099 This means that other directory variables that are initialized
1100 from this variable won't be set properly if you set this variable
1101 in `.gnus.el'. Set this variable in `.emacs' instead."
1102 :group 'gnus-files
1103 :type 'directory)
1105 (defcustom gnus-directory (or (getenv "SAVEDIR")
1106 (nnheader-concat gnus-home-directory "News/"))
1107 "Directory variable from which all other Gnus file variables are derived.
1109 Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1110 This means that other directory variables that are initialized from
1111 this variable won't be set properly if you set this variable in `.gnus.el'.
1112 Set this variable in `.emacs' instead."
1113 :group 'gnus-files
1114 :type 'directory)
1116 (defcustom gnus-default-directory nil
1117 "Default directory for all Gnus buffers."
1118 :group 'gnus-files
1119 :type '(choice (const :tag "current" nil)
1120 directory))
1122 ;; Site dependent variables.
1124 ;; Should this be obsolete?
1125 (defcustom gnus-default-nntp-server nil
1126 "The hostname of the default NNTP server.
1127 The empty string, or nil, means to use the local host.
1128 You may wish to set this on a site-wide basis.
1130 If you want to change servers, you should use `gnus-select-method'."
1131 :group 'gnus-server
1132 :type '(choice (const :tag "local host" nil)
1133 (string :tag "host name")))
1135 (defcustom gnus-nntpserver-file "/etc/nntpserver"
1136 "A file with only the name of the nntp server in it."
1137 :group 'gnus-files
1138 :group 'gnus-server
1139 :type 'file)
1141 (defun gnus-getenv-nntpserver ()
1142 "Find default nntp server.
1143 Check the NNTPSERVER environment variable and the
1144 `gnus-nntpserver-file' file."
1145 (or (getenv "NNTPSERVER")
1146 (and (file-readable-p gnus-nntpserver-file)
1147 (with-temp-buffer
1148 (insert-file-contents gnus-nntpserver-file)
1149 (when (re-search-forward "[^ \t\n\r]+" nil t)
1150 (match-string 0))))))
1152 ;; `M-x customize-variable RET gnus-select-method RET' should work without
1153 ;; starting or even loading Gnus.
1154 ;;;###autoload(when (fboundp 'custom-autoload)
1155 ;;;###autoload (custom-autoload 'gnus-select-method "gnus"))
1157 (defcustom gnus-select-method
1158 (list 'nntp (or (gnus-getenv-nntpserver)
1159 (when (and gnus-default-nntp-server
1160 (not (string= gnus-default-nntp-server "")))
1161 gnus-default-nntp-server)
1162 "news"))
1163 "Default method for selecting a newsgroup.
1164 This variable should be a list, where the first element is how the
1165 news is to be fetched, the second is the address.
1167 For instance, if you want to get your news via \"flab.flab.edu\" using
1168 NNTP, you could say:
1170 \(setq gnus-select-method \\='(nntp \"flab.flab.edu\"))
1172 If you want to use your local spool, say:
1174 \(setq gnus-select-method (list \\='nnspool (system-name)))
1176 If you use this variable, you must set `gnus-nntp-server' to nil.
1178 There is a lot more to know about select methods and virtual servers -
1179 see the manual for details."
1180 ;; Emacs has set-after since 22.1.
1181 ;set-after '(gnus-default-nntp-server)
1182 :group 'gnus-server
1183 :group 'gnus-start
1184 :initialize 'custom-initialize-default
1185 :type 'gnus-select-method)
1187 (defcustom gnus-message-archive-method "archive"
1188 "Method used for archiving messages you've sent.
1189 This should be a mail method.
1191 See also `gnus-update-message-archive-method'."
1192 :group 'gnus-server
1193 :group 'gnus-message
1194 :type '(choice (const :tag "Default archive method" "archive")
1195 gnus-select-method))
1197 (defcustom gnus-update-message-archive-method nil
1198 "Non-nil means always update the saved \"archive\" method.
1200 The archive method is initially set according to the value of
1201 `gnus-message-archive-method' and is saved in the \"~/.newsrc.eld\" file
1202 so that it may be used as a real method of the server which is named
1203 \"archive\" ever since. If it once has been saved, it will never be
1204 updated if the value of this variable is nil, even if you change the
1205 value of `gnus-message-archive-method' afterward. If you want the
1206 saved \"archive\" method to be updated whenever you change the value of
1207 `gnus-message-archive-method', set this variable to a non-nil value."
1208 :version "23.1"
1209 :group 'gnus-server
1210 :group 'gnus-message
1211 :type 'boolean)
1213 (defcustom gnus-message-archive-group '((format-time-string "sent.%Y-%m"))
1214 "Name of the group in which to save the messages you've written.
1215 This can either be a string; a list of strings; or an alist
1216 of regexps/functions/forms to be evaluated to return a string (or a list
1217 of strings). The functions are called with the name of the current
1218 group (or nil) as a parameter.
1220 If you want to save your mail in one group and the news articles you
1221 write in another group, you could say something like:
1223 (setq gnus-message-archive-group
1224 \\='((if (message-news-p)
1225 \"misc-news\"
1226 \"misc-mail\")))
1228 Normally the group names returned by this variable should be
1229 unprefixed -- which implicitly means \"store on the archive server\".
1230 However, you may wish to store the message on some other server. In
1231 that case, just return a fully prefixed name of the group --
1232 \"nnml+private:mail.misc\", for instance."
1233 :version "24.1"
1234 :group 'gnus-message
1235 :type '(choice (const :tag "none" nil)
1236 (const :tag "Weekly" ((format-time-string "sent.%Yw%U")))
1237 (const :tag "Monthly" ((format-time-string "sent.%Y-%m")))
1238 (const :tag "Yearly" ((format-time-string "sent.%Y")))
1239 function
1240 sexp
1241 string))
1243 (defcustom gnus-secondary-servers nil
1244 "List of NNTP servers that the user can choose between interactively.
1245 To make Gnus query you for a server, you have to give `gnus' a
1246 non-numeric prefix - `C-u M-x gnus', in short."
1247 :group 'gnus-server
1248 :type '(repeat string))
1249 (make-obsolete-variable 'gnus-secondary-servers 'gnus-select-method "24.1")
1251 (defcustom gnus-secondary-select-methods nil
1252 "A list of secondary methods that will be used for reading news.
1253 This is a list where each element is a complete select method (see
1254 `gnus-select-method').
1256 If, for instance, you want to read your mail with the nnml back end,
1257 you could set this variable:
1259 \(setq gnus-secondary-select-methods \\='((nnml \"\")))"
1260 :group 'gnus-server
1261 :type '(repeat gnus-select-method))
1263 (defcustom gnus-local-domain nil
1264 "Local domain name without a host name.
1265 The DOMAINNAME environment variable is used instead if it is defined.
1266 If the function `system-name' returns the full Internet name, there is
1267 no need to set this variable."
1268 :group 'gnus-message
1269 :type '(choice (const :tag "default" nil)
1270 string))
1271 (make-obsolete-variable 'gnus-local-domain nil "Emacs 24.1")
1273 ;; Customization variables
1275 (defcustom gnus-refer-article-method 'current
1276 "Preferred method for fetching an article by Message-ID.
1277 The value of this variable must be a valid select method as discussed
1278 in the documentation of `gnus-select-method'.
1280 It can also be a list of select methods, as well as the special symbol
1281 `current', which means to use the current select method. If it is a
1282 list, Gnus will try all the methods in the list until it finds a match."
1283 :version "24.1"
1284 :group 'gnus-server
1285 :type '(choice (const :tag "default" nil)
1286 (const current)
1287 (const :tag "Google" (nnweb "refer" (nnweb-type google)))
1288 gnus-select-method
1289 sexp
1290 (repeat :menu-tag "Try multiple"
1291 :tag "Multiple"
1292 :value (current (nnweb "refer" (nnweb-type google)))
1293 (choice :tag "Method"
1294 (const current)
1295 (const :tag "Google"
1296 (nnweb "refer" (nnweb-type google)))
1297 gnus-select-method))))
1299 (defcustom gnus-use-cross-reference t
1300 "Non-nil means that cross referenced articles will be marked as read.
1301 If nil, ignore cross references. If t, mark articles as read in
1302 subscribed newsgroups. If neither t nor nil, mark as read in all
1303 newsgroups."
1304 :group 'gnus-server
1305 :type '(choice (const :tag "off" nil)
1306 (const :tag "subscribed" t)
1307 (sexp :format "all"
1308 :value always)))
1310 (defcustom gnus-process-mark ?#
1311 "Process mark."
1312 :group 'gnus-group-visual
1313 :group 'gnus-summary-marks
1314 :type 'character)
1316 (defcustom gnus-large-newsgroup 200
1317 "The number of articles which indicates a large newsgroup.
1318 If the number of articles in a newsgroup is greater than this value,
1319 confirmation is required for selecting the newsgroup.
1320 If it is nil, no confirmation is required.
1322 Also see `gnus-large-ephemeral-newsgroup'."
1323 :group 'gnus-group-select
1324 :type '(choice (const :tag "No limit" nil)
1325 integer))
1327 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v)))
1328 "Non-nil means that the default name of a file to save articles in is the group name.
1329 If it's nil, the directory form of the group name is used instead.
1331 If this variable is a list, and the list contains the element
1332 `not-score', long file names will not be used for score files; if it
1333 contains the element `not-save', long file names will not be used for
1334 saving; and if it contains the element `not-kill', long file names
1335 will not be used for kill files.
1337 Note that the default for this variable varies according to what system
1338 type you're using. On `usg-unix-v' this variable defaults to nil while
1339 on all other systems it defaults to t."
1340 :group 'gnus-start
1341 :type '(radio (sexp :format "Non-nil\n"
1342 :match (lambda (widget value)
1343 (and value (not (listp value))))
1344 :value t)
1345 (const nil)
1346 (checklist (const :format "%v " not-score)
1347 (const :format "%v " not-save)
1348 (const not-kill))))
1350 (defcustom gnus-kill-files-directory gnus-directory
1351 "Name of the directory where kill files will be stored (default \"~/News\")."
1352 :group 'gnus-score-files
1353 :group 'gnus-score-kill
1354 :type 'directory)
1356 (defcustom gnus-save-score nil
1357 "If non-nil, save group scoring info."
1358 :group 'gnus-score-various
1359 :group 'gnus-start
1360 :type 'boolean)
1362 (defcustom gnus-use-undo t
1363 "If non-nil, allow undoing in Gnus group mode buffers."
1364 :group 'gnus-meta
1365 :type 'boolean)
1367 (defcustom gnus-use-adaptive-scoring nil
1368 "If non-nil, use some adaptive scoring scheme.
1369 If a list, then the values `word' and `line' are meaningful. The
1370 former will perform adaption on individual words in the subject
1371 header while `line' will perform adaption on several headers."
1372 :group 'gnus-meta
1373 :group 'gnus-score-adapt
1374 :type '(set (const word) (const line)))
1376 (defcustom gnus-use-cache 'passive
1377 "If nil, Gnus will ignore the article cache.
1378 If `passive', it will allow entering (and reading) articles
1379 explicitly entered into the cache. If anything else, use the
1380 cache to the full extent of the law."
1381 :group 'gnus-meta
1382 :group 'gnus-cache
1383 :type '(choice (const :tag "off" nil)
1384 (const :tag "passive" passive)
1385 (const :tag "active" t)))
1387 (defcustom gnus-use-trees nil
1388 "If non-nil, display a thread tree buffer."
1389 :group 'gnus-meta
1390 :type 'boolean)
1392 (defcustom gnus-keep-backlog 20
1393 "If non-nil, Gnus will keep read articles for later re-retrieval.
1394 If it is a number N, then Gnus will only keep the last N articles
1395 read. If it is neither nil nor a number, Gnus will keep all read
1396 articles. This is not a good idea."
1397 :group 'gnus-meta
1398 :type '(choice (const :tag "off" nil)
1399 integer
1400 (sexp :format "all"
1401 :value t)))
1403 (defcustom gnus-suppress-duplicates nil
1404 "If non-nil, Gnus will mark duplicate copies of the same article as read."
1405 :group 'gnus-meta
1406 :type 'boolean)
1408 (defcustom gnus-use-scoring t
1409 "If non-nil, enable scoring."
1410 :group 'gnus-meta
1411 :type 'boolean)
1413 (defcustom gnus-summary-prepare-exit-hook
1414 '(gnus-summary-expire-articles)
1415 "A hook called when preparing to exit from the summary buffer.
1416 It calls `gnus-summary-expire-articles' by default."
1417 :group 'gnus-summary-exit
1418 :type 'hook)
1420 (defcustom gnus-novice-user t
1421 "Non-nil means that you are a Usenet novice.
1422 If non-nil, verbose messages may be displayed and confirmations may be
1423 required."
1424 :group 'gnus-meta
1425 :type 'boolean)
1427 (defcustom gnus-expert-user nil
1428 "Non-nil means that you will never be asked for confirmation about anything.
1429 That doesn't mean *anything* anything; particularly destructive
1430 commands will still require prompting."
1431 :group 'gnus-meta
1432 :type 'boolean)
1434 (defcustom gnus-interactive-catchup t
1435 "If non-nil, require your confirmation when catching up a group."
1436 :group 'gnus-group-select
1437 :type 'boolean)
1439 (defcustom gnus-interactive-exit t
1440 "If non-nil, require your confirmation when exiting Gnus.
1441 If `quiet', update any active summary buffers automatically
1442 first before exiting."
1443 :group 'gnus-exit
1444 :type '(choice boolean
1445 (const quiet)))
1447 (defcustom gnus-extract-address-components 'gnus-extract-address-components
1448 "Function for extracting address components from a From header.
1449 Two pre-defined function exist: `gnus-extract-address-components',
1450 which is the default, quite fast, and too simplistic solution, and
1451 `mail-extract-address-components', which works much better, but is
1452 slower."
1453 :group 'gnus-summary-format
1454 :type '(radio (function-item gnus-extract-address-components)
1455 (function-item mail-extract-address-components)
1456 (function :tag "Other")))
1458 (defcustom gnus-shell-command-separator ";"
1459 "String used to separate shell commands."
1460 :group 'gnus-files
1461 :type 'string)
1463 (defcustom gnus-valid-select-methods
1464 '(("nntp" post address prompt-address physical-address cloud)
1465 ("nnspool" post address)
1466 ("nnvirtual" post-mail virtual prompt-address)
1467 ("nnmbox" mail respool address)
1468 ("nnml" post-mail respool address)
1469 ("nnmh" mail respool address)
1470 ("nndir" post-mail prompt-address physical-address)
1471 ("nneething" none address prompt-address physical-address)
1472 ("nndoc" none address prompt-address)
1473 ("nnbabyl" mail address respool)
1474 ("nndraft" post-mail)
1475 ("nnfolder" mail respool address)
1476 ("nngateway" post-mail address prompt-address physical-address)
1477 ("nnweb" none)
1478 ("nnrss" none global)
1479 ("nnagent" post-mail)
1480 ("nnimap" post-mail address prompt-address physical-address respool
1481 server-marks cloud)
1482 ("nnmaildir" mail respool address server-marks)
1483 ("nnnil" none))
1484 "An alist of valid select methods.
1485 The first element of each list lists should be a string with the name
1486 of the select method. The other elements may be the category of
1487 this method (i. e., `post', `mail', `none' or whatever) or other
1488 properties that this method has (like being respoolable).
1489 If you implement a new select method, all you should have to change is
1490 this variable. I think."
1491 :group 'gnus-server
1492 :type '(repeat (group (string :tag "Name")
1493 (radio-button-choice (const :format "%v " post)
1494 (const :format "%v " mail)
1495 (const :format "%v " none)
1496 (const post-mail))
1497 (checklist :inline t :greedy t
1498 (const :format "%v " address)
1499 (const cloud)
1500 (const global)
1501 (const :format "%v " prompt-address)
1502 (const :format "%v " physical-address)
1503 (const virtual)
1504 (const :format "%v " respool)
1505 (const server-marks))))
1506 :version "24.1")
1508 (defun gnus-redefine-select-method-widget ()
1509 "Recomputes the select-method widget based on the value of
1510 `gnus-valid-select-methods'."
1511 (define-widget 'gnus-select-method 'list
1512 "Widget for entering a select method."
1513 :value '(nntp "")
1514 :tag "Select Method"
1515 :args `((choice :tag "Method"
1516 ,@(mapcar (lambda (entry)
1517 (list 'const :format "%v\n"
1518 (intern (car entry))))
1519 gnus-valid-select-methods)
1520 (symbol :tag "other"))
1521 (string :tag "Address")
1522 (repeat :tag "Options"
1523 :inline t
1524 (list :format "%v"
1525 variable
1526 (sexp :tag "Value"))))))
1528 (gnus-redefine-select-method-widget)
1530 (defcustom gnus-updated-mode-lines '(group article summary tree)
1531 "List of buffers that should update their mode lines.
1532 The list may contain the symbols `group', `article', `tree' and
1533 `summary'. If the corresponding symbol is present, Gnus will keep
1534 that mode line updated with information that may be pertinent.
1535 If this variable is nil, screen refresh may be quicker."
1536 :group 'gnus-various
1537 :type '(set (const group)
1538 (const article)
1539 (const summary)
1540 (const tree)))
1542 (defcustom gnus-mode-non-string-length 30
1543 "Max length of mode-line non-string contents.
1544 If this is nil, Gnus will take space as is needed, leaving the rest
1545 of the mode line intact."
1546 :version "24.1"
1547 :group 'gnus-various
1548 :type '(choice (const nil)
1549 integer))
1551 ;; There should be special validation for this.
1552 (define-widget 'gnus-email-address 'string
1553 "An email address.")
1555 (gnus-define-group-parameter
1556 to-address
1557 :function-document
1558 "Return GROUP's to-address."
1559 :variable-document
1560 "Alist of group regexps and correspondent to-addresses."
1561 :variable-group gnus-group-parameter
1562 :parameter-type '(gnus-email-address :tag "To Address")
1563 :parameter-document "\
1564 This will be used when doing followups and posts.
1566 This is primarily useful in mail groups that represent closed
1567 mailing lists--mailing lists where it's expected that everybody that
1568 writes to the mailing list is subscribed to it. Since using this
1569 parameter ensures that the mail only goes to the mailing list itself,
1570 it means that members won't receive two copies of your followups.
1572 Using `to-address' will actually work whether the group is foreign or
1573 not. Let's say there's a group on the server that is called
1574 `fa.4ad-l'. This is a real newsgroup, but the server has gotten the
1575 articles from a mail-to-news gateway. Posting directly to this group
1576 is therefore impossible--you have to send mail to the mailing list
1577 address instead.
1579 The gnus-group-split mail splitting mechanism will behave as if this
1580 address was listed in gnus-group-split Addresses (see below).")
1582 (gnus-define-group-parameter
1583 to-list
1584 :function-document
1585 "Return GROUP's to-list."
1586 :variable-document
1587 "Alist of group regexps and correspondent to-lists."
1588 :variable-group gnus-group-parameter
1589 :parameter-type '(gnus-email-address :tag "To List")
1590 :parameter-document "\
1591 This address will be used when doing a `a' in the group.
1593 It is totally ignored when doing a followup--except that if it is
1594 present in a news group, you'll get mail group semantics when doing
1595 `f'.
1597 The gnus-group-split mail splitting mechanism will behave as if this
1598 address was listed in gnus-group-split Addresses (see below).")
1600 (gnus-define-group-parameter
1601 subscribed
1602 :type bool
1603 :function-document
1604 "Return GROUP's subscription status."
1605 :variable-document
1606 "Groups which are automatically considered subscribed."
1607 :variable-group gnus-group-parameter
1608 :parameter-type '(const :tag "Subscribed" t)
1609 :parameter-document "\
1610 Gnus assumed that you are subscribed to the To/List address.
1612 When constructing a list of subscribed groups using
1613 `gnus-find-subscribed-addresses', Gnus includes the To address given
1614 above, or the list address (if the To address has not been set).")
1616 (gnus-define-group-parameter
1617 auto-expire
1618 :type bool
1619 :function gnus-group-auto-expirable-p
1620 :function-document
1621 "Check whether GROUP is auto-expirable or not."
1622 :variable gnus-auto-expirable-newsgroups
1623 :variable-default nil
1624 :variable-document
1625 "Groups in which to automatically mark read articles as expirable.
1626 If non-nil, this should be a regexp that should match all groups in
1627 which to perform auto-expiry. This only makes sense for mail groups."
1628 :variable-group nnmail-expire
1629 :variable-type '(choice (const nil)
1630 regexp)
1631 :parameter-type '(const :tag "Automatic Expire" t)
1632 :parameter-document
1633 "All articles that are read will be marked as expirable.")
1635 (gnus-define-group-parameter
1636 total-expire
1637 :type bool
1638 :function gnus-group-total-expirable-p
1639 :function-document
1640 "Check whether GROUP is total-expirable or not."
1641 :variable gnus-total-expirable-newsgroups
1642 :variable-default nil
1643 :variable-document
1644 "Groups in which to perform expiry of all read articles.
1645 Use with extreme caution. All groups that match this regexp will be
1646 expiring - which means that all read articles will be deleted after
1647 \(say) one week. (This only goes for mail groups and the like, of
1648 course.)"
1649 :variable-group nnmail-expire
1650 :variable-type '(choice (const nil)
1651 regexp)
1652 :parameter-type '(const :tag "Total Expire" t)
1653 :parameter-document
1654 "All read articles will be put through the expiry process
1656 This happens even if they are not marked as expirable.
1657 Use with caution.")
1659 (gnus-define-group-parameter
1660 charset
1661 :function-document
1662 "Return the default charset of GROUP."
1663 :variable gnus-group-charset-alist
1664 :variable-default
1665 '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5)
1666 ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312)
1667 ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2)
1668 ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit)
1669 ("\\(^\\|:\\)relcom\\>" koi8-r)
1670 ("\\(^\\|:\\)fido7\\>" koi8-r)
1671 ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
1672 ("\\(^\\|:\\)israel\\>" iso-8859-1)
1673 ("\\(^\\|:\\)han\\>" euc-kr)
1674 ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5)
1675 ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr)
1676 ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1))
1677 :variable-document
1678 "Alist of regexps (to match group names) and default charsets to be used when reading."
1679 :variable-group gnus-charset
1680 :variable-type '(repeat (list (regexp :tag "Group")
1681 (symbol :tag "Charset")))
1682 :parameter-type '(symbol :tag "Charset")
1683 :parameter-document "\
1684 The default charset to use in the group.")
1686 (gnus-define-group-parameter
1687 post-method
1688 :type list
1689 :function-document
1690 "Return a posting method for GROUP."
1691 :variable gnus-post-method-alist
1692 :variable-document
1693 "Alist of regexps (to match group names) and method to be used when
1694 posting an article."
1695 :variable-group gnus-group-foreign
1696 :parameter-type
1697 '(choice :tag "Posting Method"
1698 (const :tag "Use native server" native)
1699 (const :tag "Use current server" current)
1700 (list :convert-widget
1701 (lambda (widget)
1702 (list 'sexp :tag "Methods"
1703 :value gnus-select-method))))
1704 :parameter-document
1705 "Posting method for this group.")
1707 (gnus-define-group-parameter
1708 large-newsgroup-initial
1709 :type integer
1710 :function-document
1711 "Return GROUP's initial input of the number of articles."
1712 :variable-document
1713 "Alist of group regexps and its initial input of the number of articles."
1714 :variable-group gnus-group-parameter
1715 :parameter-type '(choice :tag "Initial Input for Large Newsgroup"
1716 (const :tag "All" nil)
1717 (integer))
1718 :parameter-document "\
1720 This number will be prompted as the initial value of the number of
1721 articles to list when the group is a large newsgroup (see
1722 `gnus-large-newsgroup'). If it is nil, the default value is the
1723 total number of articles in the group.")
1725 ;; The Gnus registry's ignored groups
1726 (gnus-define-group-parameter
1727 registry-ignore
1728 :type list
1729 :function-document
1730 "Whether this group should be ignored by the registry."
1731 :variable gnus-registry-ignored-groups
1732 :variable-default (mapcar
1733 (lambda (g) (list g t))
1734 '("delayed$" "drafts$" "queue$" "INBOX$"
1735 "^nnmairix:" "^nnir:" "archive"))
1736 :variable-document
1737 "Groups in which the registry should be turned off."
1738 :variable-group gnus-registry
1739 :variable-type '(repeat
1740 (list
1741 (regexp :tag "Group Name Regular Expression")
1742 (boolean :tag "Ignored")))
1744 :parameter-type '(boolean :tag "Group Ignored by the Registry")
1745 :parameter-document
1746 "Whether the Gnus Registry should ignore this group.")
1748 ;; group parameters for spam processing added by Ted Zlatanov <tzz@lifelogs.com>
1749 (defcustom gnus-install-group-spam-parameters t
1750 "Disable the group parameters for spam detection.
1751 Enable if `G c' in XEmacs is giving you trouble, and make sure to submit a bug report."
1752 :version "22.1"
1753 :type 'boolean
1754 :group 'gnus-start)
1756 (when gnus-install-group-spam-parameters
1757 (defvar gnus-group-spam-classification-spam t
1758 "Spam group classification (requires spam.el).
1759 This group contains spam messages. On summary entry, unread messages
1760 will be marked as spam. On summary exit, the specified spam
1761 processors will be invoked on spam-marked messages, then those
1762 messages will be expired, so the spam processor will only see a
1763 spam-marked message once.")
1765 (defvar gnus-group-spam-classification-ham 'ask
1766 "The ham value for the spam group parameter (requires spam.el).
1767 On summary exit, the specified ham processors will be invoked on
1768 ham-marked messages. Exercise caution, since the ham processor will
1769 see the same message more than once because there is no ham message
1770 registry.")
1772 (gnus-define-group-parameter
1773 spam-contents
1774 :type list
1775 :function-document
1776 "The spam type (spam, ham, or neither) of the group."
1777 :variable gnus-spam-newsgroup-contents
1778 :variable-default nil
1779 :variable-document
1780 "Group classification (spam, ham, or neither). Only
1781 meaningful when spam.el is loaded. If non-nil, this should be a
1782 list of group name regexps associated with a classification for
1783 each one. In spam groups, new articles are marked as spam on
1784 summary entry. There is other behavior associated with ham and
1785 no classification when spam.el is loaded - see the manual."
1786 :variable-group spam
1787 :variable-type '(repeat
1788 (list :tag "Group contents spam/ham classification"
1789 (regexp :tag "Group")
1790 (choice
1791 (variable-item gnus-group-spam-classification-spam)
1792 (variable-item gnus-group-spam-classification-ham)
1793 (const :tag "Unclassified" nil))))
1795 :parameter-type '(list :tag "Group contents spam/ham classification"
1796 (choice :tag "Group contents classification for spam sorting"
1797 (variable-item gnus-group-spam-classification-spam)
1798 (variable-item gnus-group-spam-classification-ham)
1799 (const :tag "Unclassified" nil)))
1800 :parameter-document
1801 "The spam classification (spam, ham, or neither) of this group.
1802 When a spam group is entered, all unread articles are marked as
1803 spam. There is other behavior associated with ham and no
1804 classification when spam.el is loaded - see the manual.")
1806 (gnus-define-group-parameter
1807 spam-resend-to
1808 :type list
1809 :function-document
1810 "The address to get spam resent (through spam-report-resend)."
1811 :variable gnus-spam-resend-to
1812 :variable-default nil
1813 :variable-document
1814 "The address to get spam resent (through spam-report-resend)."
1815 :variable-group spam
1816 :variable-type '(repeat
1817 (list :tag "Group address for resending spam"
1818 (regexp :tag "Group")
1819 (string :tag "E-mail address for resending spam (requires the spam-use-resend exit processor)")))
1820 :parameter-type 'string :tag "E-mail address for resending spam (requires the spam-use-resend exit processor)"
1821 :parameter-document
1822 "The address to get spam resent (through spam-report-resend).")
1824 (gnus-define-group-parameter
1825 ham-resend-to
1826 :type list
1827 :function-document
1828 "The address to get ham resent (through spam-report-resend)."
1829 :variable gnus-ham-resend-to
1830 :variable-default nil
1831 :variable-document
1832 "The address to get ham resent (through spam-report-resend)."
1833 :variable-group spam
1834 :variable-type '(repeat
1835 (list :tag "Group address for resending ham"
1836 (regexp :tag "Group")
1837 (string :tag "E-mail address for resending ham (requires the spam-use-resend exit processor)")))
1838 :parameter-type 'string :tag "E-mail address for resending ham (requires the spam-use-resend exit processor)"
1839 :parameter-document
1840 "The address to get ham resent (through spam-report-resend).")
1842 (defvar gnus-group-spam-exit-processor-ifile "ifile"
1843 "OBSOLETE: The ifile summary exit spam processor.")
1845 (defvar gnus-group-spam-exit-processor-stat "stat"
1846 "OBSOLETE: The spam-stat summary exit spam processor.")
1848 (defvar gnus-group-spam-exit-processor-bogofilter "bogofilter"
1849 "OBSOLETE: The Bogofilter summary exit spam processor.")
1851 (defvar gnus-group-spam-exit-processor-blacklist "blacklist"
1852 "OBSOLETE: The Blacklist summary exit spam processor.")
1854 (defvar gnus-group-spam-exit-processor-report-gmane "report-gmane"
1855 "OBSOLETE: The Gmane reporting summary exit spam processor.
1856 Only applicable to NNTP groups with articles from Gmane. See spam-report.el")
1858 (defvar gnus-group-spam-exit-processor-spamoracle "spamoracle-spam"
1859 "OBSOLETE: The spamoracle summary exit spam processor.")
1861 (defvar gnus-group-ham-exit-processor-ifile "ifile-ham"
1862 "OBSOLETE: The ifile summary exit ham processor.
1863 Only applicable to non-spam (unclassified and ham) groups.")
1865 (defvar gnus-group-ham-exit-processor-bogofilter "bogofilter-ham"
1866 "OBSOLETE: The Bogofilter summary exit ham processor.
1867 Only applicable to non-spam (unclassified and ham) groups.")
1869 (defvar gnus-group-ham-exit-processor-stat "stat-ham"
1870 "OBSOLETE: The spam-stat summary exit ham processor.
1871 Only applicable to non-spam (unclassified and ham) groups.")
1873 (defvar gnus-group-ham-exit-processor-whitelist "whitelist"
1874 "OBSOLETE: The whitelist summary exit ham processor.
1875 Only applicable to non-spam (unclassified and ham) groups.")
1877 (defvar gnus-group-ham-exit-processor-BBDB "bbdb"
1878 "OBSOLETE: The BBDB summary exit ham processor.
1879 Only applicable to non-spam (unclassified and ham) groups.")
1881 (defvar gnus-group-ham-exit-processor-copy "copy"
1882 "OBSOLETE: The ham copy exit ham processor.
1883 Only applicable to non-spam (unclassified and ham) groups.")
1885 (defvar gnus-group-ham-exit-processor-spamoracle "spamoracle-ham"
1886 "OBSOLETE: The spamoracle summary exit ham processor.
1887 Only applicable to non-spam (unclassified and ham) groups.")
1889 (gnus-define-group-parameter
1890 spam-process
1891 :type list
1892 :parameter-type
1893 '(choice
1894 :tag "Spam Summary Exit Processor"
1895 :value nil
1896 (list :tag "Spam Summary Exit Processor Choices"
1897 (set
1898 (const :tag "Spam: Bogofilter" (spam spam-use-bogofilter))
1899 (const :tag "Spam: Blacklist" (spam spam-use-blacklist))
1900 (const :tag "Spam: Bsfilter" (spam spam-use-bsfilter))
1901 (const :tag "Spam: Gmane Report" (spam spam-use-gmane))
1902 (const :tag "Spam: Resend Message"(spam spam-use-resend))
1903 (const :tag "Spam: ifile" (spam spam-use-ifile))
1904 (const :tag "Spam: Spam Oracle" (spam spam-use-spamoracle))
1905 (const :tag "Spam: Spam-stat" (spam spam-use-stat))
1906 (const :tag "Spam: SpamAssassin" (spam spam-use-spamassassin))
1907 (const :tag "Spam: CRM114" (spam spam-use-crm114))
1908 (const :tag "Ham: BBDB" (ham spam-use-BBDB))
1909 (const :tag "Ham: Bogofilter" (ham spam-use-bogofilter))
1910 (const :tag "Ham: Bsfilter" (ham spam-use-bsfilter))
1911 (const :tag "Ham: Copy" (ham spam-use-ham-copy))
1912 (const :tag "Ham: Resend Message" (ham spam-use-resend))
1913 (const :tag "Ham: ifile" (ham spam-use-ifile))
1914 (const :tag "Ham: Spam Oracle" (ham spam-use-spamoracle))
1915 (const :tag "Ham: Spam-stat" (ham spam-use-stat))
1916 (const :tag "Ham: SpamAssassin" (ham spam-use-spamassassin))
1917 (const :tag "Ham: CRM114" (ham spam-use-crm114))
1918 (const :tag "Ham: Whitelist" (ham spam-use-whitelist))
1919 (variable-item gnus-group-spam-exit-processor-ifile)
1920 (variable-item gnus-group-spam-exit-processor-stat)
1921 (variable-item gnus-group-spam-exit-processor-bogofilter)
1922 (variable-item gnus-group-spam-exit-processor-blacklist)
1923 (variable-item gnus-group-spam-exit-processor-spamoracle)
1924 (variable-item gnus-group-spam-exit-processor-report-gmane)
1925 (variable-item gnus-group-ham-exit-processor-bogofilter)
1926 (variable-item gnus-group-ham-exit-processor-ifile)
1927 (variable-item gnus-group-ham-exit-processor-stat)
1928 (variable-item gnus-group-ham-exit-processor-whitelist)
1929 (variable-item gnus-group-ham-exit-processor-BBDB)
1930 (variable-item gnus-group-ham-exit-processor-spamoracle)
1931 (variable-item gnus-group-ham-exit-processor-copy))))
1932 :function-document
1933 "Which spam or ham processors will be applied when the summary is exited."
1934 :variable gnus-spam-process-newsgroups
1935 :variable-default nil
1936 :variable-document
1937 "Groups in which to automatically process spam or ham articles with
1938 a backend on summary exit. If non-nil, this should be a list of group
1939 name regexps that should match all groups in which to do automatic
1940 spam processing, associated with the appropriate processor."
1941 :variable-group spam
1942 :variable-type
1943 '(repeat :tag "Spam/Ham Processors"
1944 (list :tag "Spam Summary Exit Processor Choices"
1945 (regexp :tag "Group Regexp")
1946 (set
1947 :tag "Spam/Ham Summary Exit Processor"
1948 (const :tag "Spam: Bogofilter" (spam spam-use-bogofilter))
1949 (const :tag "Spam: Blacklist" (spam spam-use-blacklist))
1950 (const :tag "Spam: Bsfilter" (spam spam-use-bsfilter))
1951 (const :tag "Spam: Gmane Report" (spam spam-use-gmane))
1952 (const :tag "Spam: Resend Message"(spam spam-use-resend))
1953 (const :tag "Spam: ifile" (spam spam-use-ifile))
1954 (const :tag "Spam: Spam-stat" (spam spam-use-stat))
1955 (const :tag "Spam: Spam Oracle" (spam spam-use-spamoracle))
1956 (const :tag "Spam: SpamAssassin" (spam spam-use-spamassassin))
1957 (const :tag "Spam: CRM114" (spam spam-use-crm114))
1958 (const :tag "Ham: BBDB" (ham spam-use-BBDB))
1959 (const :tag "Ham: Bogofilter" (ham spam-use-bogofilter))
1960 (const :tag "Ham: Bsfilter" (ham spam-use-bsfilter))
1961 (const :tag "Ham: Copy" (ham spam-use-ham-copy))
1962 (const :tag "Ham: Resend Message" (ham spam-use-resend))
1963 (const :tag "Ham: ifile" (ham spam-use-ifile))
1964 (const :tag "Ham: Spam-stat" (ham spam-use-stat))
1965 (const :tag "Ham: Spam Oracle" (ham spam-use-spamoracle))
1966 (const :tag "Ham: SpamAssassin" (ham spam-use-spamassassin))
1967 (const :tag "Ham: CRM114" (ham spam-use-crm114))
1968 (const :tag "Ham: Whitelist" (ham spam-use-whitelist))
1969 (variable-item gnus-group-spam-exit-processor-ifile)
1970 (variable-item gnus-group-spam-exit-processor-stat)
1971 (variable-item gnus-group-spam-exit-processor-bogofilter)
1972 (variable-item gnus-group-spam-exit-processor-blacklist)
1973 (variable-item gnus-group-spam-exit-processor-spamoracle)
1974 (variable-item gnus-group-spam-exit-processor-report-gmane)
1975 (variable-item gnus-group-ham-exit-processor-bogofilter)
1976 (variable-item gnus-group-ham-exit-processor-ifile)
1977 (variable-item gnus-group-ham-exit-processor-stat)
1978 (variable-item gnus-group-ham-exit-processor-whitelist)
1979 (variable-item gnus-group-ham-exit-processor-BBDB)
1980 (variable-item gnus-group-ham-exit-processor-spamoracle)
1981 (variable-item gnus-group-ham-exit-processor-copy))))
1983 :parameter-document
1984 "Which spam or ham processors will be applied when the summary is exited.")
1986 (gnus-define-group-parameter
1987 spam-autodetect
1988 :type list
1989 :parameter-type
1990 '(boolean :tag "Spam autodetection")
1991 :function-document
1992 "Should spam be autodetected (with spam-split) in this group?"
1993 :variable gnus-spam-autodetect
1994 :variable-default nil
1995 :variable-document
1996 "Groups in which spam should be autodetected when they are entered.
1997 Only unseen articles will be examined, unless
1998 spam-autodetect-recheck-messages is set."
1999 :variable-group spam
2000 :variable-type
2001 '(repeat
2002 :tag "Autodetection setting"
2003 (list
2004 (regexp :tag "Group Regexp")
2005 boolean))
2006 :parameter-document
2007 "Spam autodetection.
2008 Only unseen articles will be examined, unless
2009 spam-autodetect-recheck-messages is set.")
2011 (gnus-define-group-parameter
2012 spam-autodetect-methods
2013 :type list
2014 :parameter-type
2015 '(choice :tag "Spam autodetection-specific methods"
2016 (const none)
2017 (const default)
2018 (set :tag "Use specific methods"
2019 (variable-item spam-use-blacklist)
2020 (variable-item spam-use-gmane-xref)
2021 (variable-item spam-use-regex-headers)
2022 (variable-item spam-use-regex-body)
2023 (variable-item spam-use-whitelist)
2024 (variable-item spam-use-BBDB)
2025 (variable-item spam-use-ifile)
2026 (variable-item spam-use-spamoracle)
2027 (variable-item spam-use-crm114)
2028 (variable-item spam-use-spamassassin)
2029 (variable-item spam-use-spamassassin-headers)
2030 (variable-item spam-use-bsfilter)
2031 (variable-item spam-use-bsfilter-headers)
2032 (variable-item spam-use-stat)
2033 (variable-item spam-use-blackholes)
2034 (variable-item spam-use-hashcash)
2035 (variable-item spam-use-bogofilter-headers)
2036 (variable-item spam-use-bogofilter)))
2037 :function-document
2038 "Methods to be used for autodetection in each group"
2039 :variable gnus-spam-autodetect-methods
2040 :variable-default nil
2041 :variable-document
2042 "Methods for autodetecting spam per group.
2043 Requires the spam-autodetect parameter. Only unseen articles
2044 will be examined, unless spam-autodetect-recheck-messages is
2045 set."
2046 :variable-group spam
2047 :variable-type
2048 '(repeat
2049 :tag "Autodetection methods"
2050 (list
2051 (regexp :tag "Group Regexp")
2052 (choice
2053 (const none)
2054 (const default)
2055 (set :tag "Use specific methods"
2056 (variable-item spam-use-blacklist)
2057 (variable-item spam-use-gmane-xref)
2058 (variable-item spam-use-regex-headers)
2059 (variable-item spam-use-regex-body)
2060 (variable-item spam-use-whitelist)
2061 (variable-item spam-use-BBDB)
2062 (variable-item spam-use-ifile)
2063 (variable-item spam-use-spamoracle)
2064 (variable-item spam-use-crm114)
2065 (variable-item spam-use-stat)
2066 (variable-item spam-use-blackholes)
2067 (variable-item spam-use-hashcash)
2068 (variable-item spam-use-spamassassin)
2069 (variable-item spam-use-spamassassin-headers)
2070 (variable-item spam-use-bsfilter)
2071 (variable-item spam-use-bsfilter-headers)
2072 (variable-item spam-use-bogofilter-headers)
2073 (variable-item spam-use-bogofilter)))))
2074 :parameter-document
2075 "Spam autodetection methods.
2076 Requires the spam-autodetect parameter. Only unseen articles
2077 will be examined, unless spam-autodetect-recheck-messages is
2078 set.")
2080 (gnus-define-group-parameter
2081 spam-process-destination
2082 :type list
2083 :parameter-type
2084 '(choice :tag "Destination for spam-processed articles at summary exit"
2085 (string :tag "Move to a group")
2086 (repeat :tag "Move to multiple groups"
2087 (string :tag "Destination group"))
2088 (const :tag "Expire" nil))
2089 :function-document
2090 "Where spam-processed articles will go at summary exit."
2091 :variable gnus-spam-process-destinations
2092 :variable-default nil
2093 :variable-document
2094 "Groups in which to explicitly send spam-processed articles to
2095 another group, or expire them (the default). If non-nil, this should
2096 be a list of group name regexps that should match all groups in which
2097 to do spam-processed article moving, associated with the destination
2098 group or nil for explicit expiration. This only makes sense for
2099 mail groups."
2100 :variable-group spam
2101 :variable-type
2102 '(repeat
2103 :tag "Spam-processed articles destination"
2104 (list
2105 (regexp :tag "Group Regexp")
2106 (choice
2107 :tag "Destination for spam-processed articles at summary exit"
2108 (string :tag "Move to a group")
2109 (repeat :tag "Move to multiple groups"
2110 (string :tag "Destination group"))
2111 (const :tag "Expire" nil))))
2112 :parameter-document
2113 "Where spam-processed articles will go at summary exit.")
2115 (gnus-define-group-parameter
2116 ham-process-destination
2117 :type list
2118 :parameter-type
2119 '(choice
2120 :tag "Destination for ham articles at summary exit from a spam group"
2121 (string :tag "Move to a group")
2122 (repeat :tag "Move to multiple groups"
2123 (string :tag "Destination group"))
2124 (const :tag "Respool" respool)
2125 (const :tag "Do nothing" nil))
2126 :function-document
2127 "Where ham articles will go at summary exit from a spam group."
2128 :variable gnus-ham-process-destinations
2129 :variable-default nil
2130 :variable-document
2131 "Groups in which to explicitly send ham articles to
2132 another group, or do nothing (the default). If non-nil, this should
2133 be a list of group name regexps that should match all groups in which
2134 to do ham article moving, associated with the destination
2135 group or nil for explicit ignoring. This only makes sense for
2136 mail groups, and only works in spam groups."
2137 :variable-group spam
2138 :variable-type
2139 '(repeat
2140 :tag "Ham articles destination"
2141 (list
2142 (regexp :tag "Group Regexp")
2143 (choice
2144 :tag "Destination for ham articles at summary exit from spam group"
2145 (string :tag "Move to a group")
2146 (repeat :tag "Move to multiple groups"
2147 (string :tag "Destination group"))
2148 (const :tag "Respool" respool)
2149 (const :tag "Expire" nil))))
2150 :parameter-document
2151 "Where ham articles will go at summary exit from a spam group.")
2153 (gnus-define-group-parameter
2154 ham-marks
2155 :type 'list
2156 :parameter-type '(list :tag "Ham mark choices"
2157 (set
2158 (variable-item gnus-del-mark)
2159 (variable-item gnus-read-mark)
2160 (variable-item gnus-ticked-mark)
2161 (variable-item gnus-killed-mark)
2162 (variable-item gnus-kill-file-mark)
2163 (variable-item gnus-low-score-mark)))
2165 :parameter-document
2166 "Marks considered ham (positively not spam). Such articles will be
2167 processed as ham (non-spam) on group exit. When nil, the global
2168 spam-ham-marks variable takes precedence."
2169 :variable-default '((".*" ((gnus-del-mark
2170 gnus-read-mark
2171 gnus-killed-mark
2172 gnus-kill-file-mark
2173 gnus-low-score-mark))))
2174 :variable-group spam
2175 :variable-document
2176 "Groups in which to explicitly set the ham marks to some value.")
2178 (gnus-define-group-parameter
2179 spam-marks
2180 :type 'list
2181 :parameter-type '(list :tag "Spam mark choices"
2182 (set
2183 (variable-item gnus-spam-mark)
2184 (variable-item gnus-killed-mark)
2185 (variable-item gnus-kill-file-mark)
2186 (variable-item gnus-low-score-mark)))
2188 :parameter-document
2189 "Marks considered spam.
2190 Such articles will be processed as spam on group exit. When nil, the global
2191 spam-spam-marks variable takes precedence."
2192 :variable-default '((".*" ((gnus-spam-mark))))
2193 :variable-group spam
2194 :variable-document
2195 "Groups in which to explicitly set the spam marks to some value."))
2197 (defcustom gnus-group-uncollapsed-levels 1
2198 "Number of group name elements to leave alone when making a short group name."
2199 :group 'gnus-group-visual
2200 :type 'integer)
2202 (defcustom gnus-group-use-permanent-levels nil
2203 "If non-nil, once you set a level, Gnus will use this level."
2204 :group 'gnus-group-levels
2205 :type 'boolean)
2207 ;; Hooks.
2209 (defcustom gnus-load-hook nil
2210 "A hook run while Gnus is loaded."
2211 :group 'gnus-start
2212 :type 'hook)
2214 (defcustom gnus-apply-kill-hook '(gnus-apply-kill-file)
2215 "A hook called to apply kill files to a group.
2216 This hook is intended to apply a kill file to the selected newsgroup.
2217 The function `gnus-apply-kill-file' is called by default.
2219 Since a general kill file is too heavy to use only for a few
2220 newsgroups, I recommend you to use a lighter hook function. For
2221 example, if you'd like to apply a kill file to articles which contains
2222 a string `rmgroup' in subject in newsgroup `control', you can use the
2223 following hook:
2225 (setq gnus-apply-kill-hook
2226 (list
2227 (lambda ()
2228 (cond ((string-match \"control\" gnus-newsgroup-name)
2229 (gnus-kill \"Subject\" \"rmgroup\")
2230 (gnus-expunge \"X\"))))))"
2231 :group 'gnus-score-kill
2232 :options '(gnus-apply-kill-file)
2233 :type 'hook)
2235 (defcustom gnus-group-change-level-function nil
2236 "Function run when a group level is changed.
2237 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
2238 :group 'gnus-group-levels
2239 :type '(choice (const nil)
2240 function))
2242 ;;; Face thingies.
2244 (defcustom gnus-visual
2245 '(summary-highlight group-highlight article-highlight
2246 mouse-face
2247 summary-menu group-menu article-menu
2248 tree-highlight menu highlight
2249 browse-menu server-menu
2250 page-marker tree-menu binary-menu pick-menu)
2251 "Enable visual features.
2252 If `visual' is disabled, there will be no menus and few faces. Most of
2253 the visual customization options below will be ignored. Gnus will use
2254 less space and be faster as a result.
2256 This variable can also be a list of visual elements to switch on. For
2257 instance, to switch off all visual things except menus, you can say:
2259 (setq gnus-visual \\='(menu))
2261 Valid elements include `summary-highlight', `group-highlight',
2262 `article-highlight', `mouse-face', `summary-menu', `group-menu',
2263 `article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
2264 `server-menu', `page-marker', `tree-menu', `binary-menu', and`pick-menu'."
2265 :group 'gnus-meta
2266 :group 'gnus-visual
2267 :type '(set (const summary-highlight)
2268 (const group-highlight)
2269 (const article-highlight)
2270 (const mouse-face)
2271 (const summary-menu)
2272 (const group-menu)
2273 (const article-menu)
2274 (const tree-highlight)
2275 (const menu)
2276 (const highlight)
2277 (const browse-menu)
2278 (const server-menu)
2279 (const page-marker)
2280 (const tree-menu)
2281 (const binary-menu)
2282 (const pick-menu)))
2284 ;; Byte-compiler warning.
2285 (defvar gnus-visual)
2286 ;; Find out whether the gnus-visual TYPE is wanted.
2287 (defun gnus-visual-p (&optional type class)
2288 (and gnus-visual ; Has to be non-nil, at least.
2289 (if (not type) ; We don't care about type.
2290 gnus-visual
2291 (if (listp gnus-visual) ; It's a list, so we check it.
2292 (or (memq type gnus-visual)
2293 (memq class gnus-visual))
2294 t))))
2296 (defcustom gnus-mouse-face
2297 (condition-case ()
2298 (if (gnus-visual-p 'mouse-face 'highlight)
2299 (if (boundp 'gnus-mouse-face)
2300 (or gnus-mouse-face 'highlight)
2301 'highlight)
2302 'default)
2303 (error 'highlight))
2304 "Face used for group or summary buffer mouse highlighting.
2305 The line beneath the mouse pointer will be highlighted with this
2306 face."
2307 :group 'gnus-visual
2308 :type 'face)
2310 (defcustom gnus-article-save-directory gnus-directory
2311 "Name of the directory articles will be saved in (default \"~/News\")."
2312 :group 'gnus-article-saving
2313 :type 'directory)
2315 (defvar gnus-plugged t
2316 "Whether Gnus is plugged or not.")
2318 (defcustom gnus-agent-cache t
2319 "Controls use of the agent cache while plugged.
2320 When set, Gnus will prefer using the locally stored content rather
2321 than re-fetching it from the server. You also need to enable
2322 `gnus-agent' for this to have any affect."
2323 :version "22.1"
2324 :group 'gnus-agent
2325 :type 'boolean)
2327 (defcustom gnus-default-charset 'undecided
2328 "Default charset assumed to be used when viewing non-ASCII characters.
2329 This variable is overridden on a group-to-group basis by the
2330 `gnus-group-charset-alist' variable and is only used on groups not
2331 covered by that variable."
2332 :type 'symbol
2333 :group 'gnus-charset)
2335 ;; Fixme: Doc reference to agent.
2336 (defcustom gnus-agent t
2337 "Whether we want to use the Gnus agent or not.
2339 You may customize gnus-agent to disable its use. However, some
2340 back ends have started to use the agent as a client-side cache.
2341 Disabling the agent may result in noticeable loss of performance."
2342 :version "22.1"
2343 :group 'gnus-agent
2344 :type 'boolean)
2346 (defcustom gnus-other-frame-function #'gnus
2347 "Function called by the command `gnus-other-frame' when starting Gnus."
2348 :group 'gnus-start
2349 :type '(choice (function-item gnus)
2350 (function-item gnus-no-server)
2351 (function-item gnus-slave)
2352 (function-item gnus-slave-no-server)))
2354 (declare-function gnus-group-get-new-news "gnus-group")
2356 (defcustom gnus-other-frame-resume-function #'gnus-group-get-new-news
2357 "Function called by the command `gnus-other-frame' when resuming Gnus."
2358 :version "24.4"
2359 :group 'gnus-start
2360 :type '(choice (function-item gnus)
2361 (function-item gnus-group-get-new-news)
2362 (function-item gnus-no-server)
2363 (function-item gnus-slave)
2364 (function-item gnus-slave-no-server)))
2366 (defcustom gnus-other-frame-parameters nil
2367 "Frame parameters used by `gnus-other-frame' to create a Gnus frame."
2368 :group 'gnus-start
2369 :type '(repeat (cons :format "%v"
2370 (symbol :tag "Parameter")
2371 (sexp :tag "Value"))))
2373 (defcustom gnus-user-agent '(emacs gnus type)
2374 "Which information should be exposed in the User-Agent header.
2376 Can be a list of symbols or a string. Valid symbols are `gnus'
2377 \(show Gnus version) and `emacs' \(show Emacs version). In
2378 addition to the Emacs version, you can add `codename' \(show
2379 \(S)XEmacs codename) or either `config' \(show system
2380 configuration) or `type' \(show system type). If you set it to
2381 a string, be sure to use a valid format, see RFC 2616."
2383 :version "22.1"
2384 :group 'gnus-message
2385 :type '(choice (list (set :inline t
2386 (const gnus :tag "Gnus version")
2387 (const emacs :tag "Emacs version")
2388 (choice :tag "system"
2389 (const type :tag "system type")
2390 (const config :tag "system configuration"))
2391 (const codename :tag "Emacs codename")))
2392 (string)))
2394 ;; Convert old (< 2005-01-10) symbol type values:
2395 (when (symbolp gnus-user-agent)
2396 (setq gnus-user-agent
2397 (cond ((eq gnus-user-agent 'emacs-gnus-config)
2398 '(emacs gnus config))
2399 ((eq gnus-user-agent 'emacs-gnus-type)
2400 '(emacs gnus type))
2401 ((eq gnus-user-agent 'emacs-gnus)
2402 '(emacs gnus))
2403 ((eq gnus-user-agent 'gnus)
2404 '(gnus))
2405 (t gnus-user-agent)))
2406 (gnus-message 1 "Converted `gnus-user-agent' to `%s'." gnus-user-agent)
2407 (sit-for 1)
2408 (if (get 'gnus-user-agent 'saved-value)
2409 (customize-save-variable 'gnus-user-agent gnus-user-agent)
2410 (gnus-message 1 "Edit your init file to make this change permanent.")
2411 (sit-for 2)))
2414 ;;; Internal variables
2416 (defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
2417 (defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
2418 (defvar gnus-agent-method-p-cache nil
2419 ; Reset each time gnus-agent-covered-methods is changed else
2420 ; gnus-agent-method-p may mis-report a methods status.
2422 (defvar gnus-agent-target-move-group-header "X-Gnus-Agent-Move-To")
2423 (defvar gnus-draft-meta-information-header "X-Draft-From")
2424 (defvar gnus-group-get-parameter-function #'gnus-group-get-parameter)
2425 (defvar gnus-original-article-buffer " *Original Article*")
2426 (defvar gnus-newsgroup-name nil)
2427 (defvar gnus-ephemeral-servers nil)
2428 (defvar gnus-server-method-cache nil)
2429 (defvar gnus-extended-servers nil)
2431 ;; The carpal mode has been removed, but define the variable for
2432 ;; backwards compatibility.
2433 (defvar gnus-carpal nil)
2434 (make-obsolete-variable 'gnus-carpal nil "Emacs 24.1")
2436 (defvar gnus-agent-fetching nil
2437 "Whether Gnus agent is in fetching mode.")
2439 (defvar gnus-agent-covered-methods nil
2440 "A list of servers, NOT methods, showing which servers are covered by the agent.")
2442 (defvar gnus-command-method nil
2443 "Dynamically bound variable that says what the current back end is.")
2445 (defvar gnus-current-select-method nil
2446 "The current method for selecting a newsgroup.")
2448 (defvar gnus-tree-buffer "*Tree*"
2449 "Buffer where Gnus thread trees are displayed.")
2451 ;; Variable holding the user answers to all method prompts.
2452 (defvar gnus-method-history nil)
2454 ;; Variable holding the user answers to all mail method prompts.
2455 (defvar gnus-mail-method-history nil)
2457 ;; Variable holding the user answers to all group prompts.
2458 (defvar gnus-group-history nil)
2460 (defvar gnus-server-alist nil
2461 "Servers created by Gnus, or via the server buffer.
2462 Servers defined in the user's config files do not appear here.
2463 This variable is persisted in the user's .newsrc.eld file.")
2465 (defcustom gnus-cache-directory
2466 (nnheader-concat gnus-directory "cache/")
2467 "The directory where cached articles will be stored."
2468 :group 'gnus-cache
2469 :type 'directory)
2471 (defvar gnus-predefined-server-alist
2472 `(("cache"
2473 nnspool "cache"
2474 (nnspool-spool-directory ,gnus-cache-directory)
2475 (nnspool-nov-directory ,gnus-cache-directory)
2476 (nnspool-active-file
2477 ,(nnheader-concat gnus-cache-directory "active"))))
2478 "List of predefined (convenience) servers.")
2480 (defconst gnus-article-mark-lists
2481 '((marked . tick) (replied . reply)
2482 (expirable . expire) (killed . killed)
2483 (bookmarks . bookmark) (dormant . dormant)
2484 (scored . score) (saved . save)
2485 (cached . cache) (downloadable . download)
2486 (unsendable . unsend) (forwarded . forward)
2487 (seen . seen) (unexist . unexist)))
2489 (defconst gnus-article-special-mark-lists
2490 '((seen range)
2491 (unexist range)
2492 (killed range)
2493 (bookmark tuple)
2494 (uid tuple)
2495 (active tuple)
2496 (score tuple)))
2498 ;; Propagate flags to server, with the following exceptions:
2499 ;; `seen' is private to each gnus installation
2500 ;; `cache' is a internal gnus flag for each gnus installation
2501 ;; `download' is a agent flag private to each gnus installation
2502 ;; `unsend' are for nndraft groups only
2503 ;; `score' is not a proper mark
2504 ;; `bookmark': don't propagated it, or fix the bug in update-mark.
2505 (defconst gnus-article-unpropagated-mark-lists
2506 '(seen cache download unsend score bookmark unexist)
2507 "Marks that shouldn't be propagated to back ends.
2508 Typical marks are those that make no sense in a standalone back end,
2509 such as a mark that says whether an article is stored in the cache
2510 \(which doesn't make sense in a standalone back end).")
2512 (defvar gnus-headers-retrieved-by nil)
2513 (defvar gnus-article-reply nil)
2514 (defvar gnus-override-method nil)
2515 (defvar gnus-opened-servers nil)
2517 (defvar gnus-current-kill-article nil)
2519 (defvar gnus-have-read-active-file nil)
2521 (defconst gnus-maintainer
2522 "submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)"
2523 "The mail address of the Gnus maintainers.")
2525 (defconst gnus-bug-package
2526 "emacs,gnus"
2527 "The package to use in the bug submission.")
2529 (defvar gnus-info-nodes
2530 '((gnus-group-mode "(gnus)Group Buffer")
2531 (gnus-summary-mode "(gnus)Summary Buffer")
2532 (gnus-article-mode "(gnus)Article Buffer")
2533 (gnus-server-mode "(gnus)Server Buffer")
2534 (gnus-browse-mode "(gnus)Browse Foreign Server")
2535 (gnus-tree-mode "(gnus)Tree Display"))
2536 "Alist of major modes and related Info nodes.")
2538 (defvar gnus-summary-buffer "*Summary*")
2539 (defvar gnus-article-buffer "*Article*")
2540 (defvar gnus-server-buffer "*Server*")
2542 (defvar gnus-slave nil
2543 "Whether this Gnus is a slave or not.")
2545 (defvar gnus-batch-mode nil
2546 "Whether this Gnus is running in batch mode or not.")
2548 (defvar gnus-variable-list
2549 '(gnus-newsrc-options gnus-newsrc-options-n
2550 gnus-newsrc-last-checked-date
2551 gnus-newsrc-alist gnus-server-alist
2552 gnus-killed-list gnus-zombie-list
2553 gnus-topic-topology gnus-topic-alist
2554 gnus-cloud-sequence
2555 gnus-cloud-covered-servers
2556 gnus-cloud-file-timestamps)
2557 "Gnus variables saved in the quick startup file.")
2559 (defvar gnus-newsrc-alist nil
2560 "Assoc list of read articles.
2561 `gnus-newsrc-hashtb' should be kept so that both hold the same information.")
2563 (defvar gnus-registry-alist nil
2564 "Assoc list of registry data.
2565 gnus-registry.el will populate this if it's loaded.")
2567 (defvar gnus-newsrc-hashtb nil
2568 "Hashtable of `gnus-newsrc-alist'.")
2570 (defvar gnus-killed-list nil
2571 "List of killed newsgroups.")
2573 (defvar gnus-killed-hashtb nil
2574 "Hash table equivalent of `gnus-killed-list'.")
2576 (defvar gnus-zombie-list nil
2577 "List of almost dead newsgroups.")
2579 (defvar gnus-description-hashtb nil
2580 "Descriptions of newsgroups.")
2582 (defvar gnus-list-of-killed-groups nil
2583 "List of newsgroups that have recently been killed by the user.")
2585 (defvar gnus-active-hashtb nil
2586 "Hashtable of active articles.")
2588 (defvar gnus-moderated-hashtb nil
2589 "Hashtable of moderated newsgroups.")
2591 ;; Save window configuration.
2592 (defvar gnus-prev-winconf nil)
2594 (defvar gnus-reffed-article-number nil)
2596 (defvar gnus-dead-summary nil)
2598 (defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
2599 "Regexp matching invalid groups.")
2601 (defvar gnus-other-frame-object nil
2602 "A frame object which will be created by `gnus-other-frame'.")
2604 ;;; End of variables.
2606 ;; Define some autoload functions Gnus might use.
2607 (eval-and-compile
2609 ;; This little mapcar goes through the list below and marks the
2610 ;; symbols in question as autoloaded functions.
2611 (mapc
2612 (lambda (package)
2613 (let ((interactive (nth 1 (memq ':interactive package))))
2614 (mapcar
2615 (lambda (function)
2616 (let (keymap)
2617 (when (consp function)
2618 (setq keymap (car (memq 'keymap function)))
2619 (setq function (car function)))
2620 (unless (fboundp function)
2621 (autoload function (car package) nil interactive keymap))))
2622 (if (eq (nth 1 package) ':interactive)
2623 (nthcdr 3 package)
2624 (cdr package)))))
2625 '(("info" :interactive t Info-goto-node)
2626 ("qp" quoted-printable-decode-region quoted-printable-decode-string)
2627 ("ps-print" ps-print-preprint)
2628 ("message" :interactive t
2629 message-send-and-exit message-yank-original)
2630 ("babel" babel-as-string)
2631 ("nnmail" nnmail-split-fancy nnmail-article-group)
2632 ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
2633 ;; This is only used in message.el, which has an autoload.
2634 ("rmailout" rmail-output)
2635 ;; Next two used in gnus-util, which has autoloads, and contrib/sendmail.
2636 ("rmail" rmail-count-new-messages rmail-show-message
2637 ;; Next two only used in gnus-util.
2638 rmail-summary-exists rmail-select-summary)
2639 ;; Only used in gnus-util, which has an autoload.
2640 ("rmailsum" rmail-update-summary)
2641 ("gnus-xmas" gnus-xmas-splash)
2642 ("score-mode" :interactive t gnus-score-mode)
2643 ("gnus-mh" gnus-summary-save-article-folder
2644 gnus-Folder-save-name gnus-folder-save-name)
2645 ("gnus-mh" :interactive t gnus-summary-save-in-folder)
2646 ("gnus-demon" gnus-demon-add-scanmail
2647 gnus-demon-add-rescan gnus-demon-add-scan-timestamps
2648 gnus-demon-add-disconnection gnus-demon-add-handler
2649 gnus-demon-remove-handler)
2650 ("gnus-demon" :interactive t
2651 gnus-demon-init gnus-demon-cancel)
2652 ("gnus-fun" gnus-convert-gray-x-face-to-xpm gnus-display-x-face-in-from
2653 gnus-convert-image-to-gray-x-face gnus-convert-face-to-png
2654 gnus-face-from-file)
2655 ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
2656 gnus-tree-open gnus-tree-close)
2657 ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
2658 gnus-server-server-name)
2659 ("gnus-srvr" gnus-browse-foreign-server)
2660 ("gnus-cite" :interactive t
2661 gnus-article-highlight-citation gnus-article-hide-citation-maybe
2662 gnus-article-hide-citation gnus-article-fill-cited-article
2663 gnus-article-hide-citation-in-followups
2664 gnus-article-fill-cited-long-lines)
2665 ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
2666 gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
2667 gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
2668 ("gnus-registry" gnus-try-warping-via-registry
2669 gnus-registry-handle-action)
2670 ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
2671 gnus-cache-possibly-remove-articles gnus-cache-request-article
2672 gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
2673 gnus-cache-enter-remove-article gnus-cached-article-p
2674 gnus-cache-open gnus-cache-close gnus-cache-update-article
2675 gnus-cache-articles-in-group)
2676 ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
2677 gnus-cache-remove-article gnus-summary-insert-cached-articles)
2678 ("gnus-score" :interactive t
2679 gnus-summary-increase-score gnus-summary-set-score
2680 gnus-summary-raise-thread gnus-summary-raise-same-subject
2681 gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
2682 gnus-summary-lower-thread gnus-summary-lower-same-subject
2683 gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
2684 gnus-summary-current-score gnus-score-delta-default
2685 gnus-score-flush-cache gnus-score-close
2686 gnus-possibly-score-headers gnus-score-followup-article
2687 gnus-score-followup-thread)
2688 ("gnus-score"
2689 (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
2690 gnus-current-score-file-nondirectory gnus-score-adaptive
2691 gnus-score-find-trace gnus-score-file-name)
2692 ("gnus-cus" :interactive t gnus-group-customize gnus-score-customize)
2693 ("gnus-topic" :interactive t gnus-topic-mode)
2694 ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2695 gnus-subscribe-topics)
2696 ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
2697 ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
2698 ("gnus-uu" :interactive t
2699 gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2700 gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2701 gnus-uu-mark-by-regexp gnus-uu-mark-all
2702 gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2703 gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2704 gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2705 gnus-uu-decode-binhex gnus-uu-decode-uu-view
2706 gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2707 gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
2708 gnus-uu-decode-binhex-view gnus-uu-unmark-thread
2709 gnus-uu-mark-over gnus-uu-post-news gnus-uu-invert-processable)
2710 ("gnus-uu" gnus-uu-delete-work-dir gnus-uu-unmark-thread)
2711 ("gnus-msg" (gnus-summary-send-map keymap)
2712 gnus-article-mail gnus-copy-article-buffer gnus-extended-version)
2713 ("gnus-msg" :interactive t
2714 gnus-group-post-news gnus-group-mail gnus-group-news
2715 gnus-summary-post-news gnus-summary-news-other-window
2716 gnus-summary-followup gnus-summary-followup-with-original
2717 gnus-summary-cancel-article gnus-summary-supersede-article
2718 gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2719 gnus-summary-mail-forward gnus-summary-mail-other-window
2720 gnus-summary-resend-message gnus-summary-resend-bounced-mail
2721 gnus-summary-wide-reply gnus-summary-followup-to-mail
2722 gnus-summary-followup-to-mail-with-original gnus-bug
2723 gnus-summary-wide-reply-with-original
2724 gnus-summary-post-forward gnus-summary-wide-reply-with-original
2725 gnus-summary-post-forward)
2726 ("gnus-picon" :interactive t gnus-treat-from-picon)
2727 ("smiley" :interactive t smiley-region)
2728 ("gnus-win" gnus-configure-windows gnus-add-configuration)
2729 ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2730 gnus-list-of-unread-articles gnus-list-of-read-articles
2731 gnus-offer-save-summaries gnus-make-thread-indent-array
2732 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2733 gnus-summary-skip-intangible gnus-summary-article-number
2734 gnus-data-header gnus-data-find)
2735 ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2736 gnus-group-list-groups gnus-group-first-unread-group
2737 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2738 gnus-group-setup-buffer gnus-group-get-new-news
2739 gnus-group-make-help-group gnus-group-update-group
2740 gnus-group-iterate gnus-group-group-name)
2741 ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2742 gnus-backlog-remove-article)
2743 ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2744 gnus-article-prepare gnus-article-set-window-start
2745 gnus-article-next-page gnus-article-prev-page
2746 gnus-request-article-this-buffer gnus-article-mode
2747 gnus-article-setup-buffer gnus-narrow-to-page
2748 gnus-article-delete-invisible-text gnus-treat-article)
2749 ("gnus-art" :interactive t
2750 gnus-article-hide-headers gnus-article-hide-boring-headers
2751 gnus-article-treat-overstrike
2752 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2753 gnus-article-display-x-face gnus-article-de-quoted-unreadable
2754 gnus-article-de-base64-unreadable
2755 gnus-article-decode-HZ
2756 gnus-article-wash-html
2757 gnus-article-unsplit-urls
2758 gnus-article-hide-pem gnus-article-hide-signature
2759 gnus-article-strip-leading-blank-lines gnus-article-date-local
2760 gnus-article-date-original gnus-article-date-lapsed
2761 ;;gnus-article-show-all-headers
2762 gnus-article-edit-mode gnus-article-edit-article
2763 gnus-article-edit-done gnus-article-decode-encoded-words
2764 gnus-start-date-timer gnus-stop-date-timer
2765 gnus-mime-view-all-parts)
2766 ("gnus-int" gnus-request-type)
2767 ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
2768 gnus-dribble-enter gnus-read-init-file gnus-dribble-touch
2769 gnus-check-reasonable-setup)
2770 ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2771 gnus-dup-enter-articles)
2772 ("gnus-eform" gnus-edit-form)
2773 ("gnus-logic" gnus-score-advanced)
2774 ("gnus-undo" gnus-undo-mode gnus-undo-register)
2775 ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2776 gnus-async-prefetch-article gnus-async-prefetch-remove-group
2777 gnus-async-halt-prefetch)
2778 ("gnus-agent" gnus-open-agent gnus-agent-get-function
2779 gnus-agent-save-active gnus-agent-method-p
2780 gnus-agent-get-undownloaded-list gnus-agent-fetch-session
2781 gnus-summary-set-agent-mark gnus-agent-save-group-info
2782 gnus-agent-request-article gnus-agent-retrieve-headers
2783 gnus-agent-store-article gnus-agent-group-covered-p)
2784 ("gnus-agent" :interactive t
2785 gnus-unplugged gnus-agentize gnus-agent-batch)
2786 ("gnus-vm" :interactive t gnus-summary-save-in-vm
2787 gnus-summary-save-article-vm)
2788 ("compface" uncompface)
2789 ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-queue)
2790 ("gnus-mlspl" gnus-group-split gnus-group-split-fancy)
2791 ("gnus-mlspl" :interactive t gnus-group-split-setup
2792 gnus-group-split-update)
2793 ("gnus-delay" gnus-delay-initialize))))
2795 ;;; gnus-sum.el thingies
2798 (defcustom gnus-summary-line-format "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n"
2799 "The format specification of the lines in the summary buffer.
2801 It works along the same lines as a normal formatting string,
2802 with some simple extensions.
2804 %N Article number, left padded with spaces (string)
2805 %S Subject (string)
2806 %s Subject if it is at the root of a thread, and \"\"
2807 otherwise (string)
2808 %n Name of the poster (string)
2809 %a Extracted name of the poster (string)
2810 %A Extracted address of the poster (string)
2811 %F Contents of the From: header (string)
2812 %f Contents of the From: or To: headers (string)
2813 %x Contents of the Xref: header (string)
2814 %D Date of the article (string)
2815 %d Date of the article (string) in DD-MMM format
2816 %o Date of the article (string) in YYYYMMDD`T'HHMMSS
2817 format
2818 %M Message-id of the article (string)
2819 %r References of the article (string)
2820 %c Number of characters in the article (integer)
2821 %k Pretty-printed version of the above (string)
2822 For example, \"1.2k\" or \"0.4M\".
2823 %L Number of lines in the article (integer)
2824 %I Indentation based on thread level (a string of
2825 spaces)
2826 %B A complex trn-style thread tree (string)
2827 The variables `gnus-sum-thread-*' can be used for
2828 customization.
2829 %T A string with two possible values: 80 spaces if the
2830 article is on thread level two or larger and 0 spaces
2831 on level one
2832 %R \"A\" if this article has been replied to, \" \"
2833 otherwise (character)
2834 %U \"Read\" status of this article.
2835 See Info node `(gnus)Marking Articles'
2836 %[ Opening bracket (character, \"[\" or \"<\")
2837 %] Closing bracket (character, \"]\" or \">\")
2838 %> Spaces of length thread-level (string)
2839 %< Spaces of length (- 20 thread-level) (string)
2840 %i Article score (number)
2841 %z Article zcore (character)
2842 %t Number of articles under the current thread (number).
2843 %e Whether the thread is empty or not (character).
2844 %V Total thread score (number).
2845 %P The line number (number).
2846 %O Download mark (character).
2847 %* If present, indicates desired cursor position
2848 (instead of after first colon).
2849 %u User defined specifier. The next character in the
2850 format string should be a letter. Gnus will call the
2851 function gnus-user-format-function-X, where X is the
2852 letter following %u. The function will be passed the
2853 current header as argument. The function should
2854 return a string, which will be inserted into the
2855 summary just like information from any other summary
2856 specifier.
2857 &user-date; Age sensitive date format. Various date format is
2858 defined in `gnus-user-date-format-alist'.
2861 The %U (status), %R (replied) and %z (zcore) specs have to be handled
2862 with care. For reasons of efficiency, Gnus will compute what column
2863 these characters will end up in, and \"hard-code\" that. This means that
2864 it is invalid to have these specs after a variable-length spec. Well,
2865 you might not be arrested, but your summary buffer will look strange,
2866 which is bad enough.
2868 The smart choice is to have these specs as far to the left as
2869 possible.
2871 This restriction may disappear in later versions of Gnus.
2873 General format specifiers can also be used.
2874 See Info node `(gnus)Formatting Variables'."
2875 :link '(custom-manual "(gnus)Formatting Variables")
2876 :type 'string
2877 :group 'gnus-summary-format)
2880 ;;; Skeleton keymaps
2883 (defun gnus-suppress-keymap (keymap)
2884 (suppress-keymap keymap)
2885 (let ((keys `([delete] "\177" "\M-u"))) ;[mouse-2]
2886 (while keys
2887 (define-key keymap (pop keys) 'undefined))))
2889 (defvar gnus-article-mode-map
2890 (let ((keymap (make-sparse-keymap)))
2891 (gnus-suppress-keymap keymap)
2892 keymap))
2893 (defvar gnus-summary-mode-map
2894 (let ((keymap (make-keymap)))
2895 (gnus-suppress-keymap keymap)
2896 keymap))
2897 (defvar gnus-group-mode-map
2898 (let ((keymap (make-keymap)))
2899 (gnus-suppress-keymap keymap)
2900 keymap))
2904 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2905 ;; If you want the cursor to go somewhere else, set these two
2906 ;; functions in some startup hook to whatever you want.
2907 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
2908 (defalias 'gnus-group-position-point 'gnus-goto-colon)
2910 ;;; Various macros and substs.
2912 (defun gnus-header-from (header)
2913 (mail-header-from header))
2915 (defmacro gnus-gethash (string hashtable)
2916 "Get hash value of STRING in HASHTABLE."
2917 `(symbol-value (intern-soft ,string ,hashtable)))
2919 (defmacro gnus-gethash-safe (string hashtable)
2920 "Get hash value of STRING in HASHTABLE.
2921 Return nil if not defined."
2922 `(let ((sym (intern-soft ,string ,hashtable)))
2923 (and (boundp sym) (symbol-value sym))))
2925 (defmacro gnus-sethash (string value hashtable)
2926 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
2927 `(set (intern ,string ,hashtable) ,value))
2928 (put 'gnus-sethash 'edebug-form-spec '(form form form))
2930 (defmacro gnus-group-unread (group)
2931 "Get the currently computed number of unread articles in GROUP."
2932 `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
2934 (defmacro gnus-group-entry (group)
2935 "Get the newsrc entry for GROUP."
2936 `(gnus-gethash ,group gnus-newsrc-hashtb))
2938 (defmacro gnus-active (group)
2939 "Get active info on GROUP."
2940 `(gnus-gethash ,group gnus-active-hashtb))
2942 (defmacro gnus-set-active (group active)
2943 "Set GROUP's active info."
2944 `(gnus-sethash ,group ,active gnus-active-hashtb))
2946 ;; Info access macros.
2948 (defmacro gnus-info-group (info)
2949 `(nth 0 ,info))
2950 (defmacro gnus-info-rank (info)
2951 `(nth 1 ,info))
2952 (defmacro gnus-info-read (info)
2953 `(nth 2 ,info))
2954 (defmacro gnus-info-marks (info)
2955 `(nth 3 ,info))
2956 (defmacro gnus-info-method (info)
2957 `(nth 4 ,info))
2958 (defmacro gnus-info-params (info)
2959 `(nth 5 ,info))
2961 (defmacro gnus-info-level (info)
2962 `(let ((rank (gnus-info-rank ,info)))
2963 (if (consp rank)
2964 (car rank)
2965 rank)))
2966 (defmacro gnus-info-score (info)
2967 `(let ((rank (gnus-info-rank ,info)))
2968 (or (and (consp rank) (cdr rank)) 0)))
2970 (defmacro gnus-info-set-group (info group)
2971 `(setcar ,info ,group))
2972 (defmacro gnus-info-set-rank (info rank)
2973 `(setcar (nthcdr 1 ,info) ,rank))
2974 (defmacro gnus-info-set-read (info read)
2975 `(setcar (nthcdr 2 ,info) ,read))
2976 (defmacro gnus-info-set-marks (info marks &optional extend)
2977 (if extend
2978 `(gnus-info-set-entry ,info ,marks 3)
2979 `(setcar (nthcdr 3 ,info) ,marks)))
2980 (defmacro gnus-info-set-method (info method &optional extend)
2981 (if extend
2982 `(gnus-info-set-entry ,info ,method 4)
2983 `(setcar (nthcdr 4 ,info) ,method)))
2984 (defmacro gnus-info-set-params (info params &optional extend)
2985 (if extend
2986 `(gnus-info-set-entry ,info ,params 5)
2987 `(setcar (nthcdr 5 ,info) ,params)))
2989 (defun gnus-info-set-entry (info entry number)
2990 ;; Extend the info until we have enough elements.
2991 (while (<= (length info) number)
2992 (nconc info (list nil)))
2993 ;; Set the entry.
2994 (setcar (nthcdr number info) entry))
2996 (defmacro gnus-info-set-level (info level)
2997 `(let ((rank (cdr ,info)))
2998 (if (consp (car rank))
2999 (setcar (car rank) ,level)
3000 (setcar rank ,level))))
3001 (defmacro gnus-info-set-score (info score)
3002 `(let ((rank (cdr ,info)))
3003 (if (consp (car rank))
3004 (setcdr (car rank) ,score)
3005 (setcar rank (cons (car rank) ,score)))))
3007 (defmacro gnus-get-info (group)
3008 `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
3010 (defun gnus-set-info (group info)
3011 (setcar (nthcdr 2 (gnus-gethash group gnus-newsrc-hashtb))
3012 info))
3016 ;;; Shutdown
3019 (defvar gnus-shutdown-alist nil)
3021 (defun gnus-add-shutdown (function &rest symbols)
3022 "Run FUNCTION whenever one of SYMBOLS is shut down."
3023 (push (cons function symbols) gnus-shutdown-alist))
3025 (defun gnus-shutdown (symbol)
3026 "Shut down everything that waits for SYMBOL."
3027 (dolist (entry gnus-shutdown-alist)
3028 (when (memq symbol (cdr entry))
3029 (funcall (car entry)))))
3033 ;;; Gnus Utility Functions
3036 (defun gnus-find-subscribed-addresses ()
3037 "Return a regexp matching the addresses of all subscribed mail groups.
3038 It consists of the `to-address' or `to-list' parameter of all groups
3039 with a `subscribed' parameter."
3040 (let (group address addresses)
3041 (dolist (entry (cdr gnus-newsrc-alist))
3042 (setq group (car entry))
3043 (when (gnus-parameter-subscribed group)
3044 (setq address (mail-strip-quoted-names
3045 (or (gnus-group-fast-parameter group 'to-address)
3046 (gnus-group-fast-parameter group 'to-list))))
3047 (when address
3048 (cl-pushnew address addresses :test #'equal))))
3049 (when addresses
3050 (list (mapconcat #'regexp-quote addresses "\\|")))))
3052 (defmacro gnus-string-or (&rest strings)
3053 "Return the first element of STRINGS that is a non-blank string.
3054 STRINGS will be evaluated in normal `or' order."
3055 `(gnus-string-or-1 (list ,@strings)))
3057 (defun gnus-string-or-1 (strings)
3058 (let (string)
3059 (while strings
3060 (setq string (pop strings))
3061 (if (string-match "^[ \t]*$" string)
3062 (setq string nil)
3063 (setq strings nil)))
3064 string))
3066 (defun gnus-version (&optional arg)
3067 "Version number of this version of Gnus.
3068 If ARG, insert string at point."
3069 (interactive "P")
3070 (if arg
3071 (insert (message gnus-version))
3072 (message gnus-version)))
3074 (defun gnus-continuum-version (&optional version)
3075 "Return VERSION as a floating point number."
3076 (unless version
3077 (setq version gnus-version))
3078 (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
3079 (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
3080 (let ((alpha (and (match-beginning 1) (match-string 1 version)))
3081 (number (match-string 2 version))
3082 major minor least)
3083 (unless (string-match
3084 "\\([0-9]\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?" number)
3085 (error "Invalid version string: %s" version))
3086 (setq major (string-to-number (match-string 1 number))
3087 minor (string-to-number (match-string 2 number))
3088 least (if (match-beginning 3)
3089 (string-to-number (match-string 3 number))
3091 (string-to-number
3092 (if (zerop major)
3093 (format "%1.2f00%02d%02d"
3094 (if (member alpha '("(ding)" "d"))
3095 4.99
3096 (+ 5 (* 0.02
3097 (abs
3098 (- (aref (downcase alpha) 0) ?t)))
3099 -0.01))
3100 minor least)
3101 (format "%d.%02d%02d" major minor least))))))
3103 (defvar gnus-info-buffer)
3105 (defun gnus-info-find-node (&optional nodename)
3106 "Find Info documentation of Gnus."
3107 (interactive)
3108 ;; Enlarge info window if needed.
3109 (let (gnus-info-buffer)
3110 (Info-goto-node (or nodename (cadr (assq major-mode gnus-info-nodes))))
3111 (setq gnus-info-buffer (current-buffer))
3112 (gnus-configure-windows 'info)))
3115 ;;; gnus-interactive
3118 (defvar gnus-current-prefix-symbol nil
3119 "Current prefix symbol.")
3121 (defvar gnus-current-prefix-symbols nil
3122 "List of current prefix symbols.")
3124 (defun gnus-interactive (string)
3125 "Return a list that can be fed to `interactive'.
3126 See `interactive' for full documentation.
3128 Adds the following specs:
3130 y -- The current symbolic prefix.
3131 Y -- A list of the current symbolic prefix(es).
3132 A -- Article number.
3133 H -- Article header.
3134 g -- Group name."
3135 (let ((i 0)
3136 out c prompt)
3137 (while (< i (length string))
3138 (string-match ".\\([^\n]*\\)\n?" string i)
3139 (setq c (aref string i))
3140 (when (match-end 1)
3141 (setq prompt (match-string 1 string)))
3142 (setq i (match-end 0))
3143 ;; We basically emulate just about everything that
3144 ;; `interactive' does, but add the specs listed above.
3145 (push
3146 (cond
3147 ((= c ?a)
3148 (completing-read prompt obarray 'fboundp t))
3149 ((= c ?b)
3150 (read-buffer prompt (current-buffer) t))
3151 ((= c ?B)
3152 (read-buffer prompt (other-buffer (current-buffer))))
3153 ((= c ?c)
3154 (read-char))
3155 ((= c ?C)
3156 (completing-read prompt obarray 'commandp t))
3157 ((= c ?d)
3158 (point))
3159 ((= c ?D)
3160 (read-directory-name prompt nil default-directory 'lambda))
3161 ((= c ?f)
3162 (read-file-name prompt nil nil 'lambda))
3163 ((= c ?F)
3164 (read-file-name prompt))
3165 ((= c ?k)
3166 (read-key-sequence prompt))
3167 ((= c ?K)
3168 (error "Not implemented spec"))
3169 ((= c ?e)
3170 (error "Not implemented spec"))
3171 ((= c ?m)
3172 (mark))
3173 ((= c ?N)
3174 (error "Not implemented spec"))
3175 ((= c ?n)
3176 (string-to-number (read-from-minibuffer prompt)))
3177 ((= c ?p)
3178 (prefix-numeric-value current-prefix-arg))
3179 ((= c ?P)
3180 current-prefix-arg)
3181 ((= c ?r)
3182 'gnus-prefix-nil)
3183 ((= c ?s)
3184 (read-string prompt))
3185 ((= c ?S)
3186 (intern (read-string prompt)))
3187 ((= c ?v)
3188 (read-variable prompt))
3189 ((= c ?x)
3190 (read-minibuffer prompt))
3191 ((= c ?x)
3192 (eval-minibuffer prompt))
3193 ;; And here the new specs come.
3194 ((= c ?y)
3195 gnus-current-prefix-symbol)
3196 ((= c ?Y)
3197 gnus-current-prefix-symbols)
3198 ((= c ?g)
3199 (gnus-group-group-name))
3200 ((= c ?A)
3201 (gnus-summary-skip-intangible)
3202 (or (get-text-property (point) 'gnus-number)
3203 (gnus-summary-last-subject)))
3204 ((= c ?H)
3205 (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
3207 (error "Non-implemented spec")))
3208 out)
3209 (cond
3210 ((= c ?r)
3211 (push (if (< (point) (mark)) (point) (mark)) out)
3212 (push (if (> (point) (mark)) (point) (mark)) out))))
3213 (setq out (delq 'gnus-prefix-nil out))
3214 (nreverse out)))
3216 (defun gnus-symbolic-argument ()
3217 "Read a symbolic argument and a command, and then execute command."
3218 (interactive)
3219 (let* ((in-command (this-command-keys))
3220 (command in-command)
3221 gnus-current-prefix-symbols
3222 gnus-current-prefix-symbol
3223 syms)
3224 (while (equal in-command command)
3225 (message "%s-" (key-description (this-command-keys)))
3226 (push (intern (char-to-string (read-char))) syms)
3227 (setq command (read-key-sequence nil t)))
3228 (setq gnus-current-prefix-symbols (nreverse syms)
3229 gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
3230 (call-interactively (key-binding command t))))
3232 ;;; More various functions.
3234 (defsubst gnus-check-backend-function (func group)
3235 "Check whether GROUP supports function FUNC.
3236 GROUP can either be a string (a group name) or a select method."
3237 (ignore-errors
3238 (let ((method (if (stringp group)
3239 (car (gnus-find-method-for-group group))
3240 group)))
3241 (unless (featurep method)
3242 (require method))
3243 (fboundp (intern (format "%s-%s" method func))))))
3245 (defun gnus-group-read-only-p (&optional group)
3246 "Check whether GROUP supports editing or not.
3247 If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
3248 that that variable is buffer-local to the summary buffers."
3249 (let ((group (or group gnus-newsgroup-name)))
3250 (not (gnus-check-backend-function 'request-replace-article group))))
3252 (defun gnus-virtual-group-p (group)
3253 "Say whether GROUP is virtual or not."
3254 (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
3255 gnus-valid-select-methods)))
3257 (defun gnus-news-group-p (group &optional article)
3258 "Return non-nil if GROUP (and ARTICLE) come from a news server."
3259 (cond ((gnus-member-of-valid 'post group) ;Ordinary news group
3260 t) ;is news of course.
3261 ((not (gnus-member-of-valid 'post-mail group)) ;Non-combined.
3262 nil) ;must be mail then.
3263 ((vectorp article) ;Has header info.
3264 (eq (gnus-request-type group (mail-header-id article)) 'news))
3265 ((null article) ;Hasn't header info
3266 (eq (gnus-request-type group) 'news)) ;(unknown ==> mail)
3267 ((< article 0) ;Virtual message
3268 nil) ;we don't know, guess mail.
3269 (t ;Has positive number
3270 (eq (gnus-request-type group article) 'news)))) ;use it.
3272 ;; Check whether to use long file names.
3273 (defun gnus-use-long-file-name (symbol)
3274 ;; The variable has to be set...
3275 (and gnus-use-long-file-name
3276 ;; If it isn't a list, then we return t.
3277 (or (not (listp gnus-use-long-file-name))
3278 ;; If it is a list, and the list contains `symbol', we
3279 ;; return nil.
3280 (not (memq symbol gnus-use-long-file-name)))))
3282 ;; Generate a unique new group name.
3283 (defun gnus-generate-new-group-name (leaf)
3284 (let ((name leaf)
3285 (num 0))
3286 (while (gnus-group-entry name)
3287 (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
3288 name))
3290 (defun gnus-ephemeral-group-p (group)
3291 "Say whether GROUP is ephemeral or not."
3292 (gnus-group-get-parameter group 'quit-config t))
3294 (defun gnus-group-quit-config (group)
3295 "Return the quit-config of GROUP."
3296 (gnus-group-get-parameter group 'quit-config t))
3298 (defun gnus-kill-ephemeral-group (group)
3299 "Remove ephemeral GROUP from relevant structures."
3300 (gnus-sethash group nil gnus-newsrc-hashtb))
3302 (defun gnus-simplify-mode-line ()
3303 "Make mode lines a bit simpler."
3304 (setq mode-line-modified "--")
3305 (when (listp mode-line-format)
3306 (make-local-variable 'mode-line-format)
3307 (setq mode-line-format (copy-sequence mode-line-format))
3308 (when (equal (nth 3 mode-line-format) " ")
3309 (setcar (nthcdr 3 mode-line-format) " "))))
3311 ;;; Servers and groups.
3313 (defsubst gnus-server-add-address (method)
3314 (let ((method-name (symbol-name (car method))))
3315 (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
3316 (not (assq (intern (concat method-name "-address")) method))
3317 (memq 'physical-address (assq (car method)
3318 gnus-valid-select-methods)))
3319 (append method (list (list (intern (concat method-name "-address"))
3320 (nth 1 method))))
3321 method)))
3323 (defsubst gnus-method-to-server (method &optional nocache no-enter-cache)
3324 (catch 'server-name
3325 (setq method (or method gnus-select-method))
3327 ;; Perhaps it is already in the cache.
3328 (unless nocache
3329 (mapc (lambda (name-method)
3330 (if (equal (cdr name-method) method)
3331 (throw 'server-name (car name-method))))
3332 gnus-server-method-cache))
3334 (dolist (server-alist
3335 (list gnus-server-alist
3336 gnus-predefined-server-alist))
3337 (mapc (lambda (name-method)
3338 (when (gnus-methods-equal-p (cdr name-method) method)
3339 (unless (member name-method gnus-server-method-cache)
3340 (push name-method gnus-server-method-cache))
3341 (throw 'server-name (car name-method))))
3342 server-alist))
3344 (let* ((name (if (member (cadr method) '(nil ""))
3345 (format "%s" (car method))
3346 (format "%s:%s" (car method) (cadr method))))
3347 (name-method (cons name method)))
3348 (when (and (not (member name-method gnus-server-method-cache))
3349 (not no-enter-cache)
3350 (not (assoc (car name-method) gnus-server-method-cache)))
3351 (push name-method gnus-server-method-cache))
3352 name)))
3354 (defsubst gnus-server-to-method (server)
3355 "Map virtual server names to select methods."
3356 (or (and server (listp server) server)
3357 (cdr (assoc server gnus-server-method-cache))
3358 (let ((result
3360 ;; Perhaps this is the native server?
3361 (and (equal server "native") gnus-select-method)
3362 ;; It should be in the server alist.
3363 (cdr (assoc server gnus-server-alist))
3364 ;; It could be in the predefined server alist.
3365 (cdr (assoc server gnus-predefined-server-alist))
3366 ;; If not, we look through all the opened server
3367 ;; to see whether we can find it there.
3368 (let ((opened gnus-opened-servers))
3369 (while (and opened
3370 (not (equal server (format "%s:%s" (caaar opened)
3371 (cadaar opened)))))
3372 (pop opened))
3373 (caar opened))
3374 ;; It could be a named method, search all servers
3375 (let ((servers gnus-secondary-select-methods))
3376 (while (and servers
3377 (not (equal server (format "%s:%s" (caar servers)
3378 (cadar servers)))))
3379 (pop servers))
3380 (car servers))
3381 ;; This could be some sort of foreign server that I
3382 ;; simply haven't opened (yet). Do a brute-force scan
3383 ;; of the entire gnus-newsrc-alist for the server name
3384 ;; of every method. As a side-effect, loads the
3385 ;; gnus-server-method-cache so this only happens once,
3386 ;; if at all.
3387 (let ((alist (cdr gnus-newsrc-alist))
3388 method match)
3389 (while alist
3390 (setq method (gnus-info-method (pop alist)))
3391 (when (and (not (stringp method))
3392 (equal server
3393 (gnus-method-to-server method nil t)))
3394 (setq match method
3395 alist nil)))
3396 match))))
3397 (when (and result
3398 (not (assoc server gnus-server-method-cache)))
3399 (push (cons server result) gnus-server-method-cache))
3400 result)))
3402 (defsubst gnus-server-get-method (group method)
3403 ;; Input either a server name, and extended server name, or a
3404 ;; select method, and return a select method.
3405 (cond ((stringp method)
3406 (gnus-server-to-method method))
3407 ((equal method gnus-select-method)
3408 gnus-select-method)
3409 ((and (stringp (car method))
3410 group)
3411 (gnus-server-extend-method group method))
3412 ((and method
3413 (not group)
3414 (equal (cadr method) ""))
3415 method)
3417 (gnus-server-add-address method))))
3419 (defmacro gnus-method-equal (ss1 ss2)
3420 "Say whether two servers are equal."
3421 `(let ((s1 ,ss1)
3422 (s2 ,ss2))
3423 (or (equal s1 s2)
3424 (and (= (length s1) (length s2))
3425 (progn
3426 (while (and s1 (member (car s1) s2))
3427 (setq s1 (cdr s1)))
3428 (null s1))))))
3430 (defun gnus-methods-equal-p (m1 m2)
3431 (let ((m1 (or m1 gnus-select-method))
3432 (m2 (or m2 gnus-select-method)))
3433 (or (equal m1 m2)
3434 (and (eq (car m1) (car m2))
3435 (or (not (memq 'address (assoc (symbol-name (car m1))
3436 gnus-valid-select-methods)))
3437 (equal (nth 1 m1) (nth 1 m2)))))))
3439 (defsubst gnus-sloppily-equal-method-parameters (m1 m2)
3440 ;; Check parameters for sloppy equality.
3441 (let ((p1 (copy-sequence (cddr m1)))
3442 (p2 (copy-sequence (cddr m2)))
3443 e1 e2)
3444 (cl-block nil
3445 (while (setq e1 (pop p1))
3446 (unless (setq e2 (assq (car e1) p2))
3447 ;; The parameter doesn't exist in p2.
3448 (cl-return nil))
3449 (setq p2 (delq e2 p2))
3450 (unless (equal e1 e2)
3451 (if (not (and (stringp (cadr e1))
3452 (stringp (cadr e2))))
3453 (cl-return nil)
3454 ;; Special-case string parameter comparison so that we
3455 ;; can uniquify them.
3456 (let ((s1 (cadr e1))
3457 (s2 (cadr e2)))
3458 (when (string-match "/\\'" s1)
3459 (setq s1 (directory-file-name s1)))
3460 (when (string-match "/\\'" s2)
3461 (setq s2 (directory-file-name s2)))
3462 (unless (equal s1 s2)
3463 (cl-return nil))))))
3464 ;; If p2 now is empty, they were equal.
3465 (null p2))))
3467 (defun gnus-method-ephemeral-p (method)
3468 (let ((equal nil))
3469 (dolist (ephemeral gnus-ephemeral-servers)
3470 (when (gnus-sloppily-equal-method-parameters method ephemeral)
3471 (setq equal t)))
3472 equal))
3474 (defun gnus-methods-sloppily-equal (m1 m2)
3475 ;; Same method.
3477 (eq m1 m2)
3478 ;; Type and name are equal.
3479 (and
3480 (eq (car m1) (car m2))
3481 (equal (cadr m1) (cadr m2))
3482 (gnus-sloppily-equal-method-parameters m1 m2))))
3484 (defun gnus-server-equal (m1 m2)
3485 "Say whether two methods are equal."
3486 (let ((m1 (cond ((null m1) gnus-select-method)
3487 ((stringp m1) (gnus-server-to-method m1))
3488 (t m1)))
3489 (m2 (cond ((null m2) gnus-select-method)
3490 ((stringp m2) (gnus-server-to-method m2))
3491 (t m2))))
3492 (gnus-method-equal m1 m2)))
3494 (defun gnus-servers-using-backend (backend)
3495 "Return a list of known servers using BACKEND."
3496 (let ((opened gnus-opened-servers)
3497 out)
3498 (while opened
3499 (when (eq backend (caaar opened))
3500 (push (caar opened) out))
3501 (pop opened))
3502 out))
3504 (defun gnus-archive-server-wanted-p ()
3505 "Say whether the user wants to use the archive server."
3506 (cond
3507 ((or (not gnus-message-archive-method)
3508 (not gnus-message-archive-group))
3509 nil)
3510 ((and gnus-message-archive-method gnus-message-archive-group)
3513 (let ((active (cadr (assq 'nnfolder-active-file
3514 gnus-message-archive-method))))
3515 (and active
3516 (file-exists-p active))))))
3518 (defsubst gnus-method-to-server-name (method)
3519 (concat
3520 (format "%s" (car method))
3521 (when (and
3522 (or (assoc (format "%s" (car method))
3523 (gnus-methods-using 'address))
3524 (gnus-server-equal method gnus-message-archive-method))
3525 (nth 1 method)
3526 (not (string= (nth 1 method) "")))
3527 (concat "+" (nth 1 method)))))
3529 (defsubst gnus-method-to-full-server-name (method)
3530 (format "%s+%s" (car method) (nth 1 method)))
3532 (defun gnus-group-prefixed-name (group method &optional full)
3533 "Return the whole name from GROUP and METHOD.
3534 Call with full set to get the fully qualified group name (even if the
3535 server is native)."
3536 (when (stringp method)
3537 (setq method (gnus-server-to-method method)))
3538 (if (or (not method)
3539 (and (not full) (gnus-server-equal method "native"))
3540 ;;;!!! This might not be right. We'll see...
3541 ;(string-match ":" group)
3543 group
3544 (concat (gnus-method-to-server-name method) ":" group)))
3546 (defun gnus-group-full-name (group method)
3547 "Return the full name from GROUP and METHOD, even if the method is native."
3548 (gnus-group-prefixed-name group method t))
3550 (defun gnus-group-guess-full-name-from-command-method (group)
3551 "Guess the full name from GROUP, even if the method is native."
3552 (if (gnus-group-prefixed-p group)
3553 group
3554 (gnus-group-full-name group gnus-command-method)))
3556 (defun gnus-group-real-prefix (group)
3557 "Return the prefix of the current group name."
3558 (if (stringp group)
3559 (if (string-match "^[^:]+:" group)
3560 (substring group 0 (match-end 0))
3562 nil))
3564 (defun gnus-group-short-name (group)
3565 "Return the short group name."
3566 (let ((prefix (gnus-group-real-prefix group)))
3567 (if (< 0 (length prefix))
3568 (substring group (length prefix) nil)
3569 group)))
3571 (defun gnus-group-prefixed-p (group)
3572 "Return the prefix of the current group name."
3573 (< 0 (length (gnus-group-real-prefix group))))
3575 (declare-function gnus-group-decoded-name "gnus-group" (string))
3577 (defun gnus-summary-buffer-name (group)
3578 "Return the summary buffer name of GROUP."
3579 (concat "*Summary " (gnus-group-decoded-name group) "*"))
3581 (defun gnus-group-method (group)
3582 "Return the server or method used for selecting GROUP.
3583 You should probably use `gnus-find-method-for-group' instead."
3584 (let ((prefix (gnus-group-real-prefix group)))
3585 (if (equal prefix "")
3586 gnus-select-method
3587 (let ((servers gnus-opened-servers)
3588 (server "")
3589 backend possible found)
3590 (if (string-match "^[^\\+]+\\+" prefix)
3591 (setq backend (intern (substring prefix 0 (1- (match-end 0))))
3592 server (substring prefix (match-end 0) (1- (length prefix))))
3593 (setq backend (intern (substring prefix 0 (1- (length prefix))))))
3594 (while servers
3595 (when (eq (caaar servers) backend)
3596 (setq possible (caar servers))
3597 (when (equal (cadaar servers) server)
3598 (setq found (caar servers))))
3599 (pop servers))
3600 (or (car (rassoc found gnus-server-alist))
3601 found
3602 (car (rassoc possible gnus-server-alist))
3603 possible
3604 (list backend server))))))
3606 (defsubst gnus-native-method-p (method)
3607 "Return whether METHOD is the native select method."
3608 (gnus-method-equal method gnus-select-method))
3610 (defsubst gnus-secondary-method-p (method)
3611 "Return whether METHOD is a secondary select method."
3612 (let ((methods gnus-secondary-select-methods)
3613 (gmethod (inline (gnus-server-get-method nil method))))
3614 (while (and methods
3615 (not (gnus-method-equal
3616 (inline (gnus-server-get-method nil (car methods)))
3617 gmethod)))
3618 (setq methods (cdr methods)))
3619 methods))
3621 (defun gnus-method-simplify (method)
3622 "Return the shortest uniquely identifying string or method for METHOD."
3623 (cond ((stringp method)
3624 method)
3625 ((gnus-native-method-p method)
3626 nil)
3627 ((gnus-secondary-method-p method)
3628 (format "%s:%s" (nth 0 method) (nth 1 method)))
3630 method)))
3632 (defun gnus-groups-from-server (server)
3633 "Return a list of all groups that are fetched from SERVER."
3634 (let ((alist (cdr gnus-newsrc-alist))
3635 info groups)
3636 (while (setq info (pop alist))
3637 (when (gnus-server-equal (gnus-info-method info) server)
3638 (push (gnus-info-group info) groups)))
3639 (sort groups 'string<)))
3641 (defun gnus-group-foreign-p (group)
3642 "Say whether a group is foreign or not."
3643 (and (not (gnus-group-native-p group))
3644 (not (gnus-group-secondary-p group))))
3646 (defun gnus-group-native-p (group)
3647 "Say whether the group is native or not."
3648 (not (string-match ":" group)))
3650 (defun gnus-group-secondary-p (group)
3651 "Say whether the group is secondary or not."
3652 (gnus-secondary-method-p (gnus-find-method-for-group group)))
3654 (defun gnus-parameters-get-parameter (group)
3655 "Return the group parameters for GROUP from `gnus-parameters'."
3656 (let ((case-fold-search (if (eq gnus-parameters-case-fold-search 'default)
3657 case-fold-search
3658 gnus-parameters-case-fold-search))
3659 params-list)
3660 (dolist (elem gnus-parameters)
3661 (when (string-match (car elem) group)
3662 (setq params-list
3663 (nconc (gnus-expand-group-parameters
3664 (car elem) (cdr elem) group)
3665 params-list))))
3666 params-list))
3668 (defun gnus-expand-group-parameter (match value group)
3669 "Use MATCH to expand VALUE in GROUP."
3670 (let ((start (string-match match group)))
3671 (if start
3672 (let ((matched-string (substring group start (match-end 0))))
3673 ;; Build match groups
3674 (string-match match matched-string)
3675 (replace-match value nil nil matched-string))
3676 group)))
3678 (defun gnus-expand-group-parameters (match parameters group)
3679 "Go through PARAMETERS and expand them according to the match data."
3680 (let (new)
3681 (dolist (elem parameters)
3682 (cond
3683 ((and (stringp (cdr elem))
3684 (string-match "\\\\[0-9&]" (cdr elem)))
3685 (push (cons (car elem)
3686 (gnus-expand-group-parameter match (cdr elem) group))
3687 new))
3688 ;; For `sieve' group parameters, perform substitutions for every
3689 ;; string within the match rule. This allows for parameters such
3690 ;; as:
3691 ;; ("list\\.\\(.*\\)"
3692 ;; (sieve header :is "list-id" "<\\1.domain.org>"))
3693 ((eq 'sieve (car elem))
3694 (push (mapcar (lambda (sieve-elem)
3695 (if (and (stringp sieve-elem)
3696 (string-match "\\\\[0-9&]" sieve-elem))
3697 (gnus-expand-group-parameter match sieve-elem
3698 group)
3699 sieve-elem))
3700 (cdr elem))
3701 new))
3703 (push elem new))))
3704 new))
3706 (defun gnus-group-fast-parameter (group symbol &optional allow-list)
3707 "For GROUP, return the value of SYMBOL.
3709 You should call this in the `gnus-group-buffer' buffer.
3710 The function `gnus-group-find-parameter' will do that for you."
3711 ;; The speed trick: No cons'ing and quit early.
3712 (let* ((params (funcall gnus-group-get-parameter-function group))
3713 ;; Start easy, check the "real" group parameters.
3714 (simple-results
3715 (gnus-group-parameter-value params symbol allow-list t)))
3716 (if simple-results
3717 ;; Found results; return them.
3718 (car simple-results)
3719 ;; We didn't find it there, try `gnus-parameters'.
3720 (let ((result nil)
3721 (head nil)
3722 (tail gnus-parameters))
3723 ;; A good old-fashioned non-cl loop.
3724 (while tail
3725 (setq head (car tail)
3726 tail (cdr tail))
3727 ;; The car is regexp matching for matching the group name.
3728 (when (string-match (car head) group)
3729 ;; The cdr is the parameters.
3730 (let ((this-result
3731 (gnus-group-parameter-value (cdr head) symbol allow-list t)))
3732 (when this-result
3733 (setq result (car this-result))
3734 ;; Expand if necessary.
3735 (cond
3736 ((and (stringp result) (string-match "\\\\[0-9&]" result))
3737 (setq result (gnus-expand-group-parameter
3738 (car head) result group)))
3739 ;; For `sieve' group parameters, perform substitutions
3740 ;; for every string within the match rule (see above).
3741 ((eq symbol 'sieve)
3742 (setq result
3743 (mapcar (lambda (elem)
3744 (if (stringp elem)
3745 (gnus-expand-group-parameter (car head)
3746 elem group)
3747 elem))
3748 result))))))))
3749 ;; Done.
3750 result))))
3752 (defun gnus-group-find-parameter (group &optional symbol allow-list)
3753 "Return the group parameters for GROUP.
3754 If SYMBOL, return the value of that symbol in the group parameters.
3756 If you call this function inside a loop, consider using the faster
3757 `gnus-group-fast-parameter' instead."
3758 (with-current-buffer (if (buffer-live-p (get-buffer gnus-group-buffer))
3759 gnus-group-buffer
3760 (current-buffer))
3761 (if symbol
3762 (gnus-group-fast-parameter group symbol allow-list)
3763 (nconc
3764 (copy-sequence
3765 (funcall gnus-group-get-parameter-function group))
3766 (gnus-parameters-get-parameter group)))))
3768 (defun gnus-group-get-parameter (group &optional symbol allow-list)
3769 "Return the group parameters for GROUP.
3770 If SYMBOL, return the value of that symbol in the group parameters.
3771 If ALLOW-LIST, also allow list as a result.
3772 Most functions should use `gnus-group-find-parameter', which
3773 also examines the topic parameters."
3774 (let ((params (gnus-info-params (gnus-get-info group))))
3775 (if symbol
3776 (gnus-group-parameter-value params symbol allow-list)
3777 params)))
3779 (defun gnus-group-parameter-value (params symbol &optional
3780 allow-list present-p)
3781 "Return the value of SYMBOL in group PARAMS.
3782 If ALLOW-LIST, also allow list as a result."
3783 ;; We only wish to return group parameters (dotted lists) and
3784 ;; not local variables, which may have the same names.
3785 ;; But first we handle single elements...
3786 (or (car (memq symbol params))
3787 ;; Handle alist.
3788 (let (elem)
3789 (catch 'found
3790 (while (setq elem (pop params))
3791 (when (and (consp elem)
3792 (eq (car elem) symbol)
3793 (or allow-list
3794 (atom (cdr elem))))
3795 (throw 'found (if present-p (list (cdr elem))
3796 (cdr elem)))))))))
3798 (defun gnus-group-add-parameter (group param)
3799 "Add parameter PARAM to GROUP."
3800 (let ((info (gnus-get-info group)))
3801 (when info
3802 (gnus-group-remove-parameter group (if (consp param) (car param) param))
3803 ;; Cons the new param to the old one and update.
3804 (gnus-group-set-info (cons param (gnus-info-params info))
3805 group 'params))))
3807 (defun gnus-group-set-parameter (group name value)
3808 "Set parameter NAME to VALUE in GROUP.
3809 GROUP can also be an INFO structure."
3810 (let ((info (if (listp group)
3811 group
3812 (gnus-get-info group))))
3813 (when info
3814 (gnus-group-remove-parameter group name)
3815 (let ((old-params (gnus-info-params info))
3816 (new-params (list (cons name value))))
3817 (while old-params
3818 (when (or (not (listp (car old-params)))
3819 (not (eq (caar old-params) name)))
3820 (setq new-params (append new-params (list (car old-params)))))
3821 (setq old-params (cdr old-params)))
3822 (if (listp group)
3823 (gnus-info-set-params info new-params t)
3824 (gnus-group-set-info new-params (gnus-info-group info) 'params))))))
3826 (defun gnus-group-remove-parameter (group name)
3827 "Remove parameter NAME from GROUP.
3828 GROUP can also be an INFO structure."
3829 (let ((info (if (listp group)
3830 group
3831 (gnus-get-info group))))
3832 (when info
3833 (let ((params (gnus-info-params info)))
3834 (when params
3835 (setq params (delq name params))
3836 (while (assq name params)
3837 (gnus-alist-pull name params))
3838 (gnus-info-set-params info params))))))
3840 (defun gnus-group-add-score (group &optional score)
3841 "Add SCORE to the GROUP score.
3842 If SCORE is nil, add 1 to the score of GROUP."
3843 (let ((info (gnus-get-info group)))
3844 (when info
3845 (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
3847 (defun gnus-short-group-name (group &optional levels)
3848 "Collapse GROUP name LEVELS.
3849 Select methods are stripped and any remote host name is stripped down to
3850 just the host name."
3851 (let* ((foreign "")
3852 (depth 0)
3853 (skip 1)
3854 (levels (or levels
3855 gnus-group-uncollapsed-levels
3856 (progn
3857 (while (string-match "\\." group skip)
3858 (setq skip (match-end 0)
3859 depth (+ depth 1)))
3860 depth))))
3861 ;; Separate foreign select method from group name and collapse.
3862 ;; If method contains a server, collapse to non-domain server name,
3863 ;; otherwise collapse to select method.
3864 (let* ((colon (string-match ":" group))
3865 (server (and colon (substring group 0 colon)))
3866 (plus (and server (string-match "+" server))))
3867 (when server
3868 (if plus
3869 (setq foreign (substring server (+ 1 plus)
3870 (string-match "\\." server))
3871 group (substring group (+ 1 colon)))
3872 (setq foreign server
3873 group (substring group (+ 1 colon))))
3874 (setq foreign (concat foreign ":")))
3875 ;; Collapse group name leaving LEVELS uncollapsed elements
3876 (let* ((slist (split-string group "/"))
3877 (slen (length slist))
3878 (dlist (split-string group "\\."))
3879 (dlen (length dlist))
3880 glist
3881 glen
3882 gsep
3883 res)
3884 (if (> slen dlen)
3885 (setq glist slist
3886 glen slen
3887 gsep "/")
3888 (setq glist dlist
3889 glen dlen
3890 gsep "."))
3891 (setq levels (- glen levels))
3892 (dolist (g glist)
3893 (push (if (>= (cl-decf levels) 0)
3894 (if (zerop (length g))
3896 (substring g 0 1))
3898 res))
3899 (concat foreign (mapconcat #'identity (nreverse res) gsep))))))
3901 (defun gnus-narrow-to-body ()
3902 "Narrow to the body of an article."
3903 (narrow-to-region
3904 (progn
3905 (goto-char (point-min))
3906 (or (search-forward "\n\n" nil t)
3907 (point-max)))
3908 (point-max)))
3912 ;;; Kill file handling.
3915 (defun gnus-apply-kill-file ()
3916 "Apply a kill file to the current newsgroup.
3917 Returns the number of articles marked as read."
3918 (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
3919 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3920 (gnus-apply-kill-file-internal)
3923 (defun gnus-kill-save-kill-buffer ()
3924 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3925 (when (get-file-buffer file)
3926 (with-current-buffer (get-file-buffer file)
3927 (when (buffer-modified-p)
3928 (save-buffer))
3929 (kill-buffer (current-buffer))))))
3931 (defcustom gnus-kill-file-name "KILL"
3932 "Suffix of the kill files."
3933 :group 'gnus-score-kill
3934 :group 'gnus-score-files
3935 :type 'string)
3937 (defun gnus-newsgroup-kill-file (newsgroup)
3938 "Return the name of a kill file name for NEWSGROUP.
3939 If NEWSGROUP is nil, return the global kill file name instead."
3940 (cond
3941 ;; The global KILL file is placed at top of the directory.
3942 ((or (null newsgroup)
3943 (string-equal newsgroup ""))
3944 (expand-file-name gnus-kill-file-name
3945 gnus-kill-files-directory))
3946 ;; Append ".KILL" to newsgroup name.
3947 ((gnus-use-long-file-name 'not-kill)
3948 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
3949 "." gnus-kill-file-name)
3950 gnus-kill-files-directory))
3951 ;; Place "KILL" under the hierarchical directory.
3953 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
3954 "/" gnus-kill-file-name)
3955 gnus-kill-files-directory))))
3957 ;;; Server things.
3959 (defun gnus-member-of-valid (symbol group)
3960 "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
3961 (memq symbol (assoc
3962 (symbol-name (car (gnus-find-method-for-group group)))
3963 gnus-valid-select-methods)))
3965 (defun gnus-method-option-p (method option)
3966 "Return non-nil if select METHOD has OPTION as a parameter."
3967 (when (stringp method)
3968 (setq method (gnus-server-to-method method)))
3969 (memq option (assoc (format "%s" (car method))
3970 gnus-valid-select-methods)))
3972 (defun gnus-similar-server-opened (method)
3973 "Return non-nil if we have a similar server opened.
3974 This is defined as a server with the same name, but different
3975 parameters."
3976 (let ((opened gnus-opened-servers)
3977 open)
3978 (while (and method opened)
3979 (setq open (car (pop opened)))
3980 ;; Type and name are the same...
3981 (when (and (equal (car method) (car open))
3982 (equal (cadr method) (cadr open))
3983 ;; ... but the rest of the parameters differ.
3984 (not (gnus-methods-sloppily-equal method open)))
3985 (setq method nil)))
3986 (not method)))
3988 (defun gnus-server-extend-method (group method)
3989 ;; This function "extends" a virtual server. If the server is
3990 ;; "hello", and the select method is ("hello" (my-var "something"))
3991 ;; in the group "alt.alt", this will result in a new virtual server
3992 ;; called "hello+alt.alt".
3993 (if (or (not (inline (gnus-similar-server-opened method)))
3994 (not (cddr method)))
3995 method
3996 (let ((address-slot
3997 (intern (format "%s-address" (car method)))))
3998 (setq method
3999 (if (assq address-slot (cddr method))
4000 `(,(car method) ,(concat (cadr method) "+" group)
4001 ,@(cddr method))
4002 `(,(car method) ,(concat (cadr method) "+" group)
4003 (,address-slot ,(cadr method))
4004 ,@(cddr method))))
4005 (push method gnus-extended-servers)
4006 method)))
4008 (defun gnus-server-status (method)
4009 "Return the status of METHOD."
4010 (nth 1 (assoc method gnus-opened-servers)))
4012 (defun gnus-group-name-to-method (group)
4013 "Guess a select method based on GROUP."
4014 (if (string-match ":" group)
4015 (let ((server (substring group 0 (match-beginning 0))))
4016 (if (string-match "\\+" server)
4017 (list (intern (substring server 0 (match-beginning 0)))
4018 (substring server (match-end 0)))
4019 (list (intern server) "")))
4020 gnus-select-method))
4022 (defun gnus-server-string (server)
4023 "Return a readable string that describes SERVER."
4024 (let* ((server (gnus-server-to-method server))
4025 (address (nth 1 server)))
4026 (if (and address
4027 (not (zerop (length address))))
4028 (format "%s using %s" address (car server))
4029 (format "%s" (car server)))))
4031 (defun gnus-same-method-different-name (method)
4032 (let ((slot (intern (concat (symbol-name (car method)) "-address"))))
4033 (unless (assq slot (cddr method))
4034 (setq method
4035 (append method (list (list slot (nth 1 method)))))))
4036 (let ((methods gnus-extended-servers)
4037 open found)
4038 (while (and (not found)
4039 (setq open (pop methods)))
4040 (when (and (eq (car method) (car open))
4041 (gnus-sloppily-equal-method-parameters method open))
4042 (setq found open)))
4043 found))
4045 (defun gnus-find-method-for-group (group &optional info)
4046 "Find the select method that GROUP uses."
4047 (or gnus-override-method
4048 (and (not group)
4049 gnus-select-method)
4050 (and (not (gnus-group-entry group))
4051 ;; Killed or otherwise unknown group.
4053 ;; If we know a virtual server by that name, return its method.
4054 (gnus-server-to-method (gnus-group-server group))
4055 ;; Guess a new method as last resort.
4056 (gnus-group-name-to-method group)))
4057 (let ((info (or info (gnus-get-info group)))
4058 method)
4059 (if (or (not info)
4060 (not (setq method (gnus-info-method info)))
4061 (equal method "native"))
4062 gnus-select-method
4063 (setq method
4064 (cond ((stringp method)
4065 (inline (gnus-server-to-method method)))
4066 ((stringp (cadr method))
4068 (inline
4069 (gnus-same-method-different-name method))
4070 (inline (gnus-server-extend-method group method))))
4072 method)))
4073 (cond ((equal (cadr method) "")
4074 method)
4075 ((null (cadr method))
4076 (list (car method) ""))
4078 (gnus-server-add-address method)))))))
4080 (defun gnus-methods-using (feature)
4081 "Find all methods that have FEATURE."
4082 (let ((valids gnus-valid-select-methods)
4083 outs)
4084 (while valids
4085 (when (memq feature (car valids))
4086 (push (car valids) outs))
4087 (setq valids (cdr valids)))
4088 outs))
4090 (autoload 'message-y-or-n-p "message" nil nil 'macro)
4092 (defun gnus-read-group (prompt &optional default)
4093 "Prompt the user for a group name.
4094 Disallow invalid group names."
4095 (let ((prefix "")
4096 group)
4097 (while (not group)
4098 (when (string-match
4099 gnus-invalid-group-regexp
4100 (setq group (read-string (concat prefix prompt)
4101 (cons (or default "") 0)
4102 'gnus-group-history)))
4103 (let ((match (match-string 0 group)))
4104 ;; Might be okay (e.g. for nnimap), so ask the user:
4105 (unless (and (not (string-match "^$\\|:" match))
4106 (message-y-or-n-p
4107 "Proceed and create group anyway? " t
4108 "The group name \"" group "\" contains a forbidden character: \"" match "\".
4110 Usually, it's dangerous to create a group with this name, because it's not
4111 supported by all back ends and servers. On IMAP servers it should work,
4112 though. If you are really sure, you can proceed anyway and create the group.
4114 You may customize the variable `gnus-invalid-group-regexp', which currently is
4115 set to \"" gnus-invalid-group-regexp
4116 "\", if you want to get rid of this query permanently."))
4117 (setq prefix (format "Invalid group name: \"%s\". " group)
4118 group nil)))))
4119 group))
4121 (defun gnus-read-method (prompt)
4122 "Prompt the user for a method.
4123 Allow completion over sensible values."
4124 (let* ((open-servers
4125 (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
4126 gnus-opened-servers))
4127 (valid-methods
4128 (let (methods)
4129 (dolist (method gnus-valid-select-methods)
4130 (if (or (memq 'prompt-address method)
4131 (not (assoc (format "%s:" (car method)) open-servers)))
4132 (push method methods)))
4133 methods))
4134 (servers
4135 (append valid-methods
4136 open-servers
4137 gnus-predefined-server-alist
4138 gnus-server-alist))
4139 (method
4140 (gnus-completing-read
4141 prompt (mapcar #'car servers)
4142 t nil 'gnus-method-history)))
4143 (cond
4144 ((equal method "")
4145 (setq method gnus-select-method))
4146 ((assoc method gnus-valid-select-methods)
4147 (let ((address (if (memq 'prompt-address
4148 (assoc method gnus-valid-select-methods))
4149 (read-string "Address: ")
4150 "")))
4151 (or (cadr (assoc (format "%s:%s" method address) open-servers))
4152 (list (intern method) address))))
4153 ((assoc method servers)
4154 method)
4156 (list (intern method) "")))))
4158 ;;; Agent functions
4160 (defun gnus-agent-method-p (method-or-server)
4161 "Say whether METHOD is covered by the agent."
4162 (or (eq (car gnus-agent-method-p-cache) method-or-server)
4163 (let* ((method (if (stringp method-or-server)
4164 (gnus-server-to-method method-or-server)
4165 method-or-server))
4166 (server (gnus-method-to-server method t)))
4167 (setq gnus-agent-method-p-cache
4168 (cons method-or-server
4169 (member server gnus-agent-covered-methods)))))
4170 (cdr gnus-agent-method-p-cache))
4172 (defun gnus-online (method)
4173 (not
4174 (if gnus-plugged
4175 (eq (cadr (assoc method gnus-opened-servers)) 'offline)
4176 (gnus-agent-method-p method))))
4178 ;;; User-level commands.
4180 ;;;###autoload
4181 (defun gnus-slave-no-server (&optional arg)
4182 "Read network news as a slave, without connecting to the local server."
4183 (interactive "P")
4184 (gnus-no-server arg t))
4186 ;;;###autoload
4187 (defun gnus-no-server (&optional arg slave)
4188 "Read network news.
4189 If ARG is a positive number, Gnus will use that as the startup
4190 level. If ARG is nil, Gnus will be started at level 2. If ARG is
4191 non-nil and not a positive number, Gnus will prompt the user for the
4192 name of an NNTP server to use.
4193 As opposed to `gnus', this command will not connect to the local
4194 server."
4195 (interactive "P")
4196 (gnus-no-server-1 arg slave))
4198 ;;;###autoload
4199 (defun gnus-slave (&optional arg)
4200 "Read news as a slave."
4201 (interactive "P")
4202 (gnus arg nil 'slave))
4204 (defun gnus-delete-gnus-frame ()
4205 "Delete gnus frame unless it is the only one.
4206 Used for `gnus-exit-gnus-hook' in `gnus-other-frame'."
4207 (when (and (frame-live-p gnus-other-frame-object)
4208 (cdr (frame-list)))
4209 (delete-frame gnus-other-frame-object))
4210 (setq gnus-other-frame-object nil))
4212 ;;;###autoload
4213 (defun gnus-other-frame (&optional arg display)
4214 "Pop up a frame to read news.
4215 This will call one of the Gnus commands which is specified by the user
4216 option `gnus-other-frame-function' (default `gnus') with the argument
4217 ARG if Gnus is not running, otherwise pop up a Gnus frame and run the
4218 command specified by `gnus-other-frame-resume-function'.
4219 The optional second argument DISPLAY should be a standard display string
4220 such as \"unix:0\" to specify where to pop up a frame. If DISPLAY is
4221 omitted or the function `make-frame-on-display' is not available, the
4222 current display is used."
4223 (interactive "P")
4224 (if (fboundp 'make-frame-on-display)
4225 (unless display
4226 (setq display (gnus-frame-or-window-display-name (selected-frame))))
4227 (setq display nil))
4228 (let ((alive (gnus-alive-p)))
4229 (unless (and alive
4230 (catch 'found
4231 (walk-windows
4232 (lambda (window)
4233 (when (and (or (not display)
4234 (equal display
4235 (gnus-frame-or-window-display-name
4236 window)))
4237 (with-current-buffer (window-buffer window)
4238 (string-match "\\`gnus-"
4239 (symbol-name major-mode))))
4240 (select-frame-set-input-focus
4241 (setq gnus-other-frame-object (window-frame window)))
4242 (select-window window)
4243 (throw 'found t)))
4244 'ignore t)))
4245 (select-frame-set-input-focus
4246 (setq gnus-other-frame-object
4247 (if display
4248 (make-frame-on-display display gnus-other-frame-parameters)
4249 (make-frame gnus-other-frame-parameters))))
4250 (if alive
4251 (progn (switch-to-buffer gnus-group-buffer)
4252 (funcall gnus-other-frame-resume-function arg))
4253 (funcall gnus-other-frame-function arg)
4254 (add-hook 'gnus-exit-gnus-hook #'gnus-delete-gnus-frame)
4255 ;; One might argue that `gnus-delete-gnus-frame' should not be called
4256 ;; from `gnus-suspend-gnus-hook', but, on the other hand, one might
4257 ;; argue that it should. No matter what you think, for the sake of
4258 ;; those who want it to be called from it, please keep (defun
4259 ;; gnus-delete-gnus-frame) even if you remove the next `add-hook'.
4260 (add-hook 'gnus-suspend-gnus-hook #'gnus-delete-gnus-frame)))))
4262 ;;;###autoload
4263 (defun gnus (&optional arg dont-connect slave)
4264 "Read network news.
4265 If ARG is non-nil and a positive number, Gnus will use that as the
4266 startup level. If ARG is non-nil and not a positive number, Gnus will
4267 prompt the user for the name of an NNTP server to use."
4268 (interactive "P")
4269 ;; When using the development version of Gnus, load the gnus-load
4270 ;; file.
4271 (unless (string-match "^Gnus" gnus-version)
4272 (load "gnus-load" nil t))
4273 (unless (byte-code-function-p (symbol-function 'gnus))
4274 (message "You should byte-compile Gnus")
4275 (sit-for 2))
4276 (let ((gnus-action-message-log (list nil)))
4277 (gnus-1 arg dont-connect slave)
4278 (gnus-final-warning)))
4280 (declare-function debbugs-gnu "ext:debbugs-gnu"
4281 (severities &optional packages archivedp suppress tags))
4283 (defun gnus-list-debbugs ()
4284 "List all open Gnus bug reports."
4285 (interactive)
4286 (require 'debbugs-gnu)
4287 (debbugs-gnu nil "gnus"))
4289 (provide 'gnus)
4291 ;;; gnus.el ends here