Initial Commit
[packages] / xemacs-packages / mh-e / mh-customize.el
1 ;;; mh-customize.el --- MH-E customization
2
3 ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4
5 ;; Author: Bill Wohler <wohler@newt.com>
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
7 ;; Keywords: mail
8 ;; See: mh-e.el
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Commentary:
28
29 ;; All of the defgroups, defcustoms, and deffaces in MH-E are found
30 ;; here. This makes it possible to customize modules that aren't loaded
31 ;; yet. It also makes it easier to organize the customization groups.
32
33 ;; This file contains the following sections:
34 ;;
35 ;; 1. MH-E Customization Groups
36 ;;
37 ;;    These are the customization group definitions. These are organized in a
38 ;;    logical order. High-level, windows and toolbar, folder, message,
39 ;;    composing and hooks.
40 ;;
41 ;; 2. MH-E Customization
42 ;;
43 ;;    Here are the actual customization variables. There is a sub-section for
44 ;;    each group in the MH-E Customization Groups section. Within each
45 ;;    section, variables are sorted alphabetically. The manual section
46 ;;    dictates which group a variable should be placed. New variables should
47 ;;    be placed in the section where they would most likely be defined.
48 ;;
49 ;;    All hooks should be placed in the 'mh-hook group; in addition, add the
50 ;;    group in which the hook is defined in the manual (or, if it is new,
51 ;;    where it would be defined). These two actions insures that the hooks
52 ;;    appear last in each group.
53 ;;
54 ;; 3. Faces
55
56 ;;; Change Log:
57
58 ;;; Code:
59 (provide 'mh-customize)
60 (require 'mh-utils)
61
62 ;;;###mh-autoload
63 (defun mh-customize (&optional delete-other-windows-flag)
64   "Customize MH-E variables.
65 With optional argument DELETE-OTHER-WINDOWS-FLAG, other windows in the frame
66 are removed."
67   (interactive "P")
68   (customize-group 'mh)
69   (when delete-other-windows-flag
70     (delete-other-windows)))
71
72 ;;; MH-E Customization Groups
73
74 (defgroup mh nil
75   "GNU Emacs interface to the MH mail system."
76   :link '(custom-manual "(mh-e)Top")
77   :group 'mail)
78
79 (defgroup mh-toolbar nil
80   "Toolbar configuration."
81   :prefix "mh-"
82   :group 'mh)
83
84 (defgroup mh-speed nil
85   "Speedbar and folder configuration."
86   :prefix "mh-"
87   :link '(custom-manual "(mh-e)Customizing Moving Mail")
88   :group 'mh)
89
90 (defgroup mh-folder nil
91   "Options for controlling scan listing."
92   :prefix "mh-"
93   :link '(custom-manual "(mh-e)Customizing Moving Mail")
94   :group 'mh)
95
96 (defgroup mh-index nil
97   "Indexed searching."
98   :link '(custom-manual "(mh-e)Customizing mh-e")
99   :prefix "mh-"
100   :group 'mh)
101
102 (defgroup mh-junk nil
103   "Spam handling."
104   :link '(custom-manual "(mh-e)Customizing mh-e")
105   :prefix "mh-junk-"
106   :group 'mh)
107
108 (defgroup mh-show nil
109   "Message display."
110   :prefix "mh-"
111   :link '(custom-manual "(mh-e)Customizing Reading")
112   :group 'mh)
113
114 (defgroup mh-faces nil
115   "Faces used in MH-E."
116   :link '(custom-manual "(mh-e)Customizing mh-e")
117   :prefix "mh-"
118   :group 'faces
119   :group 'mh)
120
121 (defgroup mh-letter nil
122   "Composing messages."
123   :prefix "mh-"
124   :link '(custom-manual "(mh-e)Customizing Sending")
125   :group 'mh)
126
127 (defgroup mh-alias nil
128   "Alias handling."
129   :link '(custom-manual "(mh-e)Customizing mh-e")
130   :prefix "mh-alias-"
131   :group 'mh)
132
133 (defgroup mh-identity nil
134   "Multiple personalities."
135   :link '(custom-manual "(mh-e)Customizing mh-e")
136   :prefix "mh-"
137   :group 'mh)
138
139 (defgroup mh-hooks nil
140   "MH-E hooks."
141   :link '(custom-manual "(mh-e)Customizing mh-e")
142   :prefix "mh-"
143   :group 'mh)
144
145 ;;; Faces
146
147 (defgroup mh-speed-faces nil
148   "Faces used in speedbar."
149   :link '(custom-manual "(mh-e)Customizing mh-e")
150   :prefix "mh-"
151   :group 'mh-faces
152   :group 'mh-speed)
153
154 (defgroup mh-folder-faces nil
155   "Faces used in scan listing."
156   :link '(custom-manual "(mh-e)Customizing mh-e")
157   :prefix "mh-"
158   :group 'mh-faces
159   :group 'mh-folder)
160
161 (defgroup mh-index-faces nil
162   "Faces used in indexed searches."
163   :link '(custom-manual "(mh-e)Customizing mh-e")
164   :prefix "mh-"
165   :group 'mh-faces
166   :group 'mh-index)
167
168 (defgroup mh-show-faces nil
169   "Faces used in message display."
170   :link '(custom-manual "(mh-e)Customizing mh-e")
171   :prefix "mh-"
172   :group 'mh-faces
173   :group 'mh-show)
174
175 (defgroup mh-letter-faces nil
176   "Faces used when composing messages."
177   :link '(custom-manual "(mh-e)Customizing mh-e")
178   :prefix "mh-"
179   :group 'mh-faces
180   :group 'mh-letter)
181
182 \f
183
184 ;;; MH-E Customization (:group mh)
185
186 ;;; Toolbar configuration (:group 'mh-toolbar)
187
188 (defcustom mh-tool-bar-search-function 'mh-search-folder
189   "*Function called by the tool-bar search button.
190 See `mh-search-folder' and `mh-index-search' for details."
191   :type '(choice (const mh-search-folder)
192                  (const mh-index-search)
193                  (function :tag "Other function"))
194   :group 'mh-toolbar)
195
196 ;; Functions called from the tool bar
197 (defun mh-tool-bar-search (&optional arg)
198   "Interactively call `mh-tool-bar-search-function'.
199 Optional argument ARG is not used."
200   (interactive "P")
201   (call-interactively mh-tool-bar-search-function))
202
203 (defun mh-tool-bar-customize ()
204   "Call `mh-customize' from the toolbar."
205   (interactive)
206   (mh-customize t))
207
208 (defun mh-tool-bar-folder-help ()
209   "Visit \"(mh-e)Top\"."
210   (interactive)
211   (Info-goto-node "(mh-e)Top")
212   (delete-other-windows))
213
214 (defun mh-tool-bar-letter-help ()
215   "Visit \"(mh-e)Draft Editing\"."
216   (interactive)
217   (Info-goto-node "(mh-e)Draft Editing")
218   (delete-other-windows))
219
220 (defmacro mh-tool-bar-reply-generator (function recipient folder-buffer-flag)
221   "Generate FUNCTION that replies to RECIPIENT.
222 If FOLDER-BUFFER-FLAG is nil then the function generated
223 When INCLUDE-FLAG is non-nil, include message body being replied to."
224   `(defun ,function (&optional arg)
225      ,(format "Reply to \"%s\".\nWhen ARG is non-nil include message in reply."
226               recipient)
227      (interactive "P")
228      ,(if folder-buffer-flag nil '(set-buffer mh-show-folder-buffer))
229      (mh-reply (mh-get-msg-num nil) ,recipient arg)))
230
231 (mh-tool-bar-reply-generator mh-tool-bar-reply-from "from" t)
232 (mh-tool-bar-reply-generator mh-show-tool-bar-reply-from "from" nil)
233 (mh-tool-bar-reply-generator mh-tool-bar-reply-to "to" t)
234 (mh-tool-bar-reply-generator mh-show-tool-bar-reply-to "to" nil)
235 (mh-tool-bar-reply-generator mh-tool-bar-reply-all "all" t)
236 (mh-tool-bar-reply-generator mh-show-tool-bar-reply-all "all" nil)
237
238 ;; XEmacs has a couple of extra customizations...
239 (mh-do-in-xemacs
240   (require 'mh-xemacs-icons)
241   (defcustom mh-xemacs-use-toolbar-flag (if (and (featurep 'toolbar)
242                                                  (featurep 'xpm)
243                                                  (device-on-window-system-p))
244                                             t
245                                           nil)
246     "*If non-nil, use toolbar.
247
248 This will default to t if you are in an environment that supports
249 toolbars and xpm."
250     :type 'boolean
251     :group 'mh-toolbar)
252
253   (defcustom mh-xemacs-toolbar-position (if mh-xemacs-use-toolbar-flag
254                                             'default
255                                           nil)
256     "*Where to put the toolbar.
257
258 Valid non-nil values are \"default\", \"top\", \"bottom\", \"left\",
259 \"right\".  These match the four edges of the frame, with \"default\"
260 meaning \"use the same position as the default-toolbar\".
261
262 A nil value means do not use a toolbar.
263
264 If this variable is set to anything other than \"default\" and the
265 default-toolbar has a different positional setting from the value of
266 this variable, then two toolbars will be displayed.  The MH-E toolbar
267 and the default-toolbar."
268     :type '(radio (const :tag "Same position as the \"default-toolbar\""
269                          :value default)
270                   (const :tag "Along the top edge of the frame"
271                          :value top)
272                   (const :tag "Along the bottom edge of the frame"
273                          :value bottom)
274                   (const :tag "Along the left edge of the frame"
275                          :value left)
276                   (const :tag "Along the right edge of the frame"
277                          :value right)
278                   (const :tag "Don't use a toolbar" nil))
279     :group 'mh-toolbar))
280
281 (defmacro mh-tool-bar-define (defaults &rest buttons)
282   "Define a tool bar for MH-E.
283 DEFAULTS is the list of buttons that are present by default. It is a list of
284 lists where the sublists are of the following form:
285
286   (:KEYWORD FUNC1 FUNC2 FUNC3 ...)
287
288 Here :KEYWORD is one of :folder or :letter. If it is :folder then the default
289 buttons in the folder and show mode buffers are being specified. If it is
290 :letter then the default buttons in the letter mode are listed. FUNC1, FUNC2,
291 FUNC3, ... are the names of the functions that the buttons would execute.
292
293 Each element of BUTTONS is a list consisting of four mandatory items and one
294 optional item as follows:
295
296   (FUNCTION MODES ICON DOC &optional ENABLE-EXPR)
297
298 where,
299
300   FUNCTION is the name of the function that will be executed when the button
301   is clicked.
302
303   MODES is a list of symbols. List elements must be from `folder', `letter' and
304   `sequence'. If `folder' is present then the button is available in the
305   folder and show buffer. If the name of FUNCTION is of the form \"mh-foo\",
306   where foo is some arbitrary string, then we check if the function
307   `mh-show-foo' exists. If it exists then that function is used in the show
308   buffer. Otherwise the original function `mh-foo' is used in the show buffer
309   as well. Presence of `sequence' is handled similar to the above. The only
310   difference is that the button is shown only when the folder is narrowed to a
311   sequence. If `letter' is present in MODES, then the button is available
312   during draft editing and runs FUNCTION when clicked.
313
314   ICON is the icon that is drawn in the button.
315
316   DOC is the documentation for the button. It is used in tool-tips and in
317   providing other help to the user. GNU Emacs uses only the first line of the
318   string. So the DOC should be formatted such that the first line is useful and
319   complete without the rest of the string.
320
321   Optional item ENABLE-EXPR is an arbitrary lisp expression. If it evaluates
322   to nil, then the button is deactivated, otherwise it is active. If is in't
323   present then the button is always active."
324   ;; The following variable names have been carefully chosen to make code
325   ;; generation easier. Modifying the names should be done carefully.
326   (let (folder-buttons folder-docs folder-button-setter sequence-button-setter
327         show-buttons show-button-setter show-seq-button-setter
328         letter-buttons letter-docs letter-button-setter
329         folder-defaults letter-defaults
330         folder-vectors show-vectors letter-vectors)
331     (dolist (x defaults)
332       (cond ((eq (car x) :folder) (setq folder-defaults (cdr x)))
333             ((eq (car x) :letter) (setq letter-defaults (cdr x)))))
334     (dolist (button buttons)
335       (unless (and (listp button)
336                    (or (equal (length button) 4) (equal (length button) 5)))
337         (error "Incorrect MH-E tool-bar button specification: %s" button))
338       (let* ((name (nth 0 button))
339              (name-str (symbol-name name))
340              (icon (nth 2 button))
341              (xemacs-icon (mh-do-in-xemacs
342                            (cdr (assoc (intern icon) mh-xemacs-icon-map))))
343              (full-doc (nth 3 button))
344              (doc (if (string-match "\\(.*\\)\n" full-doc)
345                       (match-string 1 full-doc)
346                     full-doc))
347              (enable-expr (or (nth 4 button) t))
348              (modes (nth 1 button))
349              functions show-sym)
350         (when (memq 'letter modes) (setq functions `(:letter ,name)))
351         (when (or (memq 'folder modes) (memq 'sequence modes))
352           (setq functions
353                 (append `(,(if (memq 'folder modes) :folder :sequence) ,name)
354                         functions))
355           (setq show-sym
356                 (if (string-match "^mh-\\(.*\\)$" name-str)
357                     (intern (concat "mh-show-" (match-string 1 name-str)))
358                   name))
359           (setq functions
360                 (append `(,(if (memq 'folder modes) :show :show-seq)
361                           ,(if (fboundp show-sym) show-sym name))
362                         functions)))
363         (do ((functions functions (cddr functions)))
364             ((null functions))
365           (let* ((type (car functions))
366                  (function (cadr functions))
367                  (type1 (substring (symbol-name type) 1))
368                  (vector-list (cond ((eq type :show) 'show-vectors)
369                                     ((eq type :show-seq) 'show-vectors)
370                                     ((eq type :letter) 'letter-vectors)
371                                     (t 'folder-vectors)))
372                  (list (cond ((eq type :letter) 'mh-tool-bar-letter-buttons)
373                              (t 'mh-tool-bar-folder-buttons)))
374                  (key (intern (concat "mh-" type1 "toolbar-" name-str)))
375                  (setter (intern (concat type1 "-button-setter")))
376                  (mbuttons (cond ((eq type :letter) 'letter-buttons)
377                                  ((eq type :show) 'show-buttons)
378                                  ((eq type :show-seq) 'show-buttons)
379                                  (t 'folder-buttons)))
380                  (docs (cond ((eq mbuttons 'letter-buttons) 'letter-docs)
381                              ((eq mbuttons 'folder-buttons) 'folder-docs))))
382             (add-to-list vector-list `[,xemacs-icon ,function t ,full-doc])
383             (add-to-list
384              setter `(when (member ',name ,list)
385                        (mh-funcall-if-exists
386                         tool-bar-add-item ,icon ',function ',key
387                                           :help ,doc :enable ',enable-expr)))
388             (add-to-list mbuttons name)
389             (if docs (add-to-list docs doc))))))
390     (setq folder-buttons (nreverse folder-buttons)
391           letter-buttons (nreverse letter-buttons)
392           show-buttons (nreverse show-buttons)
393           letter-docs (nreverse letter-docs)
394           folder-docs (nreverse folder-docs)
395           folder-vectors (nreverse folder-vectors)
396           show-vectors (nreverse show-vectors)
397           letter-vectors (nreverse letter-vectors))
398     (dolist (x folder-defaults)
399       (unless (memq x folder-buttons)
400         (error "Folder defaults contains unknown button '%s'" x)))
401     (dolist (x letter-defaults)
402       (unless (memq x letter-buttons)
403         (error "Letter defaults contains unknown button '%s'" x)))
404     `(eval-when (compile load eval)
405        (defvar mh-folder-tool-bar-map nil)
406        (defvar mh-folder-seq-tool-bar-map nil)
407        (defvar mh-show-tool-bar-map nil)
408        (defvar mh-show-seq-tool-bar-map nil)
409        (defvar mh-letter-tool-bar-map nil)
410        ;; GNU Emacs tool bar specific code
411        (mh-do-in-gnu-emacs
412          ;; Custom setter functions
413          (defun mh-tool-bar-folder-buttons-set (symbol value)
414            "Construct toolbar for `mh-folder-mode' and `mh-show-mode'."
415            (set-default symbol value)
416            (setq mh-folder-tool-bar-map
417                  (let ((tool-bar-map (make-sparse-keymap)))
418                    ,@(nreverse folder-button-setter)
419                    tool-bar-map))
420            (setq mh-show-tool-bar-map
421                  (let ((tool-bar-map (make-sparse-keymap)))
422                    ,@(nreverse show-button-setter)
423                    tool-bar-map))
424            (setq mh-show-seq-tool-bar-map
425                  (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map)))
426                    ,@(nreverse show-seq-button-setter)
427                    tool-bar-map))
428            (setq mh-folder-seq-tool-bar-map
429                  (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map)))
430                    ,@(nreverse sequence-button-setter)
431                    tool-bar-map)))
432          (defun mh-tool-bar-letter-buttons-set (symbol value)
433            "Construct toolbar for `mh-letter-mode'."
434            (set-default symbol value)
435            (setq mh-letter-tool-bar-map
436                  (let ((tool-bar-map (make-sparse-keymap)))
437                    ,@(nreverse letter-button-setter)
438                    tool-bar-map))))
439        ;; XEmacs specific code
440        (mh-do-in-xemacs
441          (defvar mh-toolbar-folder-vector-map
442            ',(loop for button in folder-buttons
443                    for vector in folder-vectors
444                    collect (cons button vector)))
445          (defvar mh-toolbar-show-vector-map
446            ',(loop for button in show-buttons
447                    for vector in show-vectors
448                    collect (cons button vector)))
449          (defvar mh-toolbar-letter-vector-map
450            ',(loop for button in letter-buttons
451                    for vector in letter-vectors
452                    collect (cons button vector)))
453          (defvar mh-toolbar-folder-buttons nil)
454          (defvar mh-toolbar-show-buttons nil)
455          (defvar mh-toolbar-letter-buttons nil)
456          ;; Custom setter functions
457          (defun mh-tool-bar-letter-buttons-set (symbol value)
458            (set-default symbol value)
459            (setq mh-toolbar-letter-buttons
460                  (loop for b in value
461                        collect (cdr (assoc b mh-toolbar-letter-vector-map)))))
462          (defun mh-tool-bar-folder-buttons-set (symbol value)
463            (set-default symbol value)
464            (setq mh-toolbar-folder-buttons
465                  (loop for b in value
466                        collect (cdr (assoc b mh-toolbar-folder-vector-map))))
467            (setq mh-toolbar-show-buttons
468                  (loop for b in value
469                        collect (cdr (assoc b mh-toolbar-show-vector-map)))))
470          ;; Initialize toolbar
471          (defun mh-toolbar-init (mode)
472            "Install toolbar in MODE."
473            (let ((toolbar (cond ((eq mode :folder) mh-toolbar-folder-buttons)
474                                 ((eq mode :letter) mh-toolbar-letter-buttons)
475                                 ((eq mode :show) mh-toolbar-show-buttons)))
476                  (height 37)
477                  (width 40)
478                  (buffer (current-buffer)))
479              (when (and mh-xemacs-toolbar-position mh-xemacs-use-toolbar-flag)
480                (cond
481                 ((eq mh-xemacs-toolbar-position 'top)
482                  (set-specifier top-toolbar toolbar buffer)
483                  (set-specifier top-toolbar-visible-p t)
484                  (set-specifier top-toolbar-height height))
485                 ((eq mh-xemacs-toolbar-position 'bottom)
486                  (set-specifier bottom-toolbar toolbar buffer)
487                  (set-specifier bottom-toolbar-visible-p t)
488                  (set-specifier bottom-toolbar-height height))
489                 ((eq mh-xemacs-toolbar-position 'left)
490                  (set-specifier left-toolbar toolbar buffer)
491                  (set-specifier left-toolbar-visible-p t)
492                  (set-specifier left-toolbar-width width))
493                 ((eq mh-xemacs-toolbar-position 'right)
494                  (set-specifier right-toolbar toolbar buffer)
495                  (set-specifier right-toolbar-visible-p t)
496                  (set-specifier right-toolbar-width width))
497                 (t (set-specifier default-toolbar toolbar buffer)))))))
498        ;; Declare customizable toolbars
499        (custom-declare-variable
500         'mh-tool-bar-folder-buttons
501         '(list ,@(mapcar (lambda (x) `(quote ,x)) folder-defaults))
502         "Choose buttons to include in MH-E folder/show toolbar."
503         :group 'mh-toolbar :set 'mh-tool-bar-folder-buttons-set
504         :type '(set ,@(loop for x in folder-buttons
505                             for y in folder-docs
506                             collect `(const :tag ,y ,x))))
507        (custom-declare-variable
508         'mh-tool-bar-letter-buttons
509         '(list ,@(mapcar (lambda (x) `(quote ,x)) letter-defaults))
510         "Choose buttons to include in MH-E letter toolbar."
511         :group 'mh-toolbar :set 'mh-tool-bar-letter-buttons-set
512         :type '(set ,@(loop for x in letter-buttons
513                             for y in letter-docs
514                             collect `(const :tag ,y ,x)))))))
515
516 (mh-tool-bar-define
517     ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg
518               mh-page-msg  mh-next-undeleted-msg mh-delete-msg mh-refile-msg
519               mh-undo mh-execute-commands mh-toggle-tick mh-reply
520               mh-alias-grab-from-field mh-send mh-rescan-folder
521               mh-tool-bar-search mh-visit-folder
522               mh-tool-bar-customize mh-tool-bar-folder-help mh-widen)
523      (:letter mh-send-letter mh-compose-insertion ispell-message save-buffer
524               undo kill-region menu-bar-kill-ring-save yank mh-fully-kill-draft
525               mh-tool-bar-customize mh-tool-bar-letter-help))
526   ;; Folder/Show buffer buttons
527   (mh-inc-folder (folder) "mail"
528     "Incorporate new mail in Inbox
529 This button runs `mh-inc-folder' which drags any
530 new mail into your Inbox folder.")
531   (mh-mime-save-parts (folder) "attach"
532     "Save MIME parts from this message
533 This button runs `mh-mime-save-parts' which saves a message's
534 different parts into separate files.")
535   (mh-previous-undeleted-msg (folder) "left_arrow"
536     "Go to the previous undeleted message
537 This button runs `mh-previous-undeleted-msg'")
538   (mh-page-msg (folder) "page-down"
539     "Page the current message forwards\nThis button runs `mh-page-msg'")
540   (mh-next-undeleted-msg (folder) "right_arrow"
541     "Go to the next undeleted message\nThe button runs `mh-next-undeleted-msg'")
542   (mh-delete-msg (folder) "close"
543     "Mark this message for deletion\nThis button runs `mh-delete-msg'")
544   (mh-refile-msg (folder) "refile"
545     "Refile this message\nThis button runs `mh-refile-msg'")
546   (mh-undo (folder) "undo" "Undo last operation\nThis button runs `undo'")
547   (mh-execute-commands (folder) "execute"
548     "Perform moves and deletes\nThis button runs `mh-execute-commands'")
549   (mh-toggle-tick (folder) "highlight"
550     "Toggle tick mark\nThis button runs `mh-toggle-tick'")
551   (mh-toggle-showing (folder) "show"
552     "Toggle showing message\nThis button runs `mh-toggle-showing'")
553   (mh-tool-bar-reply-from (folder) "reply-from" "Reply to \"from\"")
554   (mh-tool-bar-reply-to (folder) "reply-to" "Reply to \"to\"")
555   (mh-tool-bar-reply-all (folder) "reply-all" "Reply to \"all\"")
556   (mh-reply (folder) "mail/reply2"
557     "Reply to this message\nThis button runs `mh-reply'")
558   (mh-alias-grab-from-field (folder) "alias"
559     "Grab From alias\nThis button runs `mh-alias-grab-from-field'"
560     (mh-alias-from-has-no-alias-p))
561   (mh-send (folder) "mail_compose"
562     "Compose new message\nThis button runs `mh-send'")
563   (mh-rescan-folder (folder) "rescan"
564     "Rescan this folder\nThis button runs `mh-rescan-folder'")
565   (mh-pack-folder (folder) "repack"
566     "Repack this folder\nThis button runs `mh-pack-folder'")
567   (mh-tool-bar-search (folder) "search"
568     "Search\nThis button runs `mh-tool-bar-search-function'")
569   (mh-visit-folder (folder) "fld_open"
570     "Visit other folder\nThis button runs `mh-visit-folder'")
571   ;; Letter buffer buttons
572   (mh-send-letter (letter) "mail_send" "Send this letter")
573   (mh-compose-insertion (letter) "attach" "Insert attachment")
574   (ispell-message (letter) "spell" "Check spelling")
575   (save-buffer (letter) "save" "Save current buffer to its file")
576   (undo (letter) "undo" "Undo last operation")
577   (kill-region (letter) "cut"
578     "Cut (kill) text in region between mark and current position")
579   (menu-bar-kill-ring-save (letter) "copy"
580     "Copy text in region between mark and current position")
581   (yank (letter) "paste" "Paste (yank) text cut or copied earlier")
582   (mh-fully-kill-draft (letter) "close" "Kill this draft")
583   ;; Common buttons
584   (mh-tool-bar-customize (folder letter) "preferences" "MH-E Preferences")
585   (mh-tool-bar-folder-help (folder) "help"
586     "Help! (general help)\nThis button runs `Info-goto-node'")
587   (mh-tool-bar-letter-help (letter) "help"
588     "Help! (general help)\nThis button runs `Info-goto-node'")
589   ;; Folder narrowed to sequence buttons
590   (mh-widen (sequence) "widen"
591     "Widen from the sequence\nThis button runs `mh-widen'"))
592
593 \f
594
595 ;;; Speedbar and folder configuration (:group 'mh-speed)
596
597 (defcustom mh-large-folder 200
598   "The number of messages that indicates a large folder.
599 If a folder is deemed to be large, that is the number of messages in it exceed
600 this value, then confirmation is needed when it is visited. Even when
601 `mh-show-threads-flag' is non-nil, the folder is not automatically threaded, if
602 it is large. If set to nil all folders are treated as if they are small."
603   :type '(choice (const :tag "No limit") integer)
604   :group 'mh-speed)
605
606 (defcustom mh-speed-flists-interval 60
607   "Time between calls to flists in seconds.
608 If 0, flists is not called repeatedly."
609   :type 'integer
610   :group 'mh-speed)
611
612 (defcustom mh-speed-run-flists-flag t
613   "Non-nil means flists is used.
614 If non-nil, flists is executed every `mh-speed-flists-interval' seconds to
615 update the display of the number of unseen and total messages in each folder.
616 If resources are limited, this can be set to nil and the speedbar display can
617 be updated manually with the \\[mh-speed-flists] command."
618   :type 'boolean
619   :group 'mh-speed)
620
621 \f
622
623 ;;; Options for controlling scan listing (:group 'mh-folder)
624
625 (defcustom mh-adaptive-cmd-note-flag t
626   "*Non-nil means that the message number width is determined dynamically.
627 This is done once when a folder is first opened by running scan on the last
628 message of the folder. The message number for the last message is extracted
629 and its width calculated. This width is used when calling `mh-set-cmd-note'.
630
631 If you prefer fixed-width message numbers, set this variable to nil and call
632 `mh-set-cmd-note' with the width specified by the scan format in
633 `mh-scan-format-file'. For example, the default width is 4, so you would use
634 \"(mh-set-cmd-note 4)\" if `mh-scan-format-file' were nil."
635   :type 'boolean
636   :group 'mh-folder)
637
638 (defcustom mh-default-folder-list nil
639   "*Alist of addresses and folders.
640 When refiling messages, these folders are the default that is provided if the
641 sender (or recipient if the Check Recipient checkbox has been selected) has
642 the associated address, a regexp. The first entry to match will be used, so
643 order them according to the wanted priority. You do not need to list your
644 aliases here as that lookup is already performed.
645
646 See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
647 information."
648   :type '(repeat (list (regexp :tag "Address")
649                        (string :tag "Folder")
650                        (boolean :tag "Check Recipient")))
651   :group 'mh-folder)
652
653 (defcustom mh-default-folder-must-exist-flag t
654   "*Non-nil means guessed folder name must exist to be used.
655 If this variable is t, then the guessed name is only used if the folder
656 already exists\; if the folder doesn't exist, then the last folder name used
657 is suggested. This is useful if you get mail from various people for whom you
658 have an alias, but file them all in the same project folder.
659 See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
660 information."
661   :type 'boolean
662   :group 'mh-folder)
663
664 (defcustom mh-default-folder-prefix ""
665   "*Prefix used for guessed folder names.
666 This can be used to put folders associated with your aliases in a sub-folder
667 so as to not clutter your mail directory.
668 See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
669 information."
670   :type 'string
671   :group 'mh-folder)
672
673 (defcustom mh-inc-prog "inc"
674   "*Program to run to incorporate new mail into a folder.
675 Normally \"inc\".  This file is searched for relative to
676 the `mh-progs' directory unless it is an absolute pathname."
677   :type 'string
678   :group 'mh-folder)
679
680
681 (defcustom mh-inc-spool-list nil
682   "*Alist of alternate spool files, corresponding folders and keybindings.
683 Here's an example. Suppose you have subscribed to the MH-E devel mailing
684 list. You could filter its mail into a separate spool file named
685 ~/mail/mh-e using Procmail and a .procmailrc entry like:
686
687 MAILDIR=$HOME/mail      #you'd better make sure it exists
688 :0:
689 * ^From mh-e-devel-admin@lists.sourceforge.net
690 mh-e
691
692 If you wanted to incorporate that spool file into an MH folder called
693 mh-e by pressing \"I m\" in folder-mode or by `M-x mh-inc-spool-mh-e',
694 you would setup  `mh-inc-spool-list' with an entry:
695
696  Spool file:  ~/mail/mh-e
697  Folder:      mh-e
698  Key binding: m
699
700 Then, you could also install `xbuffy' and configure an extra mailbox like so:
701
702 box ~/mail/mh-e
703  title mh-e
704  origMode
705  polltime 10
706  headertime 0
707  command gnudoit -q '(mh-inc-spool-mh-e)'
708
709 Note that the entry above uses the gnuserv package to communicate the
710 command `mh-inc-spool-mh-e' to Emacs. It will incorporate the spool file
711 when clicking the xbuffy box with the middle mouse button."
712   :type '(repeat (list (file :tag "Spool file")
713                        (string :tag "Folder")
714                        (character :tag "Key binding")))
715   :set 'mh-inc-spool-list-set
716   :group 'mh-folder)
717
718 (defcustom mh-interpret-number-as-range-flag t
719   "Non-nil means interpret a number as a range.
720 If the variable is non-nil, and you use an integer, N, when asked for a
721 range to scan, then MH-E uses the range \"last:N\"."
722   :type 'boolean
723   :group 'mh-folder)
724
725 (defcustom mh-lpr-command-format "lpr -J '%s'"
726   "*Format for Unix command that prints a message.
727 The string should be a Unix command line, with the string '%s' where
728 the job's name (folder and message number) should appear.  The formatted
729 message text is piped to this command when you type \\<mh-folder-mode-map>`\\[mh-print-msg]'."
730   :type 'string
731   :group 'mh-folder)
732
733 (defcustom mh-mime-save-parts-default-directory t
734   "Default directory to use for `mh-mime-save-parts'.
735 If nil, prompt and set for next time the command is used during same session.
736 If t, prompt always"
737   :type '(choice (const :tag "Prompt the first time" nil)
738                  (const :tag "Prompt always" t)
739                  directory)
740   :group 'mh-folder)
741
742 (defcustom mh-print-background-flag nil
743   "*Non-nil means messages should be printed in the background.
744 WARNING: do not delete the messages until printing is finished;
745 otherwise, your output may be truncated."
746   :type 'boolean
747   :group 'mh-folder)
748
749 (defcustom mh-recenter-summary-flag nil
750   "*Non-nil means to recenter the summary window.
751 Recenter the summary window when the show window is toggled off if non-nil."
752   :type 'boolean
753   :group 'mh-folder)
754
755 (defcustom mh-recursive-folders-flag nil
756   "*Non-nil means that commands which operate on folders do so recursively."
757   :type 'boolean
758   :group 'mh-folder)
759
760 ;;; If `mh-unpropagated-sequences' becomes a defcustom, add the following tot
761 ;;; he docstring: "Additional sequences that should not to be preserved can be
762 ;;; specified by setting `mh-unpropagated-sequences' appropriately." XXX
763
764 (defcustom mh-refile-preserves-sequences-flag t
765   "*Non-nil means that sequences are preserved when messages are refiled.
766 If this variable is non-nil and a message belonging to a sequence other than
767 cur or Previous-Sequence (see mh-profile 5) is refiled then it is put in the
768 same sequence in the destination folder."
769   :type 'boolean
770   :group 'mh-folder)
771
772 (defcustom mh-scan-format-file t
773   "Specifies the format file to pass to the scan program.
774 If t, the format string will be taken from the either `mh-scan-format-mh'
775 or `mh-scan-format-nmh' depending on whether MH or nmh is in use.
776 If nil, the default scan output will be used.
777
778 If you customize the scan format, you may need to modify a few variables
779 containing regexps that MH-E uses to identify specific portions of the output.
780 Use `M-x apropos RET mh-scan.*regexp' to obtain a list of these variables. You
781 may also have to call `mh-set-cmd-note' with the width of your message
782 numbers. See also `mh-adaptive-cmd-note-flag'."
783   :type '(choice (const :tag "Use MH-E scan format" t)
784                  (const :tag "Use default scan format" nil)
785                  (file  :tag "Specify a scan format file"))
786   :group 'mh-folder)
787
788 (defcustom mh-scan-prog "scan"
789   "*Program to run to generate one-line-per-message listing of a folder.
790 Normally \"scan\" or a file name linked to scan.  This file is searched
791 for relative to the `mh-progs' directory unless it is an absolute pathname."
792   :type 'string
793   :group 'mh-folder)
794 (make-variable-buffer-local 'mh-scan-prog)
795
796 (defcustom mh-show-threads-flag nil
797   "Non-nil means new folders start in threaded mode.
798 Threading large number of messages can be time consuming. So if the flag is
799 non-nil then threading will be done only if the number of messages being
800 threaded is less than `mh-large-folder'."
801   :type 'boolean
802   :group 'mh-folder)
803
804 (defcustom mh-store-default-directory nil
805   "*Last directory used by \\[mh-store-msg]; default for next store.
806 A directory name string, or nil to use current directory."
807   :type '(choice (const :tag "Current" nil)
808                  directory)
809   :group 'mh-folder)
810
811 (defcustom mh-tick-seq 'tick
812   "The name of the MH tick sequence."
813   :type '(choice (const :tag "Disable ticking" nil)
814                  symbol)
815   :group 'mh-folder)
816
817 (defcustom mh-update-sequences-after-mh-show-flag t
818   "*Non-nil means `mh-update-sequence' is called from `mh-show-mode'.
819 If set, `mh-update-sequence' is run every time a message is shown, telling
820 MH or nmh that this is your current message.  It's useful, for example, to
821 display MIME content using \"M-! mhshow RET\""
822   :type 'boolean
823   :group 'mh-folder)
824
825 \f
826
827 ;;; Indexed searching (:group 'mh-index)
828
829 (defcustom mh-index-new-messages-folders t
830   "Folders searched for `mh-unseen-seq'.
831 If t, then `mh-inbox' is searched. If nil, all the top level folders are
832 searched. Otherwise the list of folders specified as strings are searched.
833 See also `mh-recursive-folders-flag'."
834   :group 'mh-index
835   :type '(choice (const :tag "Inbox" t)
836                  (const :tag "All" nil)
837                  (repeat :tag "Choose folders" (string :tag "Folder"))))
838
839 (defcustom mh-index-program nil
840   "Indexing program that MH-E shall use.
841 The possible choices are swish++, swish-e, mairix, namazu, glimpse, pick and
842 grep. By default this variable is nil which means that the programs are tried
843 in order and the first one found is used.
844
845 More information about setting up an indexing program to use with MH-E can be
846 found in the documentation of `mh-index-search'."
847   :type '(choice (const :tag "Auto-detect" nil)
848                  (const :tag "swish++" swish++)
849                  (const :tag "swish-e" swish)
850                  (const :tag "mairix" mairix)
851                  (const :tag "namazu" namazu)
852                  (const :tag "glimpse" glimpse)
853                  (const :tag "pick" pick)
854                  (const :tag "grep" grep))
855   :group 'mh-index)
856
857 (defcustom mh-index-ticked-messages-folders t
858   "Folders searched for `mh-tick-seq'.
859 If t, then `mh-inbox' is searched. If nil, all the top level folders are
860 searched. Otherwise the list of folders specified as strings are searched.
861 See also `mh-recursive-folders-flag'."
862   :group 'mh-index
863   :type '(choice (const :tag "Inbox" t)
864                  (const :tag "All" nil)
865                  (repeat :tag "Choose folders" (string :tag "Folder"))))
866
867 \f
868
869 ;;; Spam Handling (:group 'mh-junk)
870
871 ;; Spam fighting program chosen
872 (defvar mh-junk-choice nil)
873
874 ;; Available spam filter interfaces
875 (defvar mh-junk-function-alist
876   '((bogofilter mh-bogofilter-blacklist mh-bogofilter-whitelist)
877     (spamprobe mh-spamprobe-blacklist mh-spamprobe-whitelist)
878     (spamassassin mh-spamassassin-blacklist mh-spamassassin-whitelist))
879   "Available choices of spam programs to use.
880 This is an alist. For each element there are functions that blacklist a message
881 as spam and whitelist a message incorrectly classified as spam.")
882
883 (defun mh-junk-choose (symbol value)
884   "Choose spam program to use.
885 The function is always called with SYMBOL bound to `mh-junk-program' and VALUE
886 bound to the new value of `mh-junk-program'. The function sets the variable
887 `mh-junk-choice' in addition to `mh-junk-program'."
888   (set symbol value)
889   (setq mh-junk-choice
890         (or value
891             (loop for element in mh-junk-function-alist
892                   until (executable-find (symbol-name (car element)))
893                   finally return (car element)))))
894
895 ;; User customizable variables
896 (defcustom mh-junk-mail-folder nil
897   "Folder to put spam mail in.
898 If nil then the spam is deleted."
899   :type '(choice (const :tag "Delete spam" nil)
900                  (string :tag "Spam folder"))
901   :group 'mh-junk)
902
903 (defcustom mh-junk-program nil
904   "Spam program that MH-E shall use.
905 The possible choices are bogofilter, spamprobe, and spamassassin. By default
906 this variable is nil which means that the programs are tried in order and the
907 first one found is used."
908   :type '(choice (const :tag "auto-detect" nil)
909                  (const :tag "bogofilter" bogofilter)
910                  (const :tag "spamprobe" spamprobe)
911                  (const :tag "spamassassin" spamassassin))
912   :set 'mh-junk-choose
913   :group 'mh-junk)
914
915 \f
916
917 ;;; Message display (:group 'mh-show)
918
919 (defcustom mh-bury-show-buffer-flag t
920   "*Non-nil means that the displayed show buffer for a folder is buried."
921   :type 'boolean
922   :group 'mh-show)
923
924 (defcustom mh-clean-message-header-flag t
925   "*Non-nil means clean headers of messages that are displayed or inserted.
926 The variable `mh-invisible-headers' if set determines the header fields that
927 are displayed. If it isn't set, then the variable `mh-invisible-headers'
928 determines the header fields that are removed."
929   :type 'boolean
930   :group 'mh-show)
931
932 (defcustom mh-decode-mime-flag (not (not (locate-library "mm-decode")))
933   "*Non-nil means that Gnus is used to show MIME attachments with Gnus."
934   :type 'boolean
935   :group 'mh-show)
936
937 (defcustom mh-display-buttons-for-alternatives-flag nil
938   "*Non-nil means display buttons for all MIME alternatives.
939 Default behavior is to display only the preferred alternative. If this
940 variable is non-nil, then the preferred part is shown inline and buttons
941 are shown for each of the other alternatives."
942   :type 'boolean
943   :group 'mh-show)
944
945 (defcustom mh-display-buttons-for-inline-parts-flag nil
946   "*Non-nil means display buttons for all inline MIME parts.
947 If non-nil, buttons are displayed for all MIME parts. Inline parts start off
948 in displayed state but they can be hidden by clicking the button. If nil no
949 buttons are shown for inline parts."
950   :type 'boolean
951   :group 'mh-show)
952
953 (defcustom mh-do-not-confirm-flag nil
954   "*Non-nil means do not prompt for confirmation.
955 Commands such as `mh-pack-folder' prompt to confirm whether to process
956 outstanding moves and deletes or not before continuing. A non-nil setting will
957 perform the action--which is usually desired but cannot be retracted--without
958 question."
959   :type 'boolean
960   :group 'mh-show)
961
962 (defcustom mh-fetch-x-image-url nil
963   "Control fetching of X-Image-URL header field image.
964 This setting only has effect if `mh-show-use-xface-flag' is non-nil.
965
966 If set to t, the image is fetched.
967
968 If set to 'ask, the user is prompted before the image is fetched. MH-E will
969 remember your reply and will either use the already fetched image the next time
970 the same URL is encountered or silently skip it if you didn't fetch it the
971 first time.
972
973 If set to nil, the default, images are not fetched and only displayed if they
974 are already present in the cache."
975   :type '(choice (const :tag "Always fetch" t)
976                  (const :tag "Ask before fetching" ask)
977                  (const :tag "Never fetch" nil))
978   :group 'mh-show)
979
980 (defcustom mh-graphical-smileys-flag t
981   "*Non-nil means graphical smileys are displayed.
982 Non-nil means that small graphics will be used in the show buffer instead of
983 patterns like :-), ;-) etc. The setting only has effect if
984 `mh-decode-mime-flag' is non-nil."
985   :type 'boolean
986   :group 'mh-show)
987
988 (defcustom mh-graphical-emphasis-flag t
989   "*Non-nil means graphical emphasis is displayed.
990 Non-nil means that _underline_ will be underlined, *bold* will appear in bold,
991 /italic/ will appear in italic etc. See `gnus-emphasis-alist' for the whole
992 list. The setting only has effect if `mh-decode-mime-flag' is non-nil."
993   :type 'boolean
994   :group 'mh-show)
995
996 (defcustom mh-highlight-citation-p 'gnus
997   "How to highlight citations in show buffers.
998 The gnus method uses a different color for each indentation."
999   :type '(choice (const :tag "Use Gnus" gnus)
1000                  (const :tag "Use font-lock" font-lock)
1001                  (const :tag "Don't fontify" nil))
1002   :group 'mh-show)
1003
1004 (defvar mh-invisible-headers nil
1005   "*Regexp matching lines in a message header that are not to be shown.
1006 Customize the variable `mh-invisible-header-fields' to generate this variable;
1007 It will in turn automatically use the function `mh-invisible-headers' to
1008 generate this variable.
1009 If the variable `mh-visible-headers' is non-nil, it is used instead to specify
1010 what to keep.")
1011
1012 (defun mh-invisible-headers ()
1013   "Make or remake the variable `mh-invisible-headers'.
1014 Done using `mh-invisible-header-fields' as input."
1015   (if mh-invisible-header-fields
1016       (setq mh-invisible-headers
1017             (concat
1018              "^"
1019              (let ((max-specpdl-size 1000) ;workaround for insufficient default
1020                    (fields mh-invisible-header-fields))
1021                (regexp-opt fields t))))
1022     (setq mh-invisible-headers nil)))
1023
1024 ;; Keep fields alphabetized. Mention source, if known.
1025 (defcustom mh-invisible-header-fields
1026   '("Approved:"
1027     "Autoforwarded:"
1028     "Bestservhost:"
1029     "Cancel-Lock:"                      ; NNTP posts
1030     "Content-"                          ; RFC 2045
1031     "Delivered-To:"              ; Egroups/yahoogroups mailing list manager
1032     "Delivery-Date:"                    ; MH
1033     "Delivery:"
1034     "Encoding:"
1035     "Envelope-to:"
1036     "Errors-To:"
1037     "Face:"                             ; Gnus Face header
1038     "Forwarded:"                        ; MH
1039     "From "                             ; sendmail
1040     "Importance:"                       ; MS Outlook
1041     "In-Reply-To:"                      ; MH
1042     "Lines:"
1043     "List-"                             ; Mailman mailing list manager
1044     "List-"                             ; Unknown mailing list managers
1045     "List-Subscribe:"                   ; Unknown mailing list managers
1046     "List-Unsubscribe:"                 ; Unknown mailing list managers
1047     "Mail-from:"                        ; MH
1048     "Mailing-List:"              ; Egroups/yahoogroups mailing list manager
1049     "Message-Id:"                       ; RFC 822
1050     "Mime-Version"                      ; RFC 2045
1051     "NNTP-"                             ; News
1052     "Old-Return-Path:"
1053     "Original-Encoded-Information-Types:"  ; X400
1054     "Original-Lines:"                   ; mail to news
1055     "Original-Newsgroups:"              ; mail to news
1056     "Original-NNTP-"                    ; mail to news
1057     "Original-Path:"                    ; mail to news
1058     "Original-Received:"                ; mail to news
1059     "Original-To:"                      ; mail to news
1060     "Original-X-"                       ; mail to news
1061     "P1-Content-Type:"                  ; X400
1062     "P1-Message-Id:"                    ; X400
1063     "P1-Recipient:"                     ; X400
1064     "Path:"
1065     "Precedence:"
1066     "Prev-Resent"                       ; MH
1067     "Priority:"
1068     "Received:"                         ; RFC 822
1069     "References:"
1070     "Remailed-"                         ; MH
1071     "Replied:"                          ; MH
1072     "Resent"                            ; MH
1073     "Return-Path:"                      ; RFC 822
1074     "Sensitivity:"                      ; MS Outlook
1075     "Status:"                           ; sendmail
1076     "Ua-Content-Id:"                    ; X400
1077 ;;  "User-Agent:"                       ; Similar to X-Mailer, so display it.
1078     "Via:"                              ; MH
1079     "X-Abuse-Info:"
1080     "X-Accept-Language:"
1081     "X-Accept-Language:"                ; Netscape/Mozilla
1082     "X-Ack:"
1083     "X-Apparently-From:"                ; MS Outlook
1084     "X-Apparently-To:"           ; Egroups/yahoogroups mailing list manager
1085     "X-Authentication-Warning:"         ; sendmail
1086     "X-Beenthere:"                      ; Mailman mailing list manager
1087     "X-Bogosity:"                       ; bogofilter
1088     "X-Complaints-To:"
1089     "X-Cron-Env:"
1090     "X-Delivered"
1091     "X-Envelope-Sender:"
1092     "X-Envelope-To:"
1093     "X-Face:"
1094     "X-Folder:"                         ; Spam
1095     "X-From-Line"
1096     "X-Gnus-Mail-Source:"               ; gnus
1097     "X-Habeas-SWE-1:"                   ; Spam
1098     "X-Habeas-SWE-2:"                   ; Spam
1099     "X-Habeas-SWE-3:"                   ; Spam
1100     "X-Habeas-SWE-4:"                   ; Spam
1101     "X-Habeas-SWE-5:"                   ; Spam
1102     "X-Habeas-SWE-6:"                   ; Spam
1103     "X-Habeas-SWE-7:"                   ; Spam
1104     "X-Habeas-SWE-8:"                   ; Spam
1105     "X-Habeas-SWE-9:"                   ; Spam
1106     "X-Info:"                           ; NTMail
1107     "X-Juno-"                           ; Juno
1108     "X-List-Host:"                      ; Unknown mailing list managers
1109     "X-List-Subscribe:"                 ; Unknown mailing list managers
1110     "X-List-Unsubscribe:"               ; Unknown mailing list managers
1111     "X-Listserver:"                     ; Unknown mailing list managers
1112     "X-Loop:"                           ; Unknown mailing list managers
1113     "X-MIME-Autoconverted:"             ; sendmail
1114     "X-MIMETrack:"
1115     "X-MS-TNEF-Correlator:"             ; MS Outlook
1116     "X-Mailing-List:"                   ; Unknown mailing list managers
1117     "X-Mailman-Version:"                ; Mailman mailing list manager
1118     "X-Majordomo:"                      ; Majordomo mailing list manager
1119     "X-Message-Id"
1120     "X-MHE-Checksum"                    ; Checksum added during index search
1121     "X-MimeOLE:"                        ; MS Outlook
1122     "X-Mozilla-Status:"                 ; Netscape/Mozilla
1123     "X-Msmail-"                         ; MS Outlook
1124     "X-News:"                           ; News
1125     "X-No-Archive:"
1126     "X-Notes-Item:"                     ; Lotus Notes Domino structured header
1127     "X-Orcl-Content-Type:"
1128     "X-Original-Complaints-To:"
1129     "X-Original-Date:"                  ; SourceForge mailing list manager
1130     "X-Original-To:"
1131     "X-Original-Trace:"
1132     "X-OriginalArrivalTime:"            ; Hotmail
1133     "X-Originating-IP:"                 ; Hotmail
1134     "X-Priority:"                       ; MS Outlook
1135     "X-Qotd-"                           ; User added
1136     "X-Received-Date:"
1137     "X-Received:"
1138     "X-Request-"
1139     "X-SBClass:"                        ; Spam
1140     "X-SBNote:"                         ; Spam
1141     "X-SBPass:"                         ; Spam
1142     "X-SBRule:"                         ; Spam
1143     "X-Scanned-By"
1144     "X-Sender:"
1145     "X-Server-Date:"
1146     "X-Server-Uuid:"
1147     "X-Sieve:"                          ; Sieve filtering
1148     "X-Spam-Checker-Version:"           ; Spamassassin
1149     "X-Spam-Level:"                     ; Spamassassin
1150     "X-Spam-Score:"                     ; Spamassassin
1151     "X-Spam-Status:"                    ; Spamassassin
1152     "X-SpamBouncer:"                    ; Spam
1153     "X-Trace:"
1154     "X-UIDL:"
1155     "X-UserInfo1:"
1156     "X-VSMLoop:"                        ; NTMail
1157     "X-Vms-To:"
1158     "X-Wss-Id:"                         ; Worldtalk gateways
1159     "X-eGroups-"                 ; Egroups/yahoogroups mailing list manager
1160     "X-pgp:"
1161     "X-submission-address:"
1162     "X400-"                             ; X400
1163     "Xref:")
1164 "*List of header fields that are not to be shown.
1165 Regexps are not allowed. Unique fields should have a \":\" suffix; otherwise,
1166 the element can be used to render invisible an entire class of fields that
1167 start with the same prefix.
1168 This variable is ignored if the variable `mh-visible-headers' is set."
1169   :type '(repeat (string :tag "Header field"))
1170   :set (lambda (symbol value)
1171          (set-default symbol value)
1172          (mh-invisible-headers))
1173   :group 'mh-show)
1174
1175 (defcustom mh-max-inline-image-height nil
1176   "*Maximum inline image height if Content-Disposition is not present.
1177 If nil, image will be displayed if its height is smaller than the height of
1178 the window."
1179   :type '(choice (const nil) integer)
1180   :group 'mh-show)
1181
1182 (defcustom mh-max-inline-image-width nil
1183   "*Maximum inline image width if Content-Disposition is not present.
1184 If nil, image will be displayed if its width is smaller than the width of the
1185 window."
1186   :type '(choice (const nil) integer)
1187   :group 'mh-show)
1188
1189 (defcustom mh-show-maximum-size 0
1190   "*Maximum size of message (in bytes) to display automatically.
1191 Provides an opportunity to skip over large messages which may be slow to load.
1192 Use a value of 0 to display all messages automatically regardless of size."
1193   :type 'integer
1194   :group 'mh-show)
1195
1196 ;; Use goto-addr if it was already loaded (which probably sets this
1197 ;; variable to t), or if this variable is otherwise set to t.
1198 (defcustom mh-show-use-goto-addr-flag (and (boundp 'goto-address-highlight-p)
1199                                            goto-address-highlight-p)
1200   "*Non-nil means highlight URLs and email addresses.
1201 The `goto-addr' module is used."
1202   :type 'boolean
1203   :group 'mh-show)
1204
1205 (defcustom mh-show-use-xface-flag (>= emacs-major-version 21)
1206   "*Non-nil means display face images in `mh-show-mode'.
1207 This flag controls the display of three kinds of faces.
1208
1209 The first is the traditional X-Face header field. For GNU Emacs 21
1210 and above, the `uncompface' binary is required to be in the execute
1211 PATH for the display of X-Face images. It can be obtained from
1212 ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.Z.
1213
1214 If the XEmacs you are using has internal support for X-Face images, then MH-E
1215 will display X-Face images in XEmacs \"out of the box\". Even if you don't have
1216 X-Face support compiled into your XEmacs, you can still see the X-Face images
1217 in MH-E with the aid of an external x-face package and `uncompface'. It is
1218 available from ftp://ftp.jpl.org/pub/elisp/. Download it, put its files in the
1219 `load-path' and MH-E will invoke it automatically.
1220
1221 Second, MH-E supports the display of the Gnus-specific Face
1222 header field in GNU Emacs >= 21 and XEmacs. No external packages
1223 are required. More information about the Face header can be found
1224 at: http://quimby.gnus.org/circus/face/.
1225
1226 Finally, MH-E can also display images from the X-Image-URL header field. The
1227 display of the images requires the `wget' program, available from
1228 http://www.gnu.org/software/wget/wget.html, to fetch the image and the
1229 `convert' program from the ImageMagick suite, available from
1230 http://www.imagemagick.org/. Of the three header fields this is the most
1231 efficient in terms of network usage since the image doesn't need to be
1232 transmitted with every single mail. However its display needs the recipient to
1233 fetch a URL and this can be misused. So it is disabled by default. It can be
1234 enabled by customizing `mh-fetch-x-image-url'. Setting that to ask for
1235 confirmation before fetching seems like a good choice.
1236
1237 Versions of GNU Emacs prior to 21.1 don't support the display of
1238 inline images. So face images are not displayed in these versions."
1239   :type 'boolean
1240   :group 'mh-show)
1241
1242 (defcustom mh-summary-height nil
1243   "*Number of lines in MH-Folder window (including the mode line)."
1244   :type '(choice (const :tag "Automatic" nil)
1245                  (integer :tag "Fixed sized"))
1246   :group 'mh-show)
1247
1248 (defvar mh-visible-headers nil
1249   "*Regexp matching lines in a message header that are to be shown.
1250 Customize the variable `mh-visible-header-fields' to generate this variable;
1251 It will in turn automatically use the function `mh-visible-headers' to
1252 generate this variable.
1253 Only used if `mh-clean-message-header-flag' is non-nil. Setting it overrides
1254 the variable `mh-invisible-headers'.")
1255
1256 (defun mh-visible-headers ()
1257   "Make or remake the variable `mh-visible-headers'.
1258 Done using `mh-visible-header-fields' as input."
1259   (if mh-visible-header-fields
1260       (setq mh-visible-headers
1261             (concat
1262              "^"
1263              (let ((max-specpdl-size 1000) ;workaround for insufficient default
1264                    (fields mh-visible-header-fields))
1265                (regexp-opt fields t))))
1266     (setq mh-visible-headers nil)))
1267
1268 (defcustom mh-visible-header-fields nil
1269 "*List of header fields that are to be shown.
1270 Regexps are not allowed. Unique fields should have a \":\" suffix; otherwise,
1271 the element can be used to render visible an entire class of fields that
1272 start with the same prefix.
1273 Only used if `mh-clean-message-header-flag' is non-nil.
1274 Setting it overrides the variable `mh-invisible-headers'."
1275   :type '(repeat (string :tag "Header field"))
1276   :set (lambda (symbol value)
1277          (set-default symbol value)
1278          (mh-visible-headers))
1279   :group 'mh-show)
1280
1281 (defcustom mhl-formfile nil
1282   "*Name of format file to be used by mhl to show and print messages.
1283 A value of t means use the default format file.
1284 nil means don't use mhl to format messages when showing; mhl is still used,
1285 with the default format file, to format messages when printing them.
1286 The format used should specify a non-zero value for overflowoffset so
1287 the message continues to conform to RFC 822 and MH-E can parse the headers."
1288   :type '(choice (const nil) (const t) string)
1289   :group 'mh-show)
1290 (put 'mhl-formfile 'info-file "mh-e")
1291
1292 \f
1293
1294 ;;; Composing messages (:group 'mh-letter)
1295
1296 (defcustom mh-compose-insertion (if (locate-library "mml") 'gnus 'mhn)
1297   "Use either 'gnus or 'mhn to insert MIME message directives in messages."
1298   :type '(choice (const :tag "Use Gnus" gnus)
1299                  (const :tag "Use mhn"  mhn))
1300   :group 'mh-letter)
1301
1302 (defcustom mh-compose-letter-function nil
1303   "Invoked when setting up a letter draft.
1304 It is passed three arguments: TO recipients, SUBJECT, and CC recipients."
1305   :type '(choice (const nil) function)
1306   :group 'mh-letter)
1307
1308 (defcustom mh-compose-prompt-flag nil
1309   "*Non-nil means prompt for header fields when composing a new draft."
1310   :type 'boolean
1311   :group 'mh-letter)
1312
1313 (defcustom mh-compose-skipped-header-fields
1314   '("from" "organization" "references" "in-reply-to" "x-face" "face"
1315     "x-mailer")
1316   "List of header fields to skip over when navigating in draft."
1317   :type '(repeat (string :tag "Field"))
1318   :group 'mh-letter)
1319
1320 (defcustom mh-compose-space-does-completion-flag nil
1321   "*Non-nil means that SPACE does completion in message header."
1322   :type 'boolean
1323   :group 'mh-letter)
1324
1325 (defcustom mh-delete-yanked-msg-window-flag nil
1326   "*Non-nil means delete any window displaying the message.
1327 Controls window display when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
1328 If non-nil, yanking the current message into a draft letter deletes any
1329 windows displaying the message."
1330   :type 'boolean
1331   :group 'mh-letter)
1332
1333 (defcustom mh-extract-from-attribution-verb "wrote:"
1334   "*Verb to use for attribution when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg]."
1335   :type '(choice (const "wrote:")
1336                  (const "a Ã©crit :")
1337                  (string :tag "Custom string"))
1338   :group 'mh-letter)
1339
1340 (defcustom mh-forward-subject-format "%s: %s"
1341   "*Format to generate the Subject: line contents for a forwarded message.
1342 The two string arguments to the format are the sender of the original
1343 message and the original subject line."
1344   :type 'string
1345   :group 'mh-letter)
1346
1347 (defcustom mh-ins-buf-prefix "> "
1348   "*String to put before each non-blank line of a yanked or inserted message.
1349 \\<mh-letter-mode-map>Used when the message is inserted into an outgoing letter
1350 by \\[mh-insert-letter] or \\[mh-yank-cur-msg]."
1351   :type 'string
1352   :group 'mh-letter)
1353
1354 (defcustom mh-insert-x-mailer-flag t
1355   "*Non-nil means append an X-Mailer field to the header."
1356   :type 'boolean
1357   :group 'mh-letter)
1358
1359 (defcustom mh-letter-complete-function 'ispell-complete-word
1360   "*Function to call when completing outside of fields specific to aliases."
1361   :type '(choice function (const nil))
1362   :group 'mh-letter)
1363
1364 (defcustom mh-letter-fill-column 72
1365   "*Fill column to use in `mh-letter-mode'.
1366 This is usually less than in other text modes because email messages get
1367 quoted by some prefix (sometimes many times) when they are replied to,
1368 and it's best to avoid quoted lines that span more than 80 columns."
1369   :type 'integer
1370   :group 'mh-letter)
1371
1372 (defcustom mh-reply-default-reply-to nil
1373   "*Sets the person or persons to whom a reply will be sent.
1374 If nil, prompt for recipient.  If non-nil, then \\<mh-folder-mode-map>`\\[mh-reply]' will use this
1375 value and it should be one of \"from\", \"to\", \"cc\", or \"all\".
1376 The values \"cc\" and \"all\" do the same thing."
1377   :type '(choice (const :tag "Prompt" nil)
1378                  (const "from") (const "to")
1379                  (const "cc") (const "all"))
1380   :group 'mh-letter)
1381
1382 (defcustom mh-reply-show-message-flag t
1383   "*Non-nil means the show buffer is displayed using \\<mh-letter-mode-map>\\[mh-reply].
1384
1385 The setting of this variable determines whether the MH `show-buffer' is
1386 displayed with the current message when using `mh-reply' without a prefix
1387 argument.  Set it to nil if you already include the message automatically
1388 in your draft using
1389  repl: -filter repl.filter
1390 in your ~/.mh_profile file."
1391   :type 'boolean
1392   :group 'mh-letter)
1393
1394 (defcustom mh-signature-file-name "~/.signature"
1395   "*Name of file containing the user's signature.
1396 Inserted into message by \\<mh-letter-mode-map>\\[mh-insert-signature]."
1397   :type 'file
1398   :group 'mh-letter)
1399
1400 (defcustom mh-x-face-file "~/.face"
1401   "*File containing X-Face or Face header field to insert in outgoing mail.
1402
1403 If the file starts with either of the strings \"X-Face: \", \"Face: \" or
1404 \"X-Image-URL: \" then it is assumed to contain the whole field and is added to
1405 the message header verbatim. Otherwise it is assumed that the file contains the
1406 value of the X-Face header field.
1407
1408 X-Face header fields can be generated using `compface', which can be obtained
1409 from ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.Z. The \"Online
1410 X-Face Convertor\" at http://www.dairiki.org/xface/ is a useful resource for
1411 quick conversion of images into X-Face header fields.
1412
1413 There is a `make-face' script that converts a jpeg image to a Face header
1414 field at http://quimby.gnus.org/circus/face/make-face.
1415
1416 The URL of any image can be used for the X-Image-URL field and no processing
1417 of the image is required.
1418
1419 If nil, or the file does not exist, nothing is added to the message header."
1420   :type 'file
1421   :group 'mh-letter)
1422
1423 (defcustom mh-yank-from-start-of-msg 'attribution
1424   "*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
1425 If t, include the entire message, with full headers.  This is historically
1426 here for use with supercite, but is now deprecated in favor of the setting
1427 `supercite' below.
1428
1429 If the symbol `body', then yank the message minus the header.
1430
1431 If the symbol `supercite', include the entire message, with full headers.
1432 This also causes the invocation of `sc-cite-original' without the setting
1433 of `mail-citation-hook', now deprecated practice.
1434
1435 If the symbol `autosupercite', do as for `supercite' automatically when
1436 show buffer matches the message being replied-to.  When this option is used,
1437 the -noformat switch is passed to the repl program to override a -filter or
1438 -format switch.
1439
1440 If the symbol `attribution', then yank the message minus the header and add
1441 a simple attribution line at the top.
1442
1443 If the symbol `autoattrib', do as for `attribution' automatically when show
1444 buffer matches the message being replied-to.  You can make sure this is
1445 always the case by setting `mh-reply-show-message-flag' to t (which is the
1446 default) and optionally `mh-delete-yanked-msg-window-flag' to t as well such
1447 that the show window is never displayed.  When the `autoattrib' option is
1448 used, the -noformat switch is passed to the repl program to override a
1449 -filter or -format switch.
1450
1451 If nil, yank only the portion of the message following the point.
1452
1453 If the show buffer has a region, this variable is ignored unless its value is
1454 one of `attribution' or `autoattrib' in which case the attribution is added
1455 to the yanked region."
1456   :type '(choice (const :tag "Below point" nil)
1457                  (const :tag "Without header" body)
1458                  (const :tag "Invoke supercite" supercite)
1459                  (const :tag "Invoke supercite, automatically" autosupercite)
1460                  (const :tag "Without header, with attribution" attribution)
1461                  (const :tag "Without header, with attribution, automatically"
1462                         autoattrib)
1463                  (const :tag "Entire message with headers" t))
1464   :group 'mh-letter)
1465
1466 \f
1467
1468 ;;; Alias handling (:group 'mh-alias)
1469
1470 (defcustom mh-alias-completion-ignore-case-flag t
1471   "*Non-nil means don't consider case significant in MH alias completion.
1472 This is the default in plain MH, so it is the default here as well. It
1473 can be useful to set this to t if, for example, you use lowercase
1474 aliases for people and uppercase for mailing lists."
1475   :type 'boolean
1476   :group 'mh-alias)
1477
1478 (defcustom mh-alias-expand-aliases-flag nil
1479   "*Non-nil means to expand aliases entered in the minibuffer.
1480 In other words, aliases entered in the minibuffer will be expanded to the full
1481 address in the message draft. By default, this expansion is not performed."
1482   :type 'boolean
1483   :group 'mh-alias)
1484
1485 (defcustom mh-alias-flash-on-comma t
1486   "*Specify whether to flash or warn on translation.
1487 When a [comma] is pressed while entering aliases or addresses, setting this
1488 variable to the following values has the listed effects:
1489 t   Flash alias translation but don't warn if there is no translation.
1490 1   Flash alias translation and warn if there is no translation.
1491 nil Do not flash alias translation nor warn if there is no translation."
1492   :type '(choice (const :tag "Flash but don't warn if no translation" t)
1493                  (const :tag "Flash and warn if no translation" 1)
1494                  (const :tag "Don't flash nor warn if no translation" nil))
1495   :group 'mh-alias)
1496
1497 (defcustom mh-alias-insert-file nil
1498   "*Filename to use to store new MH-E aliases.
1499 This variable can also be a list of filenames, in which case MH-E will prompt
1500 for one of them. If nil, the default, then MH-E will use the first file found
1501 in the \"AliasFile\" component of the MH profile."
1502   :type '(choice (const :tag "Use AliasFile MH profile component" nil)
1503                  (file :tag "Alias file")
1504                  (repeat :tag "List of alias files" file))
1505   :group 'mh-alias)
1506
1507 (defcustom mh-alias-insertion-location 'sorted
1508   "Specifies where new aliases are entered in alias files.
1509 Options are sorted alphabetically, at the top of the file or at the bottom."
1510   :type '(choice (const :tag "Sorted alphabetically" sorted)
1511                  (const :tag "At the top of file" top)
1512                  (const :tag "At the bottom of file" bottom))
1513   :group 'mh-alias)
1514
1515 (defcustom mh-alias-local-users t
1516   "*If t, local users are completed in MH-E To: and Cc: prompts.
1517
1518 Users with a userid greater than some magic number (usually 200) are available
1519 for completion.
1520
1521 If you set this variable to a string, it will be executed to generate a
1522 password file. A value of \"ypcat passwd\" is helpful if NIS is in use."
1523   :type '(choice (boolean) (string))
1524   :group 'mh-alias)
1525
1526 (defcustom mh-alias-local-users-prefix "local."
1527   "*String prepended to the real names of users from the passwd file.
1528 If nil, use the username string unmodified instead of the real name from
1529 the gecos field of the passwd file.
1530
1531 For example, given the following passwd file line:
1532
1533  psg:x:1000:1000:Peter S Galbraith,,,:/home/psg:/bin/tcsh
1534
1535 here are the derived aliases for different values of this variable:
1536
1537  \"local.\"  -> local.peter.galbraith
1538  \"\"        -> peter.galbraith
1539  nii       -> psg
1540
1541 This variable is only meaningful if the variable `mh-alias-local-users' is
1542 non-nil."
1543   :type '(choice (const :tag "Use username instead of real name" nil)
1544                  (string))
1545   :group 'mh-alias)
1546
1547 (defcustom mh-alias-passwd-gecos-comma-separator-flag t
1548   "*Non-nil means the gecos field in the passwd file uses comma as a separator.
1549 Used to construct aliases for users in the passwd file."
1550   :type 'boolean
1551   :group 'mh-alias)
1552
1553 (defcustom mh-alias-system-aliases
1554   '("/etc/nmh/MailAliases" "/usr/lib/mh/MailAliases" "/etc/passwd")
1555   "*A list of system files from which to cull aliases.
1556 If these files are modified, they are automatically reread. This list need
1557 include only system aliases and the passwd file, since personal alias files
1558 listed in your \"AliasFile\" MH profile component are automatically included.
1559 You can update the alias list manually using \\[mh-alias-reload]."
1560   :type '(choice (file) (repeat file))
1561   :group 'mh-alias)
1562
1563 \f
1564
1565 ;;; Multiple personalities (:group 'mh-identity)
1566
1567 (defvar mh-identity-list ())
1568
1569 (defcustom mh-auto-fields-list nil
1570   "Alist of addresses for which header lines are automatically inserted.
1571 Each element has the form (REGEXP ((KEYWORD VALUE) (KEYWORD VALUE)).
1572 When the REGEXP appears in the To or cc fields of a message, the corresponding
1573 KEYWORD header field is insert with its VALUE in the message header.
1574
1575 There is one special case for KEYWORD, that of \"identity\", which means to
1576 insert that identity using `mh-insert-identity'.
1577
1578 The common KEYWORD cases of \"Mail-Followup-To\" and \"fcc\" are also
1579 prompted for in the customization interface."
1580   :type `(repeat
1581           (list :tag ""
1582                 (string :tag "Regular expression to match")
1583                 (repeat :tag "At least one pair from below"
1584                         (choice
1585                          (cons :tag "Identity entry"
1586                           (const "identity")
1587                           ,(append
1588                             '(radio)
1589                             (mapcar (function (lambda (arg) `(const ,arg)))
1590                                     (mapcar 'car mh-identity-list))))
1591                          (cons :tag "fcc field"
1592                                (const "fcc")
1593                                (string :tag "Value"))
1594                          (cons :tag "Mail-Followup-To field"
1595                                (const "Mail-Followup-To")
1596                                (string :tag "Value"))
1597                          (cons :tag "Other field and value pair"
1598                                  (string :tag "Field")
1599                                  (string :tag "Value"))))))
1600   :group 'mh-identity)
1601
1602 (defcustom mh-identity-default nil
1603   "Default identity to use when `mh-letter-mode' is called."
1604   ;; Dynamically render :type corresponding to `mh-identity-list' entries,
1605   ;; e.g.:
1606   ;;  :type '(radio (const :tag "none" nil)
1607   ;;                (const "home")
1608   ;;                (const "work"))
1609   :type (append
1610          '(radio)
1611          (cons '(const :tag "None" nil)
1612                (mapcar (function (lambda (arg) `(const ,arg)))
1613                        (mapcar 'car mh-identity-list))))
1614   :group 'mh-identity)
1615
1616 (defcustom mh-identity-list nil
1617   "*List holding MH-E identity.
1618 Omit the colon and trailing space from the field names.
1619 The keyword name \"none\" is reserved for internal use.
1620 Use the keyname name \"signature\" to specify either a signature file or a
1621 function to call to insert a signature at point.
1622
1623 Providing an empty Value (\"\") will cause the field to be deleted.
1624
1625 Example entries using the customize interface:
1626    Keyword name: work
1627             From
1628             Value: John Doe <john@work.com>
1629             Organization
1630             Value: Acme Inc.
1631    Keyword name: home
1632             From
1633             Value: John Doe <johndoe@home.net>
1634             Organization
1635             Value:
1636
1637 This would produce the equivalent of:
1638  (setq mh-identity-list
1639       '((\"work\"
1640          ((\"From\" . \"John Doe <john@work.com>\")
1641           (\"Organization\" . \"Acme Inc.\")))
1642         (\"home\"
1643          ((\"From\" . \"John Doe <johndoe@home.net>\")
1644           (\"Organization\" . \"\")))))"
1645   :type '(repeat (list :tag ""
1646                        (string :tag "Keyword name")
1647                        (repeat :tag "At least one pair from below"
1648                                (choice (cons :tag "From field"
1649                                              (const "From")
1650                                              (string :tag "Value"))
1651                                        (cons :tag "Organization field"
1652                                              (const "Organization")
1653                                              (string :tag "Value"))
1654                                        (cons :tag "Signature"
1655                                              (const "signature")
1656                                              (choice (file) (function)))
1657                                        (cons :tag "Other field & value pair"
1658                                              (string :tag "Field")
1659                                              (string :tag "Value"))))))
1660   :set 'mh-identity-list-set
1661   :group 'mh-identity)
1662
1663 \f
1664
1665 ;;; Hooks (:group 'mh-hooks + group where hook defined)
1666
1667 ;;; These are alphabetized. All hooks should be placed in the 'mh-hook group;
1668 ;;; in addition, add the group in which the hook is defined in the manual (or,
1669 ;;; if it is new, where it would be defined).
1670
1671 (defcustom mh-before-quit-hook nil
1672   "Invoked by \\<mh-folder-mode-map>`\\[mh-quit]' before quitting MH-E.
1673 See also `mh-quit-hook'."
1674   :type 'hook
1675   :group 'mh-hooks
1676   :group 'mh-folder)
1677
1678 (defcustom mh-before-send-letter-hook nil
1679   "Invoked at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command."
1680   :type 'hook
1681   :group 'mh-hooks
1682   :group 'mh-letter)
1683
1684 (defcustom mh-delete-msg-hook nil
1685   "Invoked after marking each message for deletion."
1686   :type 'hook
1687   :group 'mh-hooks
1688   :group 'mh-folder)
1689
1690 (defcustom mh-edit-mhn-hook nil
1691   "Invoked on the formatted letter by \\<mh-letter-mode-map>\\[mh-edit-mhn]."
1692   :type 'hook
1693   :group 'mh-hooks
1694   :group 'mh-letter)
1695
1696 (defcustom mh-find-path-hook nil
1697   "Invoked by `mh-find-path' after reading the user's MH profile."
1698   :type 'hook
1699   :group 'mh-hooks
1700   :group 'mh-folder)
1701
1702 (defcustom mh-folder-mode-hook nil
1703   "Invoked in `mh-folder-mode' on a new folder."
1704   :type 'hook
1705   :group 'mh-hooks
1706   :group 'mh-folder)
1707
1708 (defcustom mh-folder-updated-hook nil
1709   "Invoked when the folder actions (such as moves and deletes) are performed.
1710 Variables that are useful in this hook include `mh-delete-list' and
1711 `mh-refile-list' which can be used to see which changes are being made to
1712 current folder, `mh-current-folder'."
1713   :type 'hook
1714   :group 'mh-hooks)
1715
1716 (defcustom mh-inc-folder-hook nil
1717   "Invoked by \\<mh-folder-mode-map>`\\[mh-inc-folder]' after incorporating mail into a folder."
1718   :type 'hook
1719   :group 'mh-hooks
1720   :group 'mh-folder)
1721
1722 (defcustom mh-kill-folder-suppress-prompt-hook '(mh-index-p)
1723   "Invoked at the beginning of the  \\<mh-folder-mode-map>`\\[mh-kill-folder]' command.
1724 This hook is a list of functions to be called, with no arguments, which should
1725 return a value of non-nil if you should not be asked if you're sure that you
1726 want to remove the folder. This is useful for folders that are easily
1727 regenerated.
1728
1729 The default value of `mh-index-p' suppresses the prompt on folders generated
1730 by an index search.
1731
1732 WARNING: Use this hook with care. If there is a bug in your hook which returns
1733 t on +inbox and you hit \\<mh-folder-mode-map>`\\[mh-kill-folder]' by accident
1734 in the +inbox buffer, you will not be happy."
1735   :type 'hook
1736   :group 'mh-hooks
1737   :group 'mh-folder)
1738
1739 (defcustom mh-letter-insert-signature-hook nil
1740   "Invoked at the beginning of the \\<mh-letter-mode-map>\\[mh-insert-signature] command.
1741 Can be used to determine which signature file to use based on message content.
1742 On return, if `mh-signature-file-name' is non-nil that file will be inserted at
1743 the current point in the buffer."
1744   :type 'hook
1745   :group 'mh-hooks
1746   :group 'mh-letter)
1747
1748 (defcustom mh-letter-mode-hook nil
1749   "Invoked in `mh-letter-mode' on a new letter."
1750   :type 'hook
1751   :group 'mh-hooks
1752   :group 'mh-letter)
1753
1754 (defcustom mh-pick-mode-hook nil
1755   "Invoked upon entry to `mh-pick-mode'."
1756   :type 'hook
1757   :group 'mh-hooks
1758   :group 'mh-folder)
1759
1760 (defcustom mh-quit-hook nil
1761   "Invoked after \\<mh-folder-mode-map>`\\[mh-quit]' quits MH-E.
1762 See also `mh-before-quit-hook'."
1763   :type 'hook
1764   :group 'mh-hooks
1765   :group 'mh-folder)
1766
1767 (defcustom mh-refile-msg-hook nil
1768   "Invoked after marking each message for refiling."
1769   :type 'hook
1770   :group 'mh-hooks
1771   :group 'mh-folder)
1772
1773 (defcustom mh-show-hook nil
1774   "Invoked after \\<mh-folder-mode-map>`\\[mh-show]' shows a message."
1775   :type 'hook
1776   :group 'mh-hooks
1777   :group 'mh-show)
1778
1779 (defcustom mh-show-mode-hook nil
1780   "Invoked upon entry to `mh-show-mode'."
1781   :type 'hook
1782   :group 'mh-hooks
1783   :group 'mh-show)
1784
1785 (defcustom mh-unseen-updated-hook nil
1786   "Invoked after the unseen sequence has been updated.
1787 The variable `mh-seen-list' can be used to obtain the list of messages which
1788 will be removed from the unseen sequence."
1789   :type 'hook
1790   :group 'mh-hooks
1791   :group 'mh-folder)
1792
1793 \f
1794
1795 ;;; Faces
1796
1797 ;;; Faces used in speedbar (:group mh-speed-faces)
1798
1799 (defface mh-speedbar-folder-face
1800   '((((class color) (background light))
1801      (:foreground "blue4"))
1802     (((class color) (background dark))
1803      (:foreground "light blue")))
1804   "Face used for folders in the speedbar buffer."
1805   :group 'mh-speed-faces)
1806
1807 (defface mh-speedbar-selected-folder-face
1808   '((((class color) (background light))
1809      (:foreground "red" :underline t))
1810     (((class color) (background dark))
1811      (:foreground "red" :underline t))
1812     (t (:underline t)))
1813   "Face used for the current folder."
1814   :group 'mh-speed-faces)
1815
1816 (defface mh-speedbar-folder-with-unseen-messages-face
1817   '((t (:inherit mh-speedbar-folder-face :bold t)))
1818   "Face used for folders in the speedbar buffer which have unread messages."
1819   :group 'mh-speed-faces)
1820
1821 (defface mh-speedbar-selected-folder-with-unseen-messages-face
1822   '((t (:inherit mh-speedbar-selected-folder-face :bold t)))
1823   "Face used for the current folder when it has unread messages."
1824   :group 'mh-speed-faces)
1825
1826 \f
1827
1828 ;;; Faces used in scan listing (:group mh-folder-faces)
1829
1830 (defvar mh-folder-body-face 'mh-folder-body-face
1831   "Face for highlighting body text in MH-Folder buffers.")
1832 (defface mh-folder-body-face
1833   '((((type tty) (class color)) (:foreground "green"))
1834     (((class grayscale) (background light)) (:foreground "DimGray" :italic t))
1835     (((class grayscale) (background dark)) (:foreground "LightGray" :italic t))
1836     (((class color) (background light)) (:foreground "RosyBrown"))
1837     (((class color) (background dark)) (:foreground "LightSalmon"))
1838     (t (:italic t)))
1839   "Face for highlighting body text in MH-Folder buffers."
1840   :group 'mh-folder-faces)
1841
1842 (defvar mh-folder-cur-msg-face 'mh-folder-cur-msg-face
1843   "Face for the current message line in MH-Folder buffers.")
1844 (defface mh-folder-cur-msg-face
1845   '((((type tty pc) (class color))
1846      (:background "LightGreen"))
1847     (((class color) (background light))
1848      (:background "LightGreen")         ;Use this for solid background colour
1849      ;;  (:underline t)                 ;Use this for underlining
1850      )
1851     (((class color) (background dark))
1852      (:background "DarkOliveGreen4"))
1853     (t (:underline t)))
1854   "Face for the current message line in MH-Folder buffers."
1855   :group 'mh-folder-faces)
1856
1857 (defvar mh-folder-cur-msg-number-face 'mh-folder-cur-msg-number-face
1858   "Face for highlighting the current message in MH-Folder buffers.")
1859 (defface mh-folder-cur-msg-number-face
1860   '((((type tty) (class color)) (:foreground "cyan" :weight bold))
1861     (((class grayscale) (background light)) (:foreground "LightGray" :bold t))
1862     (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1863     (((class color) (background light)) (:foreground "Purple"))
1864     (((class color) (background dark)) (:foreground "Cyan"))
1865     (t (:bold t)))
1866   "Face for highlighting the current message in MH-Folder buffers."
1867   :group 'mh-folder-faces)
1868
1869 (defvar mh-folder-date-face 'mh-folder-date-face
1870   "Face for highlighting the date in MH-Folder buffers.")
1871 (defface mh-folder-date-face
1872   '((((class color) (background light))
1873      (:foreground "snow4"))
1874     (((class color) (background dark))
1875      (:foreground "snow3"))
1876     (t
1877      (:bold t)))
1878   "Face for highlighting the date in MH-Folder buffers."
1879   :group 'mh-folder-faces)
1880
1881 (defvar mh-folder-followup-face 'mh-folder-followup-face
1882   "Face for highlighting Re: (followup) subject text in MH-Folder buffers.")
1883 (defface mh-folder-followup-face
1884   '((((class color) (background light))
1885      (:foreground "blue3"))
1886     (((class color) (background dark))
1887      (:foreground "LightGoldenRod"))
1888     (t
1889      (:bold t)))
1890   "Face for highlighting Re: (followup) subject text in MH-Folder buffers."
1891   :group 'mh-folder-faces)
1892
1893 (defvar mh-folder-msg-number-face 'mh-folder-msg-number-face
1894   "Face for highlighting the message number in MH-Folder buffers.")
1895 (defface mh-folder-msg-number-face
1896   '((((class color) (background light))
1897      (:foreground "snow4"))
1898     (((class color) (background dark))
1899      (:foreground "snow3"))
1900     (t
1901      (:bold t)))
1902   "Face for highlighting the message number in MH-Folder buffers."
1903   :group 'mh-folder-faces)
1904
1905 (defvar mh-folder-deleted-face 'mh-folder-deleted-face
1906   "Face for highlighting deleted messages in MH-Folder buffers.")
1907 (copy-face 'mh-folder-msg-number-face 'mh-folder-deleted-face)
1908
1909 (defvar mh-folder-refiled-face 'mh-folder-refiled-face
1910   "Face for highlighting refiled messages in MH-Folder buffers.")
1911 (defface mh-folder-refiled-face
1912   '((((type tty) (class color)) (:foreground "yellow" :weight light))
1913     (((class grayscale) (background light))
1914      (:foreground "Gray90" :bold t :italic t))
1915     (((class grayscale) (background dark))
1916      (:foreground "DimGray" :bold t :italic t))
1917     (((class color) (background light)) (:foreground "DarkGoldenrod"))
1918     (((class color) (background dark)) (:foreground "LightGoldenrod"))
1919     (t (:bold t :italic t)))
1920   "Face for highlighting refiled messages in MH-Folder buffers."
1921   :group 'mh-folder-faces)
1922
1923 (defvar mh-folder-subject-face 'mh-folder-subject-face
1924   "Face for highlighting subject text in MH-Folder buffers.")
1925 (if (boundp 'facemenu-unlisted-faces)
1926     (add-to-list 'facemenu-unlisted-faces "^mh-folder"))
1927 (defface mh-folder-subject-face
1928   '((((class color) (background light))
1929      (:foreground "blue4"))
1930     (((class color) (background dark))
1931      (:foreground "yellow"))
1932     (t
1933      (:bold t)))
1934   "Face for highlighting subject text in MH-Folder buffers."
1935   :group 'mh-folder-faces)
1936
1937 (defface mh-folder-tick-face
1938   '((((class color) (background dark)) (:background "#dddf7e"))
1939     (((class color) (background light)) (:background "#dddf7e"))
1940     (t (:underline t)))
1941   "Face used to show ticked messages."
1942   :group 'mh-folder-faces)
1943
1944 (defvar mh-folder-address-face 'mh-folder-address-face
1945   "Face for highlighting the address in MH-Folder buffers.")
1946 (copy-face 'mh-folder-subject-face 'mh-folder-address-face)
1947
1948 (defvar mh-folder-scan-format-face 'mh-folder-scan-format-face
1949   "Face for highlighting `mh-scan-format-regexp' matches in MH-Folder buffers.")
1950 (copy-face 'mh-folder-followup-face 'mh-folder-scan-format-face)
1951
1952 (defvar mh-folder-to-face 'mh-folder-to-face
1953   "Face for highlighting the To: string in MH-Folder buffers.")
1954 (defface mh-folder-to-face
1955   '((((type tty) (class color)) (:foreground "green"))
1956     (((class grayscale) (background light)) (:foreground "DimGray" :italic t))
1957     (((class grayscale) (background dark)) (:foreground "LightGray" :italic t))
1958     (((class color) (background light)) (:foreground "RosyBrown"))
1959     (((class color) (background dark)) (:foreground "LightSalmon"))
1960     (t (:italic t)))
1961   "Face for highlighting the To: string in MH-Folder buffers."
1962   :group 'mh-folder-faces)
1963
1964 \f
1965
1966 ;;; Faces used in message display (:group mh-show-faces)
1967
1968 (defvar mh-show-cc-face 'mh-show-cc-face
1969   "Face for highlighting cc header fields.")
1970 (defface mh-show-cc-face
1971   '((((type tty) (class color)) (:foreground "yellow" :weight light))
1972     (((class grayscale) (background light))
1973      (:foreground "Gray90" :bold t :italic t))
1974     (((class grayscale) (background dark))
1975      (:foreground "DimGray" :bold t :italic t))
1976     (((class color) (background light)) (:foreground "DarkGoldenrod"))
1977     (((class color) (background dark)) (:foreground "LightGoldenrod"))
1978     (t (:bold t :italic t)))
1979   "Face for highlighting cc header fields."
1980   :group 'mh-show-faces)
1981
1982 (defvar mh-show-date-face 'mh-show-date-face
1983   "Face for highlighting the Date header field.")
1984 (defface mh-show-date-face
1985   '((((type tty) (class color)) (:foreground "green"))
1986     (((class grayscale) (background light)) (:foreground "Gray90" :bold t))
1987     (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1988     (((class color) (background light)) (:foreground "ForestGreen"))
1989     (((class color) (background dark)) (:foreground "PaleGreen"))
1990     (t (:bold t :underline t)))
1991   "Face for highlighting the Date header field."
1992   :group 'mh-show-faces)
1993
1994 (defvar mh-show-header-face 'mh-show-header-face
1995   "Face used to deemphasize unspecified header fields.")
1996 (defface mh-show-header-face
1997   '((((type tty) (class color)) (:foreground "green"))
1998     (((class grayscale) (background light)) (:foreground "DimGray" :italic t))
1999     (((class grayscale) (background dark)) (:foreground "LightGray" :italic t))
2000     (((class color) (background light)) (:foreground "RosyBrown"))
2001     (((class color) (background dark)) (:foreground "LightSalmon"))
2002     (t (:italic t)))
2003   "Face used to deemphasize unspecified header fields."
2004   :group 'mh-show-faces)
2005
2006 (defvar mh-show-to-face 'mh-show-to-face
2007   "Face for highlighting the To: header field.")
2008 (if (boundp 'facemenu-unlisted-faces)
2009     (add-to-list 'facemenu-unlisted-faces "^mh-show"))
2010 (defface mh-show-to-face
2011   '((((class grayscale) (background light))
2012      (:foreground "DimGray" :underline t))
2013     (((class grayscale) (background dark))
2014      (:foreground "LightGray" :underline t))
2015     (((class color) (background light)) (:foreground "SaddleBrown"))
2016     (((class color) (background dark))  (:foreground "burlywood"))
2017     (t (:underline t)))
2018   "Face for highlighting the To: header field."
2019   :group 'mh-show-faces)
2020
2021 (defvar mh-show-from-face 'mh-show-from-face
2022   "Face for highlighting the From: header field.")
2023 (defface mh-show-from-face
2024   '((((class color) (background light))
2025      (:foreground "red3"))
2026     (((class color) (background dark))
2027      (:foreground "cyan"))
2028     (t
2029      (:bold t)))
2030   "Face for highlighting the From: header field."
2031   :group 'mh-show-faces)
2032
2033 (defface mh-show-xface-face
2034   '((t (:foreground "black" :background "white")))
2035   "Face for displaying the X-Face image.
2036 The background and foreground is used in the image."
2037   :group 'mh-show-faces)
2038
2039 (defvar mh-show-subject-face 'mh-show-subject-face
2040   "Face for highlighting the Subject header field.")
2041 (copy-face 'mh-folder-subject-face 'mh-show-subject-face)
2042
2043 \f
2044
2045 ;;; Faces used in indexed searches (:group mh-index-faces)
2046
2047 (defvar mh-index-folder-face 'mh-index-folder-face
2048   "Face for highlighting folders in MH-Index buffers.")
2049 (defface mh-index-folder-face
2050   '((((class color) (background light))
2051      (:foreground "dark green" :bold t))
2052     (((class color) (background dark))
2053      (:foreground "indian red" :bold t))
2054     (t
2055      (:bold t)))
2056   "Face for highlighting folders in MH-Index buffers."
2057   :group 'mh-index-faces)
2058
2059 \f
2060
2061 ;;; Faces used when composing messages.
2062
2063 (defface mh-letter-header-field-face
2064   '((((class color) (background light))
2065      (:background "gray90"))
2066     (((class color) (background dark))
2067      (:background "gray10"))
2068     (t (:bold t)))
2069   "Face for displaying header fields in draft buffers."
2070   :group 'mh-letter-faces)
2071
2072 ;;; Local Variables:
2073 ;;; indent-tabs-mode: nil
2074 ;;; sentence-end-double-space: nil
2075 ;;; End:
2076
2077 ;;; mh-customize.el ends here