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.
33 ;; The following is just helper functions and data, not ment to be set
35 (defun gnus-make-face (color)
36 ;; Create entry for face with COLOR.
37 (custom-face-lookup color nil nil nil nil nil))
39 (defvar gnus-face-light-name-list
40 '("light blue" "light cyan" "light yellow" "light pink"
41 "pale green" "beige" "orange" "magenta" "violet" "medium purple"
44 (defvar gnus-face-dark-name-list
45 '("RoyalBlue" "firebrick"
46 "dark green" "OrangeRed" "dark khaki" "dark violet"
48 ; CornflowerBlue SeaGreen OrangeRed SteelBlue4 DeepPink3
54 The coffee-brewing, all singing, all dancing, kitchen sink newsreader.")
56 (data ((tag . "Visual")
58 GNUS can be made colorful and fun or grey and dull as you wish.")
60 (data ((tag . "Visual")
61 (doc . "Enable visual features.
62 If `visual' is disabled, there will be no menus and few faces. Most of
63 the visual customization options below will be ignored. GNUS will use
64 less space and be faster as a result.")
66 (summary-highlight group-highlight
68 summary-menu group-menu article-menu
69 tree-highlight menu highlight
70 browse-menu server-menu
74 ((tag . "WWW Browser")
76 WWW Browser to call when clicking on an URL button in the article buffer.
78 You can choose between one of the predefined browsers, or `Other'.")
79 (name . browse-url-browser-function)
80 (calculate . (cond ((boundp 'browse-url-browser-function)
81 browse-url-browser-function)
84 ((eq window-system 'x)
85 'gnus-netscape-open-url)))
92 (default . browse-url-netscape))
95 You must specify the name of a Lisp function here. The lisp function
96 should open a WWW browser when called with an URL (a string).
98 (default . __uninitialized__)
100 ((tag . "Mouse Face")
102 Face used for group or summary buffer mouse highlighting.
103 The line beneath the mouse pointer will be highlighted with this
105 (name . gnus-mouse-face)
106 (calculate . (if (boundp 'gnus-mouse-face)
110 ((tag . "Article Display")
111 (doc . "Controls how the article buffer will look.
113 If you leave the list empty, the article will appear exactly as it is
114 stored on the disk. The list entries will hide or highlight various
115 parts of the article, making it easier to find the information you
117 (name . gnus-article-display-hook)
119 (default . (gnus-article-hide-headers-if-wanted
120 gnus-article-hide-boring-headers
121 gnus-article-treat-overstrike
122 gnus-article-maybe-highlight))
123 (data ((type . repeat)
125 (data (tag . "Filter")
127 (data ((tag . "Treat Overstrike")
129 Convert use of overstrike into bold and underline.
131 Two identical letters separated by a backspace are displayed as a
132 single bold letter, while a letter followed by a backspace and an
133 underscore will be displayed as a single underlined letter. This
134 technique was developed for old line printers (think about it), and is
135 still in use on some newsgroups, in particular the ClariNet
140 gnus-article-treat-overstrike))
143 Format too long lines.
146 (default . gnus-article-word-wrap))
149 Remove carriage returns from an article.
152 (default . gnus-article-remove-cr))
153 ((tag . "Display X-Face")
155 Look for an X-Face header and display it if present.
157 See also `X Face Command' for a definition of the external command
158 used for decoding and displaying the face.
161 (default . gnus-article-display-x-face))
162 ((tag . "Unquote Printable")
164 Transform MIME quoted printable into 8-bit characters.
166 Quoted printable is often seen by strings like `=EF' where you would
167 expect a non-English letter.
171 gnus-article-de-quoted-unreadable))
172 ((tag . "Universal Time")
174 Convert date header to universal time.
177 (default . gnus-article-date-ut))
178 ((tag . "Local Time")
180 Convert date header to local timezone.
183 (default . gnus-article-date-local))
184 ((tag . "Lapsed Time")
186 Replace date header with a header showing the articles age.
189 (default . gnus-article-date-lapsed))
192 Highlight headers, citations, signature, and buttons.
195 (default . gnus-article-highlight))
196 ((tag . "Maybe Highlight")
198 Highlight headers, signature, and buttons if `Visual' is turned on.
202 gnus-article-maybe-highlight))
203 ((tag . "Highlight Some")
205 Highlight headers, signature, and buttons.
208 (default . gnus-article-highlight-some))
209 ((tag . "Highlight Headers")
211 Highlight headers as specified by `Article Header Highlighting'.
215 gnus-article-highlight-headers))
216 ((tag . "Highlight Signature")
218 Highlight the signature as specified by `Article Signature Face'.
222 gnus-article-highlight-signature))
225 Highlight the citations as specified by `Citation Faces'.
229 gnus-article-highlight-citation))
232 Hide unwanted headers, excess citation, and the signature.
235 (default . gnus-article-hide))
236 ((tag . "Hide Headers If Wanted")
238 Hide headers, but allow user to display them with `t' or `v'.
242 gnus-article-hide-headers-if-wanted))
243 ((tag . "Hide Headers")
245 Hide unwanted headers and possibly sort them as well.
246 Most likely you want to use `Hide Headers If Wanted' instead.
249 (default . gnus-article-hide-headers))
250 ((tag . "Hide Signature")
255 (default . gnus-article-hide-signature))
256 ((tag . "Hide Excess Citations")
258 Hide excess citation.
260 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
264 gnus-article-hide-citation-maybe))
265 ((tag . "Hide Citations")
270 (default . gnus-article-hide-citation))
271 ((tag . "Add Buttons")
273 Make URL's into clickable buttons.
276 (default . gnus-article-add-buttons))
279 Name of Lisp function to call.
281 Push the `Filter' button to select one of the predefined filters.
283 (type . symbol)))))))
284 ((tag . "Article Button Face")
286 Face used for highlighting buttons in the article buffer.
288 An article button is a piece of text that you can activate by pressing
289 `RET' or `mouse-2' above it.")
290 (name . gnus-article-button-face)
293 ((tag . "Article Mouse Face")
295 Face used for mouse highlighting in the article buffer.
297 Article buttons will be displayed in this face when the cursor is
299 (name . gnus-article-mouse-face)
300 (default . highlight)
302 ((tag . "Article Signature Face")
304 Face used for highlighting a signature in the article buffer.")
305 (name . gnus-signature-face)
308 ((tag . "Article Header Highlighting")
310 Controls highlighting of article header.
312 Below is a list of article header names, and the faces used for
313 displaying the name and content of the header. The `Header' field
314 should contain the name of the header. The field actually contains a
315 regular expression that should match the beginning of the header line,
316 but if you don't know what a regular expression is, just write the
317 name of the header. The second field is the `Name' field, which
318 determines how the the header name (i.e. the part of the header left
319 of the `:') is displayed. The third field is the `Content' field,
320 which determines how the content (i.e. the part of the header right of
321 the `:') is displayed.
323 If you leave the last `Header' field in the list empty, the `Name' and
324 `Content' fields will determine how headers not listed above are
327 If you only want to change the display of the name part for a specific
328 header, specify `None' in the `Content' field. Similarly, specify
329 `None' in the `Name' field if you only want to leave the name part
331 (name . gnus-header-face-alist)
333 (calculate . (cond ((not (eq gnus-display-type 'color))
335 ((eq gnus-background-mode 'dark)
336 (list (list "From" nil
338 "light blue" nil nil t t nil))
341 "pink" nil nil t t nil))
342 (list "Newsgroups:.*," nil
344 "yellow" nil nil t t nil))
347 "cyan" nil nil t nil nil)
350 nil nil nil t nil))))
352 (list (list "From" nil
360 (list "Newsgroups:.*," nil
362 "indianred" nil nil t t nil))
369 nil nil nil t nil))))))
370 (data ((type . repeat)
374 (data ((type . string)
385 ((tag . "Attribution Face")
387 Face used for attribution lines.
388 It is merged with the face for the cited text belonging to the attribution.")
389 (name . gnus-cite-attribution-face)
390 (default . underline)
392 ((tag . "Citation Faces")
394 List of faces used for highlighting citations.
396 When there are citations from multiple articles in the same message,
397 Gnus will try to give each citation from each article its own face.
398 This should make it easier to see who wrote what.")
399 (name . gnus-cite-face-list)
400 (import . gnus-custom-import-cite-face-list)
402 (calculate . (cond ((not (eq gnus-display-type 'color))
404 ((eq gnus-background-mode 'dark)
405 (mapcar 'gnus-make-face
406 gnus-face-light-name-list))
408 (mapcar 'gnus-make-face
409 gnus-face-dark-name-list))))
410 (data ((type . repeat)
414 ((tag . "Citation Hide Percentage")
416 Only hide excess citation if above this percentage of the body.")
417 (name . gnus-cite-hide-percentage)
420 ((tag . "Citation Hide Absolute")
422 Only hide excess citation if above this number of lines in the body.")
423 (name . gnus-cite-hide-absolute)
426 ((tag . "Summary Selected Face")
428 Face used for highlighting the current article in the summary buffer.")
429 (name . gnus-summary-selected-face)
430 (default . underline)
432 ((tag . "Summary Line Highlighting")
434 Controls the highlighting of summary buffer lines.
436 Below is a list of `Form'/`Face' pairs. When deciding how a a
437 particular summary line should be displayed, each form is
438 evaluated. The content of the face field after the first true form is
439 used. You can change how those summary lines are displayed, by
440 editing the face field.
442 It is also possible to change and add form fields, but currently that
443 requires an understanding of Lisp expressions. Hopefully this will
444 change in a future release. For now, you can use the following
445 variables in the Lisp expression:
447 score: The article's score
448 default: The default article score.
449 below: The score below which articles are automatically marked as read.
450 mark: The article's mark.")
451 (name . gnus-summary-highlight)
453 (calculate . (cond ((not (eq gnus-display-type 'color))
454 '(((> score default) . bold)
455 ((< score default) . italic)))
456 ((eq gnus-background-mode 'dark)
457 (list (cons '(= mark gnus-canceled-mark)
458 (custom-face-lookup "yellow" "black" nil nil nil nil))
459 (cons '(and (> score default)
460 (or (= mark gnus-dormant-mark)
461 (= mark gnus-ticked-mark)))
462 (custom-face-lookup "pink" nil nil t nil nil))
463 (cons '(and (< score default)
464 (or (= mark gnus-dormant-mark)
465 (= mark gnus-ticked-mark)))
466 (custom-face-lookup "pink" nil nil nil t nil))
467 (cons '(or (= mark gnus-dormant-mark)
468 (= mark gnus-ticked-mark))
469 (custom-face-lookup "pink" nil nil nil nil nil))
471 (cons '(and (> score default) (= mark gnus-ancient-mark))
472 (custom-face-lookup "dark blue" nil nil t nil nil))
473 (cons '(and (< score default) (= mark gnus-ancient-mark))
474 (custom-face-lookup "SkyBlue" nil nil nil t nil))
475 (cons '(= mark gnus-ancient-mark)
476 (custom-face-lookup "SkyBlue" nil nil nil nil nil))
478 (cons '(and (> score default) (= mark gnus-unread-mark))
479 (custom-face-lookup "white" nil nil t nil nil))
480 (cons '(and (< score default) (= mark gnus-unread-mark))
481 (custom-face-lookup "white" nil nil nil t nil))
482 (cons '(= mark gnus-unread-mark)
483 (custom-face-lookup "white" nil nil nil nil nil))
485 (cons '(> score default) 'bold)
486 (cons '(< score default) 'italic)))
488 (list (cons '(= mark gnus-canceled-mark)
489 (custom-face-lookup "yellow" "black" nil nil nil nil))
490 (cons '(and (> score default)
491 (or (= mark gnus-dormant-mark)
492 (= mark gnus-ticked-mark)))
493 (custom-face-lookup "firebrick" nil nil t nil nil))
494 (cons '(and (< score default)
495 (or (= mark gnus-dormant-mark)
496 (= mark gnus-ticked-mark)))
497 (custom-face-lookup "firebrick" nil nil nil t nil))
498 (cons '(or (= mark gnus-dormant-mark)
499 (= mark gnus-ticked-mark))
500 (custom-face-lookup "firebrick" nil nil nil nil nil))
502 (cons '(and (> score default) (= mark gnus-ancient-mark))
503 (custom-face-lookup "RoyalBlue" nil nil t nil nil))
504 (cons '(and (< score default) (= mark gnus-ancient-mark))
505 (custom-face-lookup "RoyalBlue" nil nil nil t nil))
506 (cons '(= mark gnus-ancient-mark)
507 (custom-face-lookup "RoyalBlue" nil nil nil nil nil))
509 (cons '(and (> score default) (/= mark gnus-unread-mark))
510 (custom-face-lookup "DarkGreen" nil nil t nil nil))
511 (cons '(and (< score default) (/= mark gnus-unread-mark))
512 (custom-face-lookup "DarkGreen" nil nil nil t nil))
513 (cons '(/= mark gnus-unread-mark)
514 (custom-face-lookup "DarkGreen" nil nil nil nil nil))
516 (cons '(> score default) 'bold)
517 (cons '(< score default) 'italic)))))
518 (data ((type . repeat)
529 ;; Do not define `gnus-button-alist' before we have
530 ;; some `complexity' attribute so we can hide it from
534 (defun gnus-custom-import-cite-face-list (custom alist)
535 ;; Backward compatible grokking of light and dark.
536 (cond ((eq alist 'light)
537 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
539 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
540 (funcall (custom-super custom 'import) custom alist))
542 ;(defun gnus-custom-import-swap-alist (custom alist)
543 ; ;; Swap key and value in CUSTOM ALIST.
544 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
545 ; (funcall (custom-super custom 'import) custom swap)))
547 ;(defun gnus-custom-export-swap-alist (custom alist)
548 ; ;; Swap key and value in CUSTOM ALIST.
549 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
550 ; (funcall (custom-super custom 'export) custom swap)))
554 ;;; gnus-cus.el ends here