1 ;;; gnus-cus.el --- User friendly customization of Gnus
2 ;; Copyright (C) 1995 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.
31 ;; The following is just helper functions and data, not ment to be set
33 (defun gnus-make-face (color)
34 ;; Create entry for face with COLOR.
35 (custom-face-lookup color nil nil nil nil nil))
37 (defvar gnus-face-light-name-list
38 '("light blue" "light cyan" "light yellow" "light pink"
39 "pale green" "beige" "orange" "magenta" "violet" "medium purple"
42 (defvar gnus-face-dark-name-list
43 '("RoyalBlue" "firebrick"
44 "dark green" "OrangeRed" "dark khaki" "dark violet"
46 ; CornflowerBlue SeaGreen OrangeRed SteelBlue4 DeepPink3
52 The coffe-brewing, all singing, all dancing, kitchen sink newsreader.")
54 (data ((tag . "Visual")
56 GNUS can be made colorful and fun or grey and dull as you wish.")
58 (data ((tag . "Visual")
59 (doc . "Enable visual features.
60 If `visual' is disabled, there will be no menus and few faces. Most of
61 the visual customization options below will be ignored. GNUS will use
62 less space and be faster as a result.")
66 summary-menu group-menu article-menu
67 browse-menu server-menu))
70 ((tag . "WWW Browser")
72 WWW Browser to call when clicking on an URL button in the article buffer.
74 You can choose between one of the predefined browsers, or `Other'.")
75 (name . gnus-button-url)
76 (calculate . (cond ((boundp 'browse-url-browser-function)
77 browse-url-browser-function)
80 ((eq window-system 'x)
81 'gnus-netscape-open-url)))
88 (default . gnus-netscape-open-url))
91 You must specify the name of a Lisp function here. The lisp function
92 should open a WWW browser when called with an URL (a string).
94 (default . __uninitialized__)
98 Face used for group or summary buffer mouse highlighting.
99 The line beneath the mouse pointer will be highlighted with this
101 (name . gnus-mouse-face)
102 (calculate . (if (boundp 'gnus-mouse-face)
106 ((tag . "Article Display")
107 (doc . "Controls how the article buffer will look.
109 If you leave the list empty, the article will appear exactly as it is
110 stored on the disk. The list entries will hide or highlight various
111 parts of the article, making it easier to find the information you
113 (name . gnus-article-display-hook)
115 (default . (gnus-article-hide-headers-if-wanted
116 gnus-article-treat-overstrike
117 gnus-article-maybe-highlight))
118 (data ((type . repeat)
120 (data (tag . "Filter")
122 (data ((tag . "Treat Overstrike")
124 Convert use of overstrike into bold and underline.
126 Two identical letters separated by a backspace are displayed as a
127 single bold letter, while a letter followed by a backspace and an
128 underscore will be displayed as a single underlined letter. This
129 technique was developed for old line printers (think about it), and is
130 still in use on some newsgroups, in particular the ClariNet
135 gnus-article-treat-overstrike))
138 Format too long lines.
141 (default . gnus-article-word-wrap))
144 Remove carriage returns from an article.
147 (default . gnus-article-remove-cr))
148 ((tag . "Display X-Face")
150 Look for an X-Face header and display it if present.
152 See also `X Face Command' for a definition of the external command
153 used for decoding and displaying the face.
156 (default . gnus-article-display-x-face))
157 ((tag . "Unquote Printable")
159 Tranform MIME quoted printable into 8-bit characters.
161 Quoted printable is often seen by strings like `=EF' where you would
162 expect a non-English letter.
166 gnus-article-de-quoted-unreadable))
167 ((tag . "Universal Time")
169 Convert date header to universal time.
172 (default . gnus-article-date-ut))
173 ((tag . "Local Time")
175 Convert date header to local timezone.
178 (default . gnus-article-date-local))
179 ((tag . "Lapsed Time")
181 Replace date header with a header showing the articles age.
184 (default . gnus-article-date-lapsed))
187 Highlight headers, citations, signature, and buttons.
190 (default . gnus-article-highlight))
191 ((tag . "Maybe Highlight")
193 Highlight headers, signature, and buttons if `Visual' is turned on.
197 gnus-article-maybe-highlight))
198 ((tag . "Highlight Some")
200 Highlight headers, signature, and buttons.
203 (default . gnus-article-highlight-some))
204 ((tag . "Highlight Headers")
206 Highlight headers as specified by `Article Header Highligting'.
210 gnus-article-highlight-headers))
211 ((tag . "Highlight Signature")
213 Highlight the signature as specified by `Article Signature Face'.
217 gnus-article-highlight-signature))
220 Highlight the citations as specified by `Citation Faces'.
224 gnus-article-highlight-citation))
227 Hide unwanted headers, excess citation, and the signature.
230 (default . gnus-article-hide))
231 ((tag . "Hide Headers If Wanted")
233 Hide headers, but allow user to display them with `t' or `v'.
237 gnus-article-hide-headers-if-wanted))
238 ((tag . "Hide Headers")
240 Hide unwanted headers and possibly sort them as well.
241 Most likely you want to use `Hide Headers If Wanted' instead.
244 (default . gnus-article-hide-headers))
245 ((tag . "Hide Signature")
250 (default . gnus-article-hide-signature))
251 ((tag . "Hide Excess Citations")
253 Hide excess citation.
255 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
259 gnus-article-hide-citation-maybe))
260 ((tag . "Hide Citations")
265 (default . gnus-article-hide-citation))
266 ((tag . "Add Buttons")
268 Make URL's into clickable buttons.
271 (default . gnus-article-add-buttons))
274 Name of Lisp function to call.
276 Push the `Filter' button to select one of the predefined filters.
278 (type . symbol)))))))
279 ((tag . "Article Button Face")
281 Face used for highlighting buttons in the article buffer.
283 An article button is a piece of text that you can activate by pressing
284 `RET' or `mouse-2' above it.")
285 (name . gnus-article-button-face)
288 ((tag . "Article Mouse Face")
290 Face used for mouse highlighting in the article buffer.
292 Article buttons will be displayed in this face when the cursor is
294 (name . gnus-article-mouse-face)
295 (default . highlight)
297 ((tag . "Article Signature Face")
299 Face used for highlighting a signature in the article buffer.")
300 (name . gnus-signature-face)
303 ((tag . "Article Header Highlighting")
305 Controls highlighting of article header.
307 Below is a list of article header names, and the faces used for
308 displaying the name and content of the header. The `Header' field
309 should contain the name of the header. The field actually contains a
310 regular expression that should match the beginning of the header line,
311 but if you don't know what a regular expression is, just write the
312 name of the header. The second field is the `Name' field, which
313 determines how the the header name (i.e. the part of the header left
314 of the `:') is displayed. The third field is the `Content' field,
315 which determines how the content (i.e. the part of the header right of
316 the `:') is displayed.
318 If you leave the last `Header' field in the list empty, the `Name' and
319 `Content' fields will determine how headers not listed above are
322 If you only want to change the display of the name part for a specific
323 header, specify `None' in the `Content' field. Similarly, specify
324 `None' in the `Name' field if you only want to leave the name part
326 (name . gnus-header-face-alist)
328 (calculate . (cond ((not (eq gnus-display-type 'color))
330 ((eq gnus-background-mode 'dark)
331 (list (list "From" nil
333 "dark blue" nil nil t t nil))
336 "pink" nil nil t t nil))
337 (list "Newsgroups:.*," nil
339 "yellow" nil nil t t nil))
342 "cyan" nil nil t nil nil)
345 nil nil nil t nil))))
347 (list (list "From" nil
355 (list "Newsgroups:.*," nil
357 "indianred" nil nil t t nil))
364 nil nil nil t nil))))))
365 (data ((type . repeat)
369 (data ((type . string)
380 ((tag . "Attribution Face")
382 Face used for attribution lines.
383 It is merged with the face for the cited text belonging to the attribution.")
384 (name . gnus-cite-attribution-face)
385 (default . underline)
387 ((tag . "Citation Faces")
389 List of faces used for highlighting citations.
391 When there are citations from multiple articles in the same message,
392 Gnus will try to give each citation from each article its own face.
393 This should make it easier to see who wrote what.")
394 (name . gnus-cite-face-list)
395 (import . gnus-custom-import-cite-face-list)
397 (calculate . (cond ((not (eq gnus-display-type 'color))
399 ((eq gnus-background-mode 'dark)
400 (mapcar 'gnus-make-face
401 gnus-face-light-name-list))
403 (mapcar 'gnus-make-face
404 gnus-face-dark-name-list))))
405 (data ((type . repeat)
409 ((tag . "Citation Hide Percentage")
411 Only hide excess citation if above this percentage of the body.")
412 (name . gnus-cite-hide-percentage)
415 ((tag . "Citation Hide Absolute")
417 Only hide excess citation if above this number of lines in the body.")
418 (name . gnus-cite-hide-absolute)
421 ((tag . "Summary Selected Face")
423 Face used for highlighting the current article in the summary buffer.")
424 (name . gnus-summary-selected-face)
425 (default . underline)
427 ((tag . "Summary Line Highlighting")
429 Controls the higlighting of summary buffer lines.
431 Below is a list of `Form'/`Face' pairs. When deciding how a a
432 particular summary line should be displayed, each form is
433 evaluated. The content of the face field after the first true form is
434 used. You can change how those summary lines are displayed, by
435 editing the face field.
437 It is also possible to change and add form fields, but currently that
438 requires an understanding of Lisp expressions. Hopefully this will
439 change in a future release. For now, you can use the following
440 variables in the Lisp expression:
442 score: The article's score
443 default: The default article score.
444 below: The score below which articles are automatically marked as read.
445 mark: The article's mark.")
446 (name . gnus-summary-highlight)
448 (calculate . (cond ((not (eq gnus-display-type 'color))
449 '(((> score default) . bold)
450 ((< score default) . italic)))
451 ((eq gnus-background-mode 'dark)
452 (list (cons '(= mark gnus-canceled-mark)
453 (custom-face-lookup "yellow" "black" nil nil nil nil))
454 (cons '(and (> score default)
455 (or (= mark gnus-dormant-mark)
456 (= mark gnus-ticked-mark)))
457 (custom-face-lookup "pink" nil nil t 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 nil t nil))
462 (cons '(or (= mark gnus-dormant-mark)
463 (= mark gnus-ticked-mark))
464 (custom-face-lookup "pink" nil nil nil nil nil))
466 (cons '(and (> score default) (= mark gnus-ancient-mark))
467 (custom-face-lookup "dark blue" nil nil t nil nil))
468 (cons '(and (< score default) (= mark gnus-ancient-mark))
469 (custom-face-lookup "SkyBlue" nil nil nil t nil))
470 (cons '(= mark gnus-ancient-mark)
471 (custom-face-lookup "SkyBlue" nil nil nil nil nil))
473 (cons '(and (> score default) (= mark gnus-unread-mark))
474 (custom-face-lookup "white" nil nil t nil nil))
475 (cons '(and (< score default) (= mark gnus-unread-mark))
476 (custom-face-lookup "white" nil nil nil t nil))
477 (cons '(= mark gnus-unread-mark)
478 (custom-face-lookup "white" nil nil nil nil nil))
480 (cons '(> score default) 'bold)
481 (cons '(< score default) 'italic)))
483 (list (cons '(= mark gnus-canceled-mark)
484 (custom-face-lookup "yellow" "black" nil nil nil nil))
485 (cons '(and (> score default)
486 (or (= mark gnus-dormant-mark)
487 (= mark gnus-ticked-mark)))
488 (custom-face-lookup "firebrick" nil nil t 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 nil t nil))
493 (cons '(or (= mark gnus-dormant-mark)
494 (= mark gnus-ticked-mark))
495 (custom-face-lookup "firebrick" nil nil nil nil nil))
497 (cons '(and (> score default) (= mark gnus-ancient-mark))
498 (custom-face-lookup "RoyalBlue" nil nil t nil nil))
499 (cons '(and (< score default) (= mark gnus-ancient-mark))
500 (custom-face-lookup "RoyalBlue" nil nil nil t nil))
501 (cons '(= mark gnus-ancient-mark)
502 (custom-face-lookup "RoyalBlue" nil nil nil nil nil))
504 (cons '(and (> score default) (/= mark gnus-unread-mark))
505 (custom-face-lookup "DarkGreen" nil nil t nil nil))
506 (cons '(and (< score default) (/= mark gnus-unread-mark))
507 (custom-face-lookup "DarkGreen" nil nil nil t nil))
508 (cons '(/= mark gnus-unread-mark)
509 (custom-face-lookup "DarkGreen" nil nil nil nil nil))
511 (cons '(> score default) 'bold)
512 (cons '(< score default) 'italic)))))
513 (data ((type . repeat)
524 ;; Do not define `gnus-button-alist' before we have
525 ;; some `complexity' attribute so we can hide it from
529 (defun gnus-custom-import-cite-face-list (custom alist)
530 ;; Backward compatible groking of light and dark.
531 (cond ((eq alist 'light)
532 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
534 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
535 (funcall (custom-super custom 'import) custom alist))
537 ;(defun gnus-custom-import-swap-alist (custom alist)
538 ; ;; Swap key and value in CUSTOM ALIST.
539 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
540 ; (funcall (custom-super custom 'import) custom swap)))
542 ;(defun gnus-custom-export-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 'export) custom swap)))
549 ;;; gnus-cus.el ends here