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 ment 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"
47 "dark green" "OrangeRed" "dark khaki" "dark violet"
49 ; CornflowerBlue SeaGreen OrangeRed SteelBlue4 DeepPink3
55 The coffee-brewing, all singing, all dancing, kitchen sink newsreader.")
60 GNUS can be made colorful and fun or grey and dull as you wish.")
64 (doc . "Enable visual features.
65 If `visual' is disabled, there will be no menus and few faces. Most of
66 the visual customization options below will be ignored. GNUS will use
67 less space and be faster as a result.")
69 (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 (boundp 'gnus-mouse-face)
115 ((tag . "Article Display")
116 (doc . "Controls how the article buffer will look.
118 If you leave the list empty, the article will appear exactly as it is
119 stored on the disk. The list entries will hide or highlight various
120 parts of the article, making it easier to find the information you
122 (name . gnus-article-display-hook)
124 (default . (gnus-article-hide-headers-if-wanted
125 gnus-article-hide-boring-headers
126 gnus-article-treat-overstrike
127 gnus-article-maybe-highlight))
135 ((tag . "Treat Overstrike")
137 Convert use of overstrike into bold and underline.
139 Two identical letters separated by a backspace are displayed as a
140 single bold letter, while a letter followed by a backspace and an
141 underscore will be displayed as a single underlined letter. This
142 technique was developed for old line printers (think about it), and is
143 still in use on some newsgroups, in particular the ClariNet
148 gnus-article-treat-overstrike))
151 Format too long lines.
154 (default . gnus-article-word-wrap))
157 Remove carriage returns from an article.
160 (default . gnus-article-remove-cr))
161 ((tag . "Display X-Face")
163 Look for an X-Face header and display it if present.
165 See also `X Face Command' for a definition of the external command
166 used for decoding and displaying the face.
169 (default . gnus-article-display-x-face))
170 ((tag . "Unquote Printable")
172 Transform MIME quoted printable into 8-bit characters.
174 Quoted printable is often seen by strings like `=EF' where you would
175 expect a non-English letter.
179 gnus-article-de-quoted-unreadable))
180 ((tag . "Universal Time")
182 Convert date header to universal time.
185 (default . gnus-article-date-ut))
186 ((tag . "Local Time")
188 Convert date header to local timezone.
191 (default . gnus-article-date-local))
192 ((tag . "Lapsed Time")
194 Replace date header with a header showing the articles age.
197 (default . gnus-article-date-lapsed))
200 Highlight headers, citations, signature, and buttons.
203 (default . gnus-article-highlight))
204 ((tag . "Maybe Highlight")
206 Highlight headers, signature, and buttons if `Visual' is turned on.
210 gnus-article-maybe-highlight))
211 ((tag . "Highlight Some")
213 Highlight headers, signature, and buttons.
216 (default . gnus-article-highlight-some))
217 ((tag . "Highlight Headers")
219 Highlight headers as specified by `Article Header Highlighting'.
223 gnus-article-highlight-headers))
224 ((tag . "Highlight Signature")
226 Highlight the signature as specified by `Article Signature Face'.
230 gnus-article-highlight-signature))
233 Highlight the citations as specified by `Citation Faces'.
237 gnus-article-highlight-citation))
240 Hide unwanted headers, excess citation, and the signature.
243 (default . gnus-article-hide))
244 ((tag . "Hide Headers If Wanted")
246 Hide headers, but allow user to display them with `t' or `v'.
250 gnus-article-hide-headers-if-wanted))
251 ((tag . "Hide Headers")
253 Hide unwanted headers and possibly sort them as well.
254 Most likely you want to use `Hide Headers If Wanted' instead.
257 (default . gnus-article-hide-headers))
258 ((tag . "Hide Signature")
263 (default . gnus-article-hide-signature))
264 ((tag . "Hide Excess Citations")
266 Hide excess citation.
268 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
272 gnus-article-hide-citation-maybe))
273 ((tag . "Hide Citations")
278 (default . gnus-article-hide-citation))
279 ((tag . "Add Buttons")
281 Make URL's into clickable buttons.
284 (default . gnus-article-add-buttons))
287 Name of Lisp function to call.
289 Push the `Filter' button to select one of the predefined filters.
291 (type . symbol)))))))
292 ((tag . "Article Button Face")
294 Face used for highlighting buttons in the article buffer.
296 An article button is a piece of text that you can activate by pressing
297 `RET' or `mouse-2' above it.")
298 (name . gnus-article-button-face)
301 ((tag . "Article Mouse Face")
303 Face used for mouse highlighting in the article buffer.
305 Article buttons will be displayed in this face when the cursor is
307 (name . gnus-article-mouse-face)
308 (default . highlight)
310 ((tag . "Article Signature Face")
312 Face used for highlighting a signature in the article buffer.")
313 (name . gnus-signature-face)
316 ((tag . "Article Header Highlighting")
318 Controls highlighting of article header.
320 Below is a list of article header names, and the faces used for
321 displaying the name and content of the header. The `Header' field
322 should contain the name of the header. The field actually contains a
323 regular expression that should match the beginning of the header line,
324 but if you don't know what a regular expression is, just write the
325 name of the header. The second field is the `Name' field, which
326 determines how the the header name (i.e. the part of the header left
327 of the `:') is displayed. The third field is the `Content' field,
328 which determines how the content (i.e. the part of the header right of
329 the `:') is displayed.
331 If you leave the last `Header' field in the list empty, the `Name' and
332 `Content' fields will determine how headers not listed above are
335 If you only want to change the display of the name part for a specific
336 header, specify `None' in the `Content' field. Similarly, specify
337 `None' in the `Name' field if you only want to leave the name part
339 (name . gnus-header-face-alist)
343 ((not (eq gnus-display-type 'color))
345 ((eq gnus-background-mode 'dark)
348 (custom-face-lookup "light blue" nil nil t t nil))
350 (custom-face-lookup "pink" nil nil t t nil))
351 (list "Newsgroups:.*," nil
352 (custom-face-lookup "yellow" nil nil t t nil))
355 (custom-face-lookup "cyan" nil nil t nil nil)
356 (custom-face-lookup "forestgreen" nil nil nil t nil))))
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))
366 (custom-face-lookup "DarkGreen" nil nil t nil nil)
367 (custom-face-lookup "DarkGreen" nil nil nil t nil))))))
386 ((tag . "Attribution Face")
388 Face used for attribution lines.
389 It is merged with the face for the cited text belonging to the attribution.")
390 (name . gnus-cite-attribution-face)
391 (default . underline)
393 ((tag . "Citation Faces")
395 List of faces used for highlighting citations.
397 When there are citations from multiple articles in the same message,
398 Gnus will try to give each citation from each article its own face.
399 This should make it easier to see who wrote what.")
400 (name . gnus-cite-face-list)
401 (import . gnus-custom-import-cite-face-list)
403 (calculate . (cond ((not (eq gnus-display-type 'color))
405 ((eq gnus-background-mode 'dark)
406 (mapcar 'gnus-make-face
407 gnus-face-light-name-list))
409 (mapcar 'gnus-make-face
410 gnus-face-dark-name-list))))
416 ((tag . "Citation Hide Percentage")
418 Only hide excess citation if above this percentage of the body.")
419 (name . gnus-cite-hide-percentage)
422 ((tag . "Citation Hide Absolute")
424 Only hide excess citation if above this number of lines in the body.")
425 (name . gnus-cite-hide-absolute)
428 ((tag . "Summary Selected Face")
430 Face used for highlighting the current article in the summary buffer.")
431 (name . gnus-summary-selected-face)
432 (default . underline)
434 ((tag . "Summary Line Highlighting")
436 Controls the highlighting of summary buffer lines.
438 Below is a list of `Form'/`Face' pairs. When deciding how a a
439 particular summary line should be displayed, each form is
440 evaluated. The content of the face field after the first true form is
441 used. You can change how those summary lines are displayed, by
442 editing the face field.
444 It is also possible to change and add form fields, but currently that
445 requires an understanding of Lisp expressions. Hopefully this will
446 change in a future release. For now, you can use the following
447 variables in the Lisp expression:
449 score: The article's score
450 default: The default article score.
451 below: The score below which articles are automatically marked as read.
452 mark: The article's mark.")
453 (name . gnus-summary-highlight)
457 ((not (eq gnus-display-type 'color))
458 '(((> score default) . bold)
459 ((< score default) . italic)))
460 ((eq gnus-background-mode 'dark)
463 '(= mark gnus-canceled-mark)
464 (custom-face-lookup "yellow" "black" nil nil nil nil))
465 (cons '(and (> score default)
466 (or (= mark gnus-dormant-mark)
467 (= mark gnus-ticked-mark)))
468 (custom-face-lookup "pink" nil nil t nil nil))
469 (cons '(and (< score default)
470 (or (= mark gnus-dormant-mark)
471 (= mark gnus-ticked-mark)))
472 (custom-face-lookup "pink" nil nil nil t nil))
473 (cons '(or (= mark gnus-dormant-mark)
474 (= mark gnus-ticked-mark))
475 (custom-face-lookup "pink" nil nil nil nil nil))
478 '(and (> score default) (= mark gnus-ancient-mark))
479 (custom-face-lookup "dark blue" nil nil t nil nil))
481 '(and (< score default) (= mark gnus-ancient-mark))
482 (custom-face-lookup "SkyBlue" nil nil nil t nil))
484 '(= mark gnus-ancient-mark)
485 (custom-face-lookup "SkyBlue" nil nil nil nil nil))
487 (cons '(and (> score default) (= mark gnus-unread-mark))
488 (custom-face-lookup "white" nil nil t nil nil))
489 (cons '(and (< score default) (= mark gnus-unread-mark))
490 (custom-face-lookup "white" nil nil nil t nil))
491 (cons '(= mark gnus-unread-mark)
492 (custom-face-lookup "white" nil nil nil nil nil))
494 (cons '(> score default) 'bold)
495 (cons '(< score default) 'italic)))
498 (cons '(= mark gnus-canceled-mark)
499 (custom-face-lookup "yellow" "black" nil nil nil nil))
500 (cons '(and (> score default)
501 (or (= mark gnus-dormant-mark)
502 (= mark gnus-ticked-mark)))
503 (custom-face-lookup "firebrick" nil nil t nil nil))
504 (cons '(and (< score default)
505 (or (= mark gnus-dormant-mark)
506 (= mark gnus-ticked-mark)))
507 (custom-face-lookup "firebrick" nil nil nil t nil))
508 (cons '(or (= mark gnus-dormant-mark)
509 (= mark gnus-ticked-mark))
510 (custom-face-lookup "firebrick" nil nil nil nil nil))
512 (cons '(and (> score default) (= mark gnus-ancient-mark))
513 (custom-face-lookup "RoyalBlue" nil nil t nil nil))
514 (cons '(and (< score default) (= mark gnus-ancient-mark))
515 (custom-face-lookup "RoyalBlue" nil nil nil t nil))
516 (cons '(= mark gnus-ancient-mark)
517 (custom-face-lookup "RoyalBlue" nil nil nil nil nil))
519 (cons '(and (> score default) (/= mark gnus-unread-mark))
520 (custom-face-lookup "DarkGreen" nil nil t nil nil))
521 (cons '(and (< score default) (/= mark gnus-unread-mark))
522 (custom-face-lookup "DarkGreen" nil nil nil t nil))
523 (cons '(/= mark gnus-unread-mark)
524 (custom-face-lookup "DarkGreen" nil nil nil nil nil))
526 (cons '(> score default) 'bold)
527 (cons '(< score default) 'italic)))))
540 ;; Do not define `gnus-button-alist' before we have
541 ;; some `complexity' attribute so we can hide it from
545 (defun gnus-custom-import-cite-face-list (custom alist)
546 ;; Backward compatible grokking of light and dark.
547 (cond ((eq alist 'light)
548 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
550 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
551 (funcall (custom-super custom 'import) custom alist))
553 ;(defun gnus-custom-import-swap-alist (custom alist)
554 ; ;; Swap key and value in CUSTOM ALIST.
555 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
556 ; (funcall (custom-super custom 'import) custom swap)))
558 ;(defun gnus-custom-export-swap-alist (custom alist)
559 ; ;; Swap key and value in CUSTOM ALIST.
560 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
561 ; (funcall (custom-super custom 'export) custom swap)))
565 ;;; gnus-cus.el ends here