444ff9ac60a826eff20f24d08fbcae3c4be64c00
[gnus] / lisp / gnus-cus.el
1 ;;; gnus-cus.el --- customization commands for Gnus
2 ;;
3 ;; Copyright (C) 1996,1999, 2000 Free Software Foundation, Inc.
4
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Keywords: news
7
8 ;; This file is part of GNU Emacs.
9
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)
13 ;; any later version.
14
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.
19
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.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 (require 'wid-edit)
30 (require 'gnus)
31 (require 'gnus-score)
32 (require 'gnus-topic)
33 (require 'gnus-art)
34
35 ;;; Widgets:
36
37 ;; There should be special validation for this.
38 (define-widget 'gnus-email-address 'string
39   "An email address")
40
41 (defun gnus-custom-mode ()
42   "Major mode for editing Gnus customization buffers.
43
44 The following commands are available:
45
46 \\[widget-forward]              Move to next button or editable field.
47 \\[widget-backward]             Move to previous button or editable field.
48 \\[widget-button-click]         Activate button under the mouse pointer.
49 \\[widget-button-press]         Activate button under point.
50
51 Entry to this mode calls the value of `gnus-custom-mode-hook'
52 if that value is non-nil."
53   (kill-all-local-variables)
54   (setq major-mode 'gnus-custom-mode
55         mode-name "Gnus Customize")
56   (use-local-map widget-keymap)
57   ;; Emacs 21 stuff:
58   (when (and (facep 'custom-button-face)
59              (facep 'custom-button-pressed-face))
60     (set (make-local-variable 'widget-button-face)
61          'custom-button-face)
62     (set (make-local-variable 'widget-button-pressed-face)
63          'custom-button-pressed-face)
64     (set (make-local-variable 'widget-mouse-face)
65          'custom-button-pressed-face))
66   (when (and (boundp 'custom-raised-buttons)
67              (symbol-value 'custom-raised-buttons))
68     (set (make-local-variable 'widget-push-button-prefix) "")
69     (set (make-local-variable 'widget-push-button-suffix) "")
70     (set (make-local-variable 'widget-link-prefix) "")
71     (set (make-local-variable 'widget-link-suffix) ""))
72   (gnus-run-hooks 'gnus-custom-mode-hook))
73
74 ;;; Group Customization:
75
76 (defconst gnus-group-parameters
77   '((to-address (gnus-email-address :tag "To Address") "\
78 This will be used when doing followups and posts.
79
80 This is primarily useful in mail groups that represent closed
81 mailing lists--mailing lists where it's expected that everybody that
82 writes to the mailing list is subscribed to it.  Since using this
83 parameter ensures that the mail only goes to the mailing list itself,
84 it means that members won't receive two copies of your followups.
85
86 Using `to-address' will actually work whether the group is foreign or
87 not.  Let's say there's a group on the server that is called
88 `fa.4ad-l'.  This is a real newsgroup, but the server has gotten the
89 articles from a mail-to-news gateway.  Posting directly to this group
90 is therefore impossible--you have to send mail to the mailing list
91 address instead.
92
93 The gnus-group-split mail splitting mechanism will behave as if this
94 address was listed in gnus-group-split Addresses (see below).")
95
96     (to-list (gnus-email-address :tag "To List") "\
97 This address will be used when doing a `a' in the group.
98
99 It is totally ignored when doing a followup--except that if it is
100 present in a news group, you'll get mail group semantics when doing
101 `f'.
102
103 The gnus-group-split mail splitting mechanism will behave as if this
104 address was listed in gnus-group-split Addresses (see below).")
105
106     (extra-aliases (choice
107                     :tag "Extra Aliases"
108                     (list
109                      :tag "List"
110                      (editable-list
111                       :inline t
112                       (gnus-email-address :tag "Address")))
113                     (gnus-email-address :tag "Address")) "\
114 Store messages posted from or to this address in this group.
115
116 You must be using gnus-group-split for this to work.  The VALUE of the
117 nnmail-split-fancy SPLIT generated for this group will match these
118 addresses.")
119
120     (split-regexp (regexp :tag "gnus-group-split Regular Expression") "\
121 Like gnus-group-split Address, but expects a regular expression.")
122
123     (split-exclude (list :tag "gnus-group-split Restricts"
124                          (editable-list
125                           :inline t (regexp :tag "Restrict"))) "\
126 Regular expression that cancels gnus-group-split matches.
127
128 Each entry is added to the nnmail-split-fancy SPLIT as a separate
129 RESTRICT clause.")
130
131     (split-spec (choice :tag "gnus-group-split Overrider"
132                         (sexp :tag "Fancy Split")
133                         (const :tag "Catch All" catch-all)
134                         (const :tag "Ignore" nil)) "\
135 Override all other gnus-group-split fields.
136
137 In `Fancy Split', you can enter any nnmail-split-fancy SPLIT.  Note
138 that the name of this group won't be automatically assumed, you have
139 to add it to the SPLITs yourself.  This means you can use such splits
140 to split messages to other groups too.
141
142 If you select `Catch All', this group will get postings for any
143 messages not matched in any other group.  It overrides the variable
144 gnus-group-split-default-catch-all-group.
145
146 Selecting `Ignore' forces no SPLIT to be generated for this group,
147 disabling all other gnus-group-split fields.")
148
149     (broken-reply-to (const :tag "Broken Reply To" t) "\
150 Ignore `Reply-To' headers in this group.
151
152 That can be useful if you're reading a mailing list group where the
153 listserv has inserted `Reply-To' headers that point back to the
154 listserv itself.  This is broken behavior.  So there!")
155
156     (to-group (string :tag "To Group") "\
157 All posts will be sent to the specified group.")
158
159     (gcc-self (choice :tag  "GCC"
160                       :value t
161                       (const :tag "To current group" t)
162                       (const none)
163                       (string :format "%v" :hide-front-space t)) "\
164 Specify default value for GCC header.
165
166 If this symbol is present in the group parameter list and set to `t',
167 new composed messages will be `Gcc''d to the current group.  If it is
168 present and set to `none', no `Gcc:' header will be generated, if it
169 is present and a string, this string will be inserted literally as a
170 `gcc' header (this symbol takes precedence over any default `Gcc'
171 rules as described later).")
172
173     (expiry-wait (choice :tag  "Expire Wait"
174                          :value never
175                          (const never)
176                          (const immediate)
177                          (number :hide-front-space t
178                                  :format "%v")) "\
179 When to expire.
180
181 Overrides any `nnmail-expiry-wait' and `nnmail-expiry-wait-function'
182 when expiring expirable messages.  The value can either be a number of
183 days (not necessarily an integer) or the symbols `never' or
184 `immediate'.")
185
186     (expiry-target (choice :tag "Expiry Target"
187                            :value delete
188                            (const delete)
189                            (function :format "%v" nnmail-)
190                            string) "\
191 Where expired messages end up.
192
193 Overrides `nnmail-expiry-target', which see.")
194
195     (score-file (file :tag "Score File") "\
196 Make the specified file into the current score file.
197 This means that all score commands you issue will end up in this file.")
198
199     (adapt-file (file :tag "Adapt File") "\
200 Make the specified file into the current adaptive file.
201 All adaptive score entries will be put into this file.")
202
203     (admin-address (gnus-email-address :tag "Admin Address") "\
204 Administration address for a mailing list.
205
206 When unsubscribing to a mailing list you should never send the
207 unsubscription notice to the mailing list itself.  Instead, you'd
208 send messages to the administrative address.  This parameter allows
209 you to put the admin address somewhere convenient.")
210
211     (display (choice :tag "Display"
212                      :value default
213                      (const all)
214                      (const default)) "\
215 Which articles to display on entering the group.
216
217 `all'
218      Display all articles, both read and unread.
219
220 `default'
221      Display the default visible articles, which normally includes
222      unread and ticked articles.")
223
224     (comment (string :tag  "Comment") "\
225 An arbitrary comment on the group.")
226
227     (visible (const :tag "Permanently visible" t) "\
228 Always display this group, even when there are no unread articles
229 in it..")
230
231     (charset (symbol :tag "Charset") "\
232 The default charset to use in the group.")
233              
234     (ignored-charsets 
235      (choice :tag "Ignored charsets" 
236              :value nil
237              (repeat (symbol))) "\
238 List of charsets that should be ignored.
239
240 When these charsets are used in the \"charset\" parameter, the
241 default charset will be used instead.")
242              
243     (highlight-words 
244      (choice :tag "Highlight words"
245              :value nil
246              (repeat (list (regexp :tag "Highlight regexp")
247                            (number :tag "Group for entire word" 0)
248                            (number :tag "Group for displayed part" 0)
249                            (symbol :tag "Face" 
250                                    gnus-emphasis-highlight-words))))
251      "highlight regexps.
252 See gnus-emphasis-alist.")
253
254     (posting-style
255      (choice :tag "Posting style"
256              :value nil
257              (repeat (list
258                       (choice :tag "Type"
259                               :value nil
260                               (const signature)
261                               (const signature-file) 
262                               (const organization)