comparison lisp/gnus/gnus-cus.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents ec9a17fef872
children 0d2f883870bc
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;; gnus-cus.el --- customization commands for Gnus 1 ;;; gnus-cus.el --- User friendly customization of Gnus
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
2 ;; 3 ;;
3 ;; Copyright (C) 1996 Free Software Foundation, Inc. 4 ;; Author: Per Abrahamsen <abraham@iesd.auc.dk>
4 5 ;; Keywords: help, news
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 6 ;; Version: 0.1
6 ;; Keywords: news
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
9 9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify 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 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) 12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version. 13 ;; any later version.
14 14
15 ;; GNU Emacs is distributed in the hope that it will be useful, 15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details. 18 ;; GNU General Public License for more details.
19 19
20 ;; You should have received a copy of the GNU General Public License 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 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;;; Code: 27 ;;; Code:
28 28
29 (require 'wid-edit) 29 (require 'custom)
30 (require 'gnus-score) 30 (require 'gnus-ems)
31 31 (require 'browse-url)
32 ;;; Widgets: 32 (eval-when-compile (require 'cl))
33 33
34 ;; There should be special validation for this. 34 ;; The following is just helper functions and data, not meant to be set
35 (define-widget 'gnus-email-address 'string 35 ;; by the user.
36 "An email address") 36 (defun gnus-make-face (color)
37 37 ;; Create entry for face with COLOR.
38 (defun gnus-custom-mode () 38 (custom-face-lookup color nil nil nil nil nil))
39 "Major mode for editing Gnus customization buffers. 39
40 40 (defvar gnus-face-light-name-list
41 The following commands are available: 41 '("light blue" "light cyan" "light yellow" "light pink"
42 42 "pale green" "beige" "orange" "magenta" "violet" "medium purple"
43 \\[widget-forward] Move to next button or editable field. 43 "turquoise"))
44 \\[widget-backward] Move to previous button or editable field. 44
45 \\[widget-button-click] Activate button under the mouse pointer. 45 (defvar gnus-face-dark-name-list
46 \\[widget-button-press] Activate button under point. 46 '("dark blue" "firebrick" "dark green" "OrangeRed"
47 47 "dark khaki" "dark violet" "SteelBlue4"))
48 Entry to this mode calls the value of `gnus-custom-mode-hook' 48 ; CornflowerBlue SeaGreen OrangeRed SteelBlue4 DeepPink3
49 if that value is non-nil." 49 ; DarkOlviveGreen4
50 (kill-all-local-variables) 50
51 (setq major-mode 'gnus-custom-mode 51 (custom-declare '()
52 mode-name "Gnus Customize") 52 '((tag . "Gnus")
53 (use-local-map widget-keymap) 53 (doc . "\
54 (run-hooks 'gnus-custom-mode-hook)) 54 The coffee-brewing, all singing, all dancing, kitchen sink newsreader.")
55 55 (type . group)
56 ;;; Group Customization: 56 (data
57 57 ((tag . "Visual")
58 (defconst gnus-group-parameters 58 (doc . "\
59 '((to-address (gnus-email-address :tag "To Address") "\ 59 Gnus can be made colorful and fun or grey and dull as you wish.")
60 This will be used when doing followups and posts. 60 (type . group)
61 61 (data
62 This is primarily useful in mail groups that represent closed 62 ((tag . "Visual")
63 mailing lists--mailing lists where it's expected that everybody that 63 (doc . "Enable visual features.
64 writes to the mailing list is subscribed to it. Since using this 64 If `visual' is disabled, there will be no menus and few faces. Most of
65 parameter ensures that the mail only goes to the mailing list itself, 65 the visual customization options below will be ignored. Gnus will use
66 it means that members won't receive two copies of your followups. 66 less space and be faster as a result.")
67 67 (default .
68 Using `to-address' will actually work whether the group is foreign or 68 (summary-highlight group-highlight
69 not. Let's say there's a group on the server that is called 69 article-highlight
70 `fa.4ad-l'. This is a real newsgroup, but the server has gotten the 70 mouse-face
71 articles from a mail-to-news gateway. Posting directly to this group 71 summary-menu group-menu article-menu
72 is therefore impossible--you have to send mail to the mailing list 72 tree-highlight menu highlight
73 address instead.") 73 browse-menu server-menu
74 74 page-marker tree-menu binary-menu pick-menu
75 (to-list (gnus-email-address :tag "To List") "\ 75 grouplens-menu))
76 This address will be used when doing a `a' in the group. 76 (name . gnus-visual)
77 77 (type . sexp))
78 It is totally ignored when doing a followup--except that if it is 78 ((tag . "WWW Browser")
79 present in a news group, you'll get mail group semantics when doing 79 (doc . "\
80 `f'.") 80 WWW Browser to call when clicking on an URL button in the article buffer.
81 81
82 (broken-reply-to (const :tag "Broken Reply To" t) "\ 82 You can choose between one of the predefined browsers, or `Other'.")
83 Ignore `Reply-To' headers in this group. 83 (name . browse-url-browser-function)
84 84 (calculate . (cond ((boundp 'browse-url-browser-function)
85 That can be useful if you're reading a mailing list group where the 85 browse-url-browser-function)
86 listserv has inserted `Reply-To' headers that point back to the 86 ((fboundp 'w3-fetch)
87 listserv itself. This is broken behavior. So there!") 87 'w3-fetch)
88 88 ((eq window-system 'x)
89 (to-group (string :tag "To Group") "\ 89 'gnus-netscape-open-url)))
90 All posts will be send to the specified group.") 90 (type . choice)
91 91 (data
92 (gcc-self (choice :tag "GCC" 92 ((tag . "W3")
93 :value t 93 (type . const)
94 (const t) 94 (default . w3-fetch))
95 (const none) 95 ((tag . "Netscape")
96 (string :format "%v" :hide-front-space t)) "\ 96 (type . const)
97 Specify default value for GCC header. 97 (default . browse-url-netscape))
98 98 ((prompt . "Other")
99 If this symbol is present in the group parameter list and set to `t', 99 (doc . "\
100 new composed messages will be `Gcc''d to the current group. If it is 100 You must specify the name of a Lisp function here. The lisp function
101 present and set to `none', no `Gcc:' header will be generated, if it 101 should open a WWW browser when called with an URL (a string).
102 is present and a string, this string will be inserted literally as a 102 ")
103 `gcc' header (this symbol takes precedence over any default `Gcc' 103 (default . __uninitialized__)
104 rules as described later).") 104 (type . symbol))))
105 105 ((tag . "Mouse Face")
106 (auto-expire (const :tag "Automatic Expire" t) "\ 106 (doc . "\
107 All articles that are read will be marked as expirable.") 107 Face used for group or summary buffer mouse highlighting.
108 108 The line beneath the mouse pointer will be highlighted with this
109 (total-expire (const :tag "Total Expire" t) "\ 109 face.")
110 All read articles will be put through the expiry process 110 (name . gnus-mouse-face)
111 111 (calculate . (condition-case ()
112 This happens even if they are not marked as expirable. 112 (if (gnus-visual-p 'mouse-face 'highlight)
113 Use with caution.") 113 (if (boundp 'gnus-mouse-face)
114 114 gnus-mouse-face
115 (expiry-wait (choice :tag "Expire Wait" 115 'highlight)
116 :value never 116 'default)
117 (const never) 117 (error nil)))
118 (const immediate) 118 (type . face))
119 (number :hide-front-space t 119 ((tag . "Article Display")
120 :format "%v")) "\ 120 (doc . "Controls how the article buffer will look.
121 When to expire. 121
122 122 If you leave the list empty, the article will appear exactly as it is
123 Overrides any `nnmail-expiry-wait' and `nnmail-expiry-wait-function' 123 stored on the disk. The list entries will hide or highlight various
124 when expiring expirable messages. The value can either be a number of 124 parts of the article, making it easier to find the information you
125 days (not necessarily an integer) or the symbols `never' or 125 want.")
126 `immediate'.") 126 (name . gnus-article-display-hook)
127 127 (type . list)
128 (score-file (file :tag "Score File") "\ 128 (calculate
129 Make the specified file into the current score file. 129 . (if (and (string-match "xemacs" emacs-version)
130 This means that all score commands you issue will end up in this file.") 130 (featurep 'xface))
131 131 '(gnus-article-hide-headers-if-wanted
132 (adapt-file (file :tag "Adapt File") "\ 132 gnus-article-hide-boring-headers
133 Make the specified file into the current adaptive file. 133 gnus-article-treat-overstrike
134 All adaptive score entries will be put into this file.") 134 gnus-article-maybe-highlight
135 135 gnus-article-display-x-face)
136 (admin-address (gnus-email-address :tag "Admin Address") "\ 136 '(gnus-article-hide-headers-if-wanted
137 Administration address for a mailing list. 137 gnus-article-hide-boring-headers
138 138 gnus-article-treat-overstrike
139 When unsubscribing to a mailing list you should never send the 139 gnus-article-maybe-highlight)))
140 unsubscription notice to the mailing list itself. Instead, you'd 140 (data
141 send messages to the administrative address. This parameter allows 141 ((type . repeat)
142 you to put the admin address somewhere convenient.") 142 (header . nil)
143 143 (data
144 (display (choice :tag "Display" 144 (tag . "Filter")
145 :value default 145 (type . choice)
146 (const all) 146 (data
147 (const default)) "\ 147 ((tag . "Treat Overstrike")
148 Which articles to display on entering the group. 148 (doc . "\
149 149 Convert use of overstrike into bold and underline.
150 `all' 150
151 Display all articles, both read and unread. 151 Two identical letters separated by a backspace are displayed as a
152 152 single bold letter, while a letter followed by a backspace and an
153 `default' 153 underscore will be displayed as a single underlined letter. This
154 Display the default visible articles, which normally includes 154 technique was developed for old line printers (think about it), and is
155 unread and ticked articles.") 155 still in use on some newsgroups, in particular the ClariNet
156 156 hierarchy.
157 (comment (string :tag "Comment") "\ 157 ")
158 An arbitrary comment on the group.")) 158 (type . const)
159 "Alist of valid group parameters. 159 (default .
160 160 gnus-article-treat-overstrike))
161 Each entry has the form (NAME TYPE DOC), where NAME is the parameter 161 ((tag . "Word Wrap")
162 itself (a symbol), TYPE is the parameters type (a sexp widget), and 162 (doc . "\
163 DOC is a documentation string for the parameter.") 163 Format too long lines.
164 164 ")
165 (defvar gnus-custom-params) 165 (type . const)
166 (defvar gnus-custom-method) 166 (default . gnus-article-word-wrap))
167 (defvar gnus-custom-group) 167 ((tag . "Remove CR")
168 168 (doc . "\
169 (defun gnus-group-customize (group &optional part) 169 Remove carriage returns from an article.
170 "Edit the group on the current line." 170 ")
171 (interactive (list (gnus-group-group-name))) 171 (type . const)
172 (let ((part (or part 'info)) 172 (default . gnus-article-remove-cr))
173 info 173 ((tag . "Display X-Face")
174 (types (mapcar (lambda (entry) 174 (doc . "\
175 `(cons :format "%v%h\n" 175 Look for an X-Face header and display it if present.
176 :doc ,(nth 2 entry) 176
177 (const :format "" ,(nth 0 entry)) 177 See also `X Face Command' for a definition of the external command
178 ,(nth 1 entry))) 178 used for decoding and displaying the face.
179 gnus-group-parameters))) 179 ")
180 (unless group 180 (type . const)
181 (error "No group on current line")) 181 (default . gnus-article-display-x-face))
182 (unless (setq info (gnus-get-info group)) 182 ((tag . "Unquote Printable")
183 (error "Killed group; can't be edited")) 183 (doc . "\
184 ;; Ready. 184 Transform MIME quoted printable into 8-bit characters.
185 (kill-buffer (get-buffer-create "*Gnus Customize*")) 185
186 (switch-to-buffer (get-buffer-create "*Gnus Customize*")) 186 Quoted printable is often seen by strings like `=EF' where you would
187 (gnus-custom-mode) 187 expect a non-English letter.
188 (make-local-variable 'gnus-custom-group) 188 ")
189 (setq gnus-custom-group group) 189 (type . const)
190 (widget-insert "Customize the ") 190 (default .
191 (widget-create 'info-link 191 gnus-article-de-quoted-unreadable))
192 :help-echo "Push me to learn more." 192 ((tag . "Universal Time")
193 :tag "group parameters" 193 (doc . "\
194 "(gnus)Group Parameters") 194 Convert date header to universal time.
195 (widget-insert " for <") 195 ")
196 (widget-insert group) 196 (type . const)
197 (widget-insert "> and press ") 197 (default . gnus-article-date-ut))
198 (widget-create 'push-button 198 ((tag . "Local Time")
199 :tag "done" 199 (doc . "\
200 :help-echo "Push me when done customizing." 200 Convert date header to local timezone.
201 :action 'gnus-group-customize-done) 201 ")
202 (widget-insert ".\n\n") 202 (type . const)
203 (make-local-variable 'gnus-custom-params) 203 (default . gnus-article-date-local))
204 (setq gnus-custom-params 204 ((tag . "Lapsed Time")
205 (widget-create 'group 205 (doc . "\
206 :value (gnus-info-params info) 206 Replace date header with a header showing the articles age.
207 `(set :inline t 207 ")
208 :greedy t 208 (type . const)
209 :tag "Parameters" 209 (default . gnus-article-date-lapsed))
210 :format "%t:\n%h%v" 210 ((tag . "Highlight")
211 :doc "\ 211 (doc . "\
212 These special paramerters are recognized by Gnus. 212 Highlight headers, citations, signature, and buttons.
213 Check the [ ] for the parameters you want to apply to this group, then 213 ")
214 edit the value to suit your taste." 214 (type . const)
215 ,@types) 215 (default . gnus-article-highlight))
216 '(repeat :inline t 216 ((tag . "Maybe Highlight")
217 :tag "Variables" 217 (doc . "\
218 :format "%t:\n%h%v%i\n\n" 218 Highlight headers, signature, and buttons if `Visual' is turned on.
219 :doc "\ 219 ")
220 Set variables local to the group you are entering. 220 (type . const)
221 221 (default .
222 If you want to turn threading off in `news.answers', you could put 222 gnus-article-maybe-highlight))
223 `(gnus-show-threads nil)' in the group parameters of that group. 223 ((tag . "Highlight Some")
224 `gnus-show-threads' will be made into a local variable in the summary 224 (doc . "\
225 buffer you enter, and the form `nil' will be `eval'ed there. 225 Highlight headers, signature, and buttons.
226 226 ")
227 This can also be used as a group-specific hook function, if you'd 227 (type . const)
228 like. If you want to hear a beep when you enter a group, you could 228 (default . gnus-article-highlight-some))
229 put something like `(dummy-variable (ding))' in the parameters of that 229 ((tag . "Highlight Headers")
230 group. `dummy-variable' will be set to the result of the `(ding)' 230 (doc . "\
231 form, but who cares?" 231 Highlight headers as specified by `Article Header Highlighting'.
232 (group :value (nil nil) 232 ")
233 (symbol :tag "Variable") 233 (type . const)
234 (sexp :tag 234 (default .
235 "Value"))) 235 gnus-article-highlight-headers))
236 236 ((tag . "Highlight Signature")
237 '(repeat :inline t 237 (doc . "\
238 :tag "Unknown entries" 238 Highlight the signature as specified by `Article Signature Face'.
239 sexp))) 239 ")
240 (widget-insert "\n\nYou can also edit the ") 240 (type . const)
241 (widget-create 'info-link 241 (default .
242 :tag "select method" 242 gnus-article-highlight-signature))
243 :help-echo "Push me to learn more about select methods." 243 ((tag . "Citation")
244 "(gnus)Select Methods") 244 (doc . "\
245 (widget-insert " for the group.\n") 245 Highlight the citations as specified by `Citation Faces'.
246 (setq gnus-custom-method 246 ")
247 (widget-create 'sexp 247 (type . const)
248 :tag "Method" 248 (default .
249 :value (gnus-info-method info))) 249 gnus-article-highlight-citation))
250 (use-local-map widget-keymap) 250 ((tag . "Hide")
251 (widget-setup))) 251 (doc . "\
252 252 Hide unwanted headers, excess citation, and the signature.
253 (defun gnus-group-customize-done (&rest ignore) 253 ")
254 "Apply changes and bury the buffer." 254 (type . const)
255 (interactive) 255 (default . gnus-article-hide))
256 (gnus-group-edit-group-done 'params gnus-custom-group 256 ((tag . "Hide Headers If Wanted")
257 (widget-value gnus-custom-params)) 257 (doc . "\
258 (gnus-group-edit-group-done 'method gnus-custom-group 258 Hide headers, but allow user to display them with `t' or `v'.
259 (widget-value gnus-custom-method)) 259 ")
260 (bury-buffer)) 260 (type . const)
261 261 (default .
262 ;;; Score Customization: 262 gnus-article-hide-headers-if-wanted))
263 263 ((tag . "Hide Headers")
264 (defconst gnus-score-parameters 264 (doc . "\
265 '((mark (number :tag "Mark") "\ 265 Hide unwanted headers and possibly sort them as well.
266 The value of this entry should be a number. 266 Most likely you want to use `Hide Headers If Wanted' instead.
267 Any articles with a score lower than this number will be marked as read.") 267 ")
268 268 (type . const)
269 (expunge (number :tag "Expunge") "\ 269 (default . gnus-article-hide-headers))
270 The value of this entry should be a number. 270 ((tag . "Hide Signature")
271 Any articles with a score lower than this number will be removed from 271 (doc . "\
272 the summary buffer.") 272 Hide the signature.
273 273 ")
274 (mark-and-expunge (number :tag "Mark-and-expunge") "\ 274 (type . const)
275 The value of this entry should be a number. 275 (default . gnus-article-hide-signature))
276 Any articles with a score lower than this number will be marked as 276 ((tag . "Hide Excess Citations")
277 read and removed from the summary buffer.") 277 (doc . "\
278 278 Hide excess citation.
279 (thread-mark-and-expunge (number :tag "Thread-mark-and-expunge") "\ 279
280 The value of this entry should be a number. 280 Excess is defined by `Citation Hide Percentage' and `Citation Hide Absolute'.
281 All articles that belong to a thread that has a total score below this 281 ")
282 number will be marked as read and removed from the summary buffer. 282 (type . const)
283 `gnus-thread-score-function' says how to compute the total score 283 (default .
284 for a thread.") 284 gnus-article-hide-citation-maybe))
285 285 ((tag . "Hide Citations")
286 (files (repeat :tag "Files" file) "\ 286 (doc . "\
287 The value of this entry should be any number of file names. 287 Hide all cited text.
288 These files are assumed to be score files as well, and will be loaded 288 ")
289 the same way this one was.") 289 (type . const)
290 290 (default . gnus-article-hide-citation))
291 (exclude-files (repeat :tag "Exclude-files" file) "\ 291 ((tag . "Add Buttons")
292 The clue of this entry should be any number of files. 292 (doc . "\
293 These files will not be loaded, even though they would normally be so, 293 Make URL's into clickable buttons.
294 for some reason or other.") 294 ")
295 295 (type . const)
296 (eval (sexp :tag "Eval" :value nil) "\ 296 (default . gnus-article-add-buttons))
297 The value of this entry will be `eval'el. 297 ((prompt . "Other")
298 This element will be ignored when handling global score files.") 298 (doc . "\
299 299 Name of Lisp function to call.
300 (read-only (boolean :tag "Read-only" :value t) "\ 300
301 Read-only score files will not be updated or saved. 301 Push the `Filter' button to select one of the predefined filters.
302 Global score files should feature this atom.") 302 ")
303 303 (type . symbol)))))))
304 (orphan (number :tag "Orphan") "\ 304 ((tag . "Article Button Face")
305 The value of this entry should be a number. 305 (doc . "\
306 Articles that do not have parents will get this number added to their 306 Face used for highlighting buttons in the article buffer.
307 scores. Imagine you follow some high-volume newsgroup, like 307
308 `comp.lang.c'. Most likely you will only follow a few of the threads, 308 An article button is a piece of text that you can activate by pressing
309 also want to see any new threads. 309 `RET' or `mouse-2' above it.")
310 310 (name . gnus-article-button-face)
311 You can do this with the following two score file entries: 311 (default . bold)
312 312 (type . face))
313 (orphan -500) 313 ((tag . "Article Mouse Face")
314 (mark-and-expunge -100) 314 (doc . "\
315 315 Face used for mouse highlighting in the article buffer.
316 When you enter the group the first time, you will only see the new 316
317 threads. You then raise the score of the threads that you find 317 Article buttons will be displayed in this face when the cursor is
318 interesting (with `I T' or `I S'), and ignore (`C y') the rest. 318 above them.")
319 Next time you enter the group, you will see new articles in the 319 (name . gnus-article-mouse-face)
320 interesting threads, plus any new threads. 320 (default . highlight)
321 321 (type . face))
322 I.e.---the orphan score atom is for high-volume groups where there 322 ((tag . "Article Signature Face")
323 exist a few interesting threads which can't be found automatically 323 (doc . "\
324 by ordinary scoring rules.") 324 Face used for highlighting a signature in the article buffer.")
325 325 (name . gnus-signature-face)
326 (adapt (choice :tag "Adapt" 326 (default . italic)
327 (const t) 327 (type . face))
328 (const ignore) 328 ((tag . "Article Header Highlighting")
329 (sexp :format "%v" 329 (doc . "\
330 :hide-front-space t)) "\ 330 Controls highlighting of article header.
331 This entry controls the adaptive scoring. 331
332 If it is `t', the default adaptive scoring rules will be used. If it 332 Below is a list of article header names, and the faces used for
333 is `ignore', no adaptive scoring will be performed on this group. If 333 displaying the name and content of the header. The `Header' field
334 it is a list, this list will be used as the adaptive scoring rules. 334 should contain the name of the header. The field actually contains a
335 If it isn't present, or is something other than `t' or `ignore', the 335 regular expression that should match the beginning of the header line,
336 default adaptive scoring rules will be used. If you want to use 336 but if you don't know what a regular expression is, just write the
337 adaptive scoring on most groups, you'd set `gnus-use-adaptive-scoring' 337 name of the header. The second field is the `Name' field, which
338 to `t', and insert an `(adapt ignore)' in the groups where you do not 338 determines how the header name (i.e. the part of the header left
339 want adaptive scoring. If you only want adaptive scoring in a few 339 of the `:') is displayed. The third field is the `Content' field,
340 groups, you'd set `gnus-use-adaptive-scoring' to `nil', and insert 340 which determines how the content (i.e. the part of the header right of
341 `(adapt t)' in the score files of the groups where you want it.") 341 the `:') is displayed.
342 342
343 (adapt-file (file :tag "Adapt-file") "\ 343 If you leave the last `Header' field in the list empty, the `Name' and
344 All adaptive score entries will go to the file named by this entry. 344 `Content' fields will determine how headers not listed above are
345 It will also be applied when entering the group. This atom might 345 displayed.
346 be handy if you want to adapt on several groups at once, using the 346
347 same adaptive file for a number of groups.") 347 If you only want to change the display of the name part for a specific
348 348 header, specify `None' in the `Content' field. Similarly, specify
349 (local (repeat :tag "Local" 349 `None' in the `Name' field if you only want to leave the name part
350 (group :value (nil nil) 350 alone.")
351 (symbol :tag "Variable") 351 (name . gnus-header-face-alist)
352 (sexp :tag "Value"))) "\ 352 (type . list)
353 The value of this entry should be a list of `(VAR VALUE)' pairs. 353 (calculate
354 Each VAR will be made buffer-local to the current summary buffer, 354 . (cond
355 and set to the value specified. This is a convenient, if somewhat 355 ((not (eq gnus-display-type 'color))
356 strange, way of setting variables in some groups if you don't like 356 '(("" bold italic)))
357 hooks much.") 357 ((eq gnus-background-mode 'dark)
358 (touched (sexp :format "Touched\n") "Internal variable.")) 358 (list
359 "Alist of valid symbolic score parameters. 359 (list "From" nil
360 360 (custom-face-lookup "light blue" nil nil t t nil))
361 Each entry has the form (NAME TYPE DOC), where NAME is the parameter 361 (list "Subject" nil
362 itself (a symbol), TYPE is the parameters type (a sexp widget), and DOC is a 362 (custom-face-lookup "pink" nil nil t t nil))
363 documentation string for the parameter.") 363 (list "Newsgroups:.*," nil
364 364 (custom-face-lookup "yellow" nil nil t t nil))
365 (define-widget 'gnus-score-string 'group 365 (list
366 "Edit score entries for string-valued headers." 366 ""
367 :convert-widget 'gnus-score-string-convert) 367 (custom-face-lookup "cyan" nil nil t nil nil)
368 368 (custom-face-lookup "forestgreen" nil nil nil t
369 (defun gnus-score-string-convert (widget) 369 nil))))
370 ;; Set args appropriately. 370 (t
371 (let* ((tag (widget-get widget :tag)) 371 (list
372 (item `(const :format "" :value ,(downcase tag))) 372 (list "From" nil
373 (match '(string :tag "Match")) 373 (custom-face-lookup "MidnightBlue" nil nil t t nil))
374 (score '(choice :tag "Score" 374 (list "Subject" nil
375 (const :tag "default" nil) 375 (custom-face-lookup "firebrick" nil nil t t nil))
376 (integer :format "%v" 376 (list "Newsgroups:.*," nil
377 :hide-front-space t))) 377 (custom-face-lookup "indianred" nil nil t t nil))
378 (expire '(choice :tag "Expire" 378 (list ""
379 (const :tag "off" nil) 379 (custom-face-lookup
380 (integer :format "%v" 380 "DarkGreen" nil nil t nil nil)
381 :hide-front-space t))) 381 (custom-face-lookup "DarkGreen" nil nil
382 (type '(choice :tag "Type" 382 nil t nil))))))
383 :value s 383 (data
384 ;; I should really create a forgiving :match 384 ((type . repeat)
385 ;; function for each type below, that only 385 (header . nil)
386 ;; looked at the first letter. 386 (data
387 (const :tag "Regexp" r) 387 (type . list)
388 (const :tag "Regexp (fixed case)" R) 388 (compact . t)
389 (const :tag "Substring" s) 389 (data
390 (const :tag "Substring (fixed case)" S) 390 ((type . string)
391 (const :tag "Exact" e) 391 (prompt . "Header")
392 (const :tag "Exact (fixed case)" E) 392 (tag . "Header "))
393 (const :tag "Word" w) 393 "\n "
394 (const :tag "Word (fixed case)" W) 394 ((type . face)
395 (const :tag "default" nil))) 395 (prompt . "Name")
396 (group `(group ,match ,score ,expire ,type)) 396 (tag . "Name "))
397 (doc (concat (or (widget-get widget :doc) 397 "\n "
398 (concat "Change score based on the " tag 398 ((type . face)
399 " header.\n")) 399 (tag . "Content"))
400 " 400 "\n")))))
401 You can have an arbitrary number of score entries for this header, 401 ((tag . "Attribution Face")
402 each score entry has four elements: 402 (doc . "\
403 403 Face used for attribution lines.
404 1. The \"match element\". This should be the string to look for in the 404 It is merged with the face for the cited text belonging to the attribution.")
405 header. 405 (name . gnus-cite-attribution-face)
406 406 (default . underline)
407 2. The \"score element\". This number should be an integer in the 407 (type . face))
408 neginf to posinf interval. This number is added to the score 408 ((tag . "Citation Faces")
409 of the article if the match is successful. If this element is 409 (doc . "\
410 not present, the `gnus-score-interactive-default-score' number 410 List of faces used for highlighting citations.
411 will be used instead. This is 1000 by default. 411
412 412 When there are citations from multiple articles in the same message,
413 3. The \"date element\". This date says when the last time this score 413 Gnus will try to give each citation from each article its own face.
414 entry matched, which provides a mechanism for expiring the 414 This should make it easier to see who wrote what.")
415 score entries. It this element is not present, the score 415 (name . gnus-cite-face-list)
416 entry is permanent. The date is represented by the number of 416 (import . gnus-custom-import-cite-face-list)
417 days since December 31, 1 ce. 417 (type . list)
418 418 (calculate . (cond ((not (eq gnus-display-type 'color))
419 4. The \"type element\". This element specifies what function should 419 '(italic))
420 be used to see whether this score entry matches the article. 420 ((eq gnus-background-mode 'dark)
421 421 (mapcar 'gnus-make-face
422 There are the regexp, as well as substring types, and exact match, 422 gnus-face-light-name-list))
423 and word match types. If this element is not present, Gnus will 423 (t
424 assume that substring matching should be used. There is case 424 (mapcar 'gnus-make-face
425 sensitive variants of all match types."))) 425 gnus-face-dark-name-list))))
426 (widget-put widget :args `(,item 426 (data
427 (repeat :inline t 427 ((type . repeat)
428 :indent 0 428 (header . nil)
429 :tag ,tag 429 (data (type . face)
430 :doc ,doc 430 (tag . "Face")))))
431 :format "%t:\n%h%v%i\n\n" 431 ((tag . "Citation Hide Percentage")
432 (choice :format "%v" 432 (doc . "\
433 :value ("" nil nil s) 433 Only hide excess citation if above this percentage of the body.")
434 ,group 434 (name . gnus-cite-hide-percentage)
435 sexp))))) 435 (default . 50)
436 widget) 436 (type . integer))
437 437 ((tag . "Citation Hide Absolute")
438 (define-widget 'gnus-score-integer 'group 438 (doc . "\
439 "Edit score entries for integer-valued headers." 439 Only hide excess citation if above this number of lines in the body.")
440 :convert-widget 'gnus-score-integer-convert) 440 (name . gnus-cite-hide-absolute)
441 441 (default . 10)
442 (defun gnus-score-integer-convert (widget) 442 (type . integer))
443 ;; Set args appropriately. 443 ((tag . "Summary Selected Face")
444 (let* ((tag (widget-get widget :tag)) 444 (doc . "\
445 (item `(const :format "" :value ,(downcase tag))) 445 Face used for highlighting the current article in the summary buffer.")
446 (match '(integer :tag "Match")) 446 (name . gnus-summary-selected-face)
447 (score '(choice :tag "Score" 447 (default . underline)
448 (const :tag "default" nil) 448 (type . face))
449 (integer :format "%v" 449 ((tag . "Summary Line Highlighting")
450 :hide-front-space t))) 450 (doc . "\
451 (expire '(choice :tag "Expire" 451 Controls the highlighting of summary buffer lines.
452 (const :tag "off" nil) 452
453 (integer :format "%v" 453 Below is a list of `Form'/`Face' pairs. When deciding how a a
454 :hide-front-space t))) 454 particular summary line should be displayed, each form is
455 (type '(choice :tag "Type" 455 evaluated. The content of the face field after the first true form is
456 :value < 456 used. You can change how those summary lines are displayed, by
457 (const <) 457 editing the face field.
458 (const >) 458
459 (const =) 459 It is also possible to change and add form fields, but currently that
460 (const >=) 460 requires an understanding of Lisp expressions. Hopefully this will
461 (const <=))) 461 change in a future release. For now, you can use the following
462 (group `(group ,match ,score ,expire ,type)) 462 variables in the Lisp expression:
463 (doc (concat (or (widget-get widget :doc) 463
464 (concat "Change score based on the " tag 464 score: The article's score
465 " header."))))) 465 default: The default article score.
466 (widget-put widget :args `(,item 466 below: The score below which articles are automatically marked as read.
467 (repeat :inline t 467 mark: The article's mark.")
468 :indent 0 468 (name . gnus-summary-highlight)
469 :tag ,tag 469 (type . list)
470 :doc ,doc 470 (calculate
471 :format "%t:\n%h%v%i\n\n" 471 . (cond
472 ,group)))) 472 ((not (eq gnus-display-type 'color))
473 widget) 473 '(((> score default) . bold)
474 474 ((< score default) . italic)))
475 (define-widget 'gnus-score-date 'group 475 ((eq gnus-background-mode 'dark)
476 "Edit score entries for date-valued headers." 476 (list
477 :convert-widget 'gnus-score-date-convert) 477 (cons
478 478 '(= mark gnus-canceled-mark)
479 (defun gnus-score-date-convert (widget) 479 (custom-face-lookup "yellow" "black" nil
480 ;; Set args appropriately. 480 nil nil nil))
481 (let* ((tag (widget-get widget :tag)) 481 (cons '(and (> score default)
482 (item `(const :format "" :value ,(downcase tag))) 482 (or (= mark gnus-dormant-mark)
483 (match '(string :tag "Match")) 483 (= mark gnus-ticked-mark)))
484 (score '(choice :tag "Score" 484 (custom-face-lookup
485 (const :tag "default" nil) 485 "pink" nil nil t nil nil))
486 (integer :format "%v" 486 (cons '(and (< score default)
487 :hide-front-space t))) 487 (or (= mark gnus-dormant-mark)
488 (expire '(choice :tag "Expire" 488 (= mark gnus-ticked-mark)))
489 (const :tag "off" nil) 489 (custom-face-lookup "pink" nil nil
490 (integer :format "%v" 490 nil t nil))
491 :hide-front-space t))) 491 (cons '(or (= mark gnus-dormant-mark)
492 (type '(choice :tag "Type" 492 (= mark gnus-ticked-mark))
493 :value regexp 493 (custom-face-lookup
494 (const regexp) 494 "pink" nil nil nil nil nil))
495 (const before) 495
496 (const at) 496 (cons
497 (const after))) 497 '(and (> score default) (= mark gnus-ancient-mark))
498 (group `(group ,match ,score ,expire ,type)) 498 (custom-face-lookup "medium blue" nil nil t
499 (doc (concat (or (widget-get widget :doc) 499 nil nil))
500 (concat "Change score based on the " tag 500 (cons
501 " header.")) 501 '(and (< score default) (= mark gnus-ancient-mark))
502 " 502 (custom-face-lookup "SkyBlue" nil nil
503 For the Date header we have three kinda silly match types: `before', 503 nil t nil))
504 `at' and `after'. I can't really imagine this ever being useful, but, 504 (cons
505 like, it would feel kinda silly not to provide this function. Just in 505 '(= mark gnus-ancient-mark)
506 case. You never know. Better safe than sorry. Once burnt, twice 506 (custom-face-lookup "SkyBlue" nil nil
507 shy. Don't judge a book by its cover. Never not have sex on a first 507 nil nil nil))
508 date. (I have been told that at least one person, and I quote, 508 (cons '(and (> score default) (= mark gnus-unread-mark))
509 \"found this function indispensable\", however.) 509 (custom-face-lookup "white" nil nil t
510 510 nil nil))
511 A more useful match type is `regexp'. With it, you can match the date 511 (cons '(and (< score default) (= mark gnus-unread-mark))
512 string using a regular expression. The date is normalized to ISO8601 512 (custom-face-lookup "white" nil nil
513 compact format first---`YYYYMMDDTHHMMSS'. If you want to match all 513 nil t nil))
514 articles that have been posted on April 1st in every year, you could 514 (cons '(= mark gnus-unread-mark)
515 use `....0401.........' as a match string, for instance. (Note that 515 (custom-face-lookup
516 the date is kept in its original time zone, so this will match 516 "white" nil nil nil nil nil))
517 articles that were posted when it was April 1st where the article was 517
518 posted from. Time zones are such wholesome fun for the whole family, 518 (cons '(> score default) 'bold)
519 eh?"))) 519 (cons '(< score default) 'italic)))
520 (widget-put widget :args `(,item 520 (t
521 (repeat :inline t 521 (list
522 :indent 0 522 (cons
523 :tag ,tag 523 '(= mark gnus-canceled-mark)
524 :doc ,doc 524 (custom-face-lookup
525 :format "%t:\n%h%v%i\n\n" 525 "yellow" "black" nil nil nil nil))
526 ,group)))) 526 (cons '(and (> score default)
527 widget) 527 (or (= mark gnus-dormant-mark)
528 528 (= mark gnus-ticked-mark)))
529 (defvar gnus-custom-scores) 529 (custom-face-lookup "firebrick" nil nil
530 (defvar gnus-custom-score-alist) 530 t nil nil))
531 531 (cons '(and (< score default)
532 (defun gnus-score-customize (file) 532 (or (= mark gnus-dormant-mark)
533 "Customize score file FILE." 533 (= mark gnus-ticked-mark)))
534 (interactive (list gnus-current-score-file)) 534 (custom-face-lookup "firebrick" nil nil
535 (let ((scores (gnus-score-load file)) 535 nil t nil))
536 (types (mapcar (lambda (entry) 536 (cons
537 `(group :format "%v%h\n" 537 '(or (= mark gnus-dormant-mark)
538 :doc ,(nth 2 entry) 538 (= mark gnus-ticked-mark))
539 (const :format "" ,(nth 0 entry)) 539 (custom-face-lookup
540 ,(nth 1 entry))) 540 "firebrick" nil nil nil nil nil))
541 gnus-score-parameters))) 541
542 ;; Ready. 542 (cons '(and (> score default) (= mark gnus-ancient-mark))
543 (kill-buffer (get-buffer-create "*Gnus Customize*")) 543 (custom-face-lookup "RoyalBlue" nil nil
544 (switch-to-buffer (get-buffer-create "*Gnus Customize*")) 544 t nil nil))
545 (gnus-custom-mode) 545 (cons '(and (< score default) (= mark gnus-ancient-mark))
546 (make-local-variable 'gnus-custom-score-alist) 546 (custom-face-lookup "RoyalBlue" nil nil
547 (setq gnus-custom-score-alist scores) 547 nil t nil))
548 (widget-insert "Customize the ") 548 (cons
549 (widget-create 'info-link 549 '(= mark gnus-ancient-mark)
550 :help-echo "Push me to learn more." 550 (custom-face-lookup
551 :tag "score entries" 551 "RoyalBlue" nil nil nil nil nil))
552 "(gnus)Score File Format") 552
553 (widget-insert " for\n\t") 553 (cons '(and (> score default) (/= mark gnus-unread-mark))
554 (widget-insert file) 554 (custom-face-lookup "DarkGreen" nil nil
555 (widget-insert "\nand press ") 555 t nil nil))
556 (widget-create 'push-button 556 (cons '(and (< score default) (/= mark gnus-unread-mark))
557 :tag "done" 557 (custom-face-lookup "DarkGreen" nil nil
558 :help-echo "Push me when done customizing." 558 nil t nil))
559 :action 'gnus-score-customize-done) 559 (cons
560 (widget-insert ".\n 560 '(/= mark gnus-unread-mark)
561 Check the [ ] for the entries you want to apply to this score file, then 561 (custom-face-lookup "DarkGreen" nil nil
562 edit the value to suit your taste. Don't forget to mark the checkbox, 562 nil nil nil))
563 if you do all your changes will be lost. ") 563
564 (widget-create 'push-button 564 (cons '(> score default) 'bold)
565 :action (lambda (&rest ignore) 565 (cons '(< score default) 'italic)))))
566 (require 'gnus-audio) 566 (data
567 (gnus-audio-play "Evil_Laugh.au")) 567 ((type . repeat)
568 "Bhahahah!") 568 (header . nil)
569 (widget-insert "\n\n") 569 (data (type . pair)
570 (make-local-variable 'gnus-custom-scores) 570 (compact . t)
571 (setq gnus-custom-scores 571 (data ((type . sexp)
572 (widget-create 'group 572 (width . 60)
573 :value scores 573 (tag . "Form"))
574 `(checklist :inline t 574 "\n "
575 :greedy t 575 ((type . face)
576 (gnus-score-string :tag "From") 576 (tag . "Face"))
577 (gnus-score-string :tag "Subject") 577 "\n")))))
578 (gnus-score-string :tag "References") 578
579 (gnus-score-string :tag "Xref") 579 ((tag . "Group Line Highlighting")
580 (gnus-score-string :tag "Message-ID") 580 (doc . "\
581 (gnus-score-integer :tag "Lines") 581 Controls the highlighting of group buffer lines.
582 (gnus-score-integer :tag "Chars") 582
583 (gnus-score-date :tag "Date") 583 Below is a list of `Form'/`Face' pairs. When deciding how a a
584 (gnus-score-string :tag "Head" 584 particular group line should be displayed, each form is
585 :doc "\ 585 evaluated. The content of the face field after the first true form is
586 Match all headers in the article. 586 used. You can change how those group lines are displayed by
587 587 editing the face field.
588 Using one of `Head', `Body', `All' will slow down scoring considerable. 588
589 ") 589 It is also possible to change and add form fields, but currently that
590 (gnus-score-string :tag "Body" 590 requires an understanding of Lisp expressions. Hopefully this will
591 :doc "\ 591 change in a future release. For now, you can use the following
592 Match the body sans header of the article. 592 variables in the Lisp expression:
593 593
594 Using one of `Head', `Body', `All' will slow down scoring considerable. 594 group: The name of the group.
595 ") 595 unread: The number of unread articles in the group.
596 (gnus-score-string :tag "All" 596 method: The select method used.
597 :doc "\ 597 mailp: Whether it's a mail group or not.
598 Match the entire article, including both headers and body. 598 level: The level of the group.
599 599 score: The score of the group.
600 Using one of `Head', `Body', `All' will slow down scoring 600 ticked: The number of ticked articles.")
601 considerable. 601 (name . gnus-group-highlight)
602 ") 602 (type . list)
603 (gnus-score-string :tag 603 (calculate
604 "Followup" 604 . (cond
605 :doc "\ 605 ((not (eq gnus-display-type 'color))
606 Score all followups to the specified authors. 606 '((mailp . bold)
607 607 ((= unread 0) . italic)))
608 This entry is somewhat special, in that it will match the `From:' 608 ((eq gnus-background-mode 'dark)
609 header, and affect the score of not only the matching articles, but 609 `(((and (not mailp) (eq level 1)) .
610 also all followups to the matching articles. This allows you 610 ,(custom-face-lookup "PaleTurquoise" nil nil t))
611 e.g. increase the score of followups to your own articles, or decrease 611 ((and (not mailp) (eq level 2)) .
612 the score of followups to the articles of some known trouble-maker. 612 ,(custom-face-lookup "turquoise" nil nil t))
613 ") 613 ((and (not mailp) (eq level 3)) .
614 (gnus-score-string :tag "Thread" 614 ,(custom-face-lookup "MediumTurquoise" nil nil t))
615 :doc "\ 615 ((and (not mailp) (>= level 4)) .
616 Add a score entry on all articles that are part of a thread. 616 ,(custom-face-lookup "DarkTurquoise" nil nil t))
617 617 ((and mailp (eq level 1)) .
618 This match key works along the same lines as the `Followup' match key. 618 ,(custom-face-lookup "aquamarine1" nil nil t))
619 If you say that you want to score on a (sub-)thread that is started by 619 ((and mailp (eq level 2)) .
620 an article with a `Message-ID' X, then you add a `thread' match. This 620 ,(custom-face-lookup "aquamarine2" nil nil t))
621 will add a new `thread' match for each article that has X in its 621 ((and mailp (eq level 3)) .
622 `References' header. (These new `thread' matches will use the 622 ,(custom-face-lookup "aquamarine3" nil nil t))
623 `Message-ID's of these matching articles.) This will ensure that you 623 ((and mailp (>= level 4)) .
624 can raise/lower the score of an entire thread, even though some 624 ,(custom-face-lookup "aquamarine4" nil nil t))
625 articles in the thread may not have complete `References' headers. 625 ))
626 Note that using this may lead to undeterministic scores of the 626 (t
627 articles in the thread. 627 `(((and (not mailp) (<= level 3)) .
628 ") 628 ,(custom-face-lookup "ForestGreen" nil nil t))
629 ,@types) 629 ((and (not mailp) (eq level 4)) .
630 '(repeat :inline t 630 ,(custom-face-lookup "DarkGreen" nil nil t))
631 :tag "Unknown entries" 631 ((and (not mailp) (eq level 5)) .
632 sexp))) 632 ,(custom-face-lookup "CadetBlue4" nil nil t))
633 (use-local-map widget-keymap) 633 ((and mailp (eq level 1)) .
634 (widget-setup))) 634 ,(custom-face-lookup "DeepPink3" nil nil t))
635 635 ((and mailp (eq level 2)) .
636 (defun gnus-score-customize-done (&rest ignore) 636 ,(custom-face-lookup "HotPink3" nil nil t))
637 "Reset the score alist with the present value." 637 ((and mailp (eq level 3)) .
638 (let ((alist gnus-custom-score-alist) 638 ,(custom-face-lookup "dark magenta" nil nil t))
639 (value (widget-value gnus-custom-scores))) 639 ((and mailp (eq level 4)) .
640 (setcar alist (car value)) 640 ,(custom-face-lookup "DeepPink4" nil nil t))
641 (setcdr alist (cdr value)) 641 ((and mailp (> level 4)) .
642 (gnus-score-set 'touched '(t) alist)) 642 ,(custom-face-lookup "DarkOrchid4" nil nil t))
643 (bury-buffer)) 643 ))))
644 644 (data
645 ;;; The End: 645 ((type . repeat)
646 (header . nil)
647 (data (type . pair)
648 (compact . t)
649 (data ((type . sexp)
650 (width . 60)
651 (tag . "Form"))
652 "\n "
653 ((type . face)
654 (tag . "Face"))
655 "\n")))))
656
657 ;; Do not define `gnus-button-alist' before we have
658 ;; some `complexity' attribute so we can hide it from
659 ;; beginners.
660 )))))
661
662 (defun gnus-custom-import-cite-face-list (custom alist)
663 ;; Backward compatible grokking of light and dark.
664 (cond ((eq alist 'light)
665 (setq alist (mapcar 'gnus-make-face gnus-face-light-name-list)))
666 ((eq alist 'dark)
667 (setq alist (mapcar 'gnus-make-face gnus-face-dark-name-list))))
668 (funcall (custom-super custom 'import) custom alist))
646 669
647 (provide 'gnus-cus) 670 (provide 'gnus-cus)
648 671
649 ;;; gnus-cus.el ends here 672 ;;; gnus-cus.el ends here
650