(mm-uu-copy-to-buffer): buffer-file-coding-system
[gnus] / lisp / gnus-cus.el
1 ;;; gnus-cus.el --- customization commands for Gnus
2 ;;
3 ;; Copyright (C) 1996, 1999, 2000, 2001, 2002, 2003
4 ;;        Free Software Foundation, Inc.
5
6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
7 ;; Keywords: news
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;;; Code:
29
30 (require 'wid-edit)
31 (require 'gnus)
32 (require 'gnus-agent)
33 (require 'gnus-score)
34 (require 'gnus-topic)
35 (require 'gnus-art)
36
37 ;;; Widgets:
38
39 (defun gnus-custom-mode ()
40   "Major mode for editing Gnus customization buffers.
41
42 The following commands are available:
43
44 \\[widget-forward]              Move to next button or editable field.
45 \\[widget-backward]             Move to previous button or editable field.
46 \\[widget-button-click]         Activate button under the mouse pointer.
47 \\[widget-button-press]         Activate button under point.
48
49 Entry to this mode calls the value of `gnus-custom-mode-hook'
50 if that value is non-nil."
51   (kill-all-local-variables)
52   (setq major-mode 'gnus-custom-mode
53         mode-name "Gnus Customize")
54   (use-local-map widget-keymap)
55   ;; Emacs 21 stuff:
56   (when (and (facep 'custom-button-face)
57              (facep 'custom-button-pressed-face))
58     (set (make-local-variable 'widget-button-face)
59          'custom-button-face)
60     (set (make-local-variable 'widget-button-pressed-face)
61          'custom-button-pressed-face)
62     (set (make-local-variable 'widget-mouse-face)
63          'custom-button-pressed-face))
64   (when (and (boundp 'custom-raised-buttons)
65              (symbol-value 'custom-raised-buttons))
66     (set (make-local-variable 'widget-push-button-prefix) "")
67     (set (make-local-variable 'widget-push-button-suffix) "")
68     (set (make-local-variable 'widget-link-prefix) "")
69     (set (make-local-variable 'widget-link-suffix) ""))
70   (gnus-run-hooks 'gnus-custom-mode-hook))
71
72 ;;; Group Customization:
73
74 (defconst gnus-group-parameters
75   '((extra-aliases (choice
76                     :tag "Extra Aliases"
77                     (list
78                      :tag "List"
79                      (editable-list
80                       :inline t
81                       (gnus-email-address :tag "Address")))
82                     (gnus-email-address :tag "Address")) "\
83 Store messages posted from or to this address in this group.
84
85 You must be using gnus-group-split for this to work.  The VALUE of the
86 nnmail-split-fancy SPLIT generated for this group will match these
87 addresses.")
88
89     (split-regexp (regexp :tag "gnus-group-split Regular Expression") "\
90 Like gnus-group-split Address, but expects a regular expression.")
91
92     (split-exclude (list :tag "gnus-group-split Restricts"
93                          (editable-list
94                           :inline t (regexp :tag "Restrict"))) "\
95 Regular expression that cancels gnus-group-split matches.
96
97 Each entry is added to the nnmail-split-fancy SPLIT as a separate
98 RESTRICT clause.")
99
100     (split-spec (choice :tag "gnus-group-split Overrider"
101                         (sexp :tag "Fancy Split")
102                         (const :tag "Catch All" catch-all)
103                         (const :tag "Ignore" nil)) "\
104 Override all other gnus-group-split fields.
105
106 In `Fancy Split', you can enter any nnmail-split-fancy SPLIT.  Note
107 that the name of this group won't be automatically assumed, you have
108 to add it to the SPLITs yourself.  This means you can use such splits
109 to split messages to other groups too.
110
111 If you select `Catch All', this group will get postings for any
112 messages not matched in any other group.  It overrides the variable
113 gnus-group-split-default-catch-all-group.
114
115 Selecting `Ignore' forces no SPLIT to be generated for this group,
116 disabling all other gnus-group-split fields.")
117
118     (broken-reply-to (const :tag "Broken Reply To" t) "\
119 Ignore `Reply-To' headers in this group.
120
121 That can be useful if you're reading a mailing list group where the
122 listserv has inserted `Reply-To' headers that point back to the
123 listserv itself.  This is broken behavior.  So there!")
124
125     (to-group (string :tag "To Group") "\
126 All posts will be sent to the specified group.")
127
128     (gcc-self (choice :tag  "GCC"
129                       :value t
130                       (const :tag "To current group" t)
131                       (const none)
132                       (string :format "%v" :hide-front-space t)) "\
133 Specify default value for GCC header.
134
135 If this symbol is present in the group parameter list and set to t,
136 new composed messages will be `Gcc''d to the current group.  If it is
137 present and set to `none', no `Gcc:' header will be generated, if it
138 is present and a string, this string will be inserted literally as a
139 `gcc' header (this symbol takes precedence over any default `Gcc'
140 rules as described later).")
141
142     (expiry-wait (choice :tag  "Expire Wait"
143                          :value never
144                          (const never)
145                          (const immediate)
146                          (number :hide-front-space t
147                                  :format "%v")) "\
148 When to expire.
149
150 Overrides any `nnmail-expiry-wait' and `nnmail-expiry-wait-function'
151 when expiring expirable messages.  The value can either be a number of
152 days (not necessarily an integer) or the symbols `never' or
153 `immediate'.")
154
155     (expiry-target (choice :tag "Expiry Target"
156                            :value delete
157                            (const delete)
158                            (function :format "%v" nnmail-)
159                            string) "\
160 Where expired messages end up.
161
162 Overrides `nnmail-expiry-target', which see.")
163
164     (score-file (file :tag "Score File") "\
165 Make the specified file into the current score file.
166 This means that all score commands you issue will end up in this file.")
167
168     (adapt-file (file :tag "Adapt File") "\
169 Make the specified file into the current adaptive file.
170 All adaptive score entries will be put into this file.")
171
172     (admin-address (gnus-email-address :tag "Admin Address") "\
173 Administration address for a mailing list.
174
175 When unsubscribing to a mailing list you should never send the
176 unsubscription notice to the mailing list itself.  Instead, you'd
177 send messages to the administrative address.  This parameter allows
178 you to put the admin address somewhere convenient.")
179
180     (display (choice :tag "Display"
181                      :value default
182                      (const all)
183                      (integer)
184                      (const default)
185                      (sexp  :tag "Other")) "\
186 Which articles to display on entering the group.
187
188 `all'
189      Display all articles, both read and unread.
190
191 `integer'
192      Display the last NUMBER articles in the group.  This is the same as
193      entering the group with C-u NUMBER.
194
195 `default'
196      Display the default visible articles, which normally includes
197      unread and ticked articles.
198
199 `Other'
200      Display the articles that satisfy the S-expression. The S-expression
201      should be in an array form.")
202
203     (comment (string :tag  "Comment") "\
204 An arbitrary comment on the group.")
205
206     (visible (const :tag "Permanently visible" t) "\
207 Always display this group, even when there are no unread articles
208 in it..")
209
210     (highlight-words
211      (choice :tag "Highlight words"
212              :value nil
213              (repeat (list (regexp :tag "Highlight regexp")
214                            (number :tag "Group for entire word" 0)
215                            (number :tag "Group for displayed part" 0)
216                            (symbol :tag "Face"
217                                    gnus-emphasis-highlight-words))))
218      "highlight regexps.
219 See `gnus-emphasis-alist'.")
220
221     (posting-style
222      (choice :tag "Posting style"
223              :value nil
224              (repeat (list
225                       (choice :tag "Type"
226                               :value nil
227                               (const signature)
228                               (const signature-file)
229                               (const organization)
230                               (const address)
231                               (const name)
232                               (const body))
233                       (string :format "%v"))))
234      "post style.
235 See `gnus-posting-styles'."))
236   "Alist of valid group or topic parameters.
237
238 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
239 itself (a symbol), TYPE is the parameters type (a sexp widget), and
240 DOC is a documentation string for the parameter.")
241
242 (defconst gnus-extra-topic-parameters
243   '((subscribe (regexp :tag "Subscribe") "\
244 If `gnus-subscribe-newsgroup-method' or
245 `gnus-subscribe-options-newsgroup-method' is set to
246 `gnus-subscribe-topics', new groups that matches this regexp will
247 automatically be subscribed to this topic")
248     (subscribe-level (integer :tag "Subscribe Level" :value 1) "\
249 If this topic parameter is set, when new groups are subscribed
250 automatically under this topic (via the `subscribe' topic parameter)
251 assign this level to the group, rather than the default level
252 set in `gnus-level-default-subscribed'"))
253   "Alist of topic parameters that are not also group parameters.
254
255 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
256 itself (a symbol), TYPE is the parameters type (a sexp widget), and
257 DOC is a documentation string for the parameter.")
258
259 (defconst gnus-extra-group-parameters
260   '((uidvalidity (string :tag "IMAP uidvalidity") "\
261 Server-assigned value attached to IMAP groups, used to maintain consistency."))
262   "Alist of group parameters that are not also topic parameters.
263
264 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
265 itself (a symbol), TYPE is the parameters type (a sexp widget), and
266 DOC is a documentation string for the parameter.")
267
268 (eval-and-compile
269   (defconst gnus-agent-parameters
270     '((agent-predicate
271        (sexp :tag "Selection Predicate" :value false)
272        "Predicate used to automatically select articles for downloading."
273        gnus-agent-cat-predicate)
274       (agent-score
275        (choice :tag "Score File" :value nil
276                (const file :tag "Use group's score files")
277                (repeat (list (string :format "%v" :tag "File name"))))
278        "Which score files to use when using score to select articles to fetch.
279
280     `nil'
281          All articles will be scored to zero (0).
282
283     `file'
284          The group's score files will be used to score the articles.
285
286     `List'
287          A list of score file names."
288        gnus-agent-cat-score-file)
289       (agent-short-article
290        (integer :tag "Max Length of Short Article" :value "")
291        "The SHORT predicate will evaluate to true when the article is
292 shorter than this length."  gnus-agent-cat-length-when-short)
293       (agent-long-article
294        (integer :tag "Min Length of Long Article" :value "")
295        "The LONG predicate will evaluate to true when the article is
296 longer than this length."  gnus-agent-cat-length-when-long)
297       (agent-low-score
298        (integer :tag "Low Score Limit" :value "")
299        "The LOW predicate will evaluate to true when the article scores
300 lower than this limit."  gnus-agent-cat-low-score)
301       (agent-high-score
302        (integer :tag "High Score Limit" :value "")
303        "The HIGH predicate will evaluate to true when the article scores
304 higher than this limit."  gnus-agent-cat-high-score)
305       (agent-days-until-old
306        (integer :tag "Days Until Old" :value "")
307        "The OLD predicate will evaluate to true when the fetched article
308 has been stored locally for at least this many days."
309        gnus-agent-cat-days-until-old)
310       (agent-enable-expiration
311        (radio :tag "Expire in this Group or Topic" :value nil
312 ;              (const :format "Inherit " nil)
313               (const :format "Enable " ENABLE)
314