1 ;;; gnus-cus.el --- User friendly customization of Gnus
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
4 ;; Author: Per Abrahamsen <abraham@iesd.auc.dk>
5 ;; Keywords: help, news
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
32 (eval-when-compile (require 'cl))
34 ;; The following is just helper functions and data, not meant to be set
36 (defun gnus-make-face (color)
37 ;; Create entry for face with COLOR.
38 (custom-face-lookup color nil nil nil nil nil))
40 (defvar gnus-face-light-name-list
41 '("light blue" "light cyan" "light yellow" "light pink"
42 "pale green" "beige" "orange" "magenta" "violet" "medium purple"
45 (defvar gnus-face-dark-name-list
46 '("dark blue" "firebrick" "dark green" "OrangeRed"
47 "dark khaki" "dark violet" "SteelBlue4"))
48 ; CornflowerBlue SeaGreen OrangeRed SteelBlue4 DeepPink3
54 The coffee-brewing, all singing, all dancing, kitchen sink newsreader.")
59 Gnus can be made colorful and fun or grey and dull as you wish.")
63 (doc . "Enable visual features.
64 If `visual' is disabled, there will be no menus and few faces. Most of
65 the visual customization options below will be ignored. Gnus will use
66 less space and be faster as a result.")
68 (summary-highlight group-highlight
71 summary-menu group-menu article-menu
72 tree-highlight menu highlight
73 browse-menu server-menu
74 page-marker tree-menu binary-menu pick-menu
78 ((tag . "WWW Browser")
80 WWW Browser to call when clicking on an URL button in the article buffer.
82 You can choose between one of the predefined browsers, or `Other'.")
83 (name . browse-url-browser-function)
84 (calculate . (cond ((boundp 'browse-url-browser-function)
85 browse-url-browser-function)
88 ((eq window-system 'x)
89 'gnus-netscape-open-url)))
97 (default . browse-url-netscape))
100 You must specify the name of a Lisp function here. The lisp function
101 should open a WWW browser when called with an URL (a string).
103 (default . __uninitialized__)
105 ((tag . "Mouse Face")
107 Face used for group or summary buffer mouse highlighting.
108 The line beneath the mouse pointer will be highlighted with this
110 (name . gnus-mouse-face)
111 (calculate . (if (gnus-visual-p 'mouse-face 'highlight)
112 (if (boundp 'gnus-mouse-face)
117 ((tag . "Article Display")
118 (doc . "Controls how the article buffer will look.
120 If you leave the list empty, the article will appear exactly as it is
121 stored on the disk. The list entries will hide or highlight various
122 parts of the article, making it easier to find the information you
124 (name . gnus-article-display-hook)
127 . (if (and (string-match "xemacs" emacs-version)
129 '(gnus-article-hide-headers-if-wanted
130 gnus-article-hide-boring-headers
131 gnus-article-treat-overstrike
132 gnus-article-maybe-highlight
133 gnus-article-display-x-face)
134 '(gnus-article-hide-headers-if-wanted
135 gnus-article-hide-boring-headers
136 gnus-article-treat-overstrike
137 gnus-article-maybe-highlight)))
145 ((tag . "Treat Overstrike")
147 Convert use of overstrike into bold and underline.
149 Two identical letters separated by a backspace are displayed as a
150 single bold letter, while a letter followed by a backspace and an
151 underscore will be displayed as a single underlined letter. This
152 technique was developed for old line printers (think about it), and is
153 still in use on some newsgroups, in particular the ClariNet
158 gnus-article-treat-overstrike))
161 Format too long lines.
164 (default . gnus-article-word-wrap))
167 Remove carriage returns from an article.
170 (default . gnus-article-remove-cr))
171 ((tag . "Display X-Face")
173 Look for an X-Face header and display it if present.
175 See also `X Face Command' for a definition of the external command
176 used for decoding and displaying the face.
179 (default . gnus-article-display-x-face))
180 ((tag . "Unquote Printable")
182 Transform MIME quoted printable into 8-bit characters.
184 Quoted printable is often seen by strings like `=EF' where you would
185 expect a non-English letter.
189 gnus-article-de-quoted-unreadable))
190 ((tag . "Universal Time")
192 Convert date header to universal time.
195 (default . gnus-article-date-ut))
196 ((tag . "Local Time")
198 Convert date header to local timezone.
201 (default . gnus-article-date-local))
202 ((tag . "Lapsed Time")
204 Replace date header with a header showing the articles age.
207 (default . gnus-article-date-lapsed))
210 Highlight headers, citations, signature, and buttons.
213 (default . gnus-article-highlight))
214 ((tag . "Maybe Highlight")
216 Highlight headers, signature, and buttons if `Visual' is turned on.
220 gnus-article-maybe-highlight))
221 ((tag . "Highlight Some")
223 Highlight headers, signature, and buttons.
226 (default . gnus-article-highlight-some))
227 ((tag . "Highlight Headers")
229 Highlight headers as specified by `Article Header Highlighting'.
233 gnus-article-highlight-headers))
234 ((tag . "Highlight Signature")
236 Highlight the signature as specified by `Article Signature Face'.
240 gnus-article-highlight-signature))
243 Highlight the citations as specified by `Citation Faces'.
247 gnus-article-highlight-citation))
250 Hide unwanted headers, excess citation, and the signature.
253 (default . gnus-article-hide))
254 ((tag . "Hide Headers If Wanted")
256 Hide headers, but allow user to display them with `t' or `v'.
260 gnus-article-hide-headers-if-wanted))
261 ((tag . "Hide Headers")
263 Hide unwanted headers and possibly sort them as well.
264 Most likely you want to use `Hide Headers If Wanted' instead.
267 (default . gnus-article-hide-headers))
268 ((tag . "Hide Signature")
273 (default . gnus-article-hide-signature))
274 ((tag . "Hide Excess Citations")
276 Hide excess citation.
278 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
282 gnus-article-hide-citation-maybe))
283 ((tag . "Hide Citations")
288 (default . gnus-article-hide-citation))
289 ((tag . "Add Buttons")
291 Make URL's into clickable buttons.
294 (default . gnus-article-add-buttons))
297 Name of Lisp function to call.
299 Push the `Filter' button to select one of the predefined filters.
301 (type . symbol)))))))
302 ((tag . "Article Button Face")
304 Face used for highlighting buttons in the article buffer.
306 An article button is a piece of text that you can activate by pressing
307 `RET' or `mouse-2' above it.")
308 (name . gnus-article-button-face)
311 ((tag . "Article Mouse Face")
313 Face used for mouse highlighting in the article buffer.
315 Article buttons will be displayed in this face when the cursor is
317 (name . gnus-article-mouse-face)
318 (default . highlight)
320 ((tag . "Article Signature Face")
322 Face used for highlighting a signature in the article buffer.")
323 (name . gnus-signature-face)
326 ((tag . "Article Header Highlighting")
328 Controls highlighting of article header.
330 Below is a list of article header names, and the faces used for
331 displaying the name and content of the header. The `Header' field
332 should contain the name of the header. The field actually contains a
333 regular expression that should match the beginning of the header line,
334 but if you don't know what a regular expression is, just write the
335 name of the header. The second field is the `Name' field, which
336 determines how the the header name (i.e. the part of the header left
337 of the `:') is displayed. The third field is the `Content' field,
338 which determines how the content (i.e. the part of the header right of
339 the `:') is displayed.
341 If you leave the last `Header' field in the list empty, the `Name' and
342 `Content' fields will determine how headers not listed above are
345 If you only want to change the display of the name part for a specific
346 header, specify `None' in the `Content' field. Similarly, specify
347 `None' in the `Name' field if you only want to leave the name part
349 (name . gnus-header-face-alist)
353 ((not (eq gnus-display-type 'color))
355 ((eq gnus-background-mode 'dark)
358 (custom-face-lookup "light blue" nil nil t t nil))
360 (custom-face-lookup "pink" nil nil t t nil))
361 (list "Newsgroups:.*," nil
362 (custom-face-lookup "yellow" nil nil t t nil))
365 (custom-face-lookup "cyan" nil nil t nil nil)
366 (custom-face-lookup "forestgreen" nil nil nil t
371 (custom-face-lookup "MidnightBlue" nil nil t t nil))
373 (custom-face-lookup "firebrick" nil nil t t nil))
374 (list "Newsgroups:.*," nil
375 (custom-face-lookup "indianred" nil nil t t nil))
378 "DarkGreen" nil nil t nil nil)
379 (custom-face-lookup "DarkGreen" nil nil
399 ((tag . "Attribution Face")
401 Face used for attribution lines.
402 It is merged with the face for the cited text belonging to the attribution.")
403 (name . gnus-cite-attribution-face)
404 (default . underline)
406 ((tag . "Citation Faces")
408 List of faces used for highlighting citations.
410 When there are citations from multiple articles in the same message,
411 Gnus will try to give each citation from each article its own face.
412 This should make it easier to see who wrote what.")
413 (name . gnus-cite-face-list)
414 (import . gnus-custom-import-cite-face-list)
416 (calculate . (cond ((not (eq gnus-display-type 'color))
418 ((eq gnus-background-mode 'dark)
419 (mapcar 'gnus-make-face
420 gnus-face-light-name-list))
422 (mapcar 'gnus-make-face
423 gnus-face-dark-name-list))))
429 ((tag . "Citation Hide Percentage")
431 Only hide excess citation if above this percentage of the body.")
432 (name . gnus-cite-hide-percentage)
435 ((tag . "Citation Hide Absolute")
437 Only hide excess citation if above this number of lines in the body.")
438 (name . gnus-cite-hide-absolute)
441 ((tag . "Summary Selected Face")
443 Face used for highlighting the current article in the summary buffer.")
444 (name . gnus-summary-selected-face)
445 (default . underline)
447 ((tag . "Summary Line Highlighting")
449 Controls the highlighting of summary buffer lines.
451 Below is a list of `Form'/`Face' pairs. When deciding how a a
452 particular summary line should be displayed, each form is
453 evaluated. The content of the face field after the first true form is
454 used. You can change how those summary lines are displayed, by
455 editing the face field.
457 It is also possible to change and add form fields, but currently that
458 requires an understanding of Lisp expressions. Hopefully this will
459 change in a future release. For now, you can use the following
460 variables in the Lisp expression:
462 score: The article's score
463 default: The default article score.
464 below: The score below which articles are automatically marked as read.
465 mark: The article's mark.")
466 (name . gnus-summary-highlight)
470 ((not (eq gnus-display-type 'color))
471 '(((> score default) . bold)
472 ((< score default) . italic)))
473 ((eq gnus-background-mode 'dark)
476 '(= mark gnus-canceled-mark)
477 (custom-face-lookup "yellow" "black" nil
479 (cons '(and (> score default)
480 (or (= mark gnus-dormant-mark)
481 (= mark gnus-ticked-mark)))
483 "pink" nil nil t nil nil))
484 (cons '(and (< score default)
485 (or (= mark gnus-dormant-mark)
486 (= mark gnus-ticked-mark)))
487 (custom-face-lookup "pink" nil nil
489 (cons '(or (= mark gnus-dormant-mark)
490 (= mark gnus-ticked-mark))
492 "pink" nil nil nil nil nil))
495 '(and (> score default) (= mark gnus-ancient-mark))
496 (custom-face-lookup "medium blue" nil nil t
499 '(and (< score default) (= mark gnus-ancient-mark))
500 (custom-face-lookup "SkyBlue" nil nil
503 '(= mark gnus-ancient-mark)
504 (custom-face-lookup "SkyBlue" nil nil
506 (cons '(and (> score default) (= mark gnus-unread-mark))
507 (custom-face-lookup "white" nil nil t
509 (cons '(and (< score default) (= mark gnus-unread-mark))
510 (custom-face-lookup "white" nil nil
512 (cons '(= mark gnus-unread-mark)
514 "white" nil nil nil nil nil))
516 (cons '(> score default) 'bold)
517 (cons '(< score default) 'italic)))
521 '(= mark gnus-canceled-mark)
523 "yellow" "black" nil nil nil nil))
524 (cons '(and (> score default)
525 (or (= mark gnus-dormant-mark)
526 (= mark gnus-ticked-mark)))
527 (custom-face-lookup "firebrick" nil nil
529 (cons '(and (< score default)
530 (or (= mark gnus-dormant-mark)
531 (= mark gnus-ticked-mark)))
532 (custom-face-lookup "firebrick" nil nil
535 '(or (= mark gnus-dormant-mark)
536 (= mark gnus-ticked-mark))
538 "firebrick" nil nil nil nil nil))
540 (cons '(and (> score default) (= mark gnus-ancient-mark))
541 (custom-face-lookup "RoyalBlue" nil nil
543 (cons '(and (< score default) (= mark gnus-ancient-mark))
544 (custom-face-lookup "RoyalBlue" nil nil
547 '(= mark gnus-ancient-mark)
549 "RoyalBlue" nil nil nil nil nil))
551 (cons '(and (> score default) (/= mark gnus-unread-mark))
552 (custom-face-lookup "DarkGreen" nil nil
554 (cons '(and (< score default) (/= mark gnus-unread-mark))
555 (custom-face-lookup "DarkGreen" nil nil
558 '(/= mark gnus-unread-mark)
559 (custom-face-lookup "DarkGreen" nil nil
562 (cons '(> score default) 'bold)
563 (cons '(< score default) 'italic)))))
577 ((tag . "Group Line Highlighting")
579 Controls the highlighting of group buffer lines.
581 Below is a list of `Form'/`Face' pairs. When deciding how a a
582 particular group line should be displayed, each form is
583 evaluated. The content of the face field after the first true form is
584 used. You can change how those group lines are displayed by
585 editing the face field.
587 It is also possible to change and add form fields, but currently that
588 requires an understanding of Lisp expressions. Hopefully this will
589 change in a future release. For now, you can use the following
590 variables in the Lisp expression:
592 group: The name of the group.
593 unread: The number of unread articles in the group.
594 method: The select method used.
595 mailp: Whether it's a mail group or not.
596 level: The level of the group.
597 score: The score of the group.
598 ticked: The number of ticked articles.")
599 (name . gnus-group-highlight)
603 ((not (eq gnus-display-type 'color))
605 ((= unread 0) . italic)))
606 ((eq gnus-background-mode 'dark)
607 `(((and (not mailp) (eq level 1)) .
608 ,(custom-face-lookup "PaleTurquoise" nil nil t))
609 ((and (not mailp) (eq level 2)) .
610 ,(custom-face-lookup "turquoise" nil nil t))
611 ((and (not mailp) (eq level 3)) .
612 ,(custom-face-lookup "MediumTurquoise" nil nil t))
613 ((and (not mailp) (>= level 4)) .
614 ,(custom-face-lookup "DarkTurquoise" nil nil t))
615 ((and mailp (eq level 1)) .
616 ,(custom-face-lookup "aquamarine1" nil nil t))
617 ((and mailp (eq level 2)) .
618 ,(custom-face-lookup "aquamarine2" nil nil t))
619 ((and mailp (eq level 3)) .
620 ,(custom-face-lookup "aquamarine3" nil nil t))
621 ((and mailp (>= level 4)) .
622 ,(custom-face-lookup "aquamarine4" nil nil t))
625 `(((and (not mailp) (<= level 3)) .
626 ,(custom-face-lookup "ForestGreen" nil nil t))
627 ((and (not mailp) (eq level 4)) .
628 ,(custom-face-lookup "DarkGreen" nil nil t))
629 ((and (not mailp) (eq level 5)) .
630 ,(custom-face-lookup "CadetBlue4" nil nil t))
631 ((and mailp (eq level 1)) .
632 ,(custom-face-lookup "DeepPink3" nil nil t))
633 ((and mailp (eq level 2)) .
634 ,(custom-face-lookup "HotPink3" nil nil t))
635 ((and mailp (eq level 3)) .
636 ,(custom-face-lookup "dark magenta" nil nil t))
637 ((and mailp (eq level 4)) .
638 ,(custom-face-lookup "DeepPink4" nil nil t))
639 ((and mailp (> level 4)) .
640 ,(custom-face-lookup "DarkOrchid4" nil nil t))
655 ;; Do not define `gnus-button-alist' before we have
656 ;; some `complexity' attribute so we can hide it from
660 (defun gnus-custom-import-cite-face-list (custom alist)
661 ;; Backward compatible grokking of light and dark.
662 (cond ((eq alist 'light)
663 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
665 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
666 (funcall (custom-super custom 'import) custom alist))
670 ;;; gnus-cus.el ends here