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)
126 (default . (gnus-article-hide-headers-if-wanted
127 gnus-article-hide-boring-headers
128 gnus-article-treat-overstrike
129 gnus-article-maybe-highlight))
137 ((tag . "Treat Overstrike")
139 Convert use of overstrike into bold and underline.
141 Two identical letters separated by a backspace are displayed as a
142 single bold letter, while a letter followed by a backspace and an
143 underscore will be displayed as a single underlined letter. This
144 technique was developed for old line printers (think about it), and is
145 still in use on some newsgroups, in particular the ClariNet
150 gnus-article-treat-overstrike))
153 Format too long lines.
156 (default . gnus-article-word-wrap))
159 Remove carriage returns from an article.
162 (default . gnus-article-remove-cr))
163 ((tag . "Display X-Face")
165 Look for an X-Face header and display it if present.
167 See also `X Face Command' for a definition of the external command
168 used for decoding and displaying the face.
171 (default . gnus-article-display-x-face))
172 ((tag . "Unquote Printable")
174 Transform MIME quoted printable into 8-bit characters.
176 Quoted printable is often seen by strings like `=EF' where you would
177 expect a non-English letter.
181 gnus-article-de-quoted-unreadable))
182 ((tag . "Universal Time")
184 Convert date header to universal time.
187 (default . gnus-article-date-ut))
188 ((tag . "Local Time")
190 Convert date header to local timezone.
193 (default . gnus-article-date-local))
194 ((tag . "Lapsed Time")
196 Replace date header with a header showing the articles age.
199 (default . gnus-article-date-lapsed))
202 Highlight headers, citations, signature, and buttons.
205 (default . gnus-article-highlight))
206 ((tag . "Maybe Highlight")
208 Highlight headers, signature, and buttons if `Visual' is turned on.
212 gnus-article-maybe-highlight))
213 ((tag . "Highlight Some")
215 Highlight headers, signature, and buttons.
218 (default . gnus-article-highlight-some))
219 ((tag . "Highlight Headers")
221 Highlight headers as specified by `Article Header Highlighting'.
225 gnus-article-highlight-headers))
226 ((tag . "Highlight Signature")
228 Highlight the signature as specified by `Article Signature Face'.
232 gnus-article-highlight-signature))
235 Highlight the citations as specified by `Citation Faces'.
239 gnus-article-highlight-citation))
242 Hide unwanted headers, excess citation, and the signature.
245 (default . gnus-article-hide))
246 ((tag . "Hide Headers If Wanted")
248 Hide headers, but allow user to display them with `t' or `v'.
252 gnus-article-hide-headers-if-wanted))
253 ((tag . "Hide Headers")
255 Hide unwanted headers and possibly sort them as well.
256 Most likely you want to use `Hide Headers If Wanted' instead.
259 (default . gnus-article-hide-headers))
260 ((tag . "Hide Signature")
265 (default . gnus-article-hide-signature))
266 ((tag . "Hide Excess Citations")
268 Hide excess citation.
270 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
274 gnus-article-hide-citation-maybe))
275 ((tag . "Hide Citations")
280 (default . gnus-article-hide-citation))
281 ((tag . "Add Buttons")
283 Make URL's into clickable buttons.
286 (default . gnus-article-add-buttons))
289 Name of Lisp function to call.
291 Push the `Filter' button to select one of the predefined filters.
293 (type . symbol)))))))
294 ((tag . "Article Button Face")
296 Face used for highlighting buttons in the article buffer.
298 An article button is a piece of text that you can activate by pressing
299 `RET' or `mouse-2' above it.")
300 (name . gnus-article-button-face)
303 ((tag . "Article Mouse Face")
305 Face used for mouse highlighting in the article buffer.
307 Article buttons will be displayed in this face when the cursor is
309 (name . gnus-article-mouse-face)
310 (default . highlight)
312 ((tag . "Article Signature Face")
314 Face used for highlighting a signature in the article buffer.")
315 (name . gnus-signature-face)
318 ((tag . "Article Header Highlighting")
320 Controls highlighting of article header.
322 Below is a list of article header names, and the faces used for
323 displaying the name and content of the header. The `Header' field
324 should contain the name of the header. The field actually contains a
325 regular expression that should match the beginning of the header line,
326 but if you don't know what a regular expression is, just write the
327 name of the header. The second field is the `Name' field, which
328 determines how the the header name (i.e. the part of the header left
329 of the `:') is displayed. The third field is the `Content' field,
330 which determines how the content (i.e. the part of the header right of
331 the `:') is displayed.
333 If you leave the last `Header' field in the list empty, the `Name' and
334 `Content' fields will determine how headers not listed above are
337 If you only want to change the display of the name part for a specific
338 header, specify `None' in the `Content' field. Similarly, specify
339 `None' in the `Name' field if you only want to leave the name part
341 (name . gnus-header-face-alist)
345 ((not (eq gnus-display-type 'color))
347 ((eq gnus-background-mode 'dark)
350 (custom-face-lookup "light blue" nil nil t t nil))
352 (custom-face-lookup "pink" nil nil t t nil))
353 (list "Newsgroups:.*," nil
354 (custom-face-lookup "yellow" nil nil t t nil))
357 (custom-face-lookup "cyan" nil nil t nil nil)
358 (custom-face-lookup "forestgreen" nil nil nil t
363 (custom-face-lookup "MidnightBlue" nil nil t t nil))
365 (custom-face-lookup "firebrick" nil nil t t nil))
366 (list "Newsgroups:.*," nil
367 (custom-face-lookup "indianred" nil nil t t nil))
370 "DarkGreen" nil nil t nil nil)
371 (custom-face-lookup "DarkGreen" nil nil
391 ((tag . "Attribution Face")
393 Face used for attribution lines.
394 It is merged with the face for the cited text belonging to the attribution.")
395 (name . gnus-cite-attribution-face)
396 (default . underline)
398 ((tag . "Citation Faces")
400 List of faces used for highlighting citations.
402 When there are citations from multiple articles in the same message,
403 Gnus will try to give each citation from each article its own face.
404 This should make it easier to see who wrote what.")
405 (name . gnus-cite-face-list)
406 (import . gnus-custom-import-cite-face-list)
408 (calculate . (cond ((not (eq gnus-display-type 'color))
410 ((eq gnus-background-mode 'dark)
411 (mapcar 'gnus-make-face
412 gnus-face-light-name-list))
414 (mapcar 'gnus-make-face
415 gnus-face-dark-name-list))))
421 ((tag . "Citation Hide Percentage")
423 Only hide excess citation if above this percentage of the body.")
424 (name . gnus-cite-hide-percentage)
427 ((tag . "Citation Hide Absolute")
429 Only hide excess citation if above this number of lines in the body.")
430 (name . gnus-cite-hide-absolute)
433 ((tag . "Summary Selected Face")
435 Face used for highlighting the current article in the summary buffer.")
436 (name . gnus-summary-selected-face)
437 (default . underline)
439 ((tag . "Summary Line Highlighting")
441 Controls the highlighting of summary buffer lines.
443 Below is a list of `Form'/`Face' pairs. When deciding how a a
444 particular summary line should be displayed, each form is
445 evaluated. The content of the face field after the first true form is
446 used. You can change how those summary lines are displayed, by
447 editing the face field.
449 It is also possible to change and add form fields, but currently that
450 requires an understanding of Lisp expressions. Hopefully this will
451 change in a future release. For now, you can use the following
452 variables in the Lisp expression:
454 score: The article's score
455 default: The default article score.
456 below: The score below which articles are automatically marked as read.
457 mark: The article's mark.")
458 (name . gnus-summary-highlight)
462 ((not (eq gnus-display-type 'color))
463 '(((> score default) . bold)
464 ((< score default) . italic)))
465 ((eq gnus-background-mode 'dark)
468 '(= mark gnus-canceled-mark)
469 (custom-face-lookup "yellow" "black" nil
471 (cons '(and (> score default)
472 (or (= mark gnus-dormant-mark)
473 (= mark gnus-ticked-mark)))
475 "pink" nil nil t nil nil))
476 (cons '(and (< score default)
477 (or (= mark gnus-dormant-mark)
478 (= mark gnus-ticked-mark)))
479 (custom-face-lookup "pink" nil nil
481 (cons '(or (= mark gnus-dormant-mark)
482 (= mark gnus-ticked-mark))
484 "pink" nil nil nil nil nil))
487 '(and (> score default) (= mark gnus-ancient-mark))
488 (custom-face-lookup "medium blue" nil nil t
491 '(and (< score default) (= mark gnus-ancient-mark))
492 (custom-face-lookup "SkyBlue" nil nil
495 '(= mark gnus-ancient-mark)
496 (custom-face-lookup "SkyBlue" nil nil
498 (cons '(and (> score default) (= mark gnus-unread-mark))
499 (custom-face-lookup "white" nil nil t
501 (cons '(and (< score default) (= mark gnus-unread-mark))
502 (custom-face-lookup "white" nil nil
504 (cons '(= mark gnus-unread-mark)
506 "white" nil nil nil nil nil))
508 (cons '(> score default) 'bold)
509 (cons '(< score default) 'italic)))
513 '(= mark gnus-canceled-mark)
515 "yellow" "black" nil nil nil nil))
516 (cons '(and (> score default)
517 (or (= mark gnus-dormant-mark)
518 (= mark gnus-ticked-mark)))
519 (custom-face-lookup "firebrick" nil nil
521 (cons '(and (< score default)
522 (or (= mark gnus-dormant-mark)
523 (= mark gnus-ticked-mark)))
524 (custom-face-lookup "firebrick" nil nil
527 '(or (= mark gnus-dormant-mark)
528 (= mark gnus-ticked-mark))
530 "firebrick" nil nil nil nil nil))
532 (cons '(and (> score default) (= mark gnus-ancient-mark))
533 (custom-face-lookup "RoyalBlue" nil nil
535 (cons '(and (< score default) (= mark gnus-ancient-mark))
536 (custom-face-lookup "RoyalBlue" nil nil
539 '(= mark gnus-ancient-mark)
541 "RoyalBlue" nil nil nil nil nil))
543 (cons '(and (> score default) (/= mark gnus-unread-mark))
544 (custom-face-lookup "DarkGreen" nil nil
546 (cons '(and (< score default) (/= mark gnus-unread-mark))
547 (custom-face-lookup "DarkGreen" nil nil
550 '(/= mark gnus-unread-mark)
551 (custom-face-lookup "DarkGreen" nil nil
554 (cons '(> score default) 'bold)
555 (cons '(< score default) 'italic)))))
569 ((tag . "Group Line Highlighting")
571 Controls the highlighting of group buffer lines.
573 Below is a list of `Form'/`Face' pairs. When deciding how a a
574 particular group line should be displayed, each form is
575 evaluated. The content of the face field after the first true form is
576 used. You can change how those group lines are displayed by
577 editing the face field.
579 It is also possible to change and add form fields, but currently that
580 requires an understanding of Lisp expressions. Hopefully this will
581 change in a future release. For now, you can use the following
582 variables in the Lisp expression:
584 group: The name of the group.
585 unread: The number of unread articles in the group.
586 method: The select method used.
587 mailp: Whether it's a mail group or not.
588 level: The level of the group.
589 score: The score of the group.
590 ticked: The number of ticked articles.")
591 (name . gnus-group-highlight)
595 ((not (eq gnus-display-type 'color))
597 ((= unread 0) . italic)))
598 ((eq gnus-background-mode 'dark)
600 ,(custom-face-lookup "Red" nil nil t))
601 ((and (< level 3) (zerop unread)) .
602 ,(custom-face-lookup "SeaGreen" nil nil t))
604 ,(custom-face-lookup "SpringGreen" nil nil t))
606 ,(custom-face-lookup "SteelBlue" nil nil t))
607 (t . ,(custom-face-lookup "SkyBlue" nil nil t))))
609 `(((and (not mailp) (<= level 3)) .
610 ,(custom-face-lookup "ForestGreen" nil nil t))
611 ((and (not mailp) (eq level 4)) .
612 ,(custom-face-lookup "DarkGreen" nil nil t))
613 ((and (not mailp) (eq level 5)) .
614 ,(custom-face-lookup "CadetBlue4" nil nil t))
615 ((and mailp (eq level 1)) .
616 ,(custom-face-lookup "DeepPink3" nil nil t))
617 ((and mailp (eq level 2)) .
618 ,(custom-face-lookup "HotPink3" nil nil t))
619 ((and mailp (eq level 3)) .
620 ,(custom-face-lookup "dark magenta" nil nil t))
621 ((and mailp (eq level 4)) .
622 ,(custom-face-lookup "DeepPink4" nil nil t))
623 ((and mailp (> level 4)) .
624 ,(custom-face-lookup "DarkOrchid4" nil nil t))
639 ;; Do not define `gnus-button-alist' before we have
640 ;; some `complexity' attribute so we can hide it from
644 (defun gnus-custom-import-cite-face-list (custom alist)
645 ;; Backward compatible grokking of light and dark.
646 (cond ((eq alist 'light)
647 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
649 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
650 (funcall (custom-super custom 'import) custom alist))
654 ;;; gnus-cus.el ends here