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.")
57 (data ((tag . "Visual")
59 GNUS can be made colorful and fun or grey and dull as you wish.")
61 (data ((tag . "Visual")
62 (doc . "Enable visual features.
63 If `visual' is disabled, there will be no menus and few faces. Most of
64 the visual customization options below will be ignored. GNUS will use
65 less space and be faster as a result.")
67 (summary-highlight group-highlight
69 summary-menu group-menu article-menu
70 tree-highlight menu highlight
71 browse-menu server-menu
75 ((tag . "WWW Browser")
77 WWW Browser to call when clicking on an URL button in the article buffer.
79 You can choose between one of the predefined browsers, or `Other'.")
80 (name . browse-url-browser-function)
81 (calculate . (cond ((boundp 'browse-url-browser-function)
82 browse-url-browser-function)
85 ((eq window-system 'x)
86 'gnus-netscape-open-url)))
93 (default . browse-url-netscape))
96 You must specify the name of a Lisp function here. The lisp function
97 should open a WWW browser when called with an URL (a string).
99 (default . __uninitialized__)
101 ((tag . "Mouse Face")
103 Face used for group or summary buffer mouse highlighting.
104 The line beneath the mouse pointer will be highlighted with this
106 (name . gnus-mouse-face)
107 (calculate . (if (boundp 'gnus-mouse-face)
111 ((tag . "Article Display")
112 (doc . "Controls how the article buffer will look.
114 If you leave the list empty, the article will appear exactly as it is
115 stored on the disk. The list entries will hide or highlight various
116 parts of the article, making it easier to find the information you
118 (name . gnus-article-display-hook)
120 (default . (gnus-article-hide-headers-if-wanted
121 gnus-article-hide-boring-headers
122 gnus-article-treat-overstrike
123 gnus-article-maybe-highlight))
124 (data ((type . repeat)
126 (data (tag . "Filter")
128 (data ((tag . "Treat Overstrike")
130 Convert use of overstrike into bold and underline.
132 Two identical letters separated by a backspace are displayed as a
133 single bold letter, while a letter followed by a backspace and an
134 underscore will be displayed as a single underlined letter. This
135 technique was developed for old line printers (think about it), and is
136 still in use on some newsgroups, in particular the ClariNet
141 gnus-article-treat-overstrike))
144 Format too long lines.
147 (default . gnus-article-word-wrap))
150 Remove carriage returns from an article.
153 (default . gnus-article-remove-cr))
154 ((tag . "Display X-Face")
156 Look for an X-Face header and display it if present.
158 See also `X Face Command' for a definition of the external command
159 used for decoding and displaying the face.
162 (default . gnus-article-display-x-face))
163 ((tag . "Unquote Printable")
165 Transform MIME quoted printable into 8-bit characters.
167 Quoted printable is often seen by strings like `=EF' where you would
168 expect a non-English letter.
172 gnus-article-de-quoted-unreadable))
173 ((tag . "Universal Time")
175 Convert date header to universal time.
178 (default . gnus-article-date-ut))
179 ((tag . "Local Time")
181 Convert date header to local timezone.
184 (default . gnus-article-date-local))
185 ((tag . "Lapsed Time")
187 Replace date header with a header showing the articles age.
190 (default . gnus-article-date-lapsed))
193 Highlight headers, citations, signature, and buttons.
196 (default . gnus-article-highlight))
197 ((tag . "Maybe Highlight")
199 Highlight headers, signature, and buttons if `Visual' is turned on.
203 gnus-article-maybe-highlight))
204 ((tag . "Highlight Some")
206 Highlight headers, signature, and buttons.
209 (default . gnus-article-highlight-some))
210 ((tag . "Highlight Headers")
212 Highlight headers as specified by `Article Header Highlighting'.
216 gnus-article-highlight-headers))
217 ((tag . "Highlight Signature")
219 Highlight the signature as specified by `Article Signature Face'.
223 gnus-article-highlight-signature))
226 Highlight the citations as specified by `Citation Faces'.
230 gnus-article-highlight-citation))
233 Hide unwanted headers, excess citation, and the signature.
236 (default . gnus-article-hide))
237 ((tag . "Hide Headers If Wanted")
239 Hide headers, but allow user to display them with `t' or `v'.
243 gnus-article-hide-headers-if-wanted))
244 ((tag . "Hide Headers")
246 Hide unwanted headers and possibly sort them as well.
247 Most likely you want to use `Hide Headers If Wanted' instead.
250 (default . gnus-article-hide-headers))
251 ((tag . "Hide Signature")
256 (default . gnus-article-hide-signature))
257 ((tag . "Hide Excess Citations")
259 Hide excess citation.
261 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
265 gnus-article-hide-citation-maybe))
266 ((tag . "Hide Citations")
271 (default . gnus-article-hide-citation))
272 ((tag . "Add Buttons")
274 Make URL's into clickable buttons.
277 (default . gnus-article-add-buttons))
280 Name of Lisp function to call.
282 Push the `Filter' button to select one of the predefined filters.
284 (type . symbol)))))))
285 ((tag . "Article Button Face")
287 Face used for highlighting buttons in the article buffer.
289 An article button is a piece of text that you can activate by pressing
290 `RET' or `mouse-2' above it.")
291 (name . gnus-article-button-face)
294 ((tag . "Article Mouse Face")
296 Face used for mouse highlighting in the article buffer.
298 Article buttons will be displayed in this face when the cursor is
300 (name . gnus-article-mouse-face)
301 (default . highlight)
303 ((tag . "Article Signature Face")
305 Face used for highlighting a signature in the article buffer.")
306 (name . gnus-signature-face)
309 ((tag . "Article Header Highlighting")
311 Controls highlighting of article header.
313 Below is a list of article header names, and the faces used for
314 displaying the name and content of the header. The `Header' field
315 should contain the name of the header. The field actually contains a
316 regular expression that should match the beginning of the header line,
317 but if you don't know what a regular expression is, just write the
318 name of the header. The second field is the `Name' field, which
319 determines how the the header name (i.e. the part of the header left
320 of the `:') is displayed. The third field is the `Content' field,
321 which determines how the content (i.e. the part of the header right of
322 the `:') is displayed.
324 If you leave the last `Header' field in the list empty, the `Name' and
325 `Content' fields will determine how headers not listed above are
328 If you only want to change the display of the name part for a specific
329 header, specify `None' in the `Content' field. Similarly, specify
330 `None' in the `Name' field if you only want to leave the name part
332 (name . gnus-header-face-alist)
334 (calculate . (cond ((not (eq gnus-display-type 'color))
336 ((eq gnus-background-mode 'dark)
337 (list (list "From" nil
339 "light blue" nil nil t t nil))
342 "pink" nil nil t t nil))
343 (list "Newsgroups:.*," nil
345 "yellow" nil nil t t nil))
348 "cyan" nil nil t nil nil)
351 nil nil nil t nil))))
353 (list (list "From" nil
361 (list "Newsgroups:.*," nil
363 "indianred" nil nil t t nil))
370 nil nil nil t nil))))))
371 (data ((type . repeat)
375 (data ((type . string)
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))))
411 (data ((type . repeat)
415 ((tag . "Citation Hide Percentage")
417 Only hide excess citation if above this percentage of the body.")
418 (name . gnus-cite-hide-percentage)
421 ((tag . "Citation Hide Absolute")
423 Only hide excess citation if above this number of lines in the body.")
424 (name . gnus-cite-hide-absolute)
427 ((tag . "Summary Selected Face")
429 Face used for highlighting the current article in the summary buffer.")
430 (name . gnus-summary-selected-face)
431 (default . underline)
433 ((tag . "Summary Line Highlighting")
435 Controls the highlighting of summary buffer lines.
437 Below is a list of `Form'/`Face' pairs. When deciding how a a
438 particular summary line should be displayed, each form is
439 evaluated. The content of the face field after the first true form is
440 used. You can change how those summary lines are displayed, by
441 editing the face field.
443 It is also possible to change and add form fields, but currently that
444 requires an understanding of Lisp expressions. Hopefully this will
445 change in a future release. For now, you can use the following
446 variables in the Lisp expression:
448 score: The article's score
449 default: The default article score.
450 below: The score below which articles are automatically marked as read.
451 mark: The article's mark.")
452 (name . gnus-summary-highlight)
454 (calculate . (cond ((not (eq gnus-display-type 'color))
455 '(((> score default) . bold)
456 ((< score default) . italic)))
457 ((eq gnus-background-mode 'dark)
458 (list (cons '(= mark gnus-canceled-mark)
459 (custom-face-lookup "yellow" "black" nil nil nil nil))
460 (cons '(and (> score default)
461 (or (= mark gnus-dormant-mark)
462 (= mark gnus-ticked-mark)))
463 (custom-face-lookup "pink" nil nil t nil nil))
464 (cons '(and (< score default)
465 (or (= mark gnus-dormant-mark)
466 (= mark gnus-ticked-mark)))
467 (custom-face-lookup "pink" nil nil nil t nil))
468 (cons '(or (= mark gnus-dormant-mark)
469 (= mark gnus-ticked-mark))
470 (custom-face-lookup "pink" nil nil nil nil nil))
472 (cons '(and (> score default) (= mark gnus-ancient-mark))
473 (custom-face-lookup "dark blue" nil nil t nil nil))
474 (cons '(and (< score default) (= mark gnus-ancient-mark))
475 (custom-face-lookup "SkyBlue" nil nil nil t nil))
476 (cons '(= mark gnus-ancient-mark)
477 (custom-face-lookup "SkyBlue" nil nil nil nil nil))
479 (cons '(and (> score default) (= mark gnus-unread-mark))
480 (custom-face-lookup "white" nil nil t nil nil))
481 (cons '(and (< score default) (= mark gnus-unread-mark))
482 (custom-face-lookup "white" nil nil nil t nil))
483 (cons '(= mark gnus-unread-mark)
484 (custom-face-lookup "white" nil nil nil nil nil))
486 (cons '(> score default) 'bold)
487 (cons '(< score default) 'italic)))
489 (list (cons '(= mark gnus-canceled-mark)
490 (custom-face-lookup "yellow" "black" nil nil nil nil))
491 (cons '(and (> score default)
492 (or (= mark gnus-dormant-mark)
493 (= mark gnus-ticked-mark)))
494 (custom-face-lookup "firebrick" nil nil t nil nil))
495 (cons '(and (< score default)
496 (or (= mark gnus-dormant-mark)
497 (= mark gnus-ticked-mark)))
498 (custom-face-lookup "firebrick" nil nil nil t nil))
499 (cons '(or (= mark gnus-dormant-mark)
500 (= mark gnus-ticked-mark))
501 (custom-face-lookup "firebrick" nil nil nil nil nil))
503 (cons '(and (> score default) (= mark gnus-ancient-mark))
504 (custom-face-lookup "RoyalBlue" nil nil t nil nil))
505 (cons '(and (< score default) (= mark gnus-ancient-mark))
506 (custom-face-lookup "RoyalBlue" nil nil nil t nil))
507 (cons '(= mark gnus-ancient-mark)
508 (custom-face-lookup "RoyalBlue" nil nil nil nil nil))
510 (cons '(and (> score default) (/= mark gnus-unread-mark))
511 (custom-face-lookup "DarkGreen" nil nil t nil nil))
512 (cons '(and (< score default) (/= mark gnus-unread-mark))
513 (custom-face-lookup "DarkGreen" nil nil nil t nil))
514 (cons '(/= mark gnus-unread-mark)
515 (custom-face-lookup "DarkGreen" nil nil nil nil nil))
517 (cons '(> score default) 'bold)
518 (cons '(< score default) 'italic)))))
519 (data ((type . repeat)
530 ;; Do not define `gnus-button-alist' before we have
531 ;; some `complexity' attribute so we can hide it from
535 (defun gnus-custom-import-cite-face-list (custom alist)
536 ;; Backward compatible grokking of light and dark.
537 (cond ((eq alist 'light)
538 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
540 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
541 (funcall (custom-super custom 'import) custom alist))
543 ;(defun gnus-custom-import-swap-alist (custom alist)
544 ; ;; Swap key and value in CUSTOM ALIST.
545 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
546 ; (funcall (custom-super custom 'import) custom swap)))
548 ;(defun gnus-custom-export-swap-alist (custom alist)
549 ; ;; Swap key and value in CUSTOM ALIST.
550 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
551 ; (funcall (custom-super custom 'export) custom swap)))
555 ;;; gnus-cus.el ends here