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 '("RoyalBlue" "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
70 summary-menu group-menu article-menu
71 tree-highlight menu highlight
72 browse-menu server-menu
73 page-marker tree-menu binary-menu pick-menu
77 ((tag . "WWW Browser")
79 WWW Browser to call when clicking on an URL button in the article buffer.
81 You can choose between one of the predefined browsers, or `Other'.")
82 (name . browse-url-browser-function)
83 (calculate . (cond ((boundp 'browse-url-browser-function)
84 browse-url-browser-function)
87 ((eq window-system 'x)
88 'gnus-netscape-open-url)))
96 (default . browse-url-netscape))
99 You must specify the name of a Lisp function here. The lisp function
100 should open a WWW browser when called with an URL (a string).
102 (default . __uninitialized__)
104 ((tag . "Mouse Face")
106 Face used for group or summary buffer mouse highlighting.
107 The line beneath the mouse pointer will be highlighted with this
109 (name . gnus-mouse-face)
110 (calculate . (if (boundp 'gnus-mouse-face)
114 ((tag . "Article Display")
115 (doc . "Controls how the article buffer will look.
117 If you leave the list empty, the article will appear exactly as it is
118 stored on the disk. The list entries will hide or highlight various
119 parts of the article, making it easier to find the information you
121 (name . gnus-article-display-hook)
123 (default . (gnus-article-hide-headers-if-wanted
124 gnus-article-hide-boring-headers
125 gnus-article-treat-overstrike
126 gnus-article-maybe-highlight))
134 ((tag . "Treat Overstrike")
136 Convert use of overstrike into bold and underline.
138 Two identical letters separated by a backspace are displayed as a
139 single bold letter, while a letter followed by a backspace and an
140 underscore will be displayed as a single underlined letter. This
141 technique was developed for old line printers (think about it), and is
142 still in use on some newsgroups, in particular the ClariNet
147 gnus-article-treat-overstrike))
150 Format too long lines.
153 (default . gnus-article-word-wrap))
156 Remove carriage returns from an article.
159 (default . gnus-article-remove-cr))
160 ((tag . "Display X-Face")
162 Look for an X-Face header and display it if present.
164 See also `X Face Command' for a definition of the external command
165 used for decoding and displaying the face.
168 (default . gnus-article-display-x-face))
169 ((tag . "Unquote Printable")
171 Transform MIME quoted printable into 8-bit characters.
173 Quoted printable is often seen by strings like `=EF' where you would
174 expect a non-English letter.
178 gnus-article-de-quoted-unreadable))
179 ((tag . "Universal Time")
181 Convert date header to universal time.
184 (default . gnus-article-date-ut))
185 ((tag . "Local Time")
187 Convert date header to local timezone.
190 (default . gnus-article-date-local))
191 ((tag . "Lapsed Time")
193 Replace date header with a header showing the articles age.
196 (default . gnus-article-date-lapsed))
199 Highlight headers, citations, signature, and buttons.
202 (default . gnus-article-highlight))
203 ((tag . "Maybe Highlight")
205 Highlight headers, signature, and buttons if `Visual' is turned on.
209 gnus-article-maybe-highlight))
210 ((tag . "Highlight Some")
212 Highlight headers, signature, and buttons.
215 (default . gnus-article-highlight-some))
216 ((tag . "Highlight Headers")
218 Highlight headers as specified by `Article Header Highlighting'.
222 gnus-article-highlight-headers))
223 ((tag . "Highlight Signature")
225 Highlight the signature as specified by `Article Signature Face'.
229 gnus-article-highlight-signature))
232 Highlight the citations as specified by `Citation Faces'.
236 gnus-article-highlight-citation))
239 Hide unwanted headers, excess citation, and the signature.
242 (default . gnus-article-hide))
243 ((tag . "Hide Headers If Wanted")
245 Hide headers, but allow user to display them with `t' or `v'.
249 gnus-article-hide-headers-if-wanted))
250 ((tag . "Hide Headers")
252 Hide unwanted headers and possibly sort them as well.
253 Most likely you want to use `Hide Headers If Wanted' instead.
256 (default . gnus-article-hide-headers))
257 ((tag . "Hide Signature")
262 (default . gnus-article-hide-signature))
263 ((tag . "Hide Excess Citations")
265 Hide excess citation.
267 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
271 gnus-article-hide-citation-maybe))
272 ((tag . "Hide Citations")
277 (default . gnus-article-hide-citation))
278 ((tag . "Add Buttons")
280 Make URL's into clickable buttons.
283 (default . gnus-article-add-buttons))
286 Name of Lisp function to call.
288 Push the `Filter' button to select one of the predefined filters.
290 (type . symbol)))))))
291 ((tag . "Article Button Face")
293 Face used for highlighting buttons in the article buffer.
295 An article button is a piece of text that you can activate by pressing
296 `RET' or `mouse-2' above it.")
297 (name . gnus-article-button-face)
300 ((tag . "Article Mouse Face")
302 Face used for mouse highlighting in the article buffer.
304 Article buttons will be displayed in this face when the cursor is
306 (name . gnus-article-mouse-face)
307 (default . highlight)
309 ((tag . "Article Signature Face")
311 Face used for highlighting a signature in the article buffer.")
312 (name . gnus-signature-face)
315 ((tag . "Article Header Highlighting")
317 Controls highlighting of article header.
319 Below is a list of article header names, and the faces used for
320 displaying the name and content of the header. The `Header' field
321 should contain the name of the header. The field actually contains a
322 regular expression that should match the beginning of the header line,
323 but if you don't know what a regular expression is, just write the
324 name of the header. The second field is the `Name' field, which
325 determines how the the header name (i.e. the part of the header left
326 of the `:') is displayed. The third field is the `Content' field,
327 which determines how the content (i.e. the part of the header right of
328 the `:') is displayed.
330 If you leave the last `Header' field in the list empty, the `Name' and
331 `Content' fields will determine how headers not listed above are
334 If you only want to change the display of the name part for a specific
335 header, specify `None' in the `Content' field. Similarly, specify
336 `None' in the `Name' field if you only want to leave the name part
338 (name . gnus-header-face-alist)
342 ((not (eq gnus-display-type 'color))
344 ((eq gnus-background-mode 'dark)
347 (custom-face-lookup "light blue" nil nil t t nil))
349 (custom-face-lookup "pink" nil nil t t nil))
350 (list "Newsgroups:.*," nil
351 (custom-face-lookup "yellow" nil nil t t nil))
354 (custom-face-lookup "cyan" nil nil t nil nil)
355 (custom-face-lookup "forestgreen" nil nil nil t
360 (custom-face-lookup "RoyalBlue" nil nil t t nil))
362 (custom-face-lookup "firebrick" nil nil t t nil))
363 (list "Newsgroups:.*," nil
364 (custom-face-lookup "indianred" nil nil t t nil))
367 "DarkGreen" nil nil t nil nil)
368 (custom-face-lookup "DarkGreen" nil nil
388 ((tag . "Attribution Face")
390 Face used for attribution lines.
391 It is merged with the face for the cited text belonging to the attribution.")
392 (name . gnus-cite-attribution-face)
393 (default . underline)
395 ((tag . "Citation Faces")
397 List of faces used for highlighting citations.
399 When there are citations from multiple articles in the same message,
400 Gnus will try to give each citation from each article its own face.
401 This should make it easier to see who wrote what.")
402 (name . gnus-cite-face-list)
403 (import . gnus-custom-import-cite-face-list)
405 (calculate . (cond ((not (eq gnus-display-type 'color))
407 ((eq gnus-background-mode 'dark)
408 (mapcar 'gnus-make-face
409 gnus-face-light-name-list))
411 (mapcar 'gnus-make-face
412 gnus-face-dark-name-list))))
418 ((tag . "Citation Hide Percentage")
420 Only hide excess citation if above this percentage of the body.")
421 (name . gnus-cite-hide-percentage)
424 ((tag . "Citation Hide Absolute")
426 Only hide excess citation if above this number of lines in the body.")
427 (name . gnus-cite-hide-absolute)
430 ((tag . "Summary Selected Face")
432 Face used for highlighting the current article in the summary buffer.")
433 (name . gnus-summary-selected-face)
434 (default . underline)
436 ((tag . "Summary Line Highlighting")
438 Controls the highlighting of summary buffer lines.
440 Below is a list of `Form'/`Face' pairs. When deciding how a a
441 particular summary line should be displayed, each form is
442 evaluated. The content of the face field after the first true form is
443 used. You can change how those summary lines are displayed, by
444 editing the face field.
446 It is also possible to change and add form fields, but currently that
447 requires an understanding of Lisp expressions. Hopefully this will
448 change in a future release. For now, you can use the following
449 variables in the Lisp expression:
451 score: The article's score
452 default: The default article score.
453 below: The score below which articles are automatically marked as read.
454 mark: The article's mark.")
455 (name . gnus-summary-highlight)
459 ((not (eq gnus-display-type 'color))
460 '(((> score default) . bold)
461 ((< score default) . italic)))
462 ((eq gnus-background-mode 'dark)
465 '(= mark gnus-canceled-mark)
466 (custom-face-lookup "yellow" "black" nil
468 (cons '(and (> score default)
469 (or (= mark gnus-dormant-mark)
470 (= mark gnus-ticked-mark)))
472 "pink" nil nil t nil nil))
473 (cons '(and (< score default)
474 (or (= mark gnus-dormant-mark)
475 (= mark gnus-ticked-mark)))
476 (custom-face-lookup "pink" nil nil
478 (cons '(or (= mark gnus-dormant-mark)
479 (= mark gnus-ticked-mark))
481 "pink" nil nil nil nil nil))
484 '(and (> score default) (= mark gnus-ancient-mark))
485 (custom-face-lookup "medium blue" nil nil t
488 '(and (< score default) (= mark gnus-ancient-mark))
489 (custom-face-lookup "SkyBlue" nil nil
492 '(= mark gnus-ancient-mark)
493 (custom-face-lookup "SkyBlue" nil nil
495 (cons '(and (> score default) (= mark gnus-unread-mark))
496 (custom-face-lookup "white" nil nil t
498 (cons '(and (< score default) (= mark gnus-unread-mark))
499 (custom-face-lookup "white" nil nil
501 (cons '(= mark gnus-unread-mark)
503 "white" nil nil nil nil nil))
505 (cons '(> score default) 'bold)
506 (cons '(< score default) 'italic)))
510 '(= mark gnus-canceled-mark)
512 "yellow" "black" nil nil nil nil))
513 (cons '(and (> score default)
514 (or (= mark gnus-dormant-mark)
515 (= mark gnus-ticked-mark)))
516 (custom-face-lookup "firebrick" nil nil
518 (cons '(and (< score default)
519 (or (= mark gnus-dormant-mark)
520 (= mark gnus-ticked-mark)))
521 (custom-face-lookup "firebrick" nil nil
524 '(or (= mark gnus-dormant-mark)
525 (= mark gnus-ticked-mark))
527 "firebrick" nil nil nil nil nil))
529 (cons '(and (> score default) (= mark gnus-ancient-mark))
530 (custom-face-lookup "RoyalBlue" nil nil
532 (cons '(and (< score default) (= mark gnus-ancient-mark))
533 (custom-face-lookup "RoyalBlue" nil nil
536 '(= mark gnus-ancient-mark)
538 "RoyalBlue" nil nil nil nil nil))
540 (cons '(and (> score default) (/= mark gnus-unread-mark))
541 (custom-face-lookup "DarkGreen" nil nil
543 (cons '(and (< score default) (/= mark gnus-unread-mark))
544 (custom-face-lookup "DarkGreen" nil nil
547 '(/= mark gnus-unread-mark)
548 (custom-face-lookup "DarkGreen" nil nil
551 (cons '(> score default) 'bold)
552 (cons '(< score default) 'italic)))))
566 ((tag . "Group Line Highlighting")
568 Controls the highlighting of group buffer lines.
570 Below is a list of `Form'/`Face' pairs. When deciding how a a
571 particular group line should be displayed, each form is
572 evaluated. The content of the face field after the first true form is
573 used. You can change how those group lines are displayed by
574 editing the face field.
576 It is also possible to change and add form fields, but currently that
577 requires an understanding of Lisp expressions. Hopefully this will
578 change in a future release. For now, you can use the following
579 variables in the Lisp expression:
581 group: The name of the group.
582 unread: The number of unread articles in the group.
583 method: The select method used.
584 mailp: Whether it's a mail group or not.
585 level: The level of the group.
586 score: The score of the group.
587 ticked: The number of ticked articles.")
588 (name . gnus-group-highlight)
592 ((not (eq gnus-display-type 'color))
594 ((= unread 0) . italic)))
595 ((eq gnus-background-mode 'dark)
597 ,(custom-face-lookup "Red" nil nil t))
598 ((and (< level 3) (zerop unread)) .
599 ,(custom-face-lookup "SeaGreen" nil nil t))
601 ,(custom-face-lookup "SpringGreen" nil nil t))
603 ,(custom-face-lookup "SteelBlue" nil nil t))
604 (t . ,(custom-face-lookup "SkyBlue" nil nil t))))
606 `(((and (not mailp) (<= level 3)) .
607 ,(custom-face-lookup "ForestGreen" nil nil t))
608 ((and (not mailp) (eq level 4)) .
609 ,(custom-face-lookup "DarkGreen" nil nil t))
610 ((and (not mailp) (eq level 5)) .
611 ,(custom-face-lookup "Red" nil nil t))
612 ((and mailp (eq level 1)) .
613 ,(custom-face-lookup "DeepPink3" nil nil t))
614 ((and mailp (eq level 2)) .
615 ,(custom-face-lookup "HotPink3" nil nil t))
616 ((and mailp (eq level 3)) .
617 ,(custom-face-lookup "dark magenta" nil nil t))
618 ((and mailp (eq level 4)) .
619 ,(custom-face-lookup "DeepPink4" nil nil t))
620 ((and mailp (> level 4)) .
621 ,(custom-face-lookup "DarkOrchid4" nil nil t))
636 ;; Do not define `gnus-button-alist' before we have
637 ;; some `complexity' attribute so we can hide it from
641 (defun gnus-custom-import-cite-face-list (custom alist)
642 ;; Backward compatible grokking of light and dark.
643 (cond ((eq alist 'light)
644 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
646 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
647 (funcall (custom-super custom 'import) custom alist))
651 ;;; gnus-cus.el ends here