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 The list below contains various filters you can use to change the look
110 of the article. If you leave the list empty, the article will appear
111 exactly as it is stored on the disk. The list entries will hide or
112 highlight various parts of the article, making it easier to find the
113 information you want.")
114 (name . gnus-article-display-hook)
116 (default . (gnus-article-hide-headers-if-wanted
117 gnus-article-treat-overstrike
118 gnus-article-maybe-highlight))
119 (data ((type . repeat)
121 (data (tag . "Filter")
123 (data ((tag . "Treat Overstrike")
125 Convert use of overstrike into bold and underline.
127 Two identical letters separated by a backspace are displayed as a
128 single bold letter, while a letter followed by a backspace and an
129 underscore will be displayed as a single underlined letter. This
130 technique was developed for old line printers (think about it), and is
131 still in use on some newsgroups, in particular the ClariNet
136 gnus-article-treat-overstrike))
139 Format too long lines.
142 (default . gnus-article-word-wrap))
145 Remove carriage returns from an article.
148 (default . gnus-article-remove-cr))
149 ((tag . "Display X-Face")
151 Look for an X-Face header and display it if present.
153 See also `X Face Command' for a definition of the external command
154 used for decoding and displaying the face.
157 (default . gnus-article-display-x-face))
158 ((tag . "Unquote Printable")
160 Tranform MIME quoted printable into 8-bit characters.
162 Quoted printable is often seen by strings like `=EF' where you would
163 expect a non-English letter.
167 gnus-article-de-quoted-unreadable))
168 ((tag . "Universal Time")
170 Convert date header to universal time.
173 (default . gnus-article-date-ut))
174 ((tag . "Local Time")
176 Convert date header to local timezone.
179 (default . gnus-article-date-local))
180 ((tag . "Lapsed Time")
182 Replace date header with a header showing the articles age.
185 (default . gnus-article-date-lapsed))
188 Highlight headers, citations, signature, and buttons.
191 (default . gnus-article-highlight))
192 ((tag . "Maybe Highlight")
194 Highlight headers, signature, and buttons if `Visual' is turned on.
198 gnus-article-maybe-highlight))
199 ((tag . "Highlight Some")
201 Highlight headers, signature, and buttons.
204 (default . gnus-article-highlight-some))
205 ((tag . "Highlight Headers")
207 Highlight headers as specified by `Article Header Highligting'.
211 gnus-article-highlight-headers))
212 ((tag . "Highlight Signature")
214 Highlight the signature as specified by `Article Signature Face'.
218 gnus-article-highlight-signature))
221 Highlight the citations as specified by `Citation Faces'.
225 gnus-article-highlight-citation))
228 Hide unwanted headers, excess citation, and the signature.
231 (default . gnus-article-hide))
232 ((tag . "Hide Headers If Wanted")
234 Hide headers, but allow user to display them with `t' or `v'.
238 gnus-article-hide-headers-if-wanted))
239 ((tag . "Hide Headers")
241 Hide unwanted headers and possibly sort them as well.
242 Most likely you want to use `Hide Headers If Wanted' instead.
245 (default . gnus-article-hide-headers))
246 ((tag . "Hide Signature")
251 (default . gnus-article-hide-signature))
252 ((tag . "Hide Excess Citations")
254 Hide excess citation.
256 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
260 gnus-article-hide-citation-maybe))
261 ((tag . "Hide Citations")
266 (default . gnus-article-hide-citation))
267 ((tag . "Add Buttons")
269 Make URL's into clickable buttons.
272 (default . gnus-article-add-buttons))
275 Name of Lisp function to call.
277 Push the `Filter' button to select one of the predefined filters.
279 (type . symbol)))))))
280 ((tag . "Article Button Face")
282 Face used for highlighting buttons in the article buffer.
284 An article button is a piece of text that you can activate by pressing
285 `RET' or `mouse-2' above it.")
286 (name . gnus-article-button-face)
289 ((tag . "Article Mouse Face")
291 Face used for mouse highlighting in the article buffer.
293 Article buttons will be displayed in this face when the cursor is
295 (name . gnus-article-mouse-face)
296 (default . highlight)
298 ((tag . "Article Signature Face")
300 Face used for highlighting a signature in the article buffer.")
301 (name . gnus-signature-face)
304 ((tag . "Article Header Highlighting")
306 Controls highlighting of article header.
308 Below is a list of article header names, and the faces used for
309 displaying the name and content of the header. The `Header' field
310 should contain the name of the header. The field actually contains a
311 regular expression that should match the beginning of the header line,
312 but if you don't know what a regular expression is, just write the
313 name of the header. The second field is the `Name' field, which
314 determines how the the header name (i.e. the part of the header left
315 of the `:') is displayed. The third field is the `Content' field,
316 which determines how the content (i.e. the part of the header right of
317 the `:') is displayed.
319 If you leave the last `Header' field in the list empty, the `Name' and
320 `Content' fields will determine how headers not listed above are
323 If you only want to change the display of the name part for a specific
324 header, specify `None' in the `Content' field. Similarly, specify
325 `None' in the `Name' field if you only want to leave the name part
327 (name . gnus-header-face-alist)
329 (calculate . (cond ((not (eq gnus-display-type 'color))
331 ((eq gnus-background-mode 'dark)
332 (list (list "From" nil
334 "dark blue" nil nil t t nil))
337 "pink" nil nil t t nil))
338 (list "Newsgroups:.*," nil
340 "yellow" nil nil t t nil))
343 "cyan" nil nil t nil nil)
346 nil nil nil t nil))))
348 (list (list "From" nil
356 (list "Newsgroups:.*," nil
358 "indianred" nil nil t t nil))
365 nil nil nil t nil))))))
366 (data ((type . repeat)
370 (data ((type . string)
381 ((tag . "Attribution Face")
383 Face used for attribution lines.
384 It is merged with the face for the cited text belonging to the attribution.")
385 (name . gnus-cite-attribution-face)
386 (default . underline)
388 ((tag . "Citation Faces")
390 List of faces used for highlighting citations.
392 When there are citations from multiple articles in the same message,
393 Gnus will try to give each citation from each article its own face.
394 This should make it easier to see who wrote what.")
395 (name . gnus-cite-face-list)
396 (import . gnus-custom-import-cite-face-list)
398 (calculate . (cond ((not (eq gnus-display-type 'color))
400 ((eq gnus-background-mode 'dark)
401 (mapcar 'gnus-make-face
402 gnus-face-light-name-list))
404 (mapcar 'gnus-make-face
405 gnus-face-dark-name-list))))
406 (data ((type . repeat)
410 ((tag . "Citation Hide Percentage")
412 Only hide excess citation if above this percentage of the body.")
413 (name . gnus-cite-hide-percentage)
416 ((tag . "Citation Hide Absolute")
418 Only hide excess citation if above this number of lines in the body.")
419 (name . gnus-cite-hide-absolute)
422 ((tag . "Summary Selected Face")
424 Face used for highlighting the current article in the summary buffer.")
425 (name . gnus-summary-selected-face)
426 (default . underline)
428 ((tag . "Summary Line Highlighting")
430 Controls the higlighting of summary buffer lines.
432 Below is a list of `Form'/`Face' pairs. When deciding how a a
433 particular summary line should be displayed, each form is
434 evaluated. The content of the face field after the first true form is
435 used. You can change how those summary lines are displayed, by
436 editing the face field.
438 It is also possible to change and add form fields, but currently that
439 requires an understanding of Lisp expressions. Hopefully this will
440 change in a future release. For now, you can use the following
441 variables in the Lisp expression:
443 score: The article's score
444 default: The default article score.
445 below: The score below which articles are automatically marked as read.
446 mark: The article's mark.")
447 (name . gnus-summary-highlight)
449 (calculate . (cond ((not (eq gnus-display-type 'color))
450 '(((> score default) . bold)
451 ((< score default) . italic)))
452 ((eq gnus-background-mode 'dark)
453 (list (cons '(= mark gnus-canceled-mark)
454 (custom-face-lookup "yellow" "black" nil nil nil nil))
455 (cons '(and (> score default)
456 (or (= mark gnus-dormant-mark)
457 (= mark gnus-ticked-mark)))
458 (custom-face-lookup "pink" nil nil t 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 nil t nil))
463 (cons '(or (= mark gnus-dormant-mark)
464 (= mark gnus-ticked-mark))
465 (custom-face-lookup "pink" nil nil nil nil nil))
467 (cons '(and (> score default) (= mark gnus-ancient-mark))
468 (custom-face-lookup "dark blue" nil nil t nil nil))
469 (cons '(and (< score default) (= mark gnus-ancient-mark))
470 (custom-face-lookup "SkyBlue" nil nil nil t nil))
471 (cons '(= mark gnus-ancient-mark)
472 (custom-face-lookup "SkyBlue" nil nil nil nil nil))
474 (cons '(and (> score default) (= mark gnus-unread-mark))
475 (custom-face-lookup "white" nil nil t nil nil))
476 (cons '(and (< score default) (= mark gnus-unread-mark))
477 (custom-face-lookup "white" nil nil nil t nil))
478 (cons '(= mark gnus-unread-mark)
479 (custom-face-lookup "white" nil nil nil nil nil))
481 (cons '(> score default) 'bold)
482 (cons '(< score default) 'italic)))
484 (list (cons '(= mark gnus-canceled-mark)
485 (custom-face-lookup "yellow" "black" nil nil nil nil))
486 (cons '(and (> score default)
487 (or (= mark gnus-dormant-mark)
488 (= mark gnus-ticked-mark)))
489 (custom-face-lookup "firebrick" nil nil t 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 nil t nil))
494 (cons '(or (= mark gnus-dormant-mark)
495 (= mark gnus-ticked-mark))
496 (custom-face-lookup "firebrick" nil nil nil nil nil))
498 (cons '(and (> score default) (= mark gnus-ancient-mark))
499 (custom-face-lookup "RoyalBlue" nil nil t nil nil))
500 (cons '(and (< score default) (= mark gnus-ancient-mark))
501 (custom-face-lookup "RoyalBlue" nil nil nil t nil))
502 (cons '(= mark gnus-ancient-mark)
503 (custom-face-lookup "RoyalBlue" nil nil nil nil nil))
505 (cons '(and (> score default) (/= mark gnus-unread-mark))
506 (custom-face-lookup "DarkGreen" nil nil t nil nil))
507 (cons '(and (< score default) (/= mark gnus-unread-mark))
508 (custom-face-lookup "DarkGreen" nil nil nil t nil))
509 (cons '(/= mark gnus-unread-mark)
510 (custom-face-lookup "DarkGreen" nil nil nil nil nil))
512 (cons '(> score default) 'bold)
513 (cons '(< score default) 'italic)))))
514 (data ((type . repeat)
525 ;; Do not define `gnus-button-alist' before we have
526 ;; some `complexity' attribute so we can hide it from
530 (defun gnus-custom-import-cite-face-list (custom alist)
531 ;; Backward compatible groking of light and dark.
532 (cond ((eq alist 'light)
533 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
535 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
536 (funcall (custom-super custom 'import) custom alist))
538 ;(defun gnus-custom-import-swap-alist (custom alist)
539 ; ;; Swap key and value in CUSTOM ALIST.
540 ; (let ((swap (mapcar (lambda (e) (cons (cdr e) (car e))) alist)))
541 ; (funcall (custom-super custom 'import) custom swap)))
543 ;(defun gnus-custom-export-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 'export) custom swap)))
550 ;;; gnus-cus.el ends here