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
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
32 ;; The following is just helper functions and data, not ment to be set
34 (defun gnus-make-face (color)
35 ;; Create entry for face with COLOR.
36 (custom-face-lookup color nil nil nil nil nil))
38 (defvar gnus-face-light-name-list
39 '("light blue" "light cyan" "light yellow" "light pink"
40 "pale green" "beige" "orange" "magenta" "violet" "medium purple"
43 (defvar gnus-face-dark-name-list
44 '("RoyalBlue" "firebrick"
45 "dark green" "OrangeRed" "dark khaki" "dark violet"
47 ; CornflowerBlue SeaGreen OrangeRed SteelBlue4 DeepPink3
53 The coffe-brewing, all singing, all dancing, kitchen sink newsreader.")
55 (data ((tag . "Visual")
57 GNUS can be made colorful and fun or grey and dull as you wish.")
59 (data ((tag . "Visual")
60 (doc . "Enable visual features.
61 If `visual' is disabled, there will be no menus and few faces. Most of
62 the visual customization options below will be ignored. GNUS will use
63 less space and be faster as a result.")
67 summary-menu group-menu article-menu
68 tree-highlight menu highlight
69 browse-menu server-menu
73 ((tag . "WWW Browser")
75 WWW Browser to call when clicking on an URL button in the article buffer.
77 You can choose between one of the predefined browsers, or `Other'.")
78 (name . gnus-button-url)
79 (calculate . (cond ((boundp 'browse-url-browser-function)
80 browse-url-browser-function)
83 ((eq window-system 'x)
84 'gnus-netscape-open-url)))
91 (default . gnus-netscape-open-url))
94 You must specify the name of a Lisp function here. The lisp function
95 should open a WWW browser when called with an URL (a string).
97 (default . __uninitialized__)
101 Face used for group or summary buffer mouse highlighting.
102 The line beneath the mouse pointer will be highlighted with this
104 (name . gnus-mouse-face)
105 (calculate . (if (boundp 'gnus-mouse-face)
109 ((tag . "Article Display")
110 (doc . "Controls how the article buffer will look.
112 If you leave the list empty, the article will appear exactly as it is
113 stored on the disk. The list entries will hide or highlight various
114 parts of the article, making it easier to find the information you
116 (name . gnus-article-display-hook)
118 (default . (gnus-article-hide-headers-if-wanted
119 gnus-article-hide-boring-headers
120 gnus-article-treat-overstrike
121 gnus-article-maybe-highlight))
122 (data ((type . repeat)
124 (data (tag . "Filter")
126 (data ((tag . "Treat Overstrike")
128 Convert use of overstrike into bold and underline.
130 Two identical letters separated by a backspace are displayed as a
131 single bold letter, while a letter followed by a backspace and an
132 underscore will be displayed as a single underlined letter. This
133 technique was developed for old line printers (think about it), and is
134 still in use on some newsgroups, in particular the ClariNet
139 gnus-article-treat-overstrike))
142 Format too long lines.
145 (default . gnus-article-word-wrap))
148 Remove carriage returns from an article.
151 (default . gnus-article-remove-cr))
152 ((tag . "Display X-Face")
154 Look for an X-Face header and display it if present.
156 See also `X Face Command' for a definition of the external command
157 used for decoding and displaying the face.
160 (default . gnus-article-display-x-face))
161 ((tag . "Unquote Printable")
163 Tranform MIME quoted printable into 8-bit characters.
165 Quoted printable is often seen by strings like `=EF' where you would
166 expect a non-English letter.
170 gnus-article-de-quoted-unreadable))
171 ((tag . "Universal Time")
173 Convert date header to universal time.
176 (default . gnus-article-date-ut))
177 ((tag . "Local Time")
179 Convert date header to local timezone.
182 (default . gnus-article-date-local))
183 ((tag . "Lapsed Time")
185 Replace date header with a header showing the articles age.
188 (default . gnus-article-date-lapsed))
191 Highlight headers, citations, signature, and buttons.
194 (default . gnus-article-highlight))
195 ((tag . "Maybe Highlight")
197 Highlight headers, signature, and buttons if `Visual' is turned on.
201 gnus-article-maybe-highlight))
202 ((tag . "Highlight Some")
204 Highlight headers, signature, and buttons.
207 (default . gnus-article-highlight-some))
208 ((tag . "Highlight Headers")
210 Highlight headers as specified by `Article Header Highligting'.
214 gnus-article-highlight-headers))
215 ((tag . "Highlight Signature")
217 Highlight the signature as specified by `Article Signature Face'.
221 gnus-article-highlight-signature))
224 Highlight the citations as specified by `Citation Faces'.
228 gnus-article-highlight-citation))
231 Hide unwanted headers, excess citation, and the signature.
234 (default . gnus-article-hide))
235 ((tag . "Hide Headers If Wanted")
237 Hide headers, but allow user to display them with `t' or `v'.
241 gnus-article-hide-headers-if-wanted))
242 ((tag . "Hide Headers")
244 Hide unwanted headers and possibly sort them as well.
245 Most likely you want to use `Hide Headers If Wanted' instead.
248 (default . gnus-article-hide-headers))
249 ((tag . "Hide Signature")
254 (default . gnus-article-hide-signature))
255 ((tag . "Hide Excess Citations")
257 Hide excess citation.
259 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
263 gnus-article-hide-citation-maybe))
264 ((tag . "Hide Citations")
269 (default . gnus-article-hide-citation))
270 ((tag . "Add Buttons")
272 Make URL's into clickable buttons.
275 (default . gnus-article-add-buttons))
278 Name of Lisp function to call.
280 Push the `Filter' button to select one of the predefined filters.
282 (type . symbol)))))))
283 ((tag . "Article Button Face")
285 Face used for highlighting buttons in the article buffer.
287 An article button is a piece of text that you can activate by pressing
288 `RET' or `mouse-2' above it.")
289 (name . gnus-article-button-face)
292 ((tag . "Article Mouse Face")
294 Face used for mouse highlighting in the article buffer.
296 Article buttons will be displayed in this face when the cursor is
298 (name . gnus-article-mouse-face)
299 (default . highlight)
301 ((tag . "Article Signature Face")
303 Face used for highlighting a signature in the article buffer.")
304 (name . gnus-signature-face)
307 ((tag . "Article Header Highlighting")
309 Controls highlighting of article header.
311 Below is a list of article header names, and the faces used for
312 displaying the name and content of the header. The `Header' field
313 should contain the name of the header. The field actually contains a
314 regular expression that should match the beginning of the header line,
315 but if you don't know what a regular expression is, just write the
316 name of the header. The second field is the `Name' field, which
317 determines how the the header name (i.e. the part of the header left
318 of the `:') is displayed. The third field is the `Content' field,
319 which determines how the content (i.e. the part of the header right of
320 the `:') is displayed.
322 If you leave the last `Header' field in the list empty, the `Name' and
323 `Content' fields will determine how headers not listed above are
326 If you only want to change the display of the name part for a specific
327 header, specify `None' in the `Content' field. Similarly, specify
328 `None' in the `Name' field if you only want to leave the name part
330 (name . gnus-header-face-alist)
332 (calculate . (cond ((not (eq gnus-display-type 'color))
334 ((eq gnus-background-mode 'dark)
335 (list (list "From" nil
337 "light blue" nil nil t t nil))
340 "pink" nil nil t t nil))
341 (list "Newsgroups:.*," nil
343 "yellow" nil nil t t nil))
346 "cyan" nil nil t nil nil)
349 nil nil nil t nil))))
351 (list (list "From" nil
359 (list "Newsgroups:.*," nil
361 "indianred" nil nil t t nil))
368 nil nil nil t nil))))))
369 (data ((type . repeat)
373 (data ((type . string)
384 ((tag . "Attribution Face")
386 Face used for attribution lines.
387 It is merged with the face for the cited text belonging to the attribution.")
388 (name . gnus-cite-attribution-face)
389 (default . underline)
391 ((tag . "Citation Faces")
393 List of faces used for highlighting citations.
395 When there are citations from multiple articles in the same message,
396 Gnus will try to give each citation from each article its own face.
397 This should make it easier to see who wrote what.")
398 (name . gnus-cite-face-list)
399 (import . gnus-custom-import-cite-face-list)
401 (calculate . (cond ((not (eq gnus-display-type 'color))
403 ((eq gnus-background-mode 'dark)
404 (mapcar 'gnus-make-face
405 gnus-face-light-name-list))
407 (mapcar 'gnus-make-face
408 gnus-face-dark-name-list))))
409 (data ((type . repeat)
413 ((tag . "Citation Hide Percentage")
415 Only hide excess citation if above this percentage of the body.")
416 (name . gnus-cite-hide-percentage)
419 ((tag . "Citation Hide Absolute")
421 Only hide excess citation if above this number of lines in the body.")
422 (name . gnus-cite-hide-absolute)
425 ((tag . "Summary Selected Face")
427 Face used for highlighting the current article in the summary buffer.")
428 (name . gnus-summary-selected-face)
429 (default . underline)
431 ((tag . "Summary Line Highlighting")
433 Controls the higlighting of summary buffer lines.
435 Below is a list of `Form'/`Face' pairs. When deciding how a a
436 particular summary line should be displayed, each form is
437 evaluated. The content of the face field after the first true form is
438 used. You can change how those summary lines are displayed, by
439 editing the face field.
441 It is also possible to change and add form fields, but currently that
442 requires an understanding of Lisp expressions. Hopefully this will
443 change in a future release. For now, you can use the following
444 variables in the Lisp expression:
446 score: The article's score
447 default: The default article score.
448 below: The score below which articles are automatically marked as read.
449 mark: The article's mark.")
450 (name . gnus-summary-highlight)
452 (calculate . (cond ((not (eq gnus-display-type 'color))
453 '(((> score default) . bold)
454 ((< score default) . italic)))
455 ((eq gnus-background-mode 'dark)
456 (list (cons '(= mark gnus-canceled-mark)
457 (custom-face-lookup "yellow" "black" nil nil nil nil))
458 (cons '(and (> score default)
459 (or (= mark gnus-dormant-mark)
460 (= mark gnus-ticked-mark)))
461 (custom-face-lookup "pink" nil nil t nil nil))
462 (cons '(and (< score default)
463 (or (= mark gnus-dormant-mark)
464 (= mark gnus-ticked-mark)))
465 (custom-face-lookup "pink" nil nil nil t nil))
466 (cons '(or (= mark gnus-dormant-mark)
467 (= mark gnus-ticked-mark))
468 (custom-face-lookup "pink" nil nil nil nil nil))
470 (cons '(and (> score default) (= mark gnus-ancient-mark))
471 (custom-face-lookup "dark blue" nil nil t nil nil))
472 (cons '(and (< score default) (= mark gnus-ancient-mark))
473 (custom-face-lookup "SkyBlue" nil nil nil t nil))
474 (cons '(= mark gnus-ancient-mark)
475 (custom-face-lookup "SkyBlue" nil nil nil nil nil))
477 (cons '(and (> score default) (= mark gnus-unread-mark))
478 (custom-face-lookup "white" nil nil t nil nil))
479 (cons '(and (< score default) (= mark gnus-unread-mark))
480 (custom-face-lookup "white" nil nil nil t nil))
481 (cons '(= mark gnus-unread-mark)
482 (custom-face-lookup "white" nil nil nil nil nil))
484 (cons '(> score default) 'bold)
485 (cons '(< score default) 'italic)))
487 (list (cons '(= mark gnus-canceled-mark)
488 (custom-face-lookup "yellow" "black" nil nil nil nil))
489 (cons '(and (> score default)
490 (or (= mark gnus-dormant-mark)
491 (= mark gnus-ticked-mark)))
492 (custom-face-lookup "firebrick" nil nil t nil nil))
493 (cons '(and (< score default)
494 (or (= mark gnus-dormant-mark)
495 (= mark gnus-ticked-mark)))
496 (custom-face-lookup "firebrick" nil nil nil t nil))
497 (cons '(or (= mark gnus-dormant-mark)
498 (= mark gnus-ticked-mark))
499 (custom-face-lookup "firebrick" nil nil nil nil nil))
501 (cons '(and (> score default) (= mark gnus-ancient-mark))
502 (custom-face-lookup "RoyalBlue" nil nil t nil nil))
503 (cons '(and (< score default) (= mark gnus-ancient-mark))
504 (custom-face-lookup "RoyalBlue" nil nil nil t nil))
505 (cons '(= mark gnus-ancient-mark)
506 (custom-face-lookup "RoyalBlue" nil nil nil nil nil))
508 (cons '(and (> score default) (/= mark gnus-unread-mark))
509 (custom-face-lookup "DarkGreen" nil nil t nil nil))
510 (cons '(and (< score default) (/= mark gnus-unread-mark))
511 (custom-face-lookup "DarkGreen" nil nil nil t nil))
512 (cons '(/= mark gnus-unread-mark)
513 (custom-face-lookup "DarkGreen" nil nil nil nil nil))
515 (cons '(> score default) 'bold)
516 (cons '(< score default) 'italic)))))
517 (data ((type . repeat)
528 ;; Do not define `gnus-button-alist' before we have
529 ;; some `complexity' attribute so we can hide it from
533 (defun gnus-custom-import-cite-face-list (custom alist)
534 ;; Backward compatible groking of light and dark.
535 (cond ((eq alist 'light)
536 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
538 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
539 (funcall (custom-super custom 'import) custom alist))
541 ;(defun gnus-custom-import-swap-alist (custom alist)
542 ; ;; Swap key and value in CUSTOM ALIST.
543 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
544 ; (funcall (custom-super custom 'import) custom swap)))
546 ;(defun gnus-custom-export-swap-alist (custom alist)
547 ; ;; Swap key and value in CUSTOM ALIST.
548 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
549 ; (funcall (custom-super custom 'export) custom swap)))
553 ;;; gnus-cus.el ends here