Initial Commit
[packages] / xemacs-packages / vm / lisp / vm-vars.el
1 ;;; vm-vars.el --- VM user and internal variable initialization
2 ;;
3 ;; Copyright (C) 1989-2003 Kyle E. Jones
4 ;; Copyright (C) 2003-2006 Robert Widhopf-Fenk
5 ;;
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2 of the License, or
9 ;; (at your option) any later version.
10 ;;
11 ;; This program is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;; GNU General Public License for more details.
15 ;;
16 ;; You should have received a copy of the GNU General Public License along
17 ;; with this program; if not, write to the Free Software Foundation, Inc.,
18 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 ;;; Code:
21 (defgroup vm nil
22   "The VM mail reader."
23   :group 'mail)
24
25 (defcustom vm-assimilate-new-messages-sorted nil
26   "*When enabled new messages will be inserted in current sort order.
27 Otherwise they are appended to the folder, which is VM default."
28   :group 'vm
29   :type 'boolean)
30
31 (defcustom vm-init-file "~/.vm"
32   "*Startup file for VM that is loaded the first time you run VM
33 in an Emacs session."
34   :group 'vm
35   :type 'file)
36
37 (defcustom vm-preferences-file "~/.vm.preferences"
38   "Unused.
39 *Secondary startup file for VM, loaded after `vm-init-file'.
40 This file is written and overwritten by VM and is not meant for
41 users to edit directly."
42   :group 'vm
43   :type 'file)
44
45 (defcustom vm-folder-directory nil
46   "*Directory where folders of mail are kept."
47   :group 'vm
48   :type '(choice (const nil) directory))
49
50 (defcustom vm-primary-inbox "~/INBOX"
51   "*Mail is moved from the system mailbox to this file for reading."
52   :group 'vm
53   :type 'file)
54
55 (defcustom vm-crash-box nil
56   "*File in which to store mail temporarily while it is transferred from
57 the system mailbox to the primary inbox.  If a crash occurs
58 during this mail transfer, any missing mail will be found in this
59 file.  VM will do crash recovery from this file automatically at
60 startup, as necessary.
61
62 If nil, `vm-primary-inbox' with `vm-crash-box-suffix' appende will be used as
63 crash boxdot set."
64   :group 'vm
65   :type '(choice file 
66                  (const :tag "Automatic" nil)))
67
68 (defcustom vm-keep-crash-boxes nil
69   "*Non-nil value should be a string specifying a directory where
70 your crash boxes should be moved after VM has copied new mail
71 out of them.  This is a safety measure.  In at least one case a
72 pointer corruption bug inside Emacs has caused VM to believe that
73 it had copied information out of the crash box when it in fact
74 had not.  VM then deleted the crash box, losing the batch of
75 incoming mail.  This is an exceedingly rare problem, but if you
76 want to avoid losing mail if it happens, set `vm-keep-crash-boxes'
77 to point to a directory in the same filesystem as all your
78 crash boxes.  Each saved crash box will have a unique name based
79 on the current date and time the box was saved.  You will need to
80 clean out this directory from time to time; VM does not do so.
81
82 A nil value means VM should just delete crash boxes after it
83 has copied out the mail."
84   :group 'vm
85   :type '(choice directory 
86                  (const :tag "No not keep crash boxes" nil)))
87
88 (defcustom vm-index-file-suffix nil
89   "*Suffix used to construct VM index file names.
90 When VM visits a folder, it checks for the existence of a file
91 whose name is the folder's file name with the value of this
92 variable appended to it.  If found, the file's contents will be
93 used to tell VM about the contents of the folder.  This is faster
94 than parsing the folder itself.
95
96 When you save a folder, the index file will be rewritten with
97 updated information about the folder.
98
99 A nil value means VM should not read or write index files."
100   :group 'vm
101   :type '(choice string (const nil)))
102
103 ;; use this function to access vm-spool-files on the fly.  this
104 ;; allows us to use environmental variables without setting
105 ;; vm-spool-files at load time and thereby making it hard to dump an
106 ;; Emacs containing a preloaded VM.
107 (defun vm-spool-files ()
108   (or vm-spool-files
109       (and (setq vm-spool-files (getenv "MAILPATH"))
110            (setq vm-spool-files
111                  (vm-delete-directory-names
112                   (vm-parse vm-spool-files
113                             "\\([^:%?]+\\)\\([%?][^:]*\\)?\\(:\\|$\\)"))))
114       (and (setq vm-spool-files (getenv "MAIL"))
115            (setq vm-spool-files (vm-delete-directory-names
116                                  (list vm-spool-files))))))
117
118 (defcustom vm-spool-files nil
119   "*If non-nil this variable's value should be a list of strings
120 or a list of lists.
121
122 If the value is a list of strings, the strings should name files
123 that VM will check for incoming mail instead of the default place
124 VM thinks your system mailbox is.  Mail will be moved from these
125 mailboxes to your primary inbox as specified by `vm-primary-inbox',
126 using `vm-crash-box' as a waystation.
127
128 If the value is a list of lists, each sublist should be of the form
129
130     (INBOX SPOOLNAME CRASHBOX)
131
132 INBOX, SPOOLNAME and CRASHBOX are all strings.
133
134 INBOX is the folder where you want your new mail to be moved when
135 you type 'g' (running `vm-get-new-mail') in VM.  It is where you
136 will read the mail.
137
138 SPOOLNAME is where the mail system leaves your incoming mail,
139 e.g. /var/spool/mail/kyle.  It can also be a mailbox
140 specification of the form, \"po:USER\", where USER is a user
141 name.  VM will pass this specification to the movemail program.
142 It is up to movemail to interpret it and figure out where to find
143 your mailbox.  Some systems use special authentication methods that
144 are only accessible via the movemail program.
145
146 SPOOLNAME can also be a POP maildrop.
147
148     A POP maildrop specification has the following format:
149
150        \"pop:HOST:PORT:AUTH:USER:PASSWORD\"
151     or
152        \"pop-ssl:HOST:PORT:AUTH:USER:PASSWORD\"
153     or
154        \"pop-ssh:HOST:PORT:AUTH:USER:PASSWORD\"
155
156     The second form is used to speak POP over an SSL connection.
157     You must have the stunnel program installed and the variable
158     `vm-stunnel-program' naming it in order for POP over SSL to
159     work.  The SSL version of the POP server will not use the
160     same port as the non-SSL version.
161
162     The third form is used to speak POP over an SSH connection.
163     You must have the ssh program installed and the variable
164     `vm-ssh-program' must name it in order for POP over SSH to
165     work.  SSH must be able to authenticate without a password,
166     which means you must be using either .shosts authentication
167     or RSA authentication.
168
169     HOST is the host name of the POP server
170
171     PORT is the TCP port number to connect to.  This should
172     normally be 110, unless you're using POP over SSL in which
173     case the stanard port is 995.
174
175     USER is the user name sent to the server.
176
177     PASSWORD is the secret shared by you and the server for
178     authentication purposes.  How is it used depends on the value of
179     the AUTH parameter.  If the PASSWORD is \"*\", VM will prompt
180     you for the password the first time you try to retrieve mail from
181     maildrop.  If the password is valid, VM will not ask you for the
182     password again during this Emacs session.
183
184     AUTH is the authentication method used to convince the server you
185     should have access to the maildrop.  Acceptable values are
186     \"pass\", \"rpop\" and \"apop\".  For \"pass\", the PASSWORD is sent to
187     the server with the POP PASS command.  For \"rpop\", the PASSWORD
188     should be the string to be sent to the server via the RPOP
189     command.  In this case the string is not really a secret;
190     authentication is done by other means.  For \"apop\", an MD5 digest
191     of the PASSWORD appended to the server timestamp will be sent to
192     the server with the APOP command.  In order to use \"apop\" you
193     will have to set the value of `vm-pop-md5-program' appropriately to
194     point at the program that will generate the MD5 digest that VM
195     needs.
196
197 SPOOLNAME can also be an IMAP maildrop.
198
199     An IMAP maildrop specification has the following format:
200
201        \"imap:HOST:PORT:MAILBOX:AUTH:USER:PASSWORD\"
202     or
203        \"imap-ssl:HOST:PORT:MAILBOX:AUTH:USER:PASSWORD\"
204     or
205        \"imap-ssh:HOST:PORT:MAILBOX:AUTH:USER:PASSWORD\"
206
207     The second form is used to speak IMAP over an SSL connection.
208     You must have the stunnel program installed and the variable
209     `vm-stunnel-program' naming it in order for IMAP over SSL to
210     work.
211
212     The third form is used to speak IMAP over an SSH connection.
213     You must have the ssh program installed and the variable
214     `vm-ssh-program' must name it in order for IMAP over SSH to
215     work.  SSH must be able to authenticate without a password,
216     which means you must be using .shosts authentication or
217     public key user authentication.
218
219     HOST is the host name of the IMAP server.
220
221     PORT is the TCP port number to connect to.  This should
222     normally be 143.  For IMAP over SSL, the standard port is
223     993.  There is no special port for IMAP over SSH.
224
225     MAILBOX is the name of the mailbox on the IMAP server.  Should
226     be \"inbox\", to access your default IMAP maildrop on the
227     server.
228
229     AUTH is the authentication method used to convince the server
230     you should have access to the maildrop.  Acceptable values
231     are \"preauth\", \"login\" and \"cram-md5\".  \"preauth\"
232     causes VM to skip the authentication stage of the protocol
233     with the assumption that the session was authenticated in some
234     external way.  \"login\", tells VM to use the IMAP LOGIN
235     command for authentication, which sends your username and
236     password in cleartext to the server.  \"cram-md5\" is a
237     challenge response system that convinces the server of your
238     identity without transmitting your password in the clear.
239     Not all servers support \"cram-md5\"; if you're not sure, ask
240     your mail administrator or just try it.
241
242     USER is the user name used with authentication methods that
243     require such an identifier.  \"login\" and \"cram-md5\"
244     use it currently.
245
246     PASSWORD is the secret shared by you and the server for
247     authentication purposes.  If the PASSWORD is \"*\", VM
248     will prompt you for the password the first time you try to
249     retrieve mail from maildrop.  If the password is valid, VM
250     will not ask you for the password again during this Emacs
251     session.
252
253 CRASHBOX is the temporary file that VM uses to store mail in
254 transit between the SPOOLNAME and the INBOX.  If the system
255 crashes or Emacs dies while mail is being moved, and the new
256 mail is not in the SPOOLNAME or the INBOX, then it will be in
257 the CRASHBOX.
258
259 There can be multiple entries with the same INBOX value, but a
260 particular SPOOLNAME should appear only once.  CRASHBOXes should
261 not be shared among different INBOXes, but you can use the same
262 CRASHBOX/INBOX pair with a different SPOOLNAME.
263
264 `vm-spool-files' will default to the value of the shell
265 environmental variables MAILPATH or MAIL if either of these
266 variables are defined and no particular value for `vm-spool-files'
267 has been specified."
268   :group 'vm
269   :type '(choice (repeat :tag "List of spool files" 
270                          (file :tag "Spoolfile"))
271                  (repeat :tag "List of (inbox spoolfile crashbox) elements"
272                          (list (file :tag "Inbox")
273                                (file :tag "Spoolfile")
274                                (file :tag "Crashbox")))))
275
276 (defcustom vm-spool-file-suffixes nil
277   "*List of suffixes to be used to create possible spool file names
278 for folders.  Example:
279
280   (setq vm-spool-file-suffixes '(\".spool\" \"-\"))
281
282 If you visit a folder ~/mail/beekeeping, when VM attempts to
283 retrieve new mail for that folder it will look for mail in
284 ~/mail/beekeeping.spool and ~/mail/beekeeping- in addition to
285 scanning `vm-spool-files' for matches.
286
287 The value of `vm-spool-files-suffixes' will not be used unless
288 `vm-crash-box-suffix' is also defined, since a crash box is
289 required for all mail retrieval from spool files."
290   :group 'vm
291   :type '(repeat string))
292
293 (defcustom vm-crash-box-suffix ".crash"
294   "*String suffix used to create possible crash box file names for folders.
295 When VM uses `vm-spool-file-suffixes' to create a spool file name,
296 it will append the value of `vm-crash-box-suffix' to the folder's
297 file name to create a crash box name."
298   :group 'vm
299   :type 'string)
300
301 (defcustom vm-make-spool-file-name nil
302   "*Non-nil value should be a function that returns a spool file name
303 for a folder.  The function will be called with one argument, the
304 folder's file name.  If the folder does not have a file name,
305 the function will not be called."
306   :group 'vm
307   :type 'function)
308
309 (defcustom vm-make-crash-box-name nil
310   "*Non-nil value should be a function that returns a crash box file name
311 for a folder.  The function will be called with one argument, the
312 folder's file name.  If the folder does not have a file name,
313 the function will not be called."
314   :group 'vm
315   :type 'function)
316
317 (defcustom vm-pop-md5-program "md5"
318   "*Program that reads a message on its standard input and writes an
319 MD5 digest on its output."
320   :group 'vm
321   :type 'string)
322
323 (defcustom vm-pop-max-message-size nil
324   "*If VM is about to retrieve via POP a message larger than this
325 size (in bytes) it will ask the you whether it should retrieve
326 the message.
327
328 If VM is retrieving mail automatically because `vm-auto-get-new-mail'
329 is set to a numeric value then you will not be prompted about large
330 messages.  This is to avoid prompting you while you're typing in
331 another buffer.  In this case the large message will be skipped with a
332 warning message.  You will be able to retrieved any skipped messages
333 later by running `vm-get-new-mail' interactively.
334
335 A nil value for `vm-pop-max-message-size' means no size limit."
336   :group 'vm
337   :type '(choice (const nil) integer))
338
339 (defcustom vm-pop-messages-per-session nil
340   "*Non-nil value should be an integer specifying how many messages to
341 retrieve per POP session.  When you type 'g' to get new mail, VM
342 will only retrieve that many messages from any particular POP maildrop.
343 To retrieve more messages, type 'g' again.
344
345 A nil value means there's no limit."
346   :group 'vm
347   :type '(choice (const nil) integer))
348
349 (defcustom vm-pop-bytes-per-session nil
350   "*Non-nil value should be an integer specifying how many bytes to
351 retrieve per POP session.  When you type 'g' to get new mail, VM
352 will only retrieve messages until the byte limit is reached on
353 any particular POP maildrop.  To retrieve more messages, type 'g'
354 again.
355
356 A nil value means there's no limit."
357   :group 'vm
358   :type '(choice (const nil) integer))
359
360 (defcustom vm-pop-expunge-after-retrieving t
361   "*Non-nil value means immediately delete messages from a POP mailbox
362 after retrieving them.  A nil value means messages will be left
363 in the POP mailbox until you run `vm-expunge-pop-messages'.
364 VM can only support a nil value for this variable if the
365 remote POP server supports the UIDL command.  If the server does
366 not support UIDL and you've asked VM leave messages on the server,
367 VM will complain about the lack of UIDL support and not retrieve
368 messages from the server.
369
370 This variable only affects POP mailboxes not listed in
371 `vm-pop-auto-expunge-alist' (which see)."
372   :group 'vm
373   :type 'boolean)
374
375 (defcustom vm-pop-auto-expunge-alist nil
376   "*List of POP mailboxes and values specifying whether messages
377 should be automatically deleted from the mailbox after retrieval.
378 The format of the list is
379
380   ((MAILBOX . VAL) (MAILBOX . VAL) ...)
381
382 MAILBOX should be a POP mailbox specification as described in
383 the documentation for the variable `vm-spool-files'.  If you have
384 the POP password specified in the `vm-spool-files' entry, you do
385 not have to specify it here as well.  Use `*' instead; VM will
386 still understand that this mailbox is the same as the one in
387 `vm-spool-files' that gives the password.
388
389 VAL should be nil if retrieved messages should be left in the
390 corresponding POP mailbox, t if retrieved messages should be
391 deleted from the mailbox immediately after retrieval.
392
393 VM can only support a non-nil setting of this variable if the
394 remote POP server supports the UIDL command.  If the server does
395 not support UIDL and you've asked to VM leave messages on the server,
396 VM will complain about the lack of UIDL support and not retrieve
397 messages from the server."
398   :group 'vm
399   :type '(repeat (cons string boolean)))
400
401 (defcustom vm-pop-read-quit-response t
402   "*Non-nil value tells VM to read the response to the POP QUIT command.
403 Sometimes, for reasons unknown, the QUIT response never arrives
404 from some POP servers and VM will hang waiting for it.  So it is
405 useful to be able to tell VM not to wait.  Some other
406 servers will not expunge messages unless the QUIT response is
407 read, so for these servers you should set the variable's value to
408 t."
409   :group 'vm
410   :type 'boolean)
411
412 (defcustom vm-recognize-pop-maildrops "^\\(pop:\\|pop-ssl:\\|pop-ssh:\\)?[^:]+:[^:]+:[^:]+:[^:]+:.+"
413   "*Value if non-nil should be a regular expression that matches
414 spool names found in `vm-spool-files' that should be considered POP
415 maildrops.  A nil value tells VM that all the spool names are to
416 be considered files except those matched by `vm-recognize-imap-maildrops'."
417   :group 'vm
418   :type 'regexp)
419
420 (defcustom vm-pop-folder-alist nil
421   "*Alist of POP maildrop specifications and names that refer to them.
422 The alist format is:
423
424  ((POPDROP NAME) ...)
425
426 POPDROP is a POP maildrop specification in the same format used
427 by `vm-spool-files' (which see).
428
429 NAME is a string that should give a less cumbersome name that you
430 will use to refer to this maildrop when using `vm-visit-pop-folder'."
431   :group 'vm
432   :type '(repeat (list string string)))
433
434 (defcustom vm-pop-folder-cache-directory nil
435   "*Directory where VM stores cached copies of POP folders.
436 When VM visits a POP folder (really just a POP server where you
437 have a mailbox) it stores the retrieved message on your computer
438 so that they need not be retrieved each time you visit the folder.
439 The cached copies are stored in the directory specified by this
440 variable."
441   :group 'vm
442   :type '(choice (const nil) directory))
443
444 (defcustom vm-imap-max-message-size nil
445   "*If VM is about to retrieve via IMAP a message larger than this size
446 (in bytes) it will ask you whether it should retrieve the message.
447
448 If VM is retrieving mail automatically because `vm-auto-get-new-mail'
449 is set to a numeric value then you will not be prompted about large
450 messages.  This is to avoid prompting you while you're typing in
451 another buffer.  In this case the large message will be skipped with a
452 warning message.  You will be able to retrieved any skipped messages
453 later by running `vm-get-new-mail' interactively.
454
455 A nil value for `vm-imap-max-message-size' means no size limit."
456   :group 'vm
457   :type '(choice (const nil) integer))
458
459 (defcustom vm-imap-messages-per-session nil
460   "*Non-nil value should be an integer specifying how many messages to
461 retrieve per IMAP session.  When you type 'g' to get new mail, VM
462 will only retrieve that many messages from any particular IMAP maildrop.
463 To retrieve more messages, type 'g' again.
464
465 A nil value means there's no limit."
466   :group 'vm
467   :type '(choice (const nil) integer))
468
469 (defcustom vm-imap-bytes-per-session nil
470   "*Non-nil value should be an integer specifying how many bytes to
471 retrieve per IMAP session.  When you type 'g' to get new mail, VM
472 will only retrieve messages until the byte limit is reached on
473 any particular IMAP maildrop.  To retrieve more messages, type 'g'
474 again.
475
476 A nil value means there's no limit."
477   :group 'vm
478   :type '(choice (const nil) integer))
479
480 (defcustom vm-imap-expunge-after-retrieving t
481   "*Non-nil value means immediately remove messages from an IMAP mailbox
482 after retrieving them.  A nil value means messages will be left
483 in the IMAP mailbox until you run `vm-expunge-imap-messages'.
484
485 This variable only affects IMAP mailboxes not listed in
486 `vm-imap-auto-expunge-alist' (which see)."
487   :group 'vm
488   :type 'boolean)
489
490 (defcustom vm-imap-auto-expunge-alist nil
491   "*List of IMAP mailboxes and values specifying whether messages
492 should be automatically deleted from the mailbox after retrieval.
493 The format of the list is
494
495   ((MAILBOX . VAL) (MAILBOX . VAL) ...)
496
497 MAILBOX should be an IMAP mailbox specification as described in
498 the documentation for the variable `vm-spool-files'.  If you have
499 the IMAP password specified in the `vm-spool-files' entry, you do
500 not have to specify it here as well.  Use `*' instead; VM will
501 still understand that this mailbox is the same as the one in
502 `vm-spool-files' that contains the password.
503
504 VAL should be nil if retrieved messages should be left in the
505 corresponding IMAP mailbox, t if retrieved messages should be
506 deleted from the mailbox immediately after retrieval."
507   :group 'vm
508   :type '(repeat (cons string boolean)))
509
510 (defcustom vm-recognize-imap-maildrops "^\\(imap\\|imap-ssl\\|imap-ssh\\):[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:.+"
511   "*Value if non-nil should be a regular expression that matches
512 spool names found in `vm-spool-files' that should be considered IMAP
513 maildrops.  A nil value tells VM that all the spool names are to
514 be considered files except those matched by `vm-recognize-pop-maildrops'."
515   :group 'vm
516   :type 'regexp)
517
518 (defcustom vm-imap-server-list nil
519   "*List of IMAP maildrop specifications that tell VM the IMAP servers
520 you have access to and how to log into them.  The IMAP maildrop
521 specification in the same format used by `vm-spool-files' (which
522 see).  The mailbox part of the specifiation is ignored and should
523 be asterisk or some other placeholder.
524
525 Example:
526  (setq vm-imap-server-list
527       '(
528          \"imap-ssl:mail.foocorp.com:993:inbox:login:becky:*\"
529          \"imap:crickle.lex.ky.us:143:inbox:login:becky:*\"
530        )
531  )"
532   :group 'vm
533   :type '(repeat string))
534
535 (defcustom vm-imap-folder-cache-directory nil
536   "*Directory where VM stores cached copies of IMAP folders.
537 When VM visits a IMAP folder (really just a IMAP server where you
538 have a mailbox) it stores the retrieved message on your computer
539 so that they need not be retrieved each time you visit the folder.
540 The cached copies are stored in the directory specified by this
541 variable."
542   :group 'vm
543   :type '(choice (const nil) directory))
544
545 (defcustom vm-imap-save-to-server nil
546   "If this variable is non-NIL, then the save-message command should
547 save to IMAP folders on the server, rather than to local files."
548   :group 'vm
549   :type '(choice (const nil) (const t)))
550
551 (defcustom vm-auto-get-new-mail t
552   "*Non-nil value causes VM to automatically move mail from spool files
553 to a mail folder when the folder is first visited.  Nil means
554 you must always use `vm-get-new-mail' to pull in newly arrived messages.
555
556 If the value is a number, then it specifies how often (in
557 seconds) VM should check for new mail and try to retrieve it.
558 This is done asynchronously and may occur while you are editing
559 other files.  It should not disturb your editing, except perhaps
560 for a pause while the check is being done."
561   :group 'vm
562   :type '(choice boolean integer))
563
564 (defcustom vm-mail-check-interval 300
565   "*Numeric value specifies the number of seconds between checks
566 for new mail.  The maildrops for all visited folders are checked.
567
568 A nil value means don't check for new mail.
569
570 Note that if new mail is found, it is not retrieved.  The
571 buffer local variable `vm-spooled-mail-waiting' is set non-nil in
572 the buffers of those folders that have mail waiting.  VM
573 displays \"Mail\" in the mode line of folders that have mail
574 waiting."
575   :group 'vm
576   :type '(choice (const nil) integer))
577
578 (defvar vm-spooled-mail-waiting nil
579   "Value is non-nil if there is mail waiting for the current folder.
580 This variable's value is local in all buffers.
581 VM maintains this variable, you should not set it.")
582 (make-variable-buffer-local 'vm-spooled-mail-waiting)
583
584 (defcustom vm-default-folder-type
585   (cond ((not (boundp 'system-configuration))
586          'From_)
587         ((or (string-match "-solaris" system-configuration)
588              (string-match "usg-unix-v" system-configuration)
589              (string-match "-ibm-aix" system-configuration))
590          'From_-with-Content-Length)
591         ((string-match "-sco" system-configuration)
592          'mmdf)
593         (t 'From_))
594   "*Default folder type for empty folders.
595 If VM has to add messages that have no specific folder type to an
596 empty folder, the folder will become this default type.
597 Allowed types are:
598
599    From_
600    From_-with-Content-Length
601    BellFrom_
602    mmdf
603    babyl
604
605 Value must be a symbol, not a string. i.e. write
606
607   (setq vm-default-folder-type 'From_)
608
609 in your .emacs or .vm file.
610
611 If you set this variable's value to From_-with-Content-Length you
612 must set `vm-trust-From_-with-Content-Length' non-nil."
613   :group 'vm
614   :type '(choice (const From_)
615                 (const From_-with-Content-Length)
616                 (const BellFrom_)
617                 (const mmdf)
618                 (const babyl)))
619
620 (defcustom vm-default-From_-folder-type 'From_
621   "*Value must be a symbol that tells VM which From-style folder type
622 is used by your local mail delivery system.  Valid values are
623
624     From_
625     BellFrom_
626
627 Messages in From_ folders are separated by the two newlines
628 followed by the string \"From\" and a space.  Messages in
629 BellFrom_ folders are only required to have a single newline
630 before the \"From\" string.
631
632 Since BellFrom_ and From_ folders cannot be reliably distinguished
633 from each other, you must tell VM which one your system uses by
634 setting the variable `vm-default-From_-folder-type' to either From_
635 or BellFrom_."
636   :group 'vm
637   :type '(choice (const From_)
638                  (const BellFrom_)))
639
640 (defcustom vm-default-new-folder-line-ending-type nil
641   "*Value must be a symbol that specifies the line ending convention
642 to use for new folders.  Text files under UNIXish and Windows
643 systems use different characters to indicate the end of a line.
644 UNIXish systems use a single linefeed character, Windows uses a
645 carriage return followed by a line feed.  The value of this
646 variable tells VM which to use.
647
648 `nil' means use the line ending convention of the local system;
649 CRLF if you're on a Windows system, LF for UNIXish systems.
650 `crlf' means use CRLF.
651 `lf' mean use LF.
652 `cr' means use CR (old Macs use this)."
653   :group 'vm
654   :type '(choice (const nil)
655                  (const crlf)
656                  (const cr)
657                  (const lf)))
658
659 (defcustom vm-check-folder-types t
660   "*Non-nil value causes VM to check folder and message types for
661 compatibility before it performs certain operations.
662
663 Before saving a message to a folder, VM will check that the destination folder
664 is of the same type as the message to be saved.
665
666 Before incorporating message into a visited folder, VM will check that the
667 messages are of the same type as that folder.
668
669 A nil value means don't do the checks.
670
671 If non-nil, VM will either convert the messages to the appropriate
672 type before saving or incorporating them, or it will signal an
673 error.  The value of `vm-convert-folder-types' determines which
674 action VM will take."
675   :group 'vm
676   :type 'boolean)
677
678 (defcustom vm-convert-folder-types t
679   "*Non-nil value means that when VM checks folder types and finds
680 a mismatch (see `vm-check-folder-types'), it will convert the
681 source messages to the type of the destination folder, if it can.
682
683 If `vm-check-folder-types' is nil, then this variable isn't
684 consulted."
685   :group 'vm
686   :type 'boolean)
687
688 (defcustom vm-trust-From_-with-Content-Length
689   (eq vm-default-folder-type 'From_-with-Content-Length)
690   "*Non-nil value means that if the first message in a folder contains
691 a Content-Length header and begins with \"From \" VM can safely
692 assume that all messages in the folder have Content-Length headers
693 that specify the length of the text section of each message.  VM
694 will then use these headers to determine message boundaries
695 instead of the usual way of searching for two newlines followed by a
696 line that begins with \"From \".
697
698 If you set `vm-default-folder-type' to From_-with-Content-Length you
699 must set this variable non-nil."
700   :group 'vm
701   :type 'boolean)
702
703 (defcustom vm-visible-headers
704   '("Resent-"
705     "From:" "Sender:"
706     "To:" "Apparently-To:" "Cc:"
707     "Subject:"
708     "Date:")
709   "*List of headers that should be visible when VM first displays a message.
710 These should be listed in the order you wish them presented.
711 Regular expressions are allowed.  There's no need to anchor
712 patterns with \"^\", as searches always start at the beginning of
713 a line.  Put a colon at the end of patterns to get exact matches.
714 For example, \"Date\" matches \"Date\" and \"Date-Sent\".  Header names
715 are always matched case insensitively.
716
717 If the value of `vm-invisible-header-regexp' is nil, only the
718 headers matched by `vm-visible-headers' will be displayed.
719 Otherwise all headers are displayed except those matched by
720 `vm-invisible-header-regexp'.  In this case `vm-visible-headers'
721 specifies the order in which headers are displayed.  Headers not
722 matching `vm-visible-headers' are displayed last."
723   :group 'vm
724   :type '(list regexp))
725
726 (defcustom vm-invisible-header-regexp nil
727   "*Non-nil value should be a regular expression that tells what headers
728 VM should NOT normally display when presenting a message.  All other
729 headers will be displayed.  The variable `vm-visible-headers' specifies
730 the presentation order of headers; headers not matched by
731 `vm-visible-headers' are displayed last.
732
733 Nil value causes VM to display ONLY those headers specified in
734 `vm-visible-headers'."
735   :group 'vm
736   :type '(choice (const nil) regexp))
737
738 (defcustom vm-highlighted-header-regexp nil
739   "*Value specifies which headers to highlight.
740 This is a regular expression that matches the names of headers that should
741 be highlighted when a message is first presented.  For example setting
742 this variable to \"From:\\\\|Subject:\" causes the From and Subject
743 headers to be highlighted.
744
745 If you're using XEmacs, you might want to use the builtin
746 `highlight-headers' package instead.  If so, then you should set
747 the variable `vm-use-lucid-highlighting' non-nil.  You'll need to
748 set the various variables used by the highlight-headers package
749 to customize highlighting.  `vm-highlighted-header-regexp' is
750 ignored in this case."
751   :group 'vm
752   :type '(choice (const nil) regexp))
753
754 (defcustom vm-use-lucid-highlighting (condition-case nil
755                                       (progn
756                                         (require 'highlight-headers)
757                                         t )
758                                     (error nil))
759   "*Non-nil means to use the `highlight-headers' package in XEmacs.
760 Nil means just use VM's builtin header highlighting code.
761
762 FSF Emacs always uses VM's builtin highlighting code."
763   :group 'vm
764   :type 'boolean)
765
766 (defgroup vm-faces nil
767   "VM additional virtual folder selectors and functions."
768   :group 'vm)
769
770 (defcustom vm-highlighted-header-face 'bold
771   "*Face to be used to highlight headers.
772 The headers to highlight are specified by the `vm-highlighted-header-regexp'
773 variable.
774
775 This variable is ignored under XEmacs if `vm-use-lucid-highlighting' is
776 non-nil.  XEmacs' highlight-headers package is used instead.  See the
777 documentation for the function `highlight-headers' to find out how to
778 customize header highlighting using this package."
779   :group 'vm-faces
780   :type 'symbol)
781
782 (defcustom vm-preview-lines 0
783   "*Non-nil value N causes VM to display the visible headers + N lines of text
784 of a message when it is first presented.  The message is not actually
785 flagged as read until it is exposed in its entirety.
786
787 A value of t causes VM to display as much of the message as will
788 fit in the window associated with the folder buffer.
789
790 A nil value causes VM not to preview messages; no text lines are hidden and
791 messages are immediately flagged as read."
792   :group 'vm
793   :type '(choice boolean integer))
794
795 (defcustom vm-preview-read-messages nil
796   "*Non-nil value means to preview messages even if they've already been read.
797 A nil value causes VM to preview messages only if new or unread."
798   :group 'vm
799   :type 'boolean)
800
801 (defcustom vm-always-use-presentation-buffer nil
802   "*Non-nil means to always use a presentation buffer for displaying messages.
803 It will also be used if no decoding or other modification of the message are
804 necessary."
805   :group 'vm
806   :type 'boolean)
807
808 (defcustom vm-fill-paragraphs-containing-long-lines nil
809   "*Non-nil numeric value N or symbol 'window-width causes VM to fill
810 paragraphs that contain lines spanning that columns or more.  Only plain text
811 messages and text/plain MIME parts will be filled.  The message
812 itself is not modified; its text is copied into a presentation
813 buffer before the filling is done."
814   :group 'vm
815   :type '(choice (const nil)
816                  (const window-width)
817                  integer))
818
819 (defcustom vm-paragraph-fill-column (default-value 'fill-column)
820   "*Column beyond which automatic line-wrapping should happen when
821 re-filling lines longer than the value of
822 `vm-fill-paragraphs-containing-long-lines'."
823   :group 'vm
824   :type 'integer)
825
826 (defcustom vm-display-using-mime t
827   "*Non-nil value means VM should display messages using MIME.
828 MIME (Multipurpose Internet Mail Extensions) is a set of
829 extensions to the standard Internet message format that allows
830 reliable tranmission and reception of arbitrary data including
831 images, audio and video as well as ordinary text.
832
833 A non-nil value for this variable means that VM will recognize
834 MIME encoded messages and display them as specified by the
835 various MIME standards specifications.
836
837 A nil value means VM will not display MIME messages any
838 differently than any other message."
839   :group 'vm
840   :type 'boolean)
841
842 ;; this is t because at this time (11 April 1997) Solaris is
843 ;; generating too many mangled MIME version headers.  For the same
844 ;; reason vm-mime-avoid-folding-content-type is also set to t.
845 (defcustom vm-mime-ignore-mime-version t
846   "*Non-nil value means ignore the version number in the MIME-Version
847 header.  VM only knows how to decode and display MIME version 1.0
848 messages.  Some systems scramble the MIME-Version header, causing
849 VM to believe that it cannot display a message that it actually
850 can display.  You can set `vm-mime-ignore-mime-version' non-nil if
851 you use such systems."
852   :group 'vm
853   :type 'boolean)
854
855 (defcustom vm-mime-require-mime-version-header t
856   "*Non-nil means a message must contain MIME-Version to be considered MIME.
857 The MIME standard requires that MIME messages contain a MIME-Version,
858 but some mailers ignore the standard and do not send the header.  Set
859 this variable to nil if you want VM to be lax and parse such messages
860 as MIME anyway."
861   :group 'vm
862   :type 'boolean)
863
864 (defcustom vm-mime-ignore-composite-type-opaque-transfer-encoding t
865   "*Non-nil means VM should ignore transfer encoding declarations
866 of base64 and quoted-printable for object of type message/* or
867 multipart/*.  The MIME spec requires that these composite types
868 use either 7bit, 8bit, or binary transfer encodings but some
869 mailers declare quoted-printable and base64 even when they are
870 not used.  Set this variable non-nil if you want VM to be lax and
871 ignore this problem and try to display the object anyway."
872   :group 'vm
873   :type 'boolean)
874
875 (defcustom vm-mime-ignore-missing-multipart-boundary t
876   "*Non-nil means VM should treat a missing MIME boundary marker
877 as if the marker were at the end of the current enclosing MIME
878 object or, if there is no enclosing object, at the end of the
879 message.  A nil value means VM will complain about missing
880 boundaries and refuse to parse such MIME messages."
881   :group 'vm
882   :type 'boolean)
883
884 (defcustom vm-send-using-mime t
885   "*Non-nil value means VM should support sending messages using MIME.
886 MIME (Multipurpose Internet Mail Extensions) is a set of
887 extensions to the standard Internet message format that allows
888 reliable tranmission and reception of arbitrary data including
889 images, audio and video as well as traditional text.
890
891 A non-nil value for this variable means that VM will
892
893   - allow you to attach files and messages to your outbound message.
894   - analyze the composition buffer when you send off a message and
895     encode it as needed.
896
897 A nil value means VM will not offer any support for composing
898 MIME messages."
899   :group 'vm
900   :type 'boolean)
901
902 (defcustom vm-honor-mime-content-disposition nil
903   "*Non-nil value means use information from the Content-Disposition header
904 to display MIME messages.  The Content-Disposition header
905 specifies whether a MIME object should be displayed inline or
906 treated as an attachment.  For VM, ``inline'' display means
907 displaying the object in the Emacs buffer, if possible.
908 Attachments will be displayed as a button that you can use
909 mouse-2 to activate or mouse-3 to pull up a menu of options."
910   :group 'vm
911   :type 'boolean)
912
913 (defcustom vm-auto-decode-mime-messages t
914   "*Non-nil value causes MIME decoding to occur automatically
915 when a message containing MIME objects is exposed.  A nil value
916 means that you will have to run the `vm-decode-mime-message'
917 command (normally bound to `D') manually to decode and display
918 MIME objects."
919   :group 'vm
920   :type 'boolean)
921
922 (defcustom vm-mime-decode-for-preview t
923   "*Non-nil value causes partial MIME decoding to happen when a message
924 is previewed, instead of when it is displayed in full.  The point of
925 this is if `vm-preview-lines' is set to a non-nil, non-zero
926 value you can see readable text instead of a potentially inscrutable
927 MIME jumble.  `vm-auto-decode-mime-messages' must also be set non-nil
928 for this variable to have effect."
929   :group 'vm
930   :type 'boolean)
931
932 (defcustom vm-auto-displayed-mime-content-types '("text" "image" "multipart")
933   "*List of MIME content types that should be displayed immediately
934 after decoding.  Other types will be displayed as a button that
935 you must activate to display the object.
936
937 A value of t means that all types should be displayed immediately.
938 A nil value means never display MIME objects immediately; only use buttons.
939
940 If the value is a list, it should be a list of strings, which
941 should all be types or type/subtype pairs.  Example:
942
943  (setq vm-auto-displayed-mime-content-types '(\"text\" \"image/jpeg\"))
944
945 If a top-level type is listed without a subtype, all subtypes of
946 that type are assumed to be included.
947
948 Note that some types are processed specially, and this variable does not
949 apply to them.
950
951    multipart/digest messages are always displayed as a button to
952    avoid automatically visiting a new folder while you are moving
953    around in the current folder.
954
955    message/partial messages are always displayed as a button,
956    because there always needs to be a way to trigger the assembly
957    of the parts into a full message.
958
959 Any type that cannot be displayed internally or externally will
960 be displayed as a button that allows you to save the body of the MIME
961 object to a file."
962   :group 'vm
963   :type '(choice (const t) (repeat string)))
964
965 (defcustom vm-auto-displayed-mime-content-type-exceptions nil
966   "*List of MIME content types that should not be displayed immediately
967 after decoding.  These types will be displayed as a button that you
968 must activate to display the object.  This is an exception list for
969 the types listed in `vm-auto-displayed-mime-content-types'; all types
970 listed there will be auto-displayed except those in the exception
971 list.
972
973 The value should be either nil or a list of strings.  The strings
974 should all be types or type/subtype pairs.  Example:
975
976  (setq vm-auto-displayed-mime-content-type-exceptions '(\"text/html\"))
977
978 If a top-level type is listed without a subtype, all subtypes of
979 that type are assumed to be included."
980   :group 'vm
981   :type '(repeat string))
982
983 (defcustom vm-mime-internal-content-types t
984   "*List of MIME content types that should be displayed internally
985 if Emacs is capable of doing so.  A value of t means that VM
986 display all types internally if possible.  A list of exceptions
987 can be specified via `vm-mime-internal-content-type-exceptions'.
988 A nil value means never display MIME objects internally, which
989 means VM must run an external viewer to display MIME objects.
990
991 If the value is a list, it should be a list of strings.  Example:
992
993  (setq vm-mime-internal-content-types '(\"text\" \"image/jpeg\"))
994
995 If a top-level type is listed without a subtype, all subtypes of
996 that type are assumed to be included.
997
998 Note that all multipart types are always handled internally.
999 There is no need to list them here."
1000   :group 'vm
1001   :type '(choice (const t) (const nil) (repeat string)))
1002
1003 (defcustom vm-mime-internal-content-type-exceptions nil
1004   "*List of MIME content types that should not be displayed internally.
1005 This is an exception list for the types specified in
1006 `vm-mime-internal-content-types'; all types listed there will be
1007 displayed internally except for those in the exception list.
1008
1009 The value should be a list of strings.  Example:
1010
1011  (setq vm-mime-internal-content-type-exceptions '(\"image/jpeg\"))
1012
1013 If a top-level type is listed without a subtype, all subtypes of
1014 that type are assumed to be included."
1015   :group 'vm
1016   :type '(repeat string))
1017
1018 (defcustom vm-mime-external-content-types-alist nil
1019   "*Alist of MIME content types and the external programs used to display them.
1020 If VM cannot display a type internally or has been instructed not
1021 to (see the documentation for the `vm-mime-internal-content-types'
1022 variable) it will try to launch an external program to display that
1023 type.
1024
1025 The alist format is a list of lists, each sublist having the form
1026
1027  (TYPE PROGRAM ARG ARG ... )
1028
1029 or
1030
1031  (TYPE COMMAND-LINE)
1032
1033 TYPE is a string specifying a MIME type or type/subtype pair.
1034 For example \"text\" or \"image/jpeg\".  If a top-level type is
1035 listed without a subtype, all subtypes of that type are assumed
1036 to be included.
1037
1038 In the first form, PROGRAM is a string naming a program to run to
1039 display an object.  Any ARGS will be passed to the program as
1040 arguments.  The octets that compose the object will be written
1041 into a temporary file and the name of the file can be inserted
1042 into an ARG string by writing %f.  In earlier versions of VM the
1043 filename was always added as the last argument; as of VM 6.49 this
1044 is only done if %f does not appear in any of the ARG strings.
1045 The filename inserted by %f will be quoted by `shell-quote-argument'
1046 and thus no single quotes should be used, i.e. do not use the following 
1047 \"...'%f'...\".
1048
1049 If the COMMAND-LINE form is used, the program and its arguments
1050 are specified as a single string and that string is passed to the
1051 shell for execution.  Since the command line will be passed to
1052 the shell, you can use shell variables and redirection if needed.
1053 As with the PROGRAM/ARGS form, the name of the temporary file
1054 that contains the MIME object will be appended to the command
1055 line if %f does not appear in the command line string.
1056
1057 In either the PROGRAM/ARG or COMMAND-LINE forms, all the
1058 program and argument strings will have any %-specifiers in
1059 them expanded as described in the documentation for the
1060 variable `vm-mime-button-format-alist'.  The only difference
1061 is that %f refers to the temporary file VM creates to store
1062 the object to be displayed, not the filename that the sender
1063 may have associated with the attachment.
1064
1065 Example:
1066
1067  (setq vm-mime-external-content-types-alist
1068        '(
1069          (\"text/html\"         \"netscape\")
1070          (\"image/gif\"         \"xv\")
1071          (\"image/jpeg\"        \"xv\")
1072          (\"video/mpeg\"        \"mpeg_play\")
1073          (\"video\"             \"xanim\")
1074         )
1075  )
1076
1077 The first matching list element will be used.
1078
1079 No multipart message will ever be sent to an external viewer."
1080   :group 'vm
1081   :type '(repeat (list string string)))
1082
1083 (defcustom vm-mime-external-content-type-exceptions nil
1084   "*List of MIME content types that should not be displayed externally
1085 without a manual request from the user.  This is an exception list
1086 for the types specified in `vm-mime-external-content-types-alist';
1087 types listed there will not be displayed using the specified viewer
1088 unless you explicitly request it by menu or `$ e' from the keyboard.
1089
1090 The value should be a list of strings.  Example:
1091
1092  (setq vm-mime-external-content-type-exceptions '(\"text/html\"))
1093
1094 If a top-level type is listed without a subtype, all subtypes of
1095 that type are assumed to be included."
1096   :group 'vm
1097   :type '(repeat string))
1098
1099 (defcustom vm-mime-delete-viewer-processes t
1100   "*Non-nil value causes VM to kill external MIME viewer processes
1101 when you switch to a different message or quit the current message's
1102 folder."
1103   :group 'vm
1104   :type 'boolean)
1105
1106 (defcustom vm-mime-type-converter-alist nil
1107   "*Alist of MIME types and programs that can convert between them.
1108 If VM cannot display a content type, it will scan this list to
1109 see if the type can be converted into a type that it can display.
1110
1111 The alist format is
1112
1113  ( (START-TYPE END-TYPE COMMAND-LINE ) ... )
1114
1115 START-TYPE is a string specifying a MIME type or type/subtype pair.
1116 Example \"text\" or \"image/jpeg\".  If a top-level type is
1117 listed without a subtype, all subtypes of that type are assumed
1118 to be included.
1119
1120 END-TYPE must be an exact type/subtype pair.  This is the type
1121 to which START-TYPE will be converted.
1122
1123 COMMAND-LINE is a string giving a command line to be passed to
1124 the shell.  The octets that compose the object will be written to
1125 the standard input of the shell command.
1126
1127 Example:
1128
1129  (setq vm-mime-type-converter-alist
1130        '(
1131          (\"image/jpeg\"        \"image/gif\"   \"jpeg2gif\")
1132          (\"text/html\"         \"text/plain\"  \"striptags\")
1133         )
1134  )
1135
1136 The first matching list element will be used."
1137   :group 'vm
1138   :type '(repeat (list (string :tag "From type")
1139                        (string :tag "To type")
1140                        (string :tag "Converter program"))))
1141
1142 (defcustom vm-mime-charset-converter-alist nil
1143   "*Alist of MIME charsets and programs that can convert between them.
1144 If VM cannot display a particular character set, it will scan this list to
1145 see if the charset can be converted into a charset that it can display.
1146
1147 The alist format is
1148
1149  ( ( START-CHARSET END-CHARSET COMMAND-LINE ) ... )
1150
1151 START-CHARSET is a string specifying a MIME charset.
1152 Example \"iso-8859-1\" or \"utf-8\".
1153
1154 END-CHARSET is a string specifying the charset to which START-CHARSET
1155 will be converted.
1156
1157 COMMAND-LINE is a string giving a command line to be passed to
1158 the shell.  The characters in START-CHARSET will be written to the
1159 standard input of the shell command and VM expects characters
1160 encoded in END-CHARSET to appear at the standard output of the
1161 COMMAND-LINE.  COMMAND-LINE is passed to the shell, so you can
1162 use pipelines, shell variables and redirections.
1163
1164 Example:
1165
1166  (setq vm-mime-charset-converter-alist
1167        '(
1168          (\"utf-8\" \"iso-2022-jp\" \"iconv -f utf-8 -t iso-2022-jp\")
1169         )
1170  )
1171
1172 The first matching list element will be used."
1173   :group 'vm
1174   :type '(repeat (list string string string)))
1175
1176 (defcustom vm-mime-alternative-select-method 'best-internal
1177   "*Value tells how to choose which multipart/alternative part to display.
1178 A MIME message of type multipart/alternative has multiple message
1179 parts containing the same information, but each part may be
1180 formatted differently.  VM will display only one of the parts.
1181 This variable tells VM how to choose which part to display.
1182
1183 A value of 'best means choose the part that is the most faithful to
1184 the sender's original content that can be displayed.
1185
1186 A value of 'best-internal means choose the best part that can
1187 be displayed internally, (i.e. with the built-in capabilities
1188 of Emacs) and is allowed to be displayed internally (see
1189 `vm-mime-internal-content-types').  If none of the parts can be
1190 displayed internally, behavior reverts to that of 'best.
1191
1192 The value can also be a list of the form
1193
1194   (favorite TYPE ...)
1195
1196 with the first element of the list being the symbol 'favorite'.  The
1197 remaining elements of the list are strings specifying MIME types.
1198 VM will look for each TYPE in turn in the list of alternatives and
1199 choose the first matching alternative found that can be displayed.
1200 If the symbol 'favorite' is 'favorite-internal' instead, the first TYPE
1201 that matches an alternative that can be displayed internally will be
1202 chosen."
1203   :group 'vm
1204   :type '(choice (choice (const best-internal)
1205                          (const best))
1206                  (cons (const favorite) (repeat string))
1207                  (cons (const favorite-internal) (repeat string))))
1208
1209 (defcustom vm-mime-use-w3-for-text/html t
1210   "*Non-nil means use Emacs W3 to display text/html MIME objects
1211 Nil means don't use W3 for this."
1212   :group 'vm
1213   :type 'boolean)
1214
1215 (defcustom vm-mime-default-face-charsets
1216   (if vm-fsfemacs-mule-p
1217       (if (eq window-system nil)
1218           '("us-ascii" "iso-8859-1")
1219         '("us-ascii"))
1220     '("us-ascii" "iso-8859-1"))
1221   "*List of character sets that can be displayed using the `default' face.
1222 The default face is what you normally see when you edit text in Emacs.
1223 The font assigned to the default face can typically display one or two
1224 character sets.  For U.S. and Western European users, ``us-ascii'' and
1225 one of the ISO-8859 character sets usually can be displayed.  Whatever
1226 character sets that your default face can display should be listed as
1227 the value of `vm-mime-default-face-charsets'.  Example:
1228
1229  (setq vm-mime-default-face-charsets '(\"us-ascii\" \"iso-8859-1\"))
1230
1231 Case is not significant in character set names.
1232
1233 A value of t means all character sets can be displayed by the
1234 default face.  This should be used in combination with
1235 `vm-mime-default-face-charset-exceptions' to tell VM that most of
1236 the mail you receive is displayable using your default face and
1237 its associated font, even though the messages might arrive with
1238 unknown or unregistered character sets specified in the MIME
1239 Content-Type header.
1240
1241 To tell VM how to display other character sets, see
1242 `vm-mime-charset-font-alist'."
1243   :group 'vm
1244   :type '(choice (const t) (repeat string)))
1245
1246 (defcustom vm-mime-default-face-charset-exceptions nil
1247   "*List of character sets that cannot be displayed using the default face.
1248 This variable acts as an exception list for `vm-mime-default-face-charsets'.
1249 Character sets listed here will not be considered displayable using the
1250 default face even if they are also listed in `vm-mime-default-face-charsets'."
1251   :group 'vm
1252   :type '(repeat string))
1253
1254 (defcustom vm-mime-charset-font-alist nil
1255   "*Assoc list of character sets and fonts that can be used to display them.
1256 The format of the list is:
1257
1258   ( (CHARSET . FONT) ...)
1259
1260 CHARSET is a string naming a MIME registered character set such
1261 as \"iso-8859-5\".  Character set names should be specified in
1262 lower case.
1263
1264 FONT is a string naming a font that can be used to display CHARSET.
1265
1266 An example setup might be:
1267
1268   (setq vm-mime-charset-font-alist
1269    '(
1270      (\"iso-8859-7\" . \"-*-*-medium-r-normal-*-16-160-72-72-c-80-iso8859-7\")
1271     )
1272   )
1273
1274 This variable is only useful for character sets whose characters
1275 can all be encoded in single 8-bit bytes.  Also multiple fonts
1276 can only be displayed if you're running under a window system
1277 e.g. X windows.  So this variable will have no effect if you're
1278 running Emacs on a tty.
1279
1280 If you're using FSF Emacs 20 or later, or you're using XEmacs with
1281 compiled in MULE support, this value of this variable is ignored.
1282
1283 Note that under FSF Emacs 19, any fonts you use must be the
1284 same height as your default font.  XEmacs does not have this
1285 limitation."
1286   :group 'vm
1287   :type '(repeat (cons string string)))
1288
1289 (defcustom vm-mime-use-image-strips t
1290   "*Non-nil means chop an image into horizontal strip for display.
1291 Emacs treats a displayed image as a single large character and cannot
1292 scroll vertically within an image.  To work around this limitation VM
1293 can display an image as a series of contiguous horizontal strips that
1294 Emacs' scrolling routines can better handle.  To do this VM needs to
1295 have the ImageMagick programs 'convert' and 'identify' installed;
1296 `vm-imagemagick-convert-program' and `vm-imagemagick-identify-program
1297 must point to them.
1298
1299 A nil value means VM should display images without cutting them
1300 into strips."
1301   :group 'vm
1302   :type 'boolean)
1303
1304 (defcustom vm-mime-display-image-strips-incrementally t
1305   "*Non-nil means display image strips as they are created
1306 rather than waiting until all the strips are created and displaying
1307 them all at once.  See `vm-mime-use-image-strips'."
1308   :group 'vm
1309   :type 'boolean)
1310
1311 (defun vm-locate-executable-file (name)
1312   (or (cond ((fboundp 'locate-file)
1313              (locate-file name exec-path nil 1))
1314             (t
1315              (let (file done (dirs exec-path))
1316                (while (and dirs (not done))
1317                  (setq file (expand-file-name name (car dirs)))
1318                  (if (file-executable-p file)
1319                      (setq done t)
1320                    (setq dirs (cdr dirs))))
1321                (and dirs file))))
1322       (let ((vmdir (file-name-directory (locate-library "vm")))
1323             file)
1324         (setq vmdir (expand-file-name "../src/" vmdir)
1325               file (expand-file-name name vmdir))
1326         (if (file-exists-p file)
1327             file
1328 ;         (message "VM could not find executable %S!" name)
1329           nil))))
1330
1331 (defcustom vm-imagemagick-convert-program (vm-locate-executable-file "convert")
1332   "*Name of ImageMagick 'convert' program.
1333 VM uses this program to convert between image formats and to slice up
1334 images for display.  Set this to nil and VM will not use the
1335 'convert' program."
1336   :group 'vm
1337   :type '(choice string (const nil)))
1338
1339 (defcustom vm-imagemagick-identify-program
1340   (vm-locate-executable-file "identify")
1341   "*Name of ImageMagick 'identify' program.
1342 VM uses this program to gather information about images.  Set this to nil
1343 and VM will not use the 'convert' program."
1344   :group 'vm
1345   :type '(choice string (const nil)))
1346
1347 (defvar vm-mime-image-type-converter-alist
1348   (if (stringp vm-imagemagick-convert-program)
1349       (let ((x vm-imagemagick-convert-program))
1350         (list
1351          (list "image" "image/png" (format "%s - png:-" x))
1352          (list "image" "image/jpeg" (format "%s - jpeg:-" x))
1353          (list "image" "image/gif" (format "%s - gif:-" x))
1354          (list "image" "image/tiff" (format "%s - tiff:-" x))
1355          (list "image" "image/xpm" (format "%s - xpm:-" x))
1356          (list "image" "image/pbm" (format "%s - pbm:-" x))
1357          (list "image" "image/xbm" (format "%s - xbm:-" x))
1358         ))))
1359
1360 (defcustom vm-mime-delete-after-saving nil
1361   "*Non-nil value causes VM to delete MIME body contents from a folder
1362 after the MIME object has been saved to disk.  The MIME object is replaced
1363 with a message/external-body object that points to the disk copy of the
1364 object."
1365   :group 'vm
1366   :type 'boolean)
1367
1368 (defcustom vm-mime-confirm-delete t
1369   "*Non-nil value causes VM to request confirmation from the user before
1370 deleting a MIME object with `vm-delete-mime-object'."
1371   :group 'vm
1372   :type 'boolean)
1373
1374 (defcustom vm-mime-button-face 'gui-button-face
1375   "*Face used for text in buttons that trigger the display of MIME objects."
1376   :group 'vm-faces
1377   :type 'boolean)
1378
1379 (defcustom vm-mime-button-format-alist
1380   '(("text" . "%-35.35(%d, %c%) [%k to %a]")
1381     ("multipart/alternative" . "%-35.35(%d%) [%k to %a]")
1382     ("multipart/digest" . "%-35.35(%d, %n message%s%) [%k to %a]")
1383     ("multipart" . "%-35.35(%d, %n part%s%) [%k to %a]")
1384     ("message/partial" . "%-35.35(%d, part %N (of %T)%) [%k to %a]")
1385     ("message/external-body" . "%-35.35(%d%) [%k to %a (%x)]")
1386     ("message" . "%-35.35(%d%) [%k to %a]")
1387     ("audio" . "%-35.35(%d%) [%k to %a]")
1388     ("video" . "%-35.35(%d%) [%k to %a]")
1389     ("image" . "%-35.35(%d%) [%k to %a]")
1390     ("application/octet-stream" . "%-35.35(%d, %f%) [%k to %a]"))
1391   "*List of types and formats for MIME buttons.
1392 When VM does not display a MIME object immediately, it displays a
1393 button or tag line in its place that describes the object and what you
1394 have to do to display it.  The value of `vm-mime-button-format-alist'
1395 determines the format of the text in those buttons.
1396
1397 The format of the list is
1398
1399   ((TYPE . FORMAT) (TYPE . FORMAT) ...)
1400
1401 The list is searched sequentially and the FORMAT corresponding to
1402 the first TYPE that matches the type of the button's object is
1403 used.
1404
1405 TYPE should be a string specifying a top level type or a type/subtype
1406 pair.  If a top-level type is listed without a subtype, all subtypes
1407 of that type are assumed to be included.
1408
1409 FORMAT should be a string specifying the text of the button.  The
1410 string should not include a newline.  The string may contain the
1411 printf-like `%' conversion specifiers which substitute information
1412 about the MIME object into the button.
1413
1414 Recognized specifiers are:
1415    a - the default action of the button.  E.g. \"display image\" for images,
1416        \"display text\" for text objects and so on.
1417    c - the character set of the object.  Usually only specified
1418        for text objects.  Displays as \"us-ascii\" if the MIME object
1419        does not specifiy a character set.
1420    d - the content description of the object taken from the
1421        Content-Description header, if present.  If the header
1422        isn't present, a generic description is provided.
1423    e - the content transfer encoding, either \"base64\" or
1424        \"quoted-printable\".
1425    f - the suggested file name to save the object into, as
1426        specified either in the Content-Disposition header, or the
1427        \"name\" parameter for objects of type \"application\".
1428    k - how to activate the button.  Usually \"Press RETURN\" or
1429        \"Click mouse-2\".
1430    n - for multipart types this is the number of bundled parts,
1431        messages, whatever.
1432    N - for message/partial objects, the part number.
1433    s - an empty string if %n would display \"1\", otherwise
1434        \"s\".
1435    t - the content type of the object, e.g. \"text/enriched\".
1436    T - for message/partial objects, the total number of expected
1437        parts.  \"?\" is displayed if the object doesn't specify
1438        the total number of parts expected.
1439    x - the content type of the external body of a message/external-body
1440        object.
1441    ( - starts a group, terminated by %).  Useful for specifying
1442        the field width and precision for the concatentation of
1443        group of format specifiers.  Example: \"%.25(%d, %t, %f%)\"
1444        specifies a maximum display width of 25 characters for the
1445        concatenation of the content description, content type and
1446        suggested file name.
1447    ) - ends a group.
1448
1449 Use %% to get a single %.
1450
1451 A numeric field width may be given between the `%' and the specifier;
1452 this causes right justification of the substituted string.  A negative field
1453 width causes left justification.
1454
1455 The field width may be followed by a `.' and a number specifying
1456 the maximum allowed length of the substituted string.  If the
1457 string is longer than this value the right end of the string is
1458 truncated.  If the value is negative, the string is truncated on
1459 the left instead of the right."
1460   :group 'vm
1461   :type '(repeat (cons string string)))
1462
1463 (defcustom vm-mime-7bit-composition-charset "us-ascii"
1464   "*Character set that VM should assume if it finds no character codes > 128
1465 in a composition buffer.  Composition buffers are assumed to use
1466 this character set unless the buffer contains a byte with the high bit set.
1467 This variable specifies what character set VM should assume if
1468 no such a character is found.
1469
1470 This variable is unused in XEmacs/MULE.  Since multiple character
1471 sets can be displayed in a single buffer under MULE, VM will map
1472 the file coding system of the composition buffer to a single MIME
1473 character set that can display all the buffer's characters."
1474   :group 'vm
1475   :type 'string)
1476
1477 (defcustom vm-mime-8bit-composition-charset nil
1478   "*Character set that VM should assume if it finds non-US-ASCII characters
1479 in a composition buffer.  Composition buffers are assumed to use
1480 US-ASCII unless the buffer contains a byte with the high bit set.
1481 This variable specifies what character set VM should assume if
1482 such a character is found.
1483
1484 This variable is unused in XEmacs/MULE and FSF Emacs starting
1485 with version 20.  Since multiple character sets can be displayed
1486 in a single buffer under MULE, VM will map the file coding system
1487 of the buffer to a single MIME character set that can display all
1488 the buffer's characters."
1489   :group 'vm
1490   :type '(choice (string :tag "iso-8859-1" "iso-8859-1")
1491                  (string :tag "iso-2022-jp" "iso-2022-jp")
1492                  (string :tag "User defined")
1493                  (const  :tag "Auto select" nil)))
1494
1495 (defcustom vm-mime-8bit-text-transfer-encoding 'quoted-printable
1496   "*Symbol specifying what kind of transfer encoding to use on 8bit
1497 text.  Characters with the high bit set cannot safely pass
1498 through all mail gateways and mail transport software.  MIME has
1499 two transfer encodings that convert 8-bit data to 7-bit for safe
1500 transport. Quoted-printable leaves the text mostly readable even
1501 if the recipient does not have a MIME-capable mail reader.  BASE64
1502 is unreadable without a MIME-capable mail reader, unless your name
1503 is U3BvY2s=.
1504
1505 A value of 'quoted-printable, means to use quoted-printable encoding.
1506 A value of 'base64 means to use BASE64 encoding.
1507 A value of '8bit means to send the message as is.
1508
1509 Note that this variable usually only applies to textual MIME
1510 content types.  Images, audio, video, etc. typically will have
1511 some attribute that makes VM consider them to be \"binary\",
1512 which moves them outside the scope of this variable.  For
1513 example, messages with line lengths of 1000 characters or more
1514 are considered binary, as are messages that contain carriage
1515 returns (ascii code 13) or NULs (ascii code 0)."
1516   :group 'vm
1517   :type '(choice (const quoted-printable) (const base64) (const 8bit)))
1518
1519 (defcustom vm-mime-composition-armor-from-lines nil
1520   "*Non-nil value means \"From \" lines should be armored before sending.
1521 A line beginning with \"From \" is considered a message separator
1522 by many mail delivery agents.  These agents will often insert a >
1523 before the word \"From\" to prevent mail readers from being
1524 confused.  This is proper behavior, but it breaks digitally signed
1525 messages, which require bit-perfect transport in order for the
1526 message contents to be considered genuine.
1527
1528 If `vm-mime-composition-armor-from-lines' is non-nil, a line
1529 beginning with \"From \" will cause VM to encode the message
1530 using either quoted-printable or BASE64 encoding so that the From
1531 line can be protected."
1532   :group 'vm
1533   :type 'boolean)
1534
1535 (defcustom vm-mime-attachment-auto-type-alist
1536   '(
1537     ("\\.jpe?g$"        .       "image/jpeg")
1538     ("\\.gif$"          .       "image/gif")
1539     ("\\.png$"          .       "image/png")
1540     ("\\.tiff?$"        .       "image/tiff")
1541     ("\\.html?$"        .       "text/html")
1542     ("\\.au$"           .       "audio/basic")
1543     ("\\.mpe?g$"        .       "video/mpeg")
1544     ("\\.mov$"          .       "video/quicktime")
1545     ("\\.zip$"          .       "application/zip")
1546     ("\\.e?ps$"         .       "application/postscript")
1547     ("\\.pdf$"          .       "application/pdf")
1548     ("\\.doc$"          .       "application/msword")
1549     ("\\.xls$"          .       "application/vnd.ms-excel")
1550     ("\\.ppt$"          .       "application/vnd.ms-powerpoint")
1551     ("\\.hqx$"          .       "application/mac-binhex40")
1552    )
1553   "*Alist used to guess a MIME content type based on a file name.
1554 The list format is
1555
1556   ((REGEXP . TYPE) ...)
1557
1558 REGEXP is a string that specifies a regular expression.
1559 TYPE is a string specifying a MIME content type.
1560
1561 When a file is attached to a MIME composition buffer using
1562 `vm-mime-attach-file', this list will be scanned until a REGEXP
1563 matches the file's name.  The corresponding TYPE will be
1564 offered as a default when you are prompted for the file's
1565 type.
1566
1567 The value of this variable is also used to guess the MIME type of
1568 application/octet-stream objects for display purposes if the
1569 value of `vm-infer-mime-types' is non-nil."
1570   :group 'vm
1571   :type '(repeat (cons regexp string)))
1572
1573 (defcustom vm-mime-attachment-auto-suffix-alist
1574   '(
1575     ("image/jpeg"               .       ".jpg")
1576     ("image/gif"                .       ".gif")
1577     ("image/png"                .       ".png")
1578     ("image/tiff"               .       ".tif")
1579     ("text/html"                .       ".html")
1580     ("audio/basic"              .       ".au")
1581     ("video/mpeg"               .       ".mpg")
1582     ("video/quicktime"          .       ".mov")
1583     ("application/zip"          .       ".zip")
1584     ("application/postscript"   .       ".ps")
1585     ("application/pdf"          .       ".pdf")
1586     ("application/msword"       .       ".doc")
1587     ("application/vnd.ms-excel" .       ".xls")
1588     ("application/vnd.ms-powerpoint" .  ".ppt")
1589     ("application/mac-binhex40" .       ".hqx")
1590    )
1591   "*Alist used to select a filename suffix for MIME object temporary files.
1592 The list format is
1593
1594   ((TYPE . SUFFIX) ...)
1595
1596 TYPE is a string specifying a MIME top-level type or a type/subtype pair.
1597 If a top-level type is listed without a subtype, all subtypes of
1598 that type are matched.
1599
1600 SUFFIX is a string specifying the suffix that should be used for
1601 the accompanying type.
1602
1603 When a MIME object is displayed using an external viewer VM must
1604 first write the object to a temporary file.  The external viewer
1605 opens and displays that file.  Some viewers will not open a file
1606 unless the filename ends with some extention that it recognizes
1607 such as '.html' or '.jpg'.  You can use this variable to map MIME
1608 types to extensions that your external viewers will recognize.  VM
1609 will search the list for a matching type.  The suffix associated
1610 with the first type that matches will be used."
1611   :group 'vm
1612   :type '(repeat (cons string string)))
1613
1614 (defcustom vm-mime-encode-headers-regexp
1615   "Subject\\|\\(\\(Resent-\\)?\\(From\\|To\\|CC\\|BCC\\)\\)\\|Organization"
1616   "*A regexp matching the headers which should be encoded."
1617   :group 'vm
1618   :type '(regexp))
1619
1620 (defcustom vm-mime-encode-headers-words-regexp
1621   (let ((8bit-word "\\([^ \t\n\r]*[^\x0-\x7f]+[^ \t\n\r]*\\)+"))
1622     (concat "\\s-\\(" 8bit-word "\\(\\s-+" 8bit-word "\\)*\\)"))
1623   "*A regexp matching a set of consecutive words which must be encoded."
1624   :group 'vm
1625   :type '(regexp))
1626
1627 (defcustom vm-mime-encode-headers-type 'B
1628   "*The encoding type to use for encoding headers."
1629   :group 'vm
1630   :type '(choice (const :tag "QP" 'Q)
1631                  (const :tag "BASE64" 'B)
1632                  (regexp :tag "BASE64 on match of " "[^- !#-'*+/-9=?A-Z^-~]")))
1633
1634
1635 (defcustom vm-mime-encode-words-regexp "[^\x0-\x7f]+"
1636   "*A regexp matching a sequence of 8 bit chars."
1637   :group 'vm
1638   :type '(regexp))
1639
1640 (defcustom vm-mime-max-message-size nil
1641   "*Largest MIME message that VM should send without fragmentation.
1642 The value should be an integer which specifies the size in bytes.
1643 A message larger than this value will be split into multiple parts
1644 for transmission using the MIME message/partial type."
1645   :group 'vm
1646   :type '(choice (const nil) integer))
1647
1648 (defcustom vm-mime-attachment-save-directory (expand-file-name "~/")
1649   "*Non-nil value is a default directory for saving MIME attachments.
1650 When VM prompts you for a target file name when saving a MIME body,
1651 any relative pathnames will be relative to this directory."
1652   :group 'vm
1653   :type '(choice (const nil) directory))
1654
1655 (defcustom vm-mime-attachment-source-directory (expand-file-name "~/")
1656   "*Non-nil value is a default source directory for MIME attachments.
1657 When `vm-mime-attach-file' prompts you for the name of a file to
1658 attach, any relative pathnames will be relative to this directory."
1659   :group 'vm
1660   :type '(choice (const nil) directory))
1661
1662 (defcustom vm-infer-mime-types nil
1663   "*Non-nil value means that VM should try to infer a MIME object's
1664 type from its filename when deciding whether the object should be
1665 displayed and how it should be displayed.  This will be done only
1666 for objects of type application/octet-stream.  The object's filename
1667 is checked against the regexps in `vm-mime-attachment-auto-type-alist'
1668 and the type corresponding to the first match found is used."
1669   :group 'vm
1670   :type 'boolean)
1671
1672 (defcustom vm-mime-attachment-infer-type-for-text-attachments nil
1673   "*Non-nil value means VM should try to infer a MIME object's
1674   type from its filename also for text attachments, not only for
1675   application/octet-stream."
1676    :group 'vm
1677   :type 'boolean)
1678
1679 (defcustom vm-mime-avoid-folding-content-type t
1680   "*Non-nil means don't send folded Content- headers in MIME messages.
1681 `Folded' headers are headers broken into multiple lines as specified
1682 in RFC822 for readability and to avoid excessive line lengths.  At
1683 least one major UNIX vendor ships a version of sendmail that believes
1684 a folded Content-Type header is a syntax error, and returns any such
1685 message to sender.  A typical error message from such a sendmail
1686 version is,
1687
1688 553 header syntax error, line \" charset=us-ascii\"
1689
1690 If you see one of these, setting `vm-mime-avoid-folding-content-type'
1691 non-nil may let your mail get through."
1692   :group 'vm
1693   :type 'boolean)
1694
1695 (defcustom vm-mime-base64-decoder-program
1696   (vm-locate-executable-file "base64-decode")
1697   "*Non-nil value should be a string that names a MIME base64 decoder.
1698 If the program is in your executable search path, you need not
1699 specify a full pathname.  The program should expect to read
1700 base64 data on its standard input and write the converted data
1701 to its standard output."
1702   :group 'vm
1703   :type '(choice string (const nil)))
1704
1705 (defcustom vm-mime-base64-decoder-switches nil
1706   "*List of command line flags passed to the command named by
1707 `vm-mime-base64-decoder-program'."
1708   :group 'vm
1709   :type '(repeat string))
1710
1711 (defcustom vm-mime-base64-encoder-program
1712   (vm-locate-executable-file "base64-encode")
1713   "*Non-nil value should be a string that names a MIME base64 encoder.
1714 If the program is in your executable search path, you need not
1715 specify a full pathname.  The program should expect arbitrary
1716 data on its standard input and write base64 data to its standard
1717 output."
1718   :group 'vm
1719   :type '(choice string (const nil)))
1720
1721 (defcustom vm-mime-base64-encoder-switches nil
1722   "*List of command line flags passed to the command named by
1723 `vm-mime-base64-encoder-program'."
1724   :group 'vm
1725   :type '(repeat string))
1726
1727 (defcustom vm-mime-qp-decoder-program (vm-locate-executable-file "qp-decode")
1728   "*Non-nil value should be a string that names a MIME quoted-printable
1729 decoder.  If the program is in your executable search path, you
1730 need not specify a full pathname.  The program should expect to
1731 read quoted-printable data on its standard input and write the
1732 converted data to its standard output."
1733   :group 'vm
1734   :type '(choice string (const nil)))
1735
1736 (defcustom vm-mime-qp-decoder-switches nil
1737   "*List of command line flags passed to the command named by
1738 `vm-mime-qp-decoder-program'."
1739   :group 'vm
1740   :type '(repeat string))
1741
1742 (defcustom vm-mime-qp-encoder-program (vm-locate-executable-file "qp-encode")
1743   "*Non-nil value should be a string that names a MIME quoted-printable
1744 encoder.  If the program is in your executable search path, you
1745 need not specify a full pathname.  The program should expect
1746 arbitrary data on its standard input and write quoted-printable
1747 data to its standard output."
1748   :group 'vm
1749   :type '(choice string (const nil)))
1750
1751 (defcustom vm-mime-qp-encoder-switches nil
1752   "*List of command line flags passed to the command named by
1753 `vm-mime-qp-encoder-program'."
1754   :group 'vm
1755   :type '(repeat string))
1756
1757 (defcustom vm-mime-uuencode-decoder-program "uudecode"
1758   "*Non-nil value should be a string that names UUENCODE decoder.
1759 If the program is in your executable search path, you need not
1760 specify a full pathname.  The program should expect to read
1761 uuencoded data on its standard input and write the converted
1762 data to the file specified in the ``begin'' line at the start of
1763 the data."
1764   :group 'vm
1765   :type '(choice string (const nil)))
1766
1767 (defcustom vm-mime-uuencode-decoder-switches nil
1768   "*List of command line flags passed to the command named by
1769 `vm-mime-uuencode-decoder-program'."
1770   :group 'vm
1771   :type '(repeat string))
1772
1773 (defcustom vm-auto-next-message t
1774   "*Non-nil value causes VM to use `vm-next-message' to advance to the next
1775 message in the folder if the user attempts to scroll past the end of the
1776 current messages.  A nil value disables this behavior."
1777   :group 'vm
1778   :type 'boolean)
1779
1780 (defcustom vm-honor-page-delimiters nil
1781   "*Non-nil value causes VM to honor page delimiters (as specified by the
1782 Emacs page-delimiter variable) when scrolling through a message.
1783 This means that when VM encounters a page delimiter when displaying a
1784 message all the screen lines below that delimiter will be blank until
1785 you scroll past that delimiter.  When you scroll past the delimiter
1786 the text lines between the delimiter and the next delimiter will be
1787 displayed.  Scrolling backward past a page delimiter reverses this
1788 process.
1789
1790 A nil value means ignore page-delimiters."
1791   :group 'vm
1792   :type 'boolean)
1793
1794 (defcustom vm-page-continuation-glyph "...press SPACE to see more..."
1795   "*Glyph VM uses to indicate there is more text on the next page.
1796 When VM honors page delimiters (see `vm-honor-page-delimiters')
1797 and when VM is previewing a message (see `vm-preview-lines') VM
1798 indicates that there is more text by placing the glyph specified
1799 by this variable at the end of the displayed text.
1800
1801 Under XEmacs, the value of `vm-page-continuation-glyph' can be a
1802 string or a glyph object.
1803
1804 Under FSF Emacs, `vm-page-continuation-glyph' must be a string."
1805   :group 'vm
1806   :type 'boolean)
1807
1808 (defvar vm-default-window-configuration
1809   ;; startup = folder on bottom, summary on top
1810   ;; quitting = full screen folder
1811   ;; reading-message = folder on bottom, summary on top
1812   ;; composing-message = full screen composition
1813   ;; editing-message = full screen edit
1814   ;; vm-summarize = folder on bottom, summary on top
1815   ;; vm-pipe-message-to-command = summary on top, shell output on bottom
1816   '(
1817     (startup
1818      ((((top . 70) (left . 70)))
1819       (((- (0 0 80 10) (0 10 80 40))
1820         ((nil summary) (nil message))
1821         ((nil nil nil t) (nil nil nil nil))))))
1822     (quitting
1823      ((((top . 70) (left . 70)))
1824       (((0 0 80 40)
1825         ((nil message))
1826         ((nil nil nil t))))))
1827     (reading-message
1828      ((((top . 70) (left . 70)))
1829       (((- (0 0 80 10) (0 10 80 40))
1830         ((nil summary) (nil message))
1831         ((nil nil nil t) (nil nil nil nil))))))
1832     (composing-message
1833      ((((top . 70) (left . 70)))
1834       (((0 0 80 40)
1835         ((nil composition))
1836         ((nil nil nil t))))))
1837     (editing-message
1838      ((((top . 70) (left . 70)))
1839       (((0 0 80 40)
1840         ((nil edit))
1841         ((nil nil nil t))))))
1842     (vm-summarize
1843      ((((top . 70) (left . 70)))
1844       (((- (0 0 80 10) (0 10 80 40))
1845         ((nil summary) (nil message))
1846         ((nil nil nil t) (nil nil nil nil))))))
1847     (vm-folders-summarize
1848      ((((top . 70) (left . 70)))
1849       (((- (0 0 80 10) (0 10 80 40))
1850         ((nil folders-summary) (nil message))
1851         ((nil nil nil t) (nil nil nil nil))))))
1852    )
1853   "Default window configuration for VM if the user does not specify one.
1854 If you want to completely turn off VM's window configuration
1855 feature, set this variable and `vm-window-configuration-file' to
1856 nil in your .vm file.
1857
1858 If you want to have a different window configuration setup than
1859 this, you should not set this variable directly.  Rather you
1860 should set the variable `vm-window-configuration-file' to point at
1861 a file, and use the command `vm-save-window-configuration'
1862 (normally bound to `WS') to modify part of this configuration to
1863 your liking.
1864
1865 WARNING: Don't point `vm-window-configuration-file' at your .vm or
1866 .emacs file.  Your window configuration file should start out as
1867 an empty or nonexistent file.  VM will repeatedly overwrite this
1868 file as you update your window configuration settings, so
1869 anything else you put into this file will go away.")
1870
1871 (defcustom vm-window-configuration-file "~/.vm.windows"
1872   "*Non-nil value should be a string that tells VM where to load
1873 and save your window configuration settings.  Your window
1874 configuration settings are loaded automatically the first time
1875 you run VM in an Emacs session, and tells VM how to set up
1876 windows depending on what you are doing inside VM.
1877
1878 The commands `vm-save-window-configuration' (normally bound to `WS') and
1879 `vm-delete-window-configuration' (bound to `WD') let you update this
1880 information; see their documentation for more information.
1881
1882 You cannot change your window configuration setup without giving
1883 `vm-window-configuration-file' a non-nil value.  A nil value causes
1884 VM to use the default window setup specified by the value of
1885 `vm-default-window-configuration'.
1886
1887 WARNING: Don't point `vm-window-configuration-file' at your .vm or
1888 .emacs file.  Your window configuration file should start out as
1889 an empty or nonexistent file.  VM will repeatedly overwrite this
1890 file as you update your window configuration settings, so
1891 anything else you put into this file will go away."
1892   :group 'vm
1893   :type 'file)
1894
1895 (defcustom vm-confirm-quit 0
1896   "*Value of t causes VM to always ask for confirmation before quitting
1897 a VM visit of a folder.  A nil value means VM will ask only when messages
1898 will be lost unwittingly by quitting, i.e. not removed by intentional
1899 delete and expunge.  A value that is not nil and not t causes VM to ask
1900 only when there are unsaved changes to message attributes, or when messages
1901 will be unwittingly lost."
1902   :group 'vm
1903   :type '(choice (const t) (const nil) (const if-something-will-be-lost)))
1904
1905 (defcustom vm-confirm-new-folders nil
1906   "*Non-nil value causes interactive calls to `vm-save-message'
1907 to ask for confirmation before creating a new folder."
1908   :group 'vm
1909   :type 'boolean)
1910
1911 (defcustom vm-delete-empty-folders t
1912   "*Non-nil value means remove empty (zero length) folders after saving.
1913 A value of t means always remove the folders.
1914 A value of nil means never remove empty folders.
1915 A value that's not t or nil means ask before removing empty folders."
1916   :group 'vm
1917   :type '(choice (const nil) (const t) (const ask)))
1918
1919 (defcustom vm-folder-file-precious-flag t
1920   "*Value that `file-precious-flag' should have in visited folders.
1921 A non-nil value causes folders to be saved by writing to a
1922 temporary file and then replacing the folder with that file.  A
1923 nil value causes folders to be saved by writing directly to the
1924 folder without the use of a temporary file."
1925   :group 'vm
1926   :type 'boolean)
1927
1928 (defcustom vm-flush-interval 90
1929   "*Non-nil value specifies how often VM flushes its cached internal
1930 data.  A numeric value gives the number of seconds between
1931 flushes.  A value of t means flush every time there is a change.
1932 Nil means don't do flushing until a message or folder is saved.
1933
1934 Normally when a message attribute is changed. VM keeps the record
1935 of the change in its internal memory and doesn't insert the
1936 changed data into the folder buffer until a particular message or
1937 the whole folder is saved to disk.  This makes normal Emacs
1938 auto-saving useless for VM folder buffers because the information
1939 you'd want to auto-save, i.e. the attribute changes are not in
1940 the buffer when it is auto-saved.
1941
1942 Setting `vm-flush-interval' to a numeric value will cause the VM's
1943 internal memory caches to be periodically flushed to the folder
1944 buffer.  This is done non-obtrusively, so that if you type
1945 something while flushing is occurring, the flush will abort
1946 cleanly and Emacs will respond to your keystrokes as usual."
1947   :group 'vm
1948   :type '(choice boolean integer))
1949
1950 (defcustom vm-visit-when-saving 0
1951   "*Value determines whether VM will visit folders when saving messages.
1952 `Visiting' means that VM will read the folder into Emacs and append the
1953 message to the buffer instead of appending to the folder file directly.
1954 This behavior is ideal when folders are encrypted or compressed since
1955 appending plaintext directly to such folders is a ghastly mistake.
1956
1957 A value of t means VM will always visit folders when saving.
1958
1959 A nil value means VM will never visit folders before saving to them, and
1960 VM will generate an error if you attempt to save messages to a folder
1961 that is being visited.  The latter restriction is necessary to insure
1962 that the buffer and disk copies of the folder being visited remain
1963 consistent.
1964
1965 A value that is not nil and not t means VM will save to a folder's
1966 buffer if that folder is being visited, otherwise VM saves to the folder
1967 file itself."
1968   :group 'vm
1969   :type '(choice boolean (const if-already-visited)))
1970
1971 (defcustom vm-auto-folder-alist nil
1972   "*Non-nil value should be an alist that VM will use to choose a default
1973 folder name when messages are saved.  The alist should be of the form
1974 \((HEADER-NAME-REGEXP
1975    (REGEXP . FOLDER-NAME) ... )
1976   ...)
1977 where HEADER-NAME-REGEXP and REGEXP are strings, and FOLDER-NAME
1978 is a string or an s-expression that evaluates to a string.
1979
1980 If any part of the contents of the first message header whose name
1981 is matched by HEADER-NAME-REGEXP is matched by the regular
1982 expression REGEXP, VM will evaluate the corresponding FOLDER-NAME
1983 and use the result as the default when prompting for a folder to
1984 save the message in.  If the resulting folder name is a relative
1985 pathname, then it will be rooted in the directory named by
1986 `vm-folder-directory', or the default-directory of the currently
1987 visited folder if `vm-folder-directory' is nil.
1988
1989 When FOLDER-NAME is evaluated, the current buffer will contain
1990 only the contents of the header matched by HEADER-NAME-REGEXP.
1991 It is safe to modify this buffer.  You can use the match data
1992 from any \\( ... \\) grouping constructs in REGEXP along with the
1993 function buffer-substring to build a folder name based on the
1994 header information.  If the result of evaluating FOLDER-NAME is a
1995 list, then the list will be treated as another auto-folder-alist
1996 and will be descended recursively.
1997
1998 Whether REGEXP is matched case sensitively depends on the value
1999 of the variable `vm-auto-folder-case-fold-search'.  Header names
2000 are always matched case insensitively."
2001   :group 'vm
2002   :type '(repeat (cons regexp (repeat (cons regexp sexp)))))
2003
2004 (defcustom vm-auto-folder-case-fold-search nil
2005   "*Non-nil value means VM will ignore case when matching header
2006 contents while doing automatic folder selection via the variable
2007 `vm-auto-folder-alist'."
2008   :group 'vm
2009   :type 'boolean)
2010
2011 (defcustom vm-virtual-folder-alist nil
2012   "*Non-nil value should be a list of virtual folder definitions.
2013
2014 A virtual folder is a mapping of messages from one or more real folders
2015 into what appears to be a single folder.  A virtual folder definition
2016 specifies which real folders should be searched for prospective messages
2017 and what the inclusion criteria are.
2018
2019 Each virtual folder definition should have the following form:
2020
2021   (VIRTUAL-FOLDER-NAME
2022     ( (FOLDER-NAME ...)
2023       (SELECTOR [ARG ...]) ... )
2024     ... )
2025
2026 VIRTUAL-FOLDER-NAME is the name of the virtual folder being defined.
2027 This is the name by which you and VM will refer to this folder.
2028
2029 FOLDER-NAME should be the name of a real folder.  There may be more than
2030 one FOLDER-NAME listed, the SELECTORs within that sublist will apply to
2031 them all.  If FOLDER-NAME is a directory, VM will assume this to mean that
2032 all the folders in that directory should be searched.
2033
2034 The SELECTOR is a Lisp symbol that tells VM how to decide whether a message
2035 from one of the folders specified by the FOLDER-NAMEs should be included
2036 in the virtual folder.  Some SELECTORs require an argument ARG; unless
2037 otherwise noted ARG may be omitted.
2038
2039 The recognized SELECTORs are:
2040
2041    author          - matches message if ARG matches the author; ARG should be a
2042                      regular expression.
2043    author-or-recipient
2044                    - matches message if ARG matches the author of
2045                      the message or any of its recipients; ARG
2046                      should be a regular expression.
2047    and             - matches the message if all its argument
2048                      selectors match the message.  Example:
2049                         (and (author \"Derek McGinty\") (new))
2050                      matches all new messages from Derek McGinty.
2051                      `and' takes any number of arguments.
2052    any             - matches any message.
2053    deleted         - matches message if it is flagged for deletion.
2054    edited          - matches message if it has been edited.
2055    filed           - matches message if it has been saved with its headers.
2056    forwarded       - matches message if it has been forwarded using
2057                      a variant of `vm-forward-message' or `vm-send-digest'.
2058    header          - matches message if ARG matches any part of the header
2059                      portion of the message; ARG should be a
2060                      regular expression.
2061    header-or-text  - matches message if ARG matches any part of the
2062                      headers or the text portion of the message;
2063                      ARG should be a regular expression.
2064    label           - matches message if message has a label named ARG.
2065    less-chars-than - matches message if message has less than ARG
2066                      characters.  ARG should be a number.
2067    less-lines-than - matches message if message has less than ARG
2068                      lines.  ARG should be a number.
2069    more-chars-than - matches message if message has more than ARG
2070                      characters.  ARG should be a number.
2071    more-lines-than - matches message if message has more than ARG
2072                      lines.  ARG should be a number.
2073    marked          - matches message if it is marked, as with `vm-mark-message'.
2074    new             - matches message if it is new.
2075    not             - matches message only if its selector argument
2076                      does NOT match the message.  Example:
2077                        (not (deleted))
2078                      matches messages that are not deleted.
2079    or              - matches the message if any of its argument
2080                      selectors match the message.  Example:
2081                         (or (author \"Dave Weckl\") (subject \"drum\"))
2082                      matches messages from Dave Weckl or messages
2083                      with the word \"drum\" in their Subject header.
2084                      `or' takes any number of arguments.
2085    read            - matches message if it is neither new nor unread.
2086    recent          - matches message if it is new.
2087    recipient       - matches message if ARG matches any part of the recipient
2088                      list of the message.  ARG should be a regular expression.
2089    redistributed   - matches message if it has been redistributed using
2090                      `vm-resend-message'.
2091    replied         - matches message if it has been replied to.
2092    sent-after      - matches message if it was sent after the date ARG.
2093                      A fully specified date looks like this:
2094                        \"31 Dec 1999 23:59:59 GMT\"
2095                      although the parts can appear in any order.
2096                      You can leave out any part and it will
2097                      default to the current date's value for that
2098                      part, with the exception of the hh:mm:ss
2099                      part which defaults to midnight.
2100    sent-before     - matches message if it was sent before the date ARG.
2101                      A fully specified date looks like this:
2102                        \"31 Dec 1999 23:59:59 GMT\"
2103                      although the parts can appear in any order.
2104                      You can leave out any part and it will
2105                      default to the current date's value for that
2106                      part, with the exception of the hh:mm:ss
2107                      part which defaults to midnight.
2108    subject         - matches message if ARG matches any part of the message's
2109                      subject; ARG should be a regular expression.
2110    text            - matches message if ARG matches any part of the text
2111                      portion of the message; ARG should be a
2112                      regular expression.
2113    unanswered      - matches message if it has not been replied to.
2114                      Same as the `unreplied' selector.
2115    undeleted       - matches message if it has not been deleted.
2116    unedited        - matches message if it has not been edited.
2117    unfiled         - matches message if it has not been saved with its
2118                      headers.
2119    unforwarded     - matches message if it has not been forwarded using
2120                      `vm-forward-message' or `vm-send-digest' or one
2121                      of their variants.
2122    unread          - matches message if it is not new and hasn't been read.
2123    unseen          - matches message if it is not new and hasn't been read.
2124                      Same as `unread' selector.
2125    unredistributed - matches message if it has not been redistributed using
2126                      `vm-resend-message'.
2127    unreplied       - matches message if it has not been replied to.
2128    virtual-folder-member
2129                    - matches message if the message is already a
2130                      member of some virtual folder currently
2131                      being visited.
2132    written         - matches message if it has been saved without its headers.
2133 "
2134   :group 'vm
2135   :type 'sexp)
2136
2137 (defcustom vm-virtual-mirror t
2138   "*Non-nil value causes the attributes of messages in virtual folders
2139 to mirror the changes in the attributes of the underlying real messages.
2140 Similarly, changes in the attributes of virtual messages will change the
2141 attributes of the underlying real messages.  A nil value causes virtual
2142 messages to have their own distinct set of attributes, apart from the
2143 underlying real message.
2144
2145 This variable automatically becomes buffer-local when set in any
2146 fashion.  You should set this variable only in your .vm or .emacs
2147 file.  Use setq-default.  Once VM has been started, you should not
2148 set this variable directly, rather you should use the command
2149 `vm-toggle-virtual-mirror', normally bound to `V M'."
2150   :group 'vm
2151   :type 'boolean)
2152 (make-variable-buffer-local 'vm-virtual-mirror)
2153
2154 (defcustom vm-folder-read-only nil
2155   "*Non-nil value causes a folder to be considered unmodifiable by VM.
2156 Commands that modify message attributes or messages themselves are disallowed.
2157 Commands that add or remove messages from the folder are disallowed.
2158 Commands that scan or allow the reading of messages are allowed but the
2159 `new' and `unread' message flags are not changed by them.
2160
2161 This variable automatically becomes buffer-local when set in any
2162 fashion.  You should set this variable only in your .vm or .emacs
2163 file.  Use setq-default.  Once VM has been started, you should not
2164 set this variable directly, rather you should use the command
2165 `vm-toggle-read-only', normally bound to C-x C-q."
2166   :group 'vm
2167   :type 'boolean)
2168 (make-variable-buffer-local 'vm-folder-read-only)
2169
2170 (defcustom vm-included-text-prefix " > "
2171   "*String used to prefix included text in replies."
2172   :group 'vm
2173   :type 'string)
2174
2175 (defcustom vm-keep-sent-messages 1
2176   "*Non-nil value N causes VM to keep the last N messages sent from within VM.
2177 `Keep' means that VM will not kill the composition buffer after
2178 you send a message with C-c C-c (`vm-mail-send-and-exit').  A
2179 value of 0 or nil causes VM never to keep such buffers.  A value
2180 of t causes VM never to kill such buffers.
2181
2182 Note that these buffers will vanish once you exit Emacs.  To keep a permanent
2183 record of your outgoing mail, use the `mail-archive-file-name' variable."
2184   :group 'vm
2185   :type '(choice boolean integer))
2186
2187 (defcustom vm-confirm-mail-send nil
2188   "*Non-nil means ask before sending a mail message.
2189 This affects `vm-mail-send' and `vm-mail-send-and-exit' in Mail mode."
2190   :group 'vm
2191   :type 'boolean)
2192
2193 (defcustom vm-mail-header-from nil
2194   "*Non-nil value should be a string that will be appear as the body
2195 of the From header in outbound mail messages.  A nil value means don't
2196 insert a From header.  This variable also controls the inclusion and
2197 format of the Resent-From header, when resending a message with
2198 `vm-resend-message'."
2199   :group 'vm
2200   :type '(choice (const nil) string))
2201
2202 (defcustom vm-mail-header-insert-date t
2203   "*Non-nil value causes VM to insert a Date header into a message
2204 when it is sent.  If the message has a Date header, it will be
2205 removed before the new one is inserted.  If the message being
2206 sent is a resent message (i.e. has a Resent- recipient header)
2207 then the Resent-Date header will be removed/inserted instead.
2208
2209 This is useful if you set mail-archive-file-name,
2210 because your archived message will contain a Date header.
2211
2212 A nil value means don't insert a Date header."
2213   :group 'vm
2214   :type 'boolean)
2215
2216 (defcustom vm-mail-header-insert-message-id t
2217   "*Non-nil value causes VM to insert a Message-ID header into a message
2218 when it is sent.  If the message has a Message-ID header, it will
2219 be removed before the new one is inserted.  If the message being
2220 sent is a resent message (i.e. has a Resent- recipient header) a
2221 Resent-Message-ID header will be removed/inserted instead.
2222
2223 This is useful if you set mail-archive-file-name, because your
2224 archived messages will contain a Message-ID header, which may be
2225 useful later for threading messages.
2226
2227 A nil value means don't insert a Message-ID header."
2228   :group 'vm
2229   :type 'boolean)
2230
2231 (defcustom vm-reply-subject-prefix nil
2232   "*Non-nil value should be a string that VM should add to the beginning
2233 of the Subject header in replies, if the string is not already present.
2234 Nil means don't prefix the Subject header."
2235   :group 'vm
2236   :type '(choice (const nil) string))
2237
2238 (defcustom vm-reply-ignored-addresses nil
2239   "*Non-nil value should be a list of regular expressions that match
2240 addresses that VM should automatically remove from the recipient
2241 headers of replies.  These addresses are removed from the headers
2242 before you are placed in the message composition buffer.  So if
2243 you see an address in the header you don't want you should remove
2244 it yourself.
2245
2246 Case is ignored when matching the addresses."
2247   :group 'vm
2248   :type '(repeat regexp))
2249
2250 (defcustom vm-reply-ignored-reply-tos nil
2251   "*Non-nil value should be a list of regular expressions that match
2252 addresses that, if VM finds in a message's Reply-To header, VM
2253 should ignore the Reply-To header and not use it for replies.  VM
2254 will use the From header instead.
2255
2256 Case is ignored when matching the addresses.
2257
2258 This variable exists solely to provide an escape chute from
2259 mailing lists that add a Reply-To: mailing list header, thereby
2260 leaving no way to reply to just the author of a message."
2261   :group 'vm
2262   :type '(repeat regexp))
2263
2264 (defcustom vm-reply-include-presentation nil
2265   "*If true a reply will include the presentation of a message.
2266 This might give better results when using filling or MIME encoded messages,
2267 e.g. HTML message."
2268   :group 'vm
2269   :type 'boolean)
2270
2271 (defcustom vm-in-reply-to-format "%i"
2272   "*String which specifies the format of the contents of the In-Reply-To
2273 header that is generated for replies.  See the documentation for the
2274 variable `vm-summary-format' for information on what this string may
2275 contain.  The format should *not* end with a newline.
2276 Nil means don't put an In-Reply-To header in replies."
2277   :group 'vm
2278   :type '(choice (const nil) string))
2279
2280 (defcustom vm-included-text-attribution-format "%F writes:\n"
2281   "*String which specifies the format of the attribution that precedes the
2282 included text from a message in a reply.  See the documentation for the
2283 variable `vm-summary-format' for information on what this string may contain.
2284 Nil means don't attribute included text in replies."
2285   :group 'vm
2286   :type '(choice (const nil) string))
2287
2288 (defcustom vm-included-mime-types-list
2289   '("text/plain" "text/enriched" "message/rfc822")
2290   "*List of mime types that should be retained in a reply message."
2291   :group 'vm
2292   :type '(repeat string))
2293
2294 (defcustom vm-included-text-headers nil
2295   "*List of headers that should be retained in a message included in
2296 a reply.  These should be listed in the order you wish them to
2297 appear in the included text.  Regular expressions are allowed.
2298 There's no need to anchor patterns with \"^\", as searches always
2299 start at the beginning of a line.  Put a colon at the end of
2300 patterns to get exact matches.  (E.g. \"Date\" matches \"Date\"
2301 and \"Date-Sent\".)  Header names are always matched case
2302 insensitively.
2303
2304 If the value of `vm-included-text-discard-header-regexp' is nil,
2305 the headers matched by `vm-included-text-headers' are the only
2306 headers that will be retained.
2307
2308 If `vm-included-text-discard-header-regexp' is non-nil, then only
2309 headers matched by that variable will be omitted; all others will
2310 be included.  `vm-included-text-headers' determines the header
2311 order in that case, with headers not matching any in the
2312 `vm-included-text-headers' list appearing last in the header
2313 section of the included text."
2314   :group 'vm
2315   :type '(repeat regexp))
2316
2317 (defcustom vm-included-text-discard-header-regexp nil
2318   "*Non-nil value should be a regular expression header that tells
2319 what headers should not be retained in a message included in a
2320 reply.  This variable along with `vm-included-text-headers' determines
2321 which headers are retained.
2322
2323 If the value of `vm-included-text-discard-header-regexp' is nil,
2324 the headers matched by `vm-included-text-headers' are the only headers
2325 that will be retained.
2326
2327 If `vm-included-text-discard-header-regexp' is non-nil, then only
2328 headers matched by this variable will not be retained; all
2329 others will be included.  `vm-included-text-headers' determines the
2330 header order in that case, with headers not matching any in
2331 the `vm-included-text-headers' list appearing last in the header
2332 section of the included text."
2333   :group 'vm
2334   :type 'regexp)
2335
2336 (defcustom vm-forwarding-subject-format "forwarded message from %F"
2337   "*String which specifies the format of the contents of the Subject
2338 header that is generated for a forwarded message.  See the documentation
2339 for the variable `vm-summary-format' for information on what this string
2340 may contain.  The format should *not* end with nor contain a newline.
2341 Nil means leave the Subject header empty when forwarding."
2342   :group 'vm
2343   :type 'string)
2344
2345 (defcustom vm-forwarded-headers nil
2346   "*List of headers that should be forwarded by `vm-forward-message'.
2347 These should be listed in the order you wish them to appear in
2348 the forwarded message.  Regular expressions are allowed.
2349 There's no need to anchor patterns with \"^\", as searches always
2350 start at the beginning of a line.  Put a colon at the end of
2351 patterns to get exact matches.  (E.g. \"Date\" matches \"Date\"
2352 and \"Date-Sent\".)  Header names are always matched case
2353 insensitively.
2354
2355 If the value of `vm-unforwarded-header-regexp' is nil, the headers
2356 matched by `vm-forwarded-headers' are the only headers that will be
2357 forwarded.
2358
2359 If `vm-unforwarded-header-regexp' is non-nil, then only headers
2360 matched by that variable will be omitted; all others will be
2361 forwarded.  `vm-forwarded-headers' determines the forwarding order
2362 in that case, with headers not matching any in the
2363 `vm-forwarded-headers' list appearing last in the header section of
2364 the forwarded message."
2365   :group 'vm
2366   :type '(repeat regexp))
2367
2368 (defcustom vm-unforwarded-header-regexp "only-drop-this-header"
2369   "*Non-nil value should be a regular expression header that tells
2370 what headers should not be forwarded by `vm-forward-message'.  This
2371 variable along with `vm-forwarded-headers' determines which headers
2372 are forwarded.
2373
2374 If the value of `vm-unforwarded-header-regexp' is nil, the headers
2375 matched by `vm-forwarded-headers' are the only headers that will be
2376 forwarded.
2377
2378 If `vm-unforwarded-header-regexp' is non-nil, then only headers
2379 matched by this variable will not be forwarded; all others will
2380 be forwarded.  `vm-forwarded-headers' determines the forwarding
2381 order in that case, with headers not matching any in the
2382 `vm-forwarded-headers' list appearing last in the header section of
2383 the forwarded message."
2384   :group 'vm
2385   :type '(choice
2386           (const nil)
2387           regexp))
2388
2389 (defcustom vm-forwarding-digest-type "mime"
2390   "*Non-nil value should be a string that specifies the type of
2391 message encapsulation format to use when forwarding a message.
2392 Legal values of this variable are:
2393
2394 \"rfc934\"
2395 \"rfc1153\"
2396 \"mime\"
2397 nil
2398
2399 A nil value means don't use a digest, just mark the beginning and
2400 end of the forwarded message."
2401   :group 'vm
2402   :type '(choice
2403           (const "rfc934")
2404           (const "rfc1153")
2405           (const "mime")
2406           (const :tag "Do not use digests" nil)))
2407
2408 (defcustom vm-mime-forward-local-external-bodies nil
2409   "*Non-nil value means forward messages that contain
2410 message/external-body parts that use the `local-file' access
2411 method.  A nil value means copy the externally referenced objects
2412 into the message before forwarding.  This copying is only done
2413 for objects accessed with the `local-file' access method.  Objects
2414 referenced with other method are not copied.
2415
2416 Messages that use the mesage/external-body type contain a
2417 reference to an object (image, audio, etc.) instead of the object
2418 itself.  So instead of the data that makes up an image, there
2419 might be a reference to a local file that contains the image.  If
2420 the recipient doesn't have access to your local filesystems then
2421 they will not be able to use the message/external-body reference.
2422 That is why the default value of this variable is nil, which
2423 forces such referneces to be converted to objects present in the
2424 message itself."
2425   :group 'vm
2426   :type 'boolean)
2427
2428 (defcustom vm-burst-digest-messages-inherit-labels t
2429   "*Non-nil values means messages from a digest inherit the digest's labels.
2430 Labels are added to messages with `vm-add-message-labels', normally
2431 bound to `l a'."
2432   :group 'vm
2433   :type 'boolean)
2434
2435 (defcustom vm-digest-preamble-format "\"%s\" (%F)"
2436   "*String which specifies the format of the preamble lines generated by
2437 `vm-send-digest' when it is invoked with a prefix argument.  One
2438 line will be generated for each message put into the digest.  See the
2439 documentation for the variable `vm-summary-format' for information
2440 on what this string may contain.  The format should *not* end
2441 with nor contain a newline."
2442   :group 'vm
2443   :type 'string)
2444
2445 (defcustom vm-digest-center-preamble t
2446   "*Non-nil value means VM will center the preamble lines that precede
2447 the start of a digest.  How the lines will be centered depends on the
2448 ambient value of fill-column.   A nil value suppresses centering."
2449   :group 'vm
2450   :type 'boolean)
2451
2452 (defcustom vm-digest-identifier-header-format "X-Digest: %s\n"
2453   "*Header to insert into messages burst from a digest.
2454 Value should be a format string of the same type as `vm-summary-format'
2455 that describes a header to be inserted into each message burst from a
2456 digest.  The format string must end with a newline."
2457   :group 'vm
2458   :type 'string)
2459
2460 (defcustom vm-digest-burst-type "guess"
2461   "*Value specifies the default digest type offered by `vm-burst-digest'
2462 when it asks you what type of digest you want to unpack.  Allowed
2463 values of this variable are:
2464
2465    \"rfc934\"
2466    \"rfc1153\"
2467    \"mime\"
2468    \"guess\"
2469
2470 rfc1153 digests have a preamble, followed by a line of exactly 70
2471 dashes, with digested messages separated by lines of exactly 30 dashes.
2472
2473 rfc934 digests separate messages on any line that begins with a few
2474 dashes, but doesn't require lines with only dashes or lines with a
2475 specific number of dashes.  In the text of the message, any line
2476 beginning with dashes is textually modified to be preceded by a dash
2477 and a space to prevent confusion with message separators.
2478
2479 MIME digests use whatever boundary that is specified by the
2480 boundary parameter in the Content-Type header of the digest.
2481
2482 If the value is \"guess\", and you take the default
2483 response when `vm-burst-digest' queries you, VM will try to guess
2484 the digest type."
2485   :group 'vm
2486   :type '(choice (const "rfc934") (const "rfc1153") (const "mime")
2487                  (const "guess")))
2488
2489 (defcustom vm-digest-send-type "mime"
2490   "*String that specifies the type of digest `vm-send-digest' will use.
2491 Legal values of this variable are:
2492
2493 \"rfc934\"
2494 \"rfc1153\"
2495 \"mime\"
2496
2497 "
2498   :group 'vm
2499   :type '(choice (const "rfc934") (const "rfc1153") (const "mime")))
2500
2501 (defcustom vm-rfc934-digest-headers
2502   '("Resent-"
2503     "From:" "Sender:"
2504     "To:" "Cc:"
2505     "Subject:"
2506     "Date:"
2507     "Message-ID:"
2508     "Keywords:")
2509   "*List of headers that should be appear in RFC 934 digests
2510 created by VM.  These should be listed in the order you wish them
2511 to appear in the digest.  Regular expressions are allowed.
2512 There's no need to anchor patterns with \"^\", as searches always
2513 start at the beginning of a line.  Put a colon at the end of
2514 patterns to get exact matches.  (E.g. \"Date\" matches \"Date\"
2515 and \"Date-Sent\".)  Header names are always matched case
2516 insensitively.
2517
2518 If the value of `vm-rfc934-digest-discard-header-regexp' is nil, the headers
2519 matched by `vm-rfc934-digest-headers' are the only headers that will be
2520 kept.
2521
2522 If `vm-rfc934-digest-discard-header-regexp' is non-nil, then only
2523 headers matched by that variable will be discarded; all others
2524 will be kept.  `vm-rfc934-digest-headers' determines the order of
2525 appearance in that case, with headers not matching any in the
2526 `vm-rfc934-digest-headers' list appearing last in the headers
2527 of the digestified messages."
2528   :group 'vm
2529   :type '(repeat regexp))
2530
2531 (defcustom vm-rfc934-digest-discard-header-regexp nil
2532   "*Non-nil value should be a regular expression header that tells
2533 what headers should not appear in RFC 934 digests created by VM.  This
2534 variable along with `vm-rfc934-digest-headers' determines which headers
2535 are kept and which are discarded.
2536
2537 If the value of `vm-rfc934-digest-discard-header-regexp' is nil, the headers
2538 matched by `vm-rfc934-digest-headers' are the only headers that will be
2539 kept.
2540
2541 If `vm-rfc934-digest-discard-header-regexp' is non-nil, then only
2542 headers matched by this variable will be discarded; all others
2543 will be kept.  `vm-rfc934-digest-headers' determines the order of
2544 appearance in that case, with headers not matching any in the
2545 `vm-rfc934-digest-headers' list appearing last in the headers
2546 of the digestified messages."
2547   :group 'vm
2548   :type 'regexp)
2549
2550 (defcustom vm-rfc1153-digest-headers
2551   '("Resent-"
2552     "Date:"
2553     "From:" "Sender:"
2554     "To:" "Cc:"
2555     "Subject:"
2556     "Message-ID:"
2557     "Keywords:")
2558   "*List of headers that should be appear in RFC 1153 digests
2559 created by VM.  These should be listed in the order you wish them
2560 to appear in the digest.  Regular expressions are allowed.
2561 There is no need to anchor patterns with \"^\", as searches always
2562 start at the beginning of a line.  Put a colon at the end of
2563 patterns to get exact matches.  (E.g. \"Date\" matches \"Date\"
2564 and \"Date-Sent\".)  Header names are always matched case
2565 insensitively.
2566
2567 If the value of `vm-rfc1153-digest-discard-header-regexp' is nil, the headers
2568 matched by `vm-rfc1153-digest-headers' are the only headers that will be
2569 kept.
2570
2571 If `vm-rfc1153-digest-discard-header-regexp' is non-nil, then only
2572 headers matched by that variable will be discarded; all others
2573 will be kept.  `vm-rfc1153-digest-headers' determines the order of
2574 appearance in that case, with headers not matching any in the
2575 `vm-rfc1153-digest-headers' list appearing last in the headers of
2576 the digestified messages."
2577   :group 'vm
2578   :type '(repeat regexp))
2579
2580 (defcustom vm-rfc1153-digest-discard-header-regexp "\\(X400-\\)?Received:"
2581   "*Non-nil value should be a regular expression header that tells
2582 what headers should not appear in RFC 1153 digests created by VM.  This
2583 variable along with `vm-rfc1153-digest-headers' determines which headers
2584 are kept and which headers are discarded.
2585
2586 If the value of `vm-rfc1153-digest-discard-header-regexp' is nil, the headers
2587 matched by `vm-rfc1153-digest-headers' are the only headers that will be
2588 kept.
2589
2590 If `vm-rfc1153-digest-discard-header-regexp' is non-nil, then only
2591 headers matched by this variable will be discarded; all others
2592 will be kept.  `vm-rfc1153-digest-headers' determines the order of
2593 appearance in that case, with headers not matching any in the
2594 `vm-rfc1153-digest-headers' list appearing last in the headers of
2595 the digestified messages."
2596   :group 'vm
2597   :type 'regexp)
2598
2599 (defcustom vm-mime-digest-headers
2600   '("Resent-"
2601     "From:" "Sender:"
2602     "To:" "Cc:"
2603     "Subject:"
2604     "Date:"
2605     "Message-ID:"
2606     "Keywords:"
2607     "MIME-Version:"
2608     "Content-")
2609   "*List of headers that should be appear in MIME digests
2610 created by VM.  These should be listed in the order you wish them
2611 to appear in the messages in the digest.  Regular expressions are
2612 allowed.  There's no need to anchor patterns with \"^\", as
2613 searches always start at the beginning of a line.  Put a colon at
2614 the end of patterns to get exact matches.  (E.g. \"Date\" matches
2615 \"Date\" and \"Date-Sent\".)  Header names are always matched
2616 case insensitively.
2617
2618 If the value of `vm-mime-digest-discard-header-regexp' is nil, the headers
2619 matched by `vm-mime-digest-headers' are the only headers that will be
2620 kept.
2621
2622 If `vm-mime-digest-discard-header-regexp' is non-nil, then only
2623 headers matched by that variable will be discarded; all others
2624 will be kept.  `vm-mime-digest-headers' determines the order of
2625 appearance in that case, with headers not matching any in the
2626 `vm-mime-digest-headers' list appearing last in the headers
2627 of the digestified messages."
2628   :group 'vm
2629   :type '(repeat regexp))
2630
2631 (defcustom vm-mime-digest-discard-header-regexp nil
2632   "*Non-nil value should be a regular expression header that tells
2633 which headers should not appear in MIME digests created
2634 by VM.  This variable along with `vm-mime-digest-headers'
2635 determines which headers are kept and which are discarded.
2636
2637 If the value of `vm-mime-digest-discard-header-regexp' is nil, the headers
2638 matched by `vm-mime-digest-headers' are the only headers that will be
2639 kept.
2640
2641 If `vm-mime-digest-discard-header-regexp' is non-nil, then only
2642 headers matched by this variable will be discarded; all others
2643 will be kept.  `vm-mime-digest-headers' determines the order of
2644 appearance in that case, with headers not matching any in the
2645 `vm-mime-digest-headers' list appearing last in the headers
2646 of the digestified messages."
2647   :group 'vm
2648   :type 'regexp)
2649
2650 (defcustom vm-resend-bounced-headers
2651   '("MIME-Version:" "Content-"
2652     "From:" "Sender:" "Reply-To:"
2653     "To:" "Cc:"
2654     "Subject:"
2655     "Newsgroups:"
2656     "In-Reply-To:" "References:"
2657     "Keywords:"
2658     "X-")
2659   "*List of headers that should be appear in messages resent with
2660 `vm-resend-bounced-message'.  These should be listed in the order you wish them
2661 to appear in the message.  Regular expressions are allowed.
2662 There is no need to anchor patterns with \"^\", as searches always
2663 start at the beginning of a line.  Put a colon at the end of
2664 patterns to get exact matches.  (E.g. \"Date\" matches \"Date\"
2665 and \"Date-Sent\".)  Header names are always matched case
2666 insensitively.
2667
2668 If the value of `vm-resend-bounced-discard-header-regexp' is nil, the headers
2669 matched by `vm-resend-bounced-headers' are the only headers that will be
2670 kept.
2671
2672 If `vm-resend-bounced-discard-header-regexp' is non-nil, then only
2673 headers matched by that variable will be discarded; all others
2674 will be kept.  `vm-resend-bounced-headers' determines the order of
2675 appearance in that case, with headers not matching any in the
2676 `vm-resend-bounced-headers' list appearing last in the headers of
2677 the message."
2678   :group 'vm
2679   :type '(repeat regexp))
2680
2681 (defcustom vm-resend-bounced-discard-header-regexp nil
2682   "*Non-nil value should be a regular expression that tells
2683 what headers should not appear in a resent bounced message.  This
2684 variable along with `vm-resend-bounced-headers' determines which headers
2685 are kept and which headers are discarded.
2686
2687 If the value of `vm-resend-bounced-discard-header-regexp' is nil,
2688 the headers matched by `vm-resend-bounced-headers' are the only
2689 headers that will be kept.
2690
2691 If `vm-resend-bounced-discard-header-regexp' is non-nil, then only
2692 headers matched by this variable will be discarded; all others
2693 will be kept.  `vm-resend-bounced-headers' determines the order of
2694 appearance in that case, with headers not matching any in the
2695 `vm-resend-bounced-headers' list appearing last in the headers of
2696 the message."
2697   :group 'vm
2698   :type 'regexp)
2699
2700 (defcustom vm-resend-headers nil
2701   "*List of headers that should be appear in messages resent with
2702 `vm-resend-message'.  These should be listed in the order you wish them
2703 to appear in the message.  Regular expressions are allowed.
2704 There is no need to anchor patterns with \"^\", as searches always
2705 start at the beginning of a line.  Put a colon at the end of
2706 patterns to get exact matches.  (E.g. \"Date\" matches \"Date\"
2707 and \"Date-Sent\".)  Header names are always matched case
2708 insensitively.
2709
2710 If the value of `vm-resend-discard-header-regexp' is nil, the headers
2711 matched by `vm-resend-headers' are the only headers that will be
2712 kept.
2713
2714 If `vm-resend-discard-header-regexp' is non-nil, then only
2715 headers matched by that variable will be discarded; all others
2716 will be kept.  `vm-resend-headers' determines the order of
2717 appearance in that case, with headers not matching any in the
2718 `vm-resend-headers' list appearing last in the headers of
2719 the message."
2720   :group 'vm
2721   :type '(repeat regexp))
2722
2723 (defcustom vm-resend-discard-header-regexp "\\(\\(X400-\\)?Received:\\|Resent-\\)"
2724   "*Non-nil value should be a regular expression that tells
2725 what headers should not appear in a resent message.  This
2726 variable along with `vm-resend-headers' determines which
2727 headers are kept and which headers are discarded.
2728
2729 If the value of `vm-resend-discard-header-regexp' is nil,
2730 the headers matched by `vm-resend-headers' are the only
2731 headers that will be kept.
2732
2733 If `vm-resend-discard-header-regexp' is non-nil, then only
2734 headers matched by this variable will be discarded; all others
2735 will be kept.  `vm-resend-headers' determines the order of
2736 appearance in that case, with headers not matching any in the
2737 `vm-resend-headers' list appearing last in the headers of
2738 the message."
2739   :group 'vm
2740   :type 'regexp)
2741
2742 (defcustom vm-summary-format "%n %*%a %-17.17F %-3.3m %2d %4l/%-5c %I\"%s\"\n"
2743   "*String which specifies the message summary line format.
2744 The string may contain the printf-like `%' conversion specifiers which
2745 substitute information about the message into the final summary line.
2746
2747 Recognized specifiers are:
2748    a - attribute indicators (always four characters wide)
2749        The first char is  `D', `N', `U' or ` ' for deleted, new, unread
2750        and read messages respectively.
2751        The second char is `F', `W' or ` ' for filed (saved) or written
2752        messages.
2753        The third char is `R', `Z' or ` ' for messages replied to,
2754        and forwarded messages.
2755        The fourth char is `E' if the message has been edited, ` ' otherwise.
2756    A - longer version of attributes indicators (seven characters wide)
2757        The first char is  `D', `N', `U' or ` ' for deleted, new, unread
2758        and read messages respectively.
2759        The second is `r' or ` ', for message replied to.
2760        The third is `z' or ` ', for messages forwarded.
2761        The fourth is `b' or ` ', for messages redistributed.
2762        The fifth is `f' or ` ', for messages filed.
2763        The sixth is `w' or ` ', for messages written.
2764        The seventh is `e' or ` ', for messages that have been edited.
2765    c - number of characters in message (ignoring headers)
2766    d - numeric day of month message sent
2767    f - author's address
2768    F - author's full name (same as f if full name not found)
2769    h - hour:min:sec message sent
2770    H - hour:min message sent
2771    i - message ID
2772    I - thread indentation
2773    l - number of lines in message (ignoring headers)
2774    L - labels (as a comma list)
2775    m - month message sent
2776    M - numeric month message sent (January = 1)
2777    n - message number
2778    s - message subject
2779    t - addresses of the recipients of the message, in a comma-separated list
2780    T - full names of the recipients of the message, in a comma-separated list
2781        If a full name cannot be found, the corresponding address is used
2782        instead.
2783    U - user defined specifier.  The next character in the format
2784        string should be a letter.  VM will call the function
2785        vm-summary-function-<letter> (e.g. vm-summary-function-A for
2786        \"%UA\") in the folder buffer with the message being summarized
2787        bracketed by (point-min) and (point-max).  The function
2788        will be passed a message struct as an argument.
2789        The function should return a string, which VM will insert into
2790        the summary as it would for information from any other summary
2791        specifier.
2792    w - day of the week message sent
2793    y - year message sent
2794    z - timezone of date when the message was sent
2795    * - `*' if the message is marked, ` ' otherwise
2796    ( - starts a group, terminated by %).  Useful for specifying
2797        the field width and precision for the concatentation of
2798        group of format specifiers.  Example: \"%.35(%I%s%)\"
2799        specifies a maximum display width of 35 characters for the
2800        concatenation of the thread indentation and the subject.
2801    ) - ends a group.
2802
2803 Use %% to get a single %.
2804
2805 A numeric field width may be given between the `%' and the specifier;
2806 this causes right justification of the substituted string.  A negative field
2807 width causes left justification.
2808
2809 The field width may be followed by a `.' and a number specifying
2810 the maximum allowed length of the substituted string.  If the
2811 string is longer than this value the right end of the string is
2812 truncated.  If the value is negative, the string is truncated on
2813 the left instead of the right.
2814
2815 The summary format need not be one line per message but it must end with
2816 a newline, otherwise the message pointer will not be displayed correctly
2817 in the summary window."
2818   :group 'vm
2819   :type 'string)
2820
2821 (defcustom vm-summary-arrow "->"
2822   "*String that is displayed to the left of the summary of the
2823 message VM consider to be the current message.  The value takes
2824 effect when the summary buffer is created.  Changing this
2825 variable's value has no effect on existing summary buffers."
2826   :group 'vm
2827   :type 'string)
2828
2829 (defcustom vm-summary-highlight-face 'bold
2830   "*Face to use to highlight the summary entry for the current message.
2831 Nil means don't highlight the current message's summary entry."
2832   :group 'vm-faces
2833   :type 'symbol)
2834
2835 (defcustom vm-mouse-track-summary t
2836   "*Non-nil value means highlight summary lines as the mouse passes
2837 over them."
2838   :group 'vm
2839   :type 'boolean)
2840
2841 (defcustom vm-summary-show-threads nil
2842   "*Non-nil value means VM should display and maintain
2843 message thread trees in the summary buffer.  This means that
2844 messages with a common ancestor will be displayed contiguously in
2845 the summary.  (If you have `vm-move-messages-physically' set
2846 non-nil the folder itself will be reordered to match the thread
2847 ordering.)  If you use the `%I' summary format specifier in your
2848 `vm-summary-format', indentation will be provided as described in the
2849 documentation for `vm-summary-thread-indent-level' (which see).
2850
2851 A nil value means don't display thread information.  The `%I'
2852 specifier does nothing in the summary format.
2853
2854 This variable automatically becomes buffer-local when set in any
2855 fashion.  You should set this variable only in your .vm or .emacs
2856 file.  Use setq-default.  Once VM has been started, you should not
2857 set this variable directly, rather you should use the command
2858 `vm-toggle-threads-display', normally bound to C-t."
2859   :group 'vm
2860   :type 'boolean)
2861 (make-variable-buffer-local 'vm-summary-show-threads)
2862
2863 (defcustom vm-summary-thread-indent-level 2
2864   "*Value should be a number that specifies how much
2865 indentation the '%I' summary format specifier should provide per
2866 thread level.  A message's `thread level' refers to the number of
2867 direct ancestors from the message to the oldest ancestor the
2868 message has that is in the current folder.  For example, the
2869 first message of a thread is generally a message about a new
2870 topic, e.g. a message that is not a reply to some other message.
2871 Therefore it has no ancestor and would cause %I to generate no
2872 indentation.  A reply to this message will be indented by the value
2873 of `vm-summary-thread-indent-level'.  A reply to that reply will be
2874 indented twice the value of `vm-summary-thread-indent-level'."
2875   :group 'vm
2876   :type 'integer)
2877
2878 (defcustom vm-thread-using-subject t
2879   "*Non-nil value causes VM to use the Subject header to thread messages.
2880 Messages with the same subject will be grouped together.
2881
2882 A nil value means VM will disregard the Subject header when
2883 threading messages."
2884   :group 'vm
2885   :type 'boolean)
2886
2887 (defcustom vm-summary-uninteresting-senders nil
2888   "*Non-nil value should be a regular expression that matches
2889 addresses that you don't consider interesting enough to
2890 appear in the summary.  When such senders would be displayed by
2891 the %F or %f summary format specifiers VM will substitute the
2892 value of `vm-summary-uninteresting-senders-arrow' (default \"To:
2893 \") followed by what would be shown by the %T and %t specifiers
2894 respectively."
2895   :group 'vm
2896   :type '(choice (const nil) regexp))
2897
2898 (defcustom vm-summary-uninteresting-senders-arrow "To: "
2899   "*String to display before the string that is displayed instead of an
2900 \"uninteresting\" sender.  See `vm-summary-uninteresting-senders'."
2901   :group 'vm
2902   :type 'string)
2903
2904 (defcustom vm-auto-center-summary 0
2905   "*Value controls whether VM will keep the summary arrow vertically
2906 centered within the summary window. A value of t causes VM to always
2907 keep arrow centered.  A value of nil means VM will never bother centering
2908 the arrow.  A value that is not nil and not t causes VM to center the
2909 arrow only if the summary window is not the only existing window."
2910   :group 'vm
2911   :type '(choice (const nil) (const t) (const yes-if-not-only-window)))
2912
2913 (defcustom vm-subject-ignored-prefix "^\\(re: *\\)+"
2914   "*Non-nil value should be a regular expression that matches
2915 strings at the beginning of the Subject header that you want VM to ignore
2916 when threading, sorting, marking, and killing messages by subject.
2917
2918 Matches are done case-insensitively."
2919   :group 'vm
2920   :type 'regexp)
2921
2922 (defcustom vm-subject-ignored-suffix "\\( (fwd)\\| \\)+$"
2923   "*Non-nil value should be a regular expression that matches
2924 strings at the end of the Subject header that you want VM to ignore
2925 when threading, sorting, marking and killing messages by subject.
2926
2927 Matches are done case-insensitively."
2928   :group 'vm
2929   :type 'regexp)
2930
2931 (defcustom vm-subject-significant-chars nil
2932   "*Number of characters in the normalized message subject considered
2933 significant in message threading and sorting.  The normalized
2934 subject is the contents of the Subject header after ignored
2935 prefixes and suffixes have been removed and after consecutive
2936 whitespace has been collapsed into single spaces.  The first
2937 `vm-subject-significant-chars' will be considered significant.
2938 Characters beyond this point in the subject string will be
2939 ignored.
2940
2941 A nil value for this variable means all characters in the message
2942 subject are significant."
2943   :group 'vm
2944   :type '(choice (const nil) integer))
2945
2946 (defcustom vm-folders-summary-database "~/.vm.folders.db"
2947   "*Name of Berkeley DB file used to store summary information about folders.
2948 This file is consulted to produce the folders summary."
2949   :group 'vm
2950   :type 'file)
2951
2952 (defcustom vm-folders-summary-format
2953       "  %12f %4t total, %n new, %u unread, %s spooled\n"
2954   "*String that specifies the folders summary format.
2955 The string may contain the printf-like `%' conversion specifiers which
2956 substitute information about the folder into the final summary line.
2957
2958 Recognized specifiers are:
2959    d - the number of deleted messages in the folder
2960    f - the name of the folder without the directory part
2961    n - the number of new messages in the folder
2962    t - the total number of messages in the folder
2963    u - the number of old but still unread messages in the folder
2964    ( - starts a group, terminated by %).  Useful for specifying
2965        the field width and precision for the concatentation of
2966        group of format specifiers.  Example: \"%.35(%d, %t, %f%)\"
2967        specifies a maximum display width of 35 characters for the
2968        concatenation of the content description, content type and
2969        suggested file name.
2970    ) - ends a group.
2971
2972 Use %% to get a single %.
2973
2974 A numeric field width may be given between the `%' and the specifier;
2975 this causes right justification of the substituted string.  A negative field
2976 width causes left justification.
2977
2978 The field width may be followed by a `.' and a number specifying
2979 the maximum allowed length of the substituted string.  If the
2980 string is longer than this value the right end of the string is
2981 truncated.  If the value is negative, the string is truncated on
2982 the left instead of the right.
2983
2984 The summary format need not be one line per folder, but it should end with
2985 a newline."
2986   :group 'vm
2987   :type 'string)
2988
2989 (defcustom vm-folders-summary-directories
2990       (list (or vm-folder-directory (file-name-directory vm-primary-inbox)))
2991   "*List of directories containing folders to be listed in the folders summary.
2992 List the directories in the order you wish them to appear in the summary."
2993   :group 'vm
2994   :type '(repeat directory))
2995
2996 (defcustom vm-mutable-windows pop-up-windows
2997   "*This variable's value controls VM's window usage.
2998
2999 A non-nil value gives VM free run of the Emacs display; it will commandeer
3000 the entire screen for its purposes.
3001
3002 A value of nil restricts VM's window usage to the window from which
3003 it was invoked.  VM will not create, delete, or use any other windows,
3004 nor will it resize its own window."
3005   :group 'vm
3006   :type 'boolean)
3007
3008 (defcustom vm-mutable-frames t
3009   "*Non-nil value means VM is allowed to create and destroy frames
3010 to display and undisplay buffers.  Whether VM actually does
3011 so depends on the value of the variables with names prefixed by
3012 ``vm-frame-per-''.
3013
3014 VM can create a frame to display a buffer, and delete frame to
3015 undisplay a buffer.  A nil value means VM should not create or
3016 delete frames.
3017
3018 This variable does not apply to the VM commands whose
3019 names end in -other-frame, which always create a new frame."
3020   :group 'vm
3021   :type 'boolean)
3022
3023 (defcustom vm-raise-frame-at-startup t
3024   "*Specifies whether VM should raise its frame at startup.
3025 A value of nil means never raise the frame.
3026 A value of t means always raise the frame.
3027 Other values are reserved for future use."
3028   :group 'vm
3029   :type 'boolean)
3030
3031 (defcustom vm-frame-per-folder t
3032   "*Non-nil value causes the folder visiting commands to visit in a new frame.
3033 Nil means the commands will use the current frame.  This variable
3034 does not apply to the VM commands whose names end in
3035 -other-frame, which always create a new frame.
3036
3037 This variable has no meaning if you're not running under an Emacs
3038 capable of displaying multiple real or virtual frames.  Note that
3039 Emacs supports multiple virtual frames on dumb terminals, and
3040 VM will use them."
3041   :group 'vm
3042   :type 'boolean)
3043
3044 (defcustom vm-frame-per-summary nil
3045   "*Non-nil value causes VM to display the folder summary in its own frame.
3046 Nil means the `vm-summarize' command will use the current frame.
3047 This variable does not apply to `vm-summarize-other-frame', which
3048 always create a new frame.
3049
3050 This variable has no meaning if you're not running under an Emacs
3051 capable of displaying multiple real or virtual frames.  Note that
3052 Emacs supports multiple virtual frames on dumb terminals, and
3053 VM will use them."
3054   :group 'vm
3055   :type 'boolean)
3056
3057 (defcustom vm-frame-per-folders-summary nil
3058   "*Non-nil value causes VM to display the 'all folders' summary in its own frame.
3059 Nil means the `vm-folders-summarize' command will use the current frame.
3060
3061 This variable has no meaning if you're not running under an Emacs
3062 capable of displaying multiple real or virtual frames.  Note that
3063 Emacs supports multiple virtual frames on dumb terminals, and
3064 VM will use them."
3065   :group 'vm
3066   :type 'boolean)
3067
3068 (defcustom vm-frame-per-composition t
3069   "*Non-nil value causes the mail composition commands to open a new frame.
3070 Nil means the commands will use the current frame.  This variable
3071 does not apply to the VM commands whose names end in
3072 -other-frame, which always create a new frame.
3073
3074 This variable has no meaning if you're not running under an Emacs
3075 capable of displaying multiple real or virtual frames.  Note that
3076 Emacs supports multiple virtual frames on dumb terminals, and
3077 VM will use them."
3078   :group 'vm
3079   :type 'boolean)
3080
3081 (defcustom vm-frame-per-edit t
3082   "*Non-nil value causes `vm-edit-message' to open a new frame.
3083 Nil means the `vm-edit-message' will use the current frame.  This
3084 variable does not apply to `vm-edit-message-other-frame', which
3085 always create a new frame.
3086
3087 This variable has no meaning if you're not running under an Emacs
3088 capable of displaying multiple real or virtual frames.  Note that
3089 Emacs support multiple virtual frames on dumb terminals, and
3090 VM will use them."
3091   :group 'vm
3092   :type 'boolean)
3093
3094 (defcustom vm-frame-per-help nil
3095   "*Non-nil value causes VM to open a new frame to display help buffers.
3096 Nil means the VM will use the current frame.
3097
3098 This variable has no meaning if you're not running under an Emacs
3099 capable of displaying multiple real or virtual frames.  Note that
3100 Emacs supports multiple virtual frames on dumb terminals, and
3101 VM will use them."
3102   :group 'vm
3103   :type 'boolean)
3104
3105 (defcustom vm-frame-per-completion t
3106   "*Non-nil value causes VM to open a new frame on mouse
3107 initiated completing reads.  A mouse initiated completing read
3108 occurs when you invoke a VM command using the mouse, either with a
3109 menu or a toolbar button.  That command must then prompt you for
3110 information, and there must be a limited set of valid responses.
3111
3112 If these conditions are met and `vm-frame-per-completion''s value
3113 is non-nil, VM will create a new frame containing a list of
3114 responses that you can select with the mouse.
3115
3116 A nil value means the current frame will be used to display the
3117 list of choices.
3118
3119 This variable has no meaning if you're not running Emacs native
3120 under X Windows or some other window system that allows multiple
3121 real Emacs frames.  Note that Emacs supports virtual frames under
3122 ttys but VM will not use these to display completion information."
3123   :group 'vm
3124   :type 'boolean)
3125
3126 (defcustom vm-frame-parameter-alist nil
3127   "*Non-nil value is an alist of types and lists of frame parameters.
3128 This list tells VM what frame parameters to associate with each
3129 new frame it creates of a specific type.
3130
3131 The alist should be of this form
3132
3133   ((SYMBOL PARAMLIST) (SYMBOL2 PARAMLIST2) ...)
3134
3135 SYMBOL must be one of ``completion'', ``composition'', ``edit'',
3136 ``folder'', ``primary-folder'' or ``summary''.  It specifies the type
3137 of frame that the following PARAMLIST applies to.
3138
3139 ``completion'' specifies parameters for frames that display lists of
3140    choices generated by a mouse-initiated completing read.
3141    (See `vm-frame-per-completion'.)
3142 ``composition'' specifies parameters for mail composition frames.
3143 ``edit'' specifies parameters for message edit frames
3144    (e.g. created by `vm-edit-message-other-frame')
3145 ``folder'' specifies parameters for frames created by `vm' and the
3146    ``vm-visit-'' commands.
3147 ``folders-summary'' specifies parameters for frames created by the
3148    ``vm-folder-summarize'' command.
3149 ``primary-folder'' specifies parameters for the frame created by running
3150    `vm' without any arguments.
3151 ``summary'' specifies parameters for frames that display a summary buffer
3152    (e.g. created by `vm-summarize-other-frame')
3153
3154 PARAMLIST is a list of pairs as described in the documentation for
3155 the function `make-frame'."
3156   :group 'vm
3157   :type '(repeat (cons (choice (const completion)
3158                                (const composition)
3159                                (const edit)
3160                                (const folder)
3161                                (const folders-summary)
3162                                (const primary-folder)
3163                                (const summary))
3164                        (repeat (cons symbol sexp)))))
3165
3166 (defcustom vm-search-other-frames t
3167   "*Non-nil means VM should search frames other than the selected frame
3168 when looking for a window that is already displaying a buffer that
3169 VM wants to display or undisplay."
3170   :group 'vm
3171   :type 'boolean)
3172
3173 (defcustom vm-configure-datadir nil
3174   "A directory VM will search for data files."
3175   :group 'vm
3176   :type 'directory)
3177
3178 (defcustom vm-configure-pixmapdir nil
3179   "A directory VM will search for pixmap files."
3180   :group 'vm
3181   :type 'directory)
3182
3183 (defun vm-pixmap-directory () 
3184   (interactive)
3185   (let* ((vm-dir (file-name-directory (locate-library "vm")))
3186          (image-dirs (list (and vm-configure-pixmapdir
3187                                 (expand-file-name vm-configure-pixmapdir))
3188                            (and vm-configure-datadir
3189                                 (expand-file-name vm-configure-datadir))
3190                            (expand-file-name "pixmaps" vm-dir)
3191                            (expand-file-name "../pixmaps" vm-dir)
3192                            (let ((d (locate-data-directory "vm")))
3193                              (and d
3194                                   (expand-file-name "pixmaps" d)))))
3195          image-dir)
3196     (while image-dirs
3197       (setq image-dir (car image-dirs))
3198       (if (and image-dir
3199                (file-exists-p (expand-file-name "visit-up.xpm" image-dir)))
3200           (setq image-dirs nil)
3201         (setq image-dirs (cdr image-dirs))))
3202     image-dir))
3203
3204 (defun vm-image-directory () 
3205   (or vm-image-directory (vm-pixmap-directory)))
3206
3207 (defcustom vm-image-directory nil
3208   "*Value specifies the directory where VM should find its artwork."
3209   :group 'vm
3210   :type '(choice directory (const :tag "Automatic" nil)))
3211
3212 (defcustom vm-use-toolbar
3213   '(getmail 
3214     next previous delete/undelete autofile file
3215     reply followup forward compose print visit quit help)
3216   "*Non-nil value causes VM to provide a toolbar interface.
3217 Value should be a list of symbols and integers that will determine which
3218 toolbar buttons will appear and in what order.
3219
3220 If nil appears in the list, it should appear exactly once.  All
3221 buttons after nil in the list will be displayed flushright in
3222 top/bottom toolbars and flushbottom in left/right toolbars.
3223
3224 If a positive integer N appears in the list, a blank space will
3225 appear in the toolbar with a width of N pixels for top/bottom
3226 toolbars, and a height of N for left/right toolbars.
3227
3228 See also `vm-toolbar-orientation' to control where the toolbar is placed."
3229   :group 'vm
3230   :type '(repeat (choice integer
3231                          (const autofile)
3232                          (const compose)
3233                          (const delete/undelete)
3234                          (const file)
3235                          (const getmail)
3236                          (const help)
3237                          (const mime)
3238                          (const next)
3239                          (const previous)
3240                          (const print)
3241                          (const quit)
3242                          (const reply)
3243                          (const followup)
3244                          (const forward)
3245                          (const visit)
3246                          (const nil))))
3247
3248 (defcustom vm-toolbar-orientation 'top
3249   "*Value is a symbol that specifies where the VM toolbar is located.
3250 Legal values are `left', `right' `top' and `bottom'.  Any other
3251 value will be interpreted as `top'.
3252
3253 This variable only has meaning under XEmacs 19.12 and beyond.
3254 Under FSF Emacs 21 the toolbar is always at the top of the frame."
3255   :group 'vm
3256   :type '(choice (const left)
3257                  (const right)
3258                  (const top)
3259                  (const bottom)))
3260
3261 (defun vm-toolbar-pixmap-directory () 
3262   (or vm-toolbar-pixmap-directory 
3263       (if (string-match "'--with-gtk'" system-configuration-options)
3264           (concat (vm-pixmap-directory) "/gtk")
3265         (vm-pixmap-directory))))
3266
3267 (defcustom vm-toolbar-pixmap-directory nil
3268   "*Value specifies the directory VM should find its toolbar pixmaps."
3269   :group 'vm
3270   :type '(choice directory (const :tag "Automatic" nil)))
3271
3272 (defcustom vm-toolbar nil
3273   "*Non-nil value should be a list of toolbar button descriptors.
3274 See the documentation for the variable default-toolbar for a
3275 definition of what a toolbar button descriptor is.
3276
3277 If `vm-toolbar' is set non-nil VM will use its value as a toolbar
3278 instantiator instead of the usual behavior of building a button
3279 list based on the value of `vm-use-toolbar'.  `vm-use-toolbar' still
3280 must be set non-nil for a toolbar to appear, however.
3281
3282 Consider this variable experimental; it may not be supported forever."
3283   :group 'vm
3284   :type 'sexp)
3285
3286 (defcustom vm-use-menus
3287   (nconc (list 'folder 'motion 'send 'mark 'label 'sort 'virtual)
3288          (cond ((string-match ".*-.*-\\(win95\\|nt\\)" system-configuration)
3289                 nil)
3290                (t (list 'undo)))
3291          (list 'dispose)
3292          (cond ((string-match ".*-.*-\\(win95\\|nt\\)" system-configuration)
3293                 nil)
3294                (t (list 'emacs)))
3295          (list nil 'help))
3296   "*Non-nil value causes VM to provide a menu interface.
3297 A value that is a list causes VM to install its own menubar.
3298 A value of 1 causes VM to install a \"VM\" item in the Emacs menubar.
3299
3300 If the value of `vm-use-menus' is a list, it should be a list of
3301 symbols.  The symbols and the order in which they are listed
3302 determine which menus will be in the menubar and how they are
3303 ordered.  Valid symbol values are:
3304
3305     dispose
3306     emacs
3307     folder
3308     help
3309     label
3310     mark
3311     motion
3312     send
3313     sort
3314     undo
3315     virtual
3316     nil
3317
3318 If nil appears in the list, it should appear exactly once.  All
3319 menus after nil in the list will be displayed flushright in
3320 menubar.
3321
3322 This variable only has meaning in Emacs environments where menus
3323 are provided, which usually means Emacs has to be running under a
3324 window system."
3325   :group 'vm
3326   :type '(choice (const 1)
3327                  (repeat (choice (const dispose)
3328                                  (const emacs)
3329                                  (const folder)
3330                                  (const help)
3331                                  (const label)
3332                                  (const mark)
3333                                  (const motion)
3334                                  (const send)
3335                                  (const sort)
3336                                  (const undo)
3337                                  (const virtual)
3338                                  (const nil)))))
3339
3340 (defcustom vm-popup-menu-on-mouse-3 t
3341   "*Non-nil value means VM should provide context-sensitive menus on mouse-3.
3342 A nil value means VM should not change the binding of mouse-3."
3343   :group 'vm
3344   :type 'boolean)
3345
3346 (defcustom vm-warp-mouse-to-new-frame nil
3347   "*Non-nil value causes VM to move the mouse cursor into newly created frames.
3348 This is useful to give the new frame the focus under some window managers
3349 that randomly place newly created frames.
3350
3351 Nil means don't move the mouse cursor."
3352   :group 'vm
3353   :type 'boolean)
3354
3355 (defcustom vm-url-retrieval-methods '(lynx wget fetch curl w3m)
3356   "*Non-nil value specifies how VM is permitted to retrieve URLs.
3357 VM needs to do this when supporting the message/external-body
3358 MIME type, which provides a reference to an object instead of the
3359 object itself.  The specification should be a list of symbols
3360 with the following meanings
3361
3362         lynx - means VM should try to use the lynx program.
3363         wget - means VM should try to use the wget program.
3364          w3m - means VM should try to use the w3m program.
3365        fetch - means VM should try to use the fetch program.
3366         curl - means VM should try to use the curl program.
3367
3368 The list can contain all these values and VM will try them all,
3369 but not in any particular order, except that the url-w3 method
3370 will likely be tried last since it is likely to be the slowest
3371 retrieval method.
3372
3373 If `vm-url-retrieval-methods' value is nil, VM will not try to
3374 use any URL retrieval methods."
3375   :group 'vm
3376   :type '(set (const lynx)
3377               (const wget)
3378               (const w3m)
3379               (const fetch)
3380               (const curl)
3381               (const url-w3)))
3382
3383 (defcustom vm-url-browser
3384   (cond ((fboundp 'w3-fetch-other-frame)
3385          'w3-fetch-other-frame)
3386         ((fboundp 'w3-fetch)
3387          'w3-fetch)
3388         (t 'vm-mouse-send-url-to-netscape))
3389   "*Non-nil value means VM should enable URL passing.
3390 This means that VM will search for URLs (Uniform Resource
3391 Locators) in messages and make it possible for you to pass them
3392 to a World Wide Web browser.
3393
3394 Clicking mouse-2 on the URL will send it to the browser.
3395
3396 By default clicking mouse-3 on the URL will pop up a menu of
3397 browsers and you can pick which one you want to use.  If
3398 `vm-popup-menu-on-mouse-3' is set to nil, you will not see the menu.
3399
3400 Moving point to a character within the URL and pressing RETURN
3401 will send the URL to the browser.
3402
3403 If the value of `vm-url-browser' is a string, it should specify
3404 name of an external browser to run.  The URL will be passed to
3405 the program as its first argument after the program switches
3406 specified by `vm-url-browser-switches', if any.
3407
3408 If the value of `vm-url-browser' is a symbol, it should specify a
3409 Lisp function to call.  The URL will be passed to the program as
3410 its first and only argument.  Use
3411
3412    (setq vm-url-browser 'vm-mouse-send-url-to-netscape)
3413
3414 for Netscape, and
3415
3416    (setq vm-url-browser 'vm-mouse-send-url-to-mmosaic)
3417
3418 for mMosaic, and
3419
3420    (setq vm-url-browser 'vm-mouse-send-url-to-mosaic)
3421
3422 for Mosaic.  The advantage of using them is that they will display
3423 an URL using an existing Mosaic or Netscape process, if possible.
3424
3425 A nil value means VM should not enable URL passing to browsers."
3426   :group 'vm
3427   :type '(choice (const nil)
3428                  function
3429                  string))
3430
3431 (defcustom vm-url-browser-switches nil
3432   "*List of command line flags passed to the command named by
3433 `vm-url-browser'.  VM uses `vm-url-browser' to display URLs
3434 in messages when you click on them."
3435   :group 'vm
3436   :type '(repeat string))
3437
3438 (defcustom vm-highlight-url-face 'bold-italic
3439   "*Non-nil value should be a face to use display URLs found in messages.
3440 Nil means don't highlight URLs."
3441   :group 'vm-faces
3442   :type 'symbol)
3443
3444 (defcustom vm-url-search-limit 12000
3445   "*Non-nil numeric value tells VM how hard to search for URLs.
3446 The number specifies the maximum message size in characters that
3447 VM will search for URLs.  For message larger than this value, VM
3448 will search from the beginning of the message to a point
3449 `vm-url-search-limit' / 2 characters into the message.  Then VM will
3450 search from a point `vm-url-search-limit' / 2 characters from the
3451 end of the message to the end of message."
3452   :group 'vm
3453   :type '(choice (const nil) integer))
3454
3455 (defcustom vm-display-xfaces nil
3456   "*Non-nil means display images as specified in X-Face headers.
3457 This requires at least XEmacs 19.12 with native xface support compiled in."
3458   :group 'vm
3459   :type 'boolean)
3460
3461 (defcustom vm-startup-with-summary t
3462   "*Value tells VM whether to generate a summary when a folder is visited.
3463 Nil means don't automatically generate a summary.
3464
3465 A value of t means always generate a summary.
3466
3467 A positive numeric value N means only generate a summary if there
3468 are N or more messages.
3469
3470 A negative numeric value -N means only generate a summary if
3471 there are N or less messages."
3472   :group 'vm
3473   :type '(choice (const t) (const nil) integer))
3474
3475 (defcustom vm-follow-summary-cursor t
3476   "*Non-nil value causes VM to select the message under the cursor in the
3477 summary window before executing commands that operate on the current message.
3478 This occurs only when the summary buffer window is the selected window."
3479   :group 'vm
3480   :type 'boolean)
3481
3482 (defcustom vm-jump-to-new-messages t
3483   "*Non-nil value causes VM to jump to the first new message
3484 whenever such messages arrive in a folder or the first time a
3485 folder is visited.
3486
3487 See also `vm-jump-to-unread-messages'."
3488   :group 'vm
3489   :type 'boolean)
3490
3491 (defcustom vm-jump-to-unread-messages t
3492   "*Non-nil value causes VM to jump to the first unread message
3493 whenever such messages arrive in a folder or the first time a
3494 folder is visited.  New messages are considered unread in this
3495 context so new messages will be jumped to as well.
3496
3497 The value of `vm-jump-to-new-messages' takes precedence over the
3498 setting of this variable.  So if there are unread messages and
3499 new messages VM will jump to the first new message, even if an
3500 unread message appears before it in the folder, provided
3501 `vm-jump-to-new-messages' is non-nil."
3502   :group 'vm
3503   :type 'boolean)
3504
3505 (defcustom vm-skip-deleted-messages t
3506   "*Non-nil value causes VM's `n' and 'p' commands to skip over
3507 deleted messages.  A value of t causes deleted messages to always be skipped.
3508 A value that is not nil and not t causes deleted messages to be skipped only
3509 if there are other messages that are not flagged for deletion in the desired
3510 direction of motion."
3511   :group 'vm
3512   :type '(choice (const nil) (const t) (const skip-if-some-undeleted)))
3513
3514 (defcustom vm-skip-read-messages nil
3515   "*Non-nil value causes VM's `n' and `p' commands to skip over
3516 messages that have already been read, in favor of new or unread messages.
3517 A value of t causes read messages to always be skipped.  A value that is
3518 not nil and not t causes read messages to be skipped only if there are
3519 unread messages in the desired direction of motion."
3520   :group 'vm
3521   :type '(choice (const nil) (const t) (const skip-if-some-undeleted)))
3522
3523 (defcustom vm-move-after-deleting nil
3524   "*Non-nil value causes VM's `d' command to automatically invoke
3525 `vm-next-message' or `vm-previous-message' after deleting, to move
3526 past the deleted messages.  A value of t means motion should
3527 honor the value of `vm-circular-folders'.  A value that is not t
3528 and not nil means that motion should be done as if
3529 `vm-circular-folders' is set to nil."
3530   :group 'vm
3531   :type '(choice (const nil) (const t) (const skip-if-some-undeleted)))
3532
3533 (defcustom vm-move-after-undeleting nil
3534   "*Non-nil value causes VM's `u' command to automatically invoke
3535 `vm-next-message' or `vm-previous-message' after undeleting, to move
3536 past the undeleted messages.  A value of t means motion should
3537 honor the value of `vm-circular-folders'.  A value that is not t
3538 and not nil means that motion should be done as if
3539 `vm-circular-folders' is set to nil."
3540   :group 'vm
3541   :type '(choice (const nil) (const t) (const skip-if-some-undeleted)))
3542
3543 (defcustom vm-move-after-killing nil
3544   "*Non-nil value causes VM's `k' command to automatically invoke
3545 `vm-next-message' or `vm-previous-message' after killing messages, to try
3546 to move past the deleted messages.  A value of t means motion
3547 should honor the value of `vm-circular-folders'.  A value that is
3548 not t and not nil means that motion should be done as if
3549 `vm-circular-folders' is set to nil."
3550   :group 'vm
3551   :type '(choice (const nil) (const t) (const skip-if-some-undeleted)))
3552
3553 (defcustom vm-delete-after-saving nil
3554   "*Non-nil value causes VM automatically to mark messages for deletion
3555 after successfully saving them to a folder."
3556   :group 'vm
3557   :type 'boolean)
3558
3559 (defcustom vm-delete-after-archiving nil
3560   "*Non-nil value causes VM automatically to mark messages for deletion
3561 after successfully auto-archiving them with the `vm-auto-archive-messages'
3562 command."
3563   :group 'vm
3564   :type 'boolean)
3565
3566 (defcustom vm-delete-after-bursting nil
3567   "*Non-nil value causes VM automatically to mark a message for deletion
3568 after it has been successfully burst by the `vm-burst-digest' command."
3569   :group 'vm
3570   :type 'boolean)
3571
3572 (defcustom vm-circular-folders nil
3573   "*Value determines whether VM folders will be considered circular by
3574 various commands.  `Circular' means VM will wrap from the end of the folder
3575 to the start and vice versa when moving the message pointer, or deleting,
3576 undeleting or saving messages before or after the current message.
3577
3578 A value of t causes all VM commands to consider folders circular.
3579
3580 A value of nil causes all of VM commands to signal an error if the start
3581 or end of the folder would have to be passed to complete the command.
3582 For movement commands, this occurs after the message pointer has been
3583 moved as far as possible in the specified direction.  For other commands,
3584 the error occurs before any part of the command has been executed, i.e.
3585 no deletions, saves, etc. will be done unless they can be done in their
3586 entirety.
3587
3588 A value that is not nil and not t causes only VM's movement commands to
3589 consider folders circular.  Saves, deletes and undelete commands will
3590 behave the same as if the value is nil."
3591   :group 'vm
3592   :type '(choice (const nil) (const t) (const for-movement-only)))
3593
3594 (defcustom vm-search-using-regexps nil
3595   "*Non-nil value causes VM's search command to interpret user input as a
3596 regular expression instead of as a literal string."
3597   :group 'vm
3598   :type 'boolean)
3599
3600 (defcustom vm-move-messages-physically nil
3601   "*Non-nil value causes VM's commands that change the message order
3602 of a folder to always move the physical messages involved and not
3603 just change the presentation order.  Nil means that commands just
3604 change the order in which VM displays messages and leave the
3605 folder itself undisturbed."
3606   :group 'vm
3607   :type 'boolean)
3608
3609 (defcustom vm-edit-message-mode 'text-mode
3610   "*Major mode to use when editing messages in VM."
3611   :group 'vm
3612   :type 'function)
3613
3614 (defvar lpr-command)
3615 (defcustom vm-print-command (if (boundp 'lpr-command) lpr-command "lpr")
3616   "*Command VM uses to print messages."
3617   :group 'vm
3618   :type '(choice string (const nil)))
3619
3620 (defvar lpr-switches)
3621 (defcustom vm-print-command-switches (if (boundp 'lpr-switches) lpr-switches nil)
3622   "*List of command line flags passed to the command named by
3623 `vm-print-command'.  VM uses `vm-print-command' to print
3624 messages."
3625   :group 'vm
3626   :type '(repeat string))
3627
3628 (defcustom vm-berkeley-mail-compatibility
3629   (memq system-type '(berkeley-unix netbsd))
3630   "*Non-nil means to read and write BSD Mail(1) style Status: headers.
3631 This makes sense if you plan to use VM to read mail archives created by
3632 Mail."
3633   :group 'vm
3634   :type 'boolean)
3635
3636 (defcustom vm-strip-reply-headers nil
3637   "*Non-nil value causes VM to strip away all comments and extraneous text
3638 from the headers generated in reply messages.  If you use the \"fakemail\"
3639 program as distributed with Emacs, you probably want to set this variable
3640 to t, because as of Emacs v18.52 \"fakemail\" could not handle unstripped
3641 headers."
3642   :group 'vm
3643   :type 'boolean)
3644
3645 (defcustom vm-select-new-message-hook nil
3646   "*List of hook functions called every time a message with the 'new'
3647 attribute is made to be the current message.  When the hooks are run, the
3648 current buffer will be the folder containing the message and the
3649 start and end of the message will be bracketed by (point-min) and
3650 (point-max)."
3651   :group 'vm
3652   :type 'hook)
3653
3654 (defcustom vm-select-unread-message-hook nil
3655   "*List of hook functions called every time a message with the 'unread'
3656 attribute is made to be the current message.  When the hooks are run, the
3657 current buffer will be the folder containing the message and the
3658 start and end of the message will be bracketed by (point-min) and
3659 (point-max)."
3660   :group 'vm
3661   :type 'hook)
3662
3663 (defcustom vm-select-message-hook nil
3664   "*List of hook functions called every time a message
3665 is made to be the current message.  When the hooks are run, the
3666 current buffer will be the folder containing the message and the
3667 start and end of the message will be bracketed by (point-min) and
3668  (point-max)."
3669   :group 'vm
3670   :type 'hook)
3671
3672 (defcustom vm-showing-message-hook nil
3673   "*List of hook functions called every time a message is showed.
3674 When the hooks are run, the current buffer will be the folder containing the
3675 message and the start and end of the message will be bracketed by (point-min)
3676 and (point-max)."
3677   :group 'vm
3678   :type 'hook)
3679
3680 (defcustom vm-arrived-message-hook nil
3681   "*List of hook functions called once for each message gathered from
3682 the system mail spool, or from another folder with
3683 `vm-get-new-mail', or from a digest with `vm-burst-digest'.  When the
3684 hooks are run, the current buffer will be the folder containing
3685 the message and the start and end of the message will be
3686 bracketed by (point-min) and (point-max)."
3687   :group 'vm
3688   :type 'hook)
3689
3690 (defcustom vm-spooled-mail-waiting-hook nil
3691   "*List of functions called when VM first notices mail is spooled
3692 for a folder.  The folder buffer will be current when the hooks are
3693 run."
3694   :group 'vm
3695   :type 'hook)
3696
3697 (defcustom vm-arrived-messages-hook nil
3698   "*List of hook functions called after VM has gathered a group of
3699 messages from the system mail spool, or from another folder with
3700 `vm-get-new-mail', or from a digest with `vm-burst-digest'.  When the
3701 hooks are run, the new messages will have already been added to
3702 the message list but may not yet appear in the summary.
3703 Also, the current buffer will be the folder containing
3704 the messages."
3705   :group 'vm
3706   :type 'hook)
3707
3708 (defcustom vm-reply-hook nil
3709   "*List of hook functions to be run after a Mail mode
3710 composition buffer has been created for a reply.  VM runs this
3711 hook and then runs `vm-mail-mode-hook' before leaving the user in
3712 the Mail mode buffer."
3713   :group 'vm
3714   :type 'hook)
3715
3716 (defcustom vm-forward-message-hook nil
3717   "*List of hook functions to be run after a Mail mode
3718 composition buffer has been created to forward a message.  VM
3719 runs this hook and then runs `vm-mail-mode-hook' before leaving the
3720 user in the Mail mode buffer."
3721   :group 'vm
3722   :type 'hook)
3723
3724 (defcustom vm-resend-bounced-message-hook nil
3725   "*List of hook functions to be run after a Mail mode
3726 composition buffer has been created to resend a bounced message.
3727 VM runs this hook and then runs `vm-mail-mode-hook' before leaving
3728 the user in the Mail mode buffer."
3729   :group 'vm
3730   :type 'hook)
3731
3732 (defcustom vm-resend-message-hook nil
3733   "*List of hook functions to be run after a Mail mode
3734 composition buffer has been created to resend a message.
3735 VM runs this hook and then runs `vm-mail-mode-hook' before leaving
3736 the user in the Mail mode buffer."
3737   :group 'vm
3738   :type 'hook)
3739
3740 (defcustom vm-send-digest-hook nil
3741   "*List of hook functions to be run after a Mail mode
3742 composition buffer has been created to send a digest.
3743 VM runs this hook and then runs `vm-mail-mode-hook' before leaving
3744 the user in the Mail mode buffer."
3745   :group 'vm
3746   :type 'hook)
3747
3748 (defcustom vm-mail-hook nil
3749   "*List of hook functions to be run after a Mail mode
3750 composition buffer has been created to send a non specialized
3751 message, i.e. a message that is not a reply, forward, digest,
3752 etc.  VM runs this hook and then runs `vm-mail-mode-hook' before
3753 leaving the user in the Mail mode buffer."
3754   :group 'vm
3755   :type 'hook)
3756
3757 (defcustom vm-summary-update-hook nil
3758   "*List of hook functions called just after VM updates an existing
3759 entry a folder summary."
3760   :group 'vm
3761   :type 'hook)
3762
3763 (defcustom vm-summary-redo-hook nil
3764   "*List of hook functions called just after VM adds or deletes
3765 entries from a folder summary."
3766   :group 'vm
3767   :type 'hook)
3768
3769 (defcustom vm-visit-folder-hook nil
3770   "*List of hook functions called just after VM visits a folder.
3771 It doesn't matter if the folder buffer already exists, this hook
3772 is run each time `vm' or `vm-visit-folder' is called interactively.
3773 It is NOT run after `vm-mode' is called."
3774   :group 'vm
3775   :type 'hook)
3776
3777 (defcustom vm-retrieved-spooled-mail-hook nil
3778   "*List of hook functions called just after VM has retrieved
3779 a group of messages from your system mailbox(es).  When these
3780 hooks are run, the messages have been added to the folder buffer
3781 but not the message list or summary.  When the hooks are run, the
3782 current buffer will be the folder where the messages were
3783 incorporated."
3784   :group 'vm
3785   :type 'hook)
3786
3787 (defcustom vm-edit-message-hook nil
3788   "*List of hook functions to be run just before a message is edited.
3789 This is the last thing `vm-edit-message' does before leaving the user
3790 in the edit buffer."
3791   :group 'vm
3792   :type 'hook)
3793
3794 (defcustom vm-mail-mode-hook nil
3795   "*List of hook functions to be run after a Mail mode
3796 composition buffer has been created.  This is the last thing VM
3797 does before leaving the user in the Mail mode buffer."
3798   :group 'vm
3799   :type 'hook)
3800
3801 (defcustom vm-mode-hook nil
3802   "*List of hook functions to run when a buffer enters `vm-mode'.
3803 These hook functions should generally be used to set key bindings
3804 and local variables."
3805   :group 'vm
3806   :type 'hook)
3807
3808 (defcustom vm-mode-hooks nil
3809   "*Old name for `vm-mode-hook'.
3810 Supported for backward compatibility.
3811 You should use the new name."
3812   :group 'vm
3813   :type 'hook)
3814
3815 (defcustom vm-summary-mode-hook nil
3816   "*List of hook functions to run when a VM summary buffer is created.
3817 The current buffer will be that buffer when the hooks are run."
3818   :group 'vm
3819   :type 'hook)
3820
3821 (defcustom vm-summary-mode-hooks nil
3822   "*Old name for `vm-summary-mode-hook'.
3823 Supported for backward compatibility.
3824 You should use the new name."
3825   :group 'vm
3826   :type 'hook)
3827
3828 (defcustom vm-folders-summary-mode-hook nil
3829   "*List of hook functions to run when a VM folders summary buffer is created.
3830 The current buffer will be that buffer when the hooks are run."
3831   :group 'vm
3832   :type 'hook)
3833
3834 (defcustom vm-virtual-mode-hook nil
3835   "*List of hook functions to run when a VM virtual folder buffer is created.
3836 The current buffer will be that buffer when the hooks are run."
3837   :group 'vm
3838   :type 'hook)
3839
3840 (defcustom vm-presentation-mode-hook nil
3841   "*List of hook functions to run when a VM presentation buffer is created.
3842 The current buffer will be the new presentation buffer when the hooks are run.
3843 Presentation buffers are used to display messages when some type of decoding
3844 must be done to the message to make it presentable.  E.g. MIME decoding."
3845   :group 'vm
3846   :type 'hook)
3847
3848 (defcustom vm-quit-hook nil
3849   "*List of hook functions to run when you quit VM.
3850 This applies to any VM quit command."
3851   :group 'vm
3852   :type 'hook)
3853
3854 (defcustom vm-summary-pointer-update-hook nil
3855   "*List of hook functions to run when the VM summary pointer is updated.
3856 When the hooks are run, the current buffer will be the summary buffer."
3857   :group 'vm
3858   :type 'hook)
3859
3860 (defcustom vm-display-buffer-hook nil
3861   "*List of hook functions that are run every time VM wants to
3862 display a buffer.  When the hooks are run, the current buffer will
3863 be the buffer that VM wants to display.  The hooks are expected
3864 to select a window and VM will display the buffer in that
3865 window.
3866
3867 If you use display hooks, you should not use VM's builtin window
3868 configuration system as the result is likely to be confusing."
3869   :group 'vm
3870   :type 'hook)
3871
3872 (defcustom vm-undisplay-buffer-hook nil
3873   "*List of hook functions that are run every time VM wants to
3874 remove a buffer from the display.  When the hooks are run, the
3875 current buffer will be the buffer that VM wants to disappear.
3876 The hooks are expected to do the work of removing the buffer from
3877 the display.  The hook functions should not kill the buffer.
3878
3879 If you use undisplay hooks, you should not use VM's builtin
3880 window configuration system as the result is likely to be
3881 confusing."
3882   :group 'vm
3883   :type 'hook)
3884
3885 (defcustom vm-iconify-frame-hook nil
3886   "*List of hook functions that are run whenever VM iconifies a frame."
3887   :group 'vm
3888   :type 'hook)
3889
3890 (defcustom vm-menu-setup-hook nil
3891   "*List of hook functions that are run just after all menus are initialized."
3892   :group 'vm
3893   :type 'hook)
3894
3895 (defcustom vm-mime-display-function nil
3896   "*If non-nil, this should name a function to be called inside
3897 `vm-decode-mime-message' to do the MIME display the current
3898 message.  The function is called with no arguments, and at the
3899 time of the call the current buffer will be the `presentation'
3900 buffer for the folder, which is a temporary buffer that VM uses
3901 for the display of MIME messages.  A copy of the current message
3902 will be in the presentation buffer at that time.  The normal work
3903 that `vm-decode-mime-message' would do is not done, because this
3904 function is expected to subsume all of it."
3905   :group 'vm
3906   :type 'function)
3907
3908 (defcustom vm-mime-deleted-object-label "[Deleted %f (%d;%t)]\n"
3909   "*The label that will be inserted instead of the original mime object.
3910 See `vm-mime-compile-format-1' for valid format specifiers."
3911   :group 'vm
3912   :type 'string)
3913
3914 (defcustom vm-mime-show-alternatives nil
3915   "*Show alternative for multipart/alternative parts."
3916   :group 'vm
3917   :type 'boolean)
3918
3919 (defcustom vm-imap-session-preauth-hook nil
3920   "*List of hook functions to call to generate an preauthenticated
3921 IMAP session process.  This hook is only run if the
3922 authentication method for the IMAP mailbox is ``preauth''.  Each
3923 hook is called with five arguments: HOST, PORT, MAILBOX, USER,
3924 PASSWORD.  (See the documentation for `vm-spool-files' to find out
3925 about these arguments.)  It is the responsibility of the hook
3926 function to create an Emacs process whose input/output streams
3927 are connected to an authenticated IMAP session, and to return
3928 this process.  If the hook cannot accomplish this,
3929 it should return nil.  If all the hooks return nil, VM will
3930 signal an error.
3931
3932 At the time the hook is run, the current buffer will be the
3933 buffer any created process should be associated with. (The BUFFER
3934 argument to start-process or open-network-stream should be
3935 (current-bfufer).)"
3936   :group 'vm
3937   :type 'hook)
3938
3939 (defcustom vm-mail-send-hook nil
3940   "*List of hook functions to call just before sending a message.
3941 The hooks are run after confirming that you want to send the
3942 message (see `vm-confirm-mail-send') but before MIME encoding and
3943 FCC processing."
3944   :group 'vm
3945   :type 'hook)
3946
3947 (defvar mail-yank-hooks nil
3948   "Hooks called after a message is yanked into a mail composition buffer.
3949
3950    (This hook is deprecated, you should use mail-citation-hook instead.)
3951
3952 The value of this hook is a list of functions to be run.
3953 Each hook function can find the newly yanked message between point and mark.
3954 Each hook function should return with point and mark around the yanked message.
3955
3956 See the documentation for `vm-yank-message' to see when VM will run
3957 these hooks.")
3958
3959 (defcustom mail-citation-hook nil
3960   "*Hook for modifying a citation just inserted in the mail buffer.
3961 Each hook function can find the citation between (point) and (mark t).
3962 And each hook function should leave point and mark around the citation
3963 text as modified.
3964
3965 If this hook is entirely empty (nil), a default action is taken
3966 instead of no action."
3967   :group 'vm
3968   :type 'hook)
3969
3970 (defcustom mail-default-headers nil
3971   "*A string containing header lines, to be inserted in outgoing messages.
3972 It is inserted before you edit the message,
3973 so you can edit or delete these lines."
3974   :group 'vm
3975   :type '(choice (const nil) string))
3976
3977 (defcustom mail-signature nil
3978   "*Text inserted at end of mail buffer when a message is initialized.
3979 If t, it means to insert the contents of the file `~/.signature'."
3980   :group 'vm
3981   :type '(choice (const nil) (const t) string))
3982
3983 (defcustom vm-rename-current-buffer-function nil
3984   "*Non-nil value should be a function to call to rename a buffer.
3985 Value should be something that can be passed to `funcall'.  If
3986 this variable is non-nil, VM will use this function instead of
3987 its own buffer renaming code.  The buffer to be renamed will be
3988 the current buffer when the function is called."
3989   :group 'vm
3990   :type 'function)
3991
3992 (defvar mode-popup-menu nil
3993   "The mode-specific popup menu.  Automatically buffer local.
3994 By default, when you press mouse-3 in VM, this menu is popped up.")
3995 (make-variable-buffer-local 'mode-popup-menu)
3996
3997 (defcustom vm-movemail-program "movemail"
3998   "*Name of program to use to move mail from the system spool
3999 to another location.  Normally this should be the movemail
4000 program distributed with Emacs.  If you use another program, it must
4001 accept as its last two arguments the spool file (or maildrop) from which
4002 mail is retrieved, and the local file where the retrieved mail
4003 should be stored."
4004   :group 'vm
4005   :type 'string)
4006
4007 (defcustom vm-movemail-program-switches nil
4008   "*List of command line flags to pass to the movemail program
4009 named by `vm-movemail-program'."
4010   :group 'vm
4011   :type '(repeat string))
4012
4013 (defcustom vm-netscape-program "netscape"
4014   "*Name of program to use to run Netscape.
4015 `vm-mouse-send-url-to-netscape' uses this."
4016   :group 'vm
4017   :type 'string)
4018
4019 (defcustom vm-netscape-program-switches nil
4020   "*List of command line switches to pass to Netscape."
4021   :group 'vm
4022   :type '(repeat string))
4023
4024 (defcustom vm-opera-program "opera"
4025   "*Name of program to use to run Opera.
4026 `vm-mouse-send-url-to-opera' uses this."
4027   :group 'vm
4028   :type 'string)
4029
4030 (defcustom vm-opera-program-switches nil
4031   "*List of command line switches to pass to Opera."
4032   :group 'vm
4033   :type '(repeat string))
4034
4035 (defcustom vm-mozilla-program "mozilla"
4036   "*Name of program to use to run Mozilla.
4037 `vm-mouse-send-url-to-mozilla' uses this."
4038   :group 'vm
4039   :type 'string)
4040
4041 (defcustom vm-mozilla-program-switches nil
4042   "*List of command line switches to pass to Mozilla."
4043   :group 'vm
4044   :type '(repeat string))
4045
4046 (defcustom vm-mosaic-program "Mosaic"
4047   "*Name of program to use to run Mosaic.
4048 `vm-mouse-send-url-to-mosaic' uses this."
4049   :group 'vm
4050   :type 'string)
4051
4052 (defcustom vm-mosaic-program-switches nil
4053   "*List of command line switches to pass to Mosaic."
4054   :group 'vm
4055   :type '(repeat string))
4056
4057 (defcustom vm-mmosaic-program "mMosaic"
4058   "*Name of program to use to run mMosaic.
4059 `vm-mouse-send-url-to-mosaic' uses this."
4060   :group 'vm
4061   :type 'string)
4062
4063 (defcustom vm-mmosaic-program-switches nil
4064   "*List of command line switches to pass to mMosaic."
4065   :group 'vm
4066   :type '(repeat string))
4067
4068 (defcustom vm-konqueror-program "konqueror"
4069   "*Name of program to use to run Konqueror.
4070 `vm-mouse-send-url-to-konqueror' uses this."
4071   :group 'vm
4072   :type 'string)
4073
4074 (defcustom vm-konqueror-program-switches nil
4075   "*List of command line switches to pass to Konqueror."
4076   :group 'vm
4077   :type '(repeat string))
4078
4079 (defcustom vm-konqueror-client-program "kfmclient"
4080   "*Name of program to use to issue requests to Konqueror.
4081 `vm-mouse-send-url-to-konqueror' uses this."
4082   :group 'vm
4083   :type 'string)
4084
4085 (defcustom vm-konqueror-client-program-switches nil
4086   "*List of command line switches to pass to Konqueror client."
4087   :group 'vm
4088   :type '(repeat string))
4089
4090 (defcustom vm-firefox-program "firefox"
4091   "*Name of program to use to run Mozilla Firefox.
4092 `vm-mouse-send-url-to-firefox' uses this."
4093   :group 'vm
4094   :type 'string)
4095
4096 (defcustom vm-firefox-program-switches nil
4097   "*List of command line switches to pass to Mozilla Firefox."
4098   :group 'vm
4099   :type '(repeat string))
4100
4101 (defcustom vm-firefox-client-program "firefox"
4102   "*Name of program to use to issue requests to Mozilla Firefox.
4103 `vm-mouse-send-url-to-firefox' uses this."
4104   :group 'vm
4105   :type 'string)
4106
4107 (defcustom vm-firefox-client-program-switches '("-remote")
4108   "*List of command line switches to pass to Mozilla Firefox client."
4109   :group 'vm
4110   :type '(repeat string))
4111
4112 (defcustom vm-wget-program "wget"
4113   "*Name of program to use to run wget.
4114 This is used to retrieve URLs."
4115   :group 'vm
4116   :type 'string)
4117
4118 (defcustom vm-w3m-program "w3m"
4119   "*Name of program to use to run w3m.
4120 This is used to retrieve URLs."
4121   :group 'vm
4122   :type 'string)
4123
4124 (defcustom vm-fetch-program "fetch"
4125   "*Name of program to use to run fetch.
4126 This is used to retrieve URLs.  Fetch is part of the standard
4127 FreeBSD installation."
4128   :group 'vm
4129   :type 'string)
4130
4131 (defcustom vm-curl-program "curl"
4132   "*Name of program to use to run curl.
4133 This is used to retrieve URLs."
4134   :group 'vm
4135   :type 'string)
4136
4137 (defcustom vm-lynx-program "lynx"
4138   "*Name of program to use to run lynx.
4139 This is used to retrieve URLs."
4140   :group 'vm
4141   :type 'string)
4142
4143 (defcustom vm-grep-program "grep"
4144   "*Name of program to use to run grep.
4145 This is used to count message separators in folders.
4146 Set this to nil and VM will not use it."
4147   :group 'vm
4148   :type '(choice string (const nil)))
4149
4150 (defcustom vm-stunnel-program "stunnel"
4151   "*Name of program to use to run stunnel.
4152 This is used to make SSL connections to POP and IMAP servers that
4153 support SSL.  Set this to nil and VM will not use it."
4154   :group 'vm
4155   :type '(choice string (const nil)))
4156
4157 (defcustom vm-stunnel-program-switches nil
4158   "*List of command line switches to pass to stunnel.
4159 Leave this set to nil unless you understand how VM uses stunnel
4160 and know that you need to change something to get stunnel working.
4161 This variable is ignored if you're running stunnel version 4 or
4162 later versions, since those versions of stunnel are configurable
4163 only with a configuration file."
4164   :group 'vm
4165   :type '(list string))
4166
4167 (defcustom vm-stunnel-program-additional-configuration-file nil
4168   "*Name of a configuration file to append to the config file VM creates
4169 when using stunnel version 4 or later.  Leave this set to nil
4170 unless you understand how VM uses stunnel and know that you need
4171 to change something to get stunnel working.
4172
4173 For stunnel version 4 and beyond stunnel relies on a configuration
4174 file to tell it what to do.  VM builts te ncessary configuration
4175 file for each instance of stunnel that it runs.  If you have extra
4176 configuration options you want stunnel to use, put them in a file
4177 and set vm-stunnel-program-additional-configuration-file to the
4178 name of that file.
4179
4180 This variable is ignored if you're running stunnel versions prior
4181 to version 4 as VM uses command line argument to control stunnel
4182 in those cases."
4183   :group 'vm
4184   :type 'string)
4185
4186 (defcustom vm-stunnel-random-data-method 'generate
4187   "*Specifies what VM should do about sending the PRNG.
4188 The stunnel program uses the OpenSSL library which requires a
4189 certain amount of random data to seed its pseudo-random number
4190 generator.  VM can generate this data using Emacs' random number
4191 generator or it can rely on stunnel to find the data by itself
4192 somehow.  Some systems have a /dev/urandom device that stunnel
4193 can use.  Some system have a entropy gathering daemon that can be
4194 tapped for random data.  If sufficient random data cannot be
4195 found, the OpenSSL library will refuse to work and stunnel will
4196 not be able to establish an SSL connection.
4197
4198 Setting `vm-stunnel-random-data-method' to the symbol `generate'
4199 tells VM to generate the random data.
4200
4201 A nil value tells VM to do nothing and let stunnel find the data
4202 if it can."
4203   :group 'vm
4204   :type '(choice (const nil) (const generate)))
4205
4206 (defcustom vm-ssh-program "ssh"
4207   "*Name of program to use to run SSH.
4208 This is used to build an SSH tunnel to remote POP and IMAP servers.
4209 Set this to nil and VM will not use it."
4210   :group 'vm
4211   :type '(choice string (const nil)))
4212
4213 (defcustom vm-ssh-program-switches nil
4214   "*List of command line switches to pass to SSH."
4215   :group 'vm
4216   :type '(repeat string))
4217
4218 (defcustom vm-ssh-remote-command "echo ready; sleep 15"
4219   "*Shell command to run to hold open the SSH connection.
4220 This command must generate one line of output and then
4221 sleep long enough for VM to open a port-forwarded connection.
4222 The default should work on UNIX systems."
4223   :group 'vm
4224   :type 'string)
4225
4226 (defcustom vm-uncompface-program (and vm-fsfemacs-p
4227                                    (fboundp 'image-type-available-p)
4228                                    (vm-locate-executable-file "uncompface"))
4229   "*Program used to convert X-Face data to Sun icon format.
4230 Or if the program version is new enough, it will be called with
4231 -X to produce XBM data.  This program is needed to support he
4232 display of X-Faces under Emacs 21."
4233   :group 'vm
4234   :type '(choice string (const nil)))
4235
4236 (defcustom vm-icontopbm-program (and vm-fsfemacs-p
4237                                   (fboundp 'image-type-available-p)
4238                                   (vm-locate-executable-file "icontopbm"))
4239   "*Program to convert Sun icon data to a PBM file.
4240 This program is needed to support the display of X-Faces under
4241 Emacs 21 if the uncompface program can't convert X-Face image
4242 data to XBM data."
4243   :group 'vm
4244   :type '(choice string (const nil)))
4245
4246 (defvar vm-uncompface-accepts-dash-x
4247   (and vm-fsfemacs-p (fboundp 'image-type-available-p)
4248        (stringp vm-uncompface-program)
4249        (eq 0 (string-match "#define"
4250                            (shell-command-to-string
4251                             (format "%s -X" vm-uncompface-program)))))
4252   "Non-nil if the uncompface command accepts a -X argument.
4253 This is only used for FSF Emacs currently.")
4254
4255 (defvar vm-stunnel-wants-configuration-file 'unknown
4256   "Non-nil if stunnel is controlled by a configuration file.
4257 An older stunnel version used command line arguments instead.")
4258
4259 (defcustom vm-temp-file-directory
4260   (or (getenv "TMPDIR")
4261       (and (file-directory-p "/tmp") "/tmp")
4262       (and (file-directory-p "C:\\TEMP") "C:\\TEMP")
4263       (and (file-directory-p "C:\\") "C:\\")
4264       "/tmp")
4265   "*Name of a directory where VM can put temporary files."
4266   :group 'vm
4267   :type 'directory)
4268
4269 (defcustom vm-tale-is-an-idiot nil
4270   "*Non-nil value causes `vm-mail-send' to check multi-line recipient
4271 headers of outbound mail for lines that don't end with a
4272 comma.  If such a line is found, an error is signaled and the
4273 mail is not sent."
4274   :group 'vm
4275   :type 'boolean)
4276
4277 (defun vm-octal (n)
4278   (let ((val 0) digit (expo 1))
4279     (while (> n 0)
4280       (setq digit (% n 10))
4281       (if (>= digit 8)
4282           (error "invalid octal digit: %d" digit))
4283       (setq val (+ val (* digit expo))
4284             n (/ n 10)
4285             expo (* expo 8)))
4286     val ))
4287
4288 (defcustom vm-default-folder-permission-bits (vm-octal 600)
4289   "*Default UNIX permission bits for newly created folders."
4290   :group 'vm
4291   :type 'integer)
4292
4293 (defcustom vm-coding-system-priorities '(iso-8859-1 iso-8859-15 utf-8)
4294   "*List of coding systems for VM-MIME to use, in order of preference."
4295   :group 'vm
4296   :type 'sexp)
4297
4298 (defcustom vm-mime-ucs-list '(utf-8 iso-2022-jp ctext escape-quoted)
4299   "*List of coding systems that can encode all characters known to emacs."
4300   :group 'vm
4301   :type 'sexp)
4302
4303 (defcustom vm-drop-buffer-name-chars nil
4304   "*Regexp used to replace chars in composition buffer names.
4305 If non-nil buffer names will be cleaned to avoid save problems.
4306 If t, 8bit chars are replaced by a \"_\", if a string it should
4307 be a regexp matching all chars to be replaced by a \"_\"."
4308   :group 'vm
4309   :type '(choice (const :tag "Disabled" nil)
4310                  (regexp :tag "8bit chars" "[^\x0-\x80]")
4311                  (regexp :tag "Custom regexp")))
4312
4313 (defconst vm-maintainer-address "hack@robf.de"
4314   "Where to send VM bug reports.")
4315
4316 (defvar vm-mode-map
4317   (let ((map (make-keymap)))
4318 ;; unneeded now that VM buffers all have buffer-read-only == t.
4319 ;;    (suppress-keymap map)
4320     (define-key map "h" 'vm-summarize)
4321     (define-key map "H" 'vm-folders-summarize)
4322     (define-key map "\M-n" 'vm-next-unread-message)
4323     (define-key map "\M-p" 'vm-previous-unread-message)
4324     (define-key map "n" 'vm-next-message)
4325     (define-key map "p" 'vm-previous-message)
4326     (define-key map "N" 'vm-next-message-no-skip)
4327     (define-key map "P" 'vm-previous-message-no-skip)
4328     (define-key map "\C-\M-n" 'vm-move-message-forward)
4329     (define-key map "\C-\M-p" 'vm-move-message-backward)
4330     (define-key map "\t" 'vm-goto-message-last-seen)
4331     (define-key map "\r" 'vm-goto-message)
4332     (define-key map "\M-g" 'vm-goto-message)
4333     (define-key map "^" 'vm-goto-parent-message)
4334     (define-key map "t" 'vm-expose-hidden-headers)
4335     (define-key map " " 'vm-scroll-forward)
4336     (define-key map "b" 'vm-scroll-backward)
4337     (define-key map "\C-?" 'vm-scroll-backward)
4338     (define-key map [delete] 'vm-scroll-backward)
4339     (define-key map [backspace] 'vm-scroll-backward)
4340     (define-key map "D" 'vm-decode-mime-message)
4341     (define-key map "d" 'vm-delete-message)
4342     (define-key map "\C-d" 'vm-delete-message-backward)
4343     (define-key map "u" 'vm-undelete-message)
4344     (define-key map "U" 'vm-unread-message)
4345     (define-key map "e" 'vm-edit-message)
4346     (define-key map "a" 'vm-set-message-attributes)
4347     (define-key map "j" 'vm-discard-cached-data)
4348     (define-key map "k" 'vm-kill-subject)
4349     (define-key map "f" 'vm-followup)
4350     (define-key map "F" 'vm-followup-include-text)
4351     (define-key map "r" 'vm-reply)
4352     (define-key map "R" 'vm-reply-include-text)
4353     (define-key map "\M-r" 'vm-resend-bounced-message)
4354     (define-key map "B" 'vm-resend-message)
4355     (define-key map "z" 'vm-forward-message)
4356     (define-key map "c" 'vm-continue-composing-message)
4357     (define-key map "@" 'vm-send-digest)
4358     (define-key map "*" 'vm-burst-digest)
4359     (define-key map "m" 'vm-mail)
4360     (define-key map "g" 'vm-get-new-mail)
4361     (define-key map "G" 'vm-sort-messages)
4362     (define-key map "v" 'vm-visit-folder)
4363     (define-key map "s" 'vm-save-message)
4364     (define-key map "w" 'vm-save-message-sans-headers)
4365     (define-key map "A" 'vm-auto-archive-messages)
4366     (define-key map "S" 'vm-save-folder)
4367     (define-key map "||" 'vm-pipe-message-to-command)
4368     (define-key map "|d" 'vm-pipe-message-to-command-discard-output)
4369     (define-key map "|s" 'vm-pipe-messages-to-command)
4370     (define-key map "|n" 'vm-pipe-messages-to-command-discard-output)
4371     (define-key map "###" 'vm-expunge-folder)
4372     (cond ((fboundp 'set-keymap-prompt)
4373            (set-keymap-prompt (lookup-key map "#")
4374                                "(Type # twice more to expunge)")
4375            (set-keymap-prompt (lookup-key map "##")
4376                                "(Type # once more to expunge)")))
4377     (define-key map "q" 'vm-quit)
4378     (define-key map "x" 'vm-quit-no-change)
4379     (define-key map "i" 'vm-iconify-frame)
4380     (define-key map "?" 'vm-help)
4381     (define-key map "\C-_" 'vm-undo)
4382     (define-key map [(control /)] 'vm-undo)
4383     (define-key map "\C-xu" 'vm-undo)
4384     (define-key map "!" 'shell-command)
4385     (define-key map "<" 'vm-beginning-of-message)
4386     (define-key map ">" 'vm-end-of-message)
4387     (define-key map "[" 'vm-move-to-previous-button)
4388     (define-key map "]" 'vm-move-to-next-button)
4389     (define-key map "\M-s" 'vm-isearch-forward)
4390     (define-key map "=" 'vm-summarize)
4391     (define-key map "L" 'vm-load-init-file)
4392     (define-key map "\M-l" 'vm-edit-init-file)
4393     (define-key map "l" (make-sparse-keymap))
4394     (define-key map "la" 'vm-add-message-labels)
4395     (define-key map "le" 'vm-add-existing-message-labels)
4396     (define-key map "ld" 'vm-delete-message-labels)
4397     (define-key map "V" (make-sparse-keymap))
4398     (define-key map "VV" 'vm-visit-virtual-folder)
4399     (define-key map "VC" 'vm-create-virtual-folder)
4400     (define-key map "VA" 'vm-create-virtual-folder-same-author)
4401     (define-key map "VS" 'vm-create-virtual-folder-same-subject)
4402     (define-key map "VX" 'vm-apply-virtual-folder)
4403     (define-key map "VM" 'vm-toggle-virtual-mirror)
4404     (define-key map "V?" 'vm-virtual-help)
4405     (define-key map "M" (make-sparse-keymap))
4406     (define-key map "MN" 'vm-next-command-uses-marks)
4407     (define-key map "Mn" 'vm-next-command-uses-marks)
4408     (define-key map "MM" 'vm-mark-message)
4409     (define-key map "MU" 'vm-unmark-message)
4410     (define-key map "Mm" 'vm-mark-all-messages)
4411     (define-key map "Mu" 'vm-clear-all-marks)
4412     (define-key map "MC" 'vm-mark-matching-messages)
4413     (define-key map "Mc" 'vm-unmark-matching-messages)
4414     (define-key map "MT" 'vm-mark-thread-subtree)
4415     (define-key map "Mt" 'vm-unmark-thread-subtree)
4416     (define-key map "MS" 'vm-mark-messages-same-subject)
4417     (define-key map "Ms" 'vm-unmark-messages-same-subject)
4418     (define-key map "MA" 'vm-mark-messages-same-author)
4419     (define-key map "Ma" 'vm-unmark-messages-same-author)
4420     (define-key map "MR" 'vm-mark-summary-region)
4421     (define-key map "Mr" 'vm-unmark-summary-region)
4422     (define-key map "MV" 'vm-toggle-all-marks)
4423     (define-key map "MX" 'vm-mark-matching-messages-with-virtual-folder)
4424     (define-key map "Mx" 'vm-unmark-matching-messages-with-virtual-folder)
4425     (define-key map "M?" 'vm-mark-help)
4426     (define-key map "W" (make-sparse-keymap))
4427     (define-key map "WW" 'vm-apply-window-configuration)
4428     (define-key map "WS" 'vm-save-window-configuration)
4429     (define-key map "WD" 'vm-delete-window-configuration)
4430     (define-key map "W?" 'vm-window-help)
4431     (define-key map "\C-t" 'vm-toggle-threads-display)
4432     (define-key map "\C-x\C-s" 'vm-save-buffer)
4433     (define-key map "\C-x\C-w" 'vm-write-file)
4434     (define-key map "\C-x\C-q" 'vm-toggle-read-only)
4435     (define-key map "%" 'vm-change-folder-type)
4436     (define-key map "\M-C" 'vm-show-copying-restrictions)
4437     (define-key map "\M-W" 'vm-show-no-warranty)
4438     ;; suppress-keymap provides these, but now that we don't use
4439     ;; suppress-keymap anymore...
4440     (define-key map "0" 'digit-argument)
4441     (define-key map "1" 'digit-argument)
4442     (define-key map "2" 'digit-argument)
4443     (define-key map "3" 'digit-argument)
4444     (define-key map "4" 'digit-argument)
4445     (define-key map "5" 'digit-argument)
4446     (define-key map "6" 'digit-argument)
4447     (define-key map "7" 'digit-argument)
4448     (define-key map "8" 'digit-argument)
4449     (define-key map "9" 'digit-argument)
4450     (define-key map "-" 'negative-argument)
4451     (cond ((fboundp 'set-keymap-name)
4452            (set-keymap-name map 'vm-mode-map)
4453            (set-keymap-name (lookup-key map "l")
4454                             "VM mode message labels map")
4455            (set-keymap-name (lookup-key map "V")
4456                             "VM mode virtual folders map")
4457            (set-keymap-name (lookup-key map "M")
4458                             "VM mode message marks map")
4459            (set-keymap-name (lookup-key map "W")
4460                             "VM mode window configuration map")))
4461
4462     map )
4463   "Keymap for VM mode.")
4464
4465 (defvar vm-summary-mode-map vm-mode-map
4466   "Keymap for VM Summary mode")
4467
4468 (defvar vm-folders-summary-mode-map vm-mode-map
4469   "Keymap for VM Folders Summary mode")
4470
4471 (defvar vm-mail-mode-map
4472   (let ((map (make-sparse-keymap)))
4473     (define-key map "\C-c\C-v" vm-mode-map)
4474     (define-key map "\C-c\C-p" 'vm-preview-composition)
4475     (define-key map "\C-c\C-d" 'vm-postpone-message)
4476     (define-key map "\C-c\C-e" 'vm-mime-encode-composition)
4477     (define-key map "\C-c\C-a" 'vm-mime-attach-file)
4478     (define-key map "\C-c\C-b" 'vm-mime-attach-buffer)
4479     (define-key map "\C-c\C-m" 'vm-mime-attach-message)
4480     (define-key map "\C-c\C-y" 'vm-yank-message)
4481     (define-key map "\C-c\C-s" 'vm-mail-send)
4482     (define-key map "\C-c\C-c" 'vm-mail-send-and-exit)
4483     (cond ((fboundp 'set-keymap-name)
4484            (set-keymap-name map 'vm-mail-mode-map)))
4485     map )
4486   "Keymap for VM Mail mode buffers.
4487 Its parent keymap is mail-mode-map.")
4488
4489 (defvar vm-edit-message-map
4490   (let ((map (make-sparse-keymap)))
4491     (define-key map "\C-c\C-v" vm-mode-map)
4492     (define-key map "\C-c\e" 'vm-edit-message-end)
4493     (define-key map "\C-c\C-c" 'vm-edit-message-end)
4494     (define-key map "\C-c\C-]" 'vm-edit-message-abort)
4495     (cond ((fboundp 'set-keymap-name)
4496            (set-keymap-name map 'vm-edit-message-map)))
4497     map )
4498   "Keymap for the buffers created by VM's `vm-edit-message' command.")
4499
4500 (defvar vm-mime-reader-map
4501   (let ((map (make-sparse-keymap)))
4502     (define-key map "\r" 'vm-mime-run-display-function-at-point)
4503     (define-key map "$\r" 'vm-mime-reader-map-display-using-default)
4504     (define-key map "$e" 'vm-mime-reader-map-display-using-external-viewer)
4505     (define-key map "$v" 'vm-mime-reader-map-display-object-as-type)
4506     (define-key map "$w" 'vm-mime-reader-map-save-file)
4507     (define-key map "$s" 'vm-mime-reader-map-save-message)
4508     (define-key map "$p" 'vm-mime-reader-map-pipe-to-printer)
4509     (define-key map "$|" 'vm-mime-reader-map-pipe-to-command)
4510     (define-key map "$a" 'vm-mime-attach-object-from-message)
4511     (define-key map "$d" 'vm-delete-mime-object)
4512     (cond ((vm-mouse-xemacs-mouse-p)
4513            (define-key map 'button3 'vm-menu-popup-mime-dispose-menu)))
4514     (cond ((fboundp 'set-keymap-name)
4515            (set-keymap-name map 'vm-mime-reader-map)))
4516     map )
4517   "Keymap for the MIME buttons in VM folder buffers.")
4518
4519 (defvar vm-folder-history nil
4520   "List of folders visited this Emacs session.")
4521
4522 ;; for sixth arg of read-file-name in early version of Emacs 21.
4523 (defun vm-folder-history (&rest ignored) t)
4524
4525 ;; internal vars
4526 (defvar vm-folder-type nil)
4527 (make-variable-buffer-local 'vm-folder-type)
4528 (defvar vm-folder-access-method nil)
4529 (make-variable-buffer-local 'vm-folder-access-method)
4530 (defvar vm-folder-access-data nil)
4531 (make-variable-buffer-local 'vm-folder-access-data)
4532 (defvar vm-message-list nil)
4533 (make-variable-buffer-local 'vm-message-list)
4534 (defvar vm-virtual-folder-definition nil)
4535 (make-variable-buffer-local 'vm-virtual-folder-definition)
4536 (defvar vm-virtual-buffers nil)
4537 (make-variable-buffer-local 'vm-virtual-buffers)
4538 (defvar vm-real-buffers nil)
4539 (make-variable-buffer-local 'vm-real-buffers)
4540 (defvar vm-message-pointer nil)
4541 (make-variable-buffer-local 'vm-message-pointer)
4542 (defvar vm-message-order-changed nil)
4543 (make-variable-buffer-local 'vm-message-order-changed)
4544 (defvar vm-message-order-header-present nil)
4545 (make-variable-buffer-local 'vm-message-order-header-present)
4546 (defvar vm-last-message-pointer nil)
4547 (make-variable-buffer-local 'vm-last-message-pointer)
4548 (defvar vm-folders-summary-hash nil)
4549 (defvar vm-folders-summary-spool-hash nil)
4550 (defvar vm-folders-summary-folder-hash nil)
4551 (defvar vm-folders-summary-buffer nil)
4552 (defvar vm-mail-buffer nil)
4553 (make-variable-buffer-local 'vm-mail-buffer)
4554 (defvar vm-presentation-buffer nil)
4555 (make-variable-buffer-local 'vm-presentation-buffer)
4556 (defvar vm-presentation-buffer-handle nil)
4557 (make-variable-buffer-local 'vm-presentation-buffer-handle)
4558 (defvar vm-mime-decoded nil)
4559 (make-variable-buffer-local 'vm-mime-decoded)
4560 (defvar vm-summary-buffer nil)
4561 (make-variable-buffer-local 'vm-summary-buffer)
4562 (defvar vm-summary-pointer nil)
4563 (make-variable-buffer-local 'vm-summary-pointer)
4564 (defvar vm-system-state nil)
4565 (make-variable-buffer-local 'vm-system-state)
4566 (defvar vm-undo-record-list nil)
4567 (make-variable-buffer-local 'vm-undo-record-list)
4568 (defvar vm-saved-undo-record-list nil)
4569 (make-variable-buffer-local 'vm-saved-undo-record-list)
4570 (defvar vm-undo-record-pointer nil)
4571 (make-variable-buffer-local 'vm-undo-record-pointer)
4572 (defvar vm-last-save-folder nil)
4573 (make-variable-buffer-local 'vm-last-save-folder)
4574 (defvar vm-last-written-file nil)
4575 (make-variable-buffer-local 'vm-last-written-file)
4576 (defvar vm-last-visit-folder nil)
4577 (defvar vm-last-visit-pop-folder nil)
4578 (defvar vm-last-visit-imap-folder nil)
4579 (defvar vm-last-pipe-command nil)
4580 (make-variable-buffer-local 'vm-last-pipe-command)
4581 (defvar vm-messages-not-on-disk 0)
4582 (make-variable-buffer-local 'vm-messages-not-on-disk)
4583 (defvar vm-totals nil)
4584 (make-variable-buffer-local 'vm-totals)
4585 (defvar vm-modification-counter 0)
4586 (make-variable-buffer-local 'vm-modification-counter)
4587 (defvar vm-flushed-modification-counter nil)
4588 (make-variable-buffer-local 'vm-flushed-modification-counter)
4589 (defvar vm-tempfile-counter 0)
4590 (defvar vm-messages-needing-summary-update nil)
4591 (defvar vm-buffers-needing-display-update nil)
4592 (defvar vm-buffers-needing-undo-boundaries nil)
4593 (defvar vm-numbering-redo-start-point nil)
4594 (make-variable-buffer-local 'vm-numbering-redo-start-point)
4595 (defvar vm-numbering-redo-end-point nil)
4596 (make-variable-buffer-local 'vm-numbering-redo-end-point)
4597 (defvar vm-summary-redo-start-point nil)
4598 (make-variable-buffer-local 'vm-summary-redo-start-point)
4599 (defvar vm-need-summary-pointer-update nil)
4600 (make-variable-buffer-local 'vm-need-summary-pointer-update)
4601 (defvar vm-thread-obarray 'bonk)
4602 (make-variable-buffer-local 'vm-thread-obarray)
4603 (defvar vm-thread-subject-obarray 'bonk)
4604 (make-variable-buffer-local 'vm-thread-subject-obarray)
4605 (defvar vm-label-obarray nil)
4606 (make-variable-buffer-local 'vm-label-obarray)
4607 (defvar vm-block-new-mail nil)
4608 (make-variable-buffer-local 'vm-block-new-mail)
4609 (defvar vm-global-block-new-mail nil)
4610 (defvar vm-saved-buffer-modified-p nil)
4611 (make-variable-buffer-local 'vm-saved-buffer-modified-p)
4612 (defvar vm-kept-mail-buffers nil)
4613 (defvar vm-inhibit-write-file-hook nil)
4614 ;; used to choose between the default and
4615 ;; mail-extract-address-components but I don't see the utility of
4616 ;; it anymore.  It tries to be too smart.
4617 ;;(defvar vm-chop-full-name-function 'vm-choose-chop-full-name-function)
4618 (defvar vm-chop-full-name-function 'vm-default-chop-full-name)
4619 (defvar vm-session-beginning t)
4620 (defvar vm-init-file-loaded nil)
4621 (defvar vm-window-configurations nil)
4622 (defvar vm-window-configuration nil)
4623 (defvar vm-message-id-number 0)
4624 (defconst vm-spool-directory
4625   (or (and (boundp 'rmail-spool-directory) rmail-spool-directory)
4626       "/usr/spool/mail/"))
4627 (defconst vm-content-length-search-regexp "^Content-Length:.*\n\\|\\(\n\n\\)")
4628 (defconst vm-content-length-header "Content-Length:")
4629 (defconst vm-attributes-header-regexp
4630   "^X-VM-\\(Attributes\\|v5-Data\\):\\(.*\n\\([ \t].*\n\\)*\\)")
4631 (defconst vm-attributes-header "X-VM-v5-Data:")
4632 (defconst vm-message-order-header-regexp "^X-VM-Message-Order:")
4633 (defconst vm-message-order-header "X-VM-Message-Order:")
4634 (defconst vm-bookmark-header-regexp "^X-VM-Bookmark:")
4635 (defconst vm-bookmark-header "X-VM-Bookmark:")
4636 (defconst vm-pop-retrieved-header-regexp "^X-VM-POP-Retrieved:")
4637 (defconst vm-pop-retrieved-header "X-VM-POP-Retrieved:")
4638 (defconst vm-imap-retrieved-header-regexp "^X-VM-IMAP-Retrieved:")
4639 (defconst vm-imap-retrieved-header "X-VM-IMAP-Retrieved:")
4640 (defconst vm-last-modified-header-regexp "^X-VM-Last-Modified:")
4641 (defconst vm-last-modified-header "X-VM-Last-Modified:")
4642 (defconst vm-summary-header-regexp "^X-VM-Summary-Format:")
4643 (defconst vm-summary-header "X-VM-Summary-Format:")
4644 (defconst vm-vheader-header-regexp "^X-VM-VHeader:")
4645 (defconst vm-vheader-header "X-VM-VHeader:")
4646 (defconst vm-labels-header-regexp "^X-VM-Labels:")
4647 (defconst vm-labels-header "X-VM-Labels:")
4648 (defconst vm-berkeley-mail-status-header "Status: ")
4649 (defconst vm-berkeley-mail-status-header-regexp "^Status: \\(..?\\)\n")
4650 (defconst vm-internal-unforwarded-header-regexp
4651   "\\(X-VM-\\|Status:\\|Content-Length:\\)")
4652 (defvar vm-matched-header-vector (make-vector 6 nil))
4653 (defconst vm-supported-folder-types
4654   '("From_" "BellFrom_" "From_-with-Content-Length" "mmdf" "babyl"))
4655 (defconst vm-supported-window-configurations
4656   '(
4657     ("default")
4658     ("startup")
4659     ("quitting")
4660     ("composing-message")
4661     ("editing-message")
4662     ("marking-message")
4663     ("reading-message")
4664     ("searching-message")
4665     ("vm")
4666     ("vm-add-message-labels")
4667     ("vm-apply-virtual-folder")
4668     ("vm-auto-archive-messages")
4669     ("vm-beginning-of-message")
4670     ("vm-burst-digest")
4671     ("vm-burst-mime-digest")
4672     ("vm-burst-rfc1153-digest")
4673     ("vm-burst-rfc934-digest")
4674     ("vm-change-folder-type")
4675     ("vm-clear-all-marks")
4676     ("vm-continue-composing-message")
4677     ("vm-create-virtual-folder")
4678     ("vm-create-virtual-folder-same-author")
4679     ("vm-create-virtual-folder-same-subject")
4680     ("vm-decode-mime-message")
4681     ("vm-delete-duplicate-messages")
4682     ("vm-delete-message")
4683     ("vm-delete-message-backward")
4684     ("vm-delete-message-labels")
4685     ("vm-delete-mime-object")
4686     ("vm-discard-cached-data")
4687     ("vm-edit-message")
4688     ("vm-edit-message-abort")
4689     ("vm-edit-message-end")
4690     ("vm-edit-message-other-frame")
4691     ("vm-end-of-message")
4692     ("vm-expose-hidden-headers")
4693     ("vm-expunge-folder")
4694     ("vm-expunge-imap-messages")
4695     ("vm-expunge-pop-messages")
4696     ("vm-folders-summarize")
4697     ("vm-followup")
4698     ("vm-followup-include-text")
4699     ("vm-followup-include-text-other-frame")
4700     ("vm-followup-other-frame")
4701     ("vm-forward-message")
4702     ("vm-forward-message-all-headers")
4703     ("vm-forward-message-all-headers-other-frame")
4704     ("vm-forward-message-other-frame")
4705     ("vm-get-new-mail")
4706     ("vm-goto-message")
4707     ("vm-goto-message-last-seen")
4708     ("vm-goto-parent-message")
4709     ("vm-help")
4710     ("vm-isearch-forward")
4711     ("vm-kill-subject")
4712     ("vm-load-init-file")
4713     ("vm-mail")
4714     ("vm-mail-other-frame")
4715     ("vm-mail-other-window")
4716     ("vm-mail-send")
4717     ("vm-mail-send-and-exit")
4718     ("vm-mark-all-messages")
4719     ("vm-mark-help")
4720     ("vm-mark-matching-messages")
4721     ("vm-mark-matching-messages-with-virtual-folder")
4722     ("vm-mark-message")
4723     ("vm-mark-messages-same-author")
4724     ("vm-mark-messages-same-subject")
4725     ("vm-mark-summary-region")
4726     ("vm-mark-thread-subtree")
4727     ("vm-mime-attach-buffer")
4728     ("vm-mime-attach-file")
4729     ("vm-mime-attach-message")
4730     ("vm-mime-attach-mime-file")
4731     ("vm-mime-attach-object-from-message")
4732     ("vm-mode")
4733     ("vm-move-message-backward")
4734     ("vm-move-message-backward-physically")
4735     ("vm-move-message-forward")
4736     ("vm-move-message-forward-physically")
4737     ("vm-move-to-previous-button")
4738     ("vm-move-to-next-button")
4739     ("vm-next-command-uses-marks")
4740     ("vm-next-message")
4741     ("vm-next-message-no-skip")
4742     ("vm-next-message-no-skip")
4743     ("vm-next-message-same-subject")
4744     ("vm-next-unread-message")
4745     ("vm-other-frame")
4746     ("vm-other-window")
4747     ("vm-pipe-message-to-command")
4748     ("vm-previous-message")
4749     ("vm-previous-message-no-skip")
4750     ("vm-previous-message-no-skip")
4751     ("vm-previous-message-same-subject")
4752     ("vm-previous-unread-message")
4753     ("vm-quit")
4754     ("vm-quit-just-bury")
4755     ("vm-quit-just-iconify")
4756     ("vm-quit-no-change")
4757     ("vm-reply")
4758     ("vm-reply-include-text")
4759     ("vm-reply-include-text-other-frame")
4760     ("vm-reply-other-frame")
4761     ("vm-resend-bounced-message")
4762     ("vm-resend-bounced-message-other-frame")
4763     ("vm-resend-message")
4764     ("vm-resend-message-other-frame")
4765     ("vm-save-and-expunge-folder")
4766     ("vm-save-buffer")
4767     ("vm-save-folder")
4768     ("vm-save-message")
4769     ("vm-save-message-sans-headers")
4770     ("vm-save-message-to-imap-folder")
4771     ("vm-scroll-backward")
4772     ("vm-scroll-backward-one-line")
4773     ("vm-scroll-forward")
4774     ("vm-scroll-forward-one-line")
4775     ("vm-send-digest")
4776     ("vm-send-digest-other-frame")
4777     ("vm-send-mime-digest")
4778     ("vm-send-mime-digest-other-frame")
4779     ("vm-send-rfc1153-digest")
4780     ("vm-send-rfc1153-digest-other-frame")
4781     ("vm-send-rfc934-digest")
4782     ("vm-send-rfc934-digest-other-frame")
4783     ("vm-set-message-attributes")
4784     ("vm-show-copying-restrictions")
4785     ("vm-show-no-warranty")
4786     ("vm-sort-messages")
4787     ("vm-submit-bug-report")
4788     ("vm-summarize")
4789     ("vm-summarize-other-frame")
4790     ("vm-toggle-all-marks")
4791     ("vm-toggle-read-only")
4792     ("vm-toggle-threads-display")
4793     ("vm-undelete-message")
4794     ("vm-undo")
4795     ("vm-unmark-matching-messages")
4796     ("vm-unmark-matching-messages-with-virtual-folder")
4797     ("vm-unmark-message")
4798     ("vm-unmark-messages-same-author")
4799     ("vm-unmark-messages-same-subject")
4800     ("vm-unmark-summary-region")
4801     ("vm-unmark-thread-subtree")
4802     ("vm-unread-message")
4803     ("vm-virtual-help")
4804     ("vm-visit-folder")
4805     ("vm-visit-folder-other-frame")
4806     ("vm-visit-folder-other-window")
4807     ("vm-visit-imap-folder")
4808     ("vm-visit-imap-folder-other-frame")
4809     ("vm-visit-imap-folder-other-window")
4810     ("vm-visit-pop-folder")
4811     ("vm-visit-pop-folder-other-frame")
4812     ("vm-visit-pop-folder-other-window")
4813     ("vm-visit-virtual-folder")
4814     ("vm-visit-virtual-folder-other-frame")
4815     ("vm-visit-virtual-folder-other-window")
4816     ("vm-write-file")
4817     ("vm-yank-message")
4818     ("vm-yank-message-other-folder")
4819 ))
4820
4821 (defconst vm-supported-sort-keys
4822   '("date" "reversed-date"
4823     "author" "reversed-author"
4824     "full-name" "reversed-full-name"
4825     "subject" "reversed-subject"
4826     "recipients" "reversed-recipients"
4827     "line-count" "reversed-line-count"
4828     "byte-count" "reversed-byte-count"
4829     "spam-score" "reversed-spam-score"
4830     "physical-order" "reversed-physical-order"))
4831
4832 (defconst vm-supported-interactive-virtual-selectors
4833   '(("any")
4834     ("sexp")
4835     ("virtual-folder-member")
4836     ("header")
4837     ("label")
4838     ("text")
4839     ("header-or-text")
4840     ("recipient")
4841     ("author")
4842     ("author-or-recipient")
4843     ("subject")
4844     ("sent-before")
4845     ("sent-after")
4846     ("more-chars-than")
4847     ("less-chars-than")
4848     ("more-lines-than")
4849     ("less-lines-than")
4850     ("new")
4851     ("unread")
4852     ("read")
4853     ("unseen")
4854     ("recent")
4855     ("deleted")
4856     ("replied")
4857     ("forwarded")
4858     ("redistributed")
4859     ("filed")
4860     ("written")
4861     ("edited")
4862     ("marked")
4863     ("undeleted")
4864     ("unreplied")
4865     ("unforwarded")
4866     ("unredistributed")
4867     ("unfiled")
4868     ("unwritten")
4869     ("unedited")
4870     ("unmarked")))
4871
4872 (defconst vm-virtual-selector-function-alist
4873   '((any . vm-vs-any)
4874     (virtual-folder-member . vm-vs-virtual-folder-member)
4875     (and . vm-vs-and)
4876     (or . vm-vs-or)
4877     (not . vm-vs-not)
4878     (header . vm-vs-header)
4879     (label . vm-vs-label)
4880     (text . vm-vs-text)
4881     (header-or-text . vm-vs-header-or-text)
4882     (recipient . vm-vs-recipient)
4883     (author . vm-vs-author)
4884     (author-or-recipient . vm-vs-author-or-recipient)
4885     (subject . vm-vs-subject)
4886     (sortable-subject . vm-vs-sortable-subject)
4887     (sent-before . vm-vs-sent-before)
4888     (sent-after . vm-vs-sent-after)
4889     (more-chars-than . vm-vs-more-chars-than)
4890     (less-chars-than . vm-vs-less-chars-than)
4891     (more-lines-than . vm-vs-more-lines-than)
4892     (less-lines-than . vm-vs-less-lines-than)
4893     (new . vm-vs-new)
4894     (unread . vm-vs-unread)
4895     (read . vm-vs-read)
4896     (unseen . vm-vs-unseen)
4897     (recent . vm-vs-recent)
4898     (deleted . vm-vs-deleted)
4899     (replied . vm-vs-replied)
4900     (answered . vm-vs-answered)
4901     (forwarded . vm-vs-forwarded)
4902     (redistributed . vm-vs-redistributed)
4903     (filed . vm-vs-filed)
4904     (written . vm-vs-written)
4905     (edited . vm-vs-edited)
4906     (marked . vm-vs-marked)
4907     (undeleted . vm-vs-undeleted)
4908     (unreplied . vm-vs-unreplied)
4909     (unanswered . vm-vs-unanswered)
4910     (unforwarded . vm-vs-unforwarded)
4911     (unredistributed . vm-vs-unredistributed)
4912     (unfiled . vm-vs-unfiled)
4913     (unwritten . vm-vs-unwritten)
4914     (unedited . vm-vs-unedited)
4915     (unmarked . vm-vs-unmarked)))
4916
4917 (defconst vm-supported-attribute-names
4918   '("new"
4919     "unread"
4920     "read"
4921     "deleted"
4922     "replied"
4923     "forwarded"
4924     "redistributed"
4925     "filed"
4926     "written"
4927     "edited"
4928     "undeleted"
4929     "unreplied"
4930     "unforwarded"
4931     "unredistributed"
4932     "unfiled"
4933     "unwritten"
4934     "unedited"
4935     ;; for babyl cogniscenti
4936     "recent"
4937     "unseen"
4938     "answered"
4939     "unanswered"))
4940
4941 (defvar vm-key-functions nil)
4942 (defconst vm-digest-type-alist '(("rfc934") ("rfc1153") ("mime")))
4943 (defvar vm-completion-auto-correct t
4944   "Non-nil means that minibuffer-complete-file should aggressively erase
4945 the trailing part of a word that caused completion to fail, and retry
4946 the completion with the resulting word.")
4947 (defvar vm-minibuffer-completion-table nil
4948   "Completion table used by `vm-minibuffer-complete-word'.
4949 Should be just a list of strings, not an alist or an obarray.")
4950 (defvar vm-completion-auto-space t
4951   "Non-nil value means that `vm-minibuffer-complete-word' should automatically
4952 append a space to words that complete unambiguously.")
4953 (defconst vm-attributes-vector-length 9)
4954 (defconst vm-cache-vector-length 26)
4955 (defconst vm-softdata-vector-length 20)
4956 (defconst vm-location-data-vector-length 6)
4957 (defconst vm-mirror-data-vector-length 6)
4958 (defconst vm-folder-summary-vector-length 15)
4959 (defconst vm-startup-message-lines
4960   '("Please use \\[vm-submit-bug-report] to report bugs."
4961     "For discussion about the VM mail reader, see the gnu.emacs.vm.info newsgroup"
4962     "You may give out copies of VM.  Type \\[vm-show-copying-restrictions] to see the conditions"
4963     "VM comes with ABSOLUTELY NO WARRANTY; type \\[vm-show-no-warranty] for full details"))
4964 (defconst vm-startup-message-displayed nil)
4965 ;; for the mode line
4966 (defvar vm-mode-line-format
4967   '("" "  %&%& "
4968     ("VM " vm-version ": "
4969      (vm-folder-read-only "read-only ")
4970      (vm-virtual-folder-definition (vm-virtual-mirror "mirrored "))
4971      "%b"
4972      (vm-mail-buffer (vm-ml-sort-keys ("" " by " vm-ml-sort-keys)))
4973      (vm-message-list
4974       ("   " vm-ml-message-number
4975        " (of " vm-ml-highest-message-number ")")
4976       (vm-folder-type
4977        "   (unrecognized folder type)"
4978        "   (no messages)")))
4979     (vm-spooled-mail-waiting " Mail")
4980     (vm-message-list
4981      ("  %[ " vm-ml-message-attributes-alist
4982       (vm-ml-labels ("; " vm-ml-labels)) " %]    ")
4983      ("  %[%]   "))
4984     "%p" "   " global-mode-string))
4985
4986 (defvar vm-ml-message-attributes-alist
4987   '((vm-ml-message-new
4988      "new"
4989      (vm-ml-message-unread
4990       "unread"
4991       (vm-ml-message-read "read")))
4992     (vm-ml-message-edited " edited")
4993     (vm-ml-message-filed " filed")
4994     (vm-ml-message-written " written")
4995     (vm-ml-message-replied " replied")
4996     (vm-ml-message-forwarded " forwarded")
4997     (vm-ml-message-redistributed " redistributed")
4998     (vm-ml-message-deleted " deleted")
4999     (vm-ml-message-marked " MARKED")))
5000 (defvar vm-ml-message-number nil)
5001 (make-variable-buffer-local 'vm-ml-message-number)
5002 (defvar vm-ml-highest-message-number nil)
5003 (make-variable-buffer-local 'vm-ml-highest-message-number)
5004 (defvar vm-ml-sort-keys nil)
5005 (make-variable-buffer-local 'vm-ml-sort-keys)
5006 (defvar vm-ml-labels nil)
5007 (make-variable-buffer-local 'vm-ml-labels)
5008 ; unused now
5009 ;(defvar vm-ml-attributes-string nil)
5010 ;(make-variable-buffer-local 'vm-ml-attributes-string)
5011 (defvar vm-ml-message-new nil)
5012 (make-variable-buffer-local 'vm-ml-message-new)
5013 (defvar vm-ml-message-unread nil)
5014 (make-variable-buffer-local 'vm-ml-message-unread)
5015 (defvar vm-ml-message-read nil)
5016 (make-variable-buffer-local 'vm-ml-message-read)
5017 (defvar vm-ml-message-edited nil)
5018 (make-variable-buffer-local 'vm-ml-message-edited)
5019 (defvar vm-ml-message-replied nil)
5020 (make-variable-buffer-local 'vm-ml-message-replied)
5021 (defvar vm-ml-message-forwarded nil)
5022 (make-variable-buffer-local 'vm-ml-message-forwarded)
5023 (defvar vm-ml-message-redistributed nil)
5024 (make-variable-buffer-local 'vm-ml-message-redistributed)
5025 (defvar vm-ml-message-deleted nil)
5026 (make-variable-buffer-local 'vm-ml-message-deleted)
5027 (defvar vm-ml-message-filed nil)
5028 (make-variable-buffer-local 'vm-ml-message-filed)
5029 (defvar vm-ml-message-written nil)
5030 (make-variable-buffer-local 'vm-ml-message-written)
5031 (defvar vm-ml-message-marked nil)
5032 (make-variable-buffer-local 'vm-ml-message-marked)
5033 ;; to make the tanjed compiler shut up
5034 (defvar vm-pop-read-point nil)
5035 (defvar vm-pop-ok-to-ask nil)
5036 (defvar vm-pop-passwords nil)
5037 (defvar vm-pop-retrieved-messages nil)
5038 (make-variable-buffer-local 'vm-pop-retrieved-messages)
5039 (defvar vm-pop-messages-to-expunge nil)
5040 (make-variable-buffer-local 'vm-pop-messages-to-expunge)
5041 (defvar vm-imap-read-point nil)
5042 (defvar vm-imap-ok-to-ask nil)
5043 (defvar vm-imap-passwords nil)
5044 (defvar vm-imap-retrieved-messages nil)
5045 (make-variable-buffer-local 'vm-imap-retrieved-messages)
5046 (defvar vm-imap-messages-to-expunge nil)
5047 (make-variable-buffer-local 'vm-imap-messages-to-expunge)
5048 (defvar vm-imap-capabilities nil)
5049 (defvar vm-imap-auth-methods nil)
5050 (defvar vm-pop-keep-failed-trace-buffers 5)
5051 (defvar vm-imap-keep-failed-trace-buffers 5)
5052 (defvar vm-kept-pop-buffers nil)
5053 (defvar vm-kept-imap-buffers nil)
5054 (defvar vm-imap-keep-trace-buffer nil)
5055 (defvar vm-imap-session-done nil)
5056 (defvar vm-reply-list nil)
5057 (defvar vm-forward-list nil)
5058 (defvar vm-redistribute-list nil)
5059
5060 (eval-when-compile
5061   (defvar current-itimer nil)
5062   (defvar current-menubar nil)
5063   (defvar scrollbar-height nil)
5064   (defvar top-toolbar nil)
5065   (defvar top-toolbar-height nil)
5066   (defvar bottom-toolbar nil)
5067   (defvar bottom-toolbar-height nil)
5068   (defvar right-toolbar nil)
5069   (defvar right-toolbar-width nil)
5070   (defvar left-toolbar nil)
5071   (defvar left-toolbar-width nil))
5072
5073 (defvar vm-fsfemacs-toolbar-installed-p nil)
5074 ;; this defvar matches the XEmacs one so it doesn't matter if VM
5075 ;; is loaded before highlight-headers.el
5076 (defvar highlight-headers-regexp "Subject[ \t]*:")
5077 (defvar vm-url-regexp
5078   "<URL:\\([^>\n]+\\)>\\|\\(\\(file\\|ftp\\|gopher\\|http\\|https\\|news\\|wais\\|www\\)://[^ \t\n\f\r\"<>|()]*[^ \t\n\f\r\"<>|.!?(){}]\\)\\|\\(mailto:[^ \t\n\f\r\"<>|()]*[^] \t\n\f\r\"<>|.!?(){}]\\)\\|\\(file:/[^ \t\n\f\r\"<>|()]*[^ \t\n\f\r\"<>|.!?(){}]\\)"
5079   "Regular expression that matches an absolute URL.
5080 The URL itself must be matched by a \\(..\\) grouping.
5081 VM will extract the URL by copying the lowest number grouping
5082 that has a match.")
5083 (defconst vm-month-alist
5084   '(("jan" "January" "1")
5085     ("feb" "February" "2")
5086     ("mar" "March" "3")
5087     ("apr" "April" "4")
5088     ("may" "May" "5")
5089     ("jun" "June" "6")
5090     ("jul" "July" "7")
5091     ("aug" "August" "8")
5092     ("sep" "September" "9")
5093     ("oct" "October" "10")
5094     ("nov" "November" "11")
5095     ("dec" "December" "12")))
5096 (defconst vm-weekday-alist
5097   '(("sun" "Sunday" "0")
5098     ("mon" "Monday" "1")
5099     ("tue" "Tuesday" "2")
5100     ("wed" "Wednesday" "3")
5101     ("thu" "Thursday" "4")
5102     ("fri" "Friday" "5")
5103     ("sat" "Saturday" "6")))
5104 (defvar pop-up-frames nil)
5105 (defvar vm-parse-date-workspace (make-vector 6 nil))
5106 ;; cache so we don't call timezone-make-date-sortable so much.
5107 ;; messages have their own cache; this is for the virtual folder
5108 ;; alist selectors.
5109 (defvar vm-sortable-date-alist nil)
5110 (defvar vm-summary-=> nil)
5111 (defvar vm-summary-no-=> nil)
5112 (defvar vm-summary-overlay nil)
5113 (make-variable-buffer-local 'vm-summary-overlay)
5114 (defvar vm-summary-tokenized-compiled-format-alist nil)
5115 (defvar vm-summary-untokenized-compiled-format-alist nil)
5116 (defvar vm-folders-summary-compiled-format-alist nil)
5117 (defvar vm-folders-summary-overlay nil)
5118 (defvar vm-spool-file-message-count-hash (make-vector 61 0))
5119 (defvar vm-page-end-overlay nil)
5120 (make-variable-buffer-local 'vm-page-end-overlay)
5121 (defvar vm-begin-glyph-property (if (fboundp 'extent-property)
5122                                        'begin-glyph
5123                                      'before-string))
5124 (defvar vm-thread-loop-obarray (make-vector 641 0))
5125 (defvar vm-delete-duplicates-obarray (make-vector 29 0))
5126 (defvar vm-image-obarray (make-vector 29 0))
5127 (defvar vm-mail-mode-map-parented nil)
5128 (defvar vm-xface-cache (make-vector 29 0))
5129 (defvar vm-mf-default-action nil)
5130 (defvar vm-mime-compiled-format-alist nil)
5131 (defvar vm-mime-default-action-string-alist
5132   '(("text" . "display text")
5133     ("multipart/alternative" . "display selected part")
5134     ("multipart/digest" . "read digest")
5135     ("multipart/parallel" . "display parts in parallel")
5136     ("multipart" . "display parts")
5137     ("message/partial" . "attempt message assembly")
5138     ("message/external-body" . "retrieve the object")
5139     ("message" . "display message")
5140     ("audio" . "play audio")
5141     ("video" . "display video")
5142     ("image" . "display image")
5143     ("model" . "display model")
5144     ("application/postscript" . "display PostScript")
5145     ("application/msword" . "display Word document")
5146     ("application" . "display attachment")))
5147
5148 (defvar vm-mime-type-description-alist
5149   '(("multipart/digest" . "digest")
5150     ("multipart/alternative" . "multipart alternative")
5151     ("multipart/parallel" . "multipart parallel")
5152     ("multipart" . "multipart message")
5153     ("text/plain" . "plain text")
5154     ("text/enriched" . "enriched text")
5155     ("text/html" . "HTML")
5156     ("image/gif" . "GIF image")
5157     ("image/tiff" . "TIFF image")
5158     ("image/jpeg" . "JPEG image")
5159     ("image/png" . "PNG image")
5160     ("message/rfc822" . "mail message")
5161     ("message/news" . "USENET news article")
5162     ("message/partial" . "message fragment")
5163     ("message/external-body" . "external object")
5164     ("application/postscript" . "PostScript")
5165     ("application/msword" . "Word document")
5166     ("application/vnd.ms-excel" . "Excel spreadsheet")
5167     ("application/octet-stream" . "untyped binary data")))
5168
5169 (defconst vm-mime-base64-alphabet
5170   (concat
5171    [
5172      65  66  67  68  69  70  71  72  73  74  75  76  77
5173      78  79  80  81  82  83  84  85  86  87  88  89  90
5174      97  98  99 100 101 102 103 104 105 106 107 108 109
5175     110 111 112 113 114 115 116 117 118 119 120 121 122
5176      48  49  50  51  52  53  54  55  56  57  43  47
5177    ]
5178   ))
5179 (defconst vm-mime-base64-alphabet-decoding-vector
5180   [
5181      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
5182      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
5183      0  0  0  0  0  0  0  0  0  0  0 62  0  0  0 63
5184     52 53 54 55 56 57 58 59 60 61  0  0  0  0  0  0
5185      0  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
5186     15 16 17 18 19 20 21 22 23 24 25  0  0  0  0  0
5187      0 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
5188     41 42 43 44 45 46 47 48 49 50 51  0  0  0  0  0
5189   ])
5190
5191 ;;(defconst vm-mime-base64-alphabet-decoding-alist
5192 ;;  '(
5193 ;;    ( 65 . 00) ( 66 . 01) ( 67 . 02) ( 68 . 03) ( 69 . 04) ( 70 . 05)
5194 ;;    ( 71 . 06) ( 72 . 07) ( 73 . 08) ( 74 . 09) ( 75 . 10) ( 76 . 11)
5195 ;;    ( 77 . 12) ( 78 . 13) ( 79 . 14) ( 80 . 15) ( 81 . 16) ( 82 . 17)
5196 ;;    ( 83 . 18) ( 84 . 19) ( 85 . 20) ( 86 . 21) ( 87 . 22) ( 88 . 23)
5197 ;;    ( 89 . 24) ( 90 . 25) ( 97 . 26) ( 98 . 27) ( 99 . 28) (100 . 29)
5198 ;;    (101 . 30) (102 . 31) (103 . 32) (104 . 33) (105 . 34) (106 . 35)
5199 ;;    (107 . 36) (108 . 37) (109 . 38) (110 . 39) (111 . 40) (112 . 41)
5200 ;;    (113 . 42) (114 . 43) (115 . 44) (116 . 45) (117 . 46) (118 . 47)
5201 ;;    (119 . 48) (120 . 49) (121 . 50) (122 . 51) ( 48 . 52) ( 49 . 53)
5202 ;;    ( 50 . 54) ( 51 . 55) ( 52 . 56) ( 53 . 57) ( 54 . 58) ( 55 . 59)
5203 ;;    ( 56 . 60) ( 57 . 61) ( 43 . 62) ( 47 . 63)
5204 ;;   ))
5205 ;;
5206 ;;(defvar vm-mime-base64-alphabet-decoding-vector
5207 ;;  (let ((v (make-vector 123 nil))
5208 ;;      (p vm-mime-base64-alphabet-decoding-alist))
5209 ;;    (while p
5210 ;;      (aset v (car (car p)) (cdr (car p)))
5211 ;;      (setq p (cdr p)))
5212 ;;    v ))
5213
5214 (defvar vm-message-garbage-alist nil)
5215 (make-variable-buffer-local 'vm-message-garbage-alist)
5216 (defvar vm-folder-garbage-alist nil)
5217 (make-variable-buffer-local 'vm-folder-garbage-alist)
5218 (defvar vm-global-garbage-alist nil)
5219 (defconst vm-mime-header-list '("MIME-Version:" "Content-"))
5220 (defconst vm-mime-header-regexp "\\(MIME-Version:\\|Content-\\)")
5221 (defconst vm-mime-mule-charset-to-coding-alist
5222   (cond (vm-fsfemacs-mule-p
5223          (let ((coding-systems (coding-system-list))
5224                (alist nil)
5225                val)
5226            (while coding-systems
5227              (setq val (coding-system-get (car coding-systems) 'mime-charset))
5228              (if val
5229                  (setq alist (cons (list (symbol-name val)
5230                                          (car coding-systems))
5231                                    alist)))
5232              (setq coding-systems (cdr coding-systems)))
5233            (setq alist (append '(("us-ascii" raw-text)
5234                                  ("unknown" iso-8859-1)) alist))
5235            alist))
5236          (t
5237          '(
5238            ("us-ascii"          no-conversion)
5239            ("iso-8859-1"        no-conversion)
5240            ("iso-8859-2"        iso-8859-2)
5241            ("iso-8859-3"        iso-8859-3)
5242            ("iso-8859-4"        iso-8859-4)
5243            ("iso-8859-5"        iso-8859-5)
5244 ;          ("iso-8859-6"        iso-8859-6)
5245            ("iso-8859-7"        iso-8859-7)
5246            ("iso-8859-8"        iso-8859-8)
5247            ("iso-8859-9"        iso-8859-9)
5248            ("iso-2022-jp"       iso-2022-jp)
5249            ("big5"              big5)
5250            ("koi8-r"            koi8-r)
5251            ("ks_c_5601-1987"    euc-kr)
5252            ("euc-jp"            euc-jp)
5253            ;; probably not correct, but probably better than nothing.
5254            ("iso-2022-jp-2"     iso-2022-jp)
5255            ("iso-2022-int-1"    iso-2022-int-1)
5256            ("iso-2022-kr"       iso-2022-kr)
5257            ("euc-kr"            iso-2022-kr)
5258           )
5259          ))
5260   "Alist that maps MIME character sets to MULE coding systems.")
5261           
5262 (defvar vm-mime-mule-charset-to-charset-alist
5263   '(
5264     (latin-iso8859-1    "iso-8859-1")
5265     (latin-iso8859-2    "iso-8859-2")
5266     (latin-iso8859-3    "iso-8859-3")
5267     (latin-iso8859-4    "iso-8859-4")
5268     (cyrillic-iso8859-5 "iso-8859-5")
5269     (arabic-iso8859-6   "iso-8859-6")
5270     (greek-iso8859-7    "iso-8859-7")
5271     (hebrew-iso8859-8   "iso-8859-8")
5272     (latin-iso8859-9    "iso-8859-9")
5273     (japanese-jisx0208  "iso-2022-jp")
5274     (korean-ksc5601     "iso-2022-kr")
5275     (chinese-gb2312     "iso-2022-jp")
5276     (sisheng            "iso-2022-jp")
5277     (thai-tis620        "iso-2022-jp")
5278    )
5279   "Alist that maps MULE character sets to matching MIME character sets.")
5280
5281 (defvar vm-mime-mule-coding-to-charset-alist
5282   (cond (vm-fsfemacs-mule-p
5283          (let ((coding-systems (coding-system-list))
5284                (alist nil)
5285                val)
5286            (while coding-systems
5287              (setq val (coding-system-get (car coding-systems) 'mime-charset))
5288              (if val
5289                  (setq alist (cons (list (car coding-systems)
5290                                          (symbol-name val))
5291                                    alist)))
5292              (setq coding-systems (cdr coding-systems)))
5293            (setq alist (append '((raw-text "us-ascii")) alist))
5294            alist))
5295         (t
5296          '(
5297            (iso-2022-8          "iso-2022-jp")
5298            (iso-2022-7-unix     "iso-2022-jp")
5299            (iso-2022-7-dos      "iso-2022-jp")
5300            (iso-2022-7-mac      "iso-2022-jp")
5301           )))
5302   "Alist that maps MULE coding systems to MIME character sets.")
5303
5304 (defconst vm-mime-charset-completion-alist
5305   '(
5306     ("us-ascii")
5307     ("iso-8859-1")
5308     ("iso-8859-2")
5309     ("iso-8859-3")
5310     ("iso-8859-4")
5311     ("iso-8859-5")
5312     ("iso-8859-6")
5313     ("iso-8859-7")
5314     ("iso-8859-8")
5315     ("iso-8859-9")
5316     ("iso-2022-jp")
5317     ("iso-2022-jp-2")
5318     ("iso-2022-int-1")
5319     ("iso-2022-kr")
5320    ))
5321 (defconst vm-mime-type-completion-alist
5322   '(
5323     ("text/plain")
5324     ("text/enriched")
5325     ("text/html")
5326     ("audio/basic")
5327     ("image/jpeg")
5328     ("image/png")
5329     ("image/gif")
5330     ("image/tiff")
5331     ("video/mpeg")
5332     ("application/postscript")
5333     ("application/octet-stream")
5334     ("message/rfc822")
5335     ("message/news")
5336    ))
5337
5338 (defconst vm-mime-encoded-word-regexp
5339   "=\\?\\([^?*]+\\)\\(\\*\\([^?*]+\\)\\)?\\?\\([BbQq]\\)\\?\\([^?]+\\)\\?=")
5340
5341 ;; for MS-DOS and Windows NT
5342 ;;    nil value means text file
5343 ;;      t value means binary file
5344 ;; presumably it controls whether LF -> CRLF mapping is done
5345 ;; when writing to files.
5346 (defvar buffer-file-type)
5347 (defvar vm-mf-attachment-file nil)
5348 (defvar vm-frame-list nil)
5349 (if (not (boundp 'shell-command-switch))
5350     (defvar shell-command-switch "-c"))
5351 (defvar vm-stunnel-random-data-file nil)
5352 (defvar vm-stunnel-configuration-file nil)
5353 (defvar vm-fsfemacs-cached-scroll-bar-width nil)
5354 (defvar vm-update-composition-buffer-name-timer nil)
5355
5356 (defcustom vm-enable-addons '(check-recipients
5357                               check-for-empty-subject
5358                               encode-headers
5359                               take-action-on-attachment)
5360   "*A list of addons to enable, t for all and nil to disable all.
5361 Most addons are from `vm-rfaddons-infect-vm'.
5362
5363 You must restart VM after a change to cause any effects."
5364   :group 'vm
5365   :type '(set (const :tag "Enable faces in the summary buffer" 
5366                      summary-faces)
5367               (const :tag "Enable shrinking of multi-line headers to one line."
5368                      shrunken-headers)
5369               (const :tag "Open a line when typing in quoted text"
5370                      open-line)
5371               (const :tag "Check the recipients before sending a message"
5372                      check-recipients)
5373               (const :tag "Check for an empty subject before sending a message"
5374                      check-for-empty-subject)
5375               (const :tag "MIME encode headers before sending a message"
5376                      encode-headers)
5377               (const :tag "Clean up subject prefixes before sending a message"
5378                      clean-subject)
5379               (const :tag "Do not replace Date: header when sending a message"
5380                      fake-date)
5381               (const :tag "Bind '.' on attachment buttons to 'vm-mime-take-action-on-attachment'"
5382                      take-action-on-attachment)
5383               (const :tag "Bind 'C-c C-s' to `vm-mime-save-all-attachments'"
5384                      save-all-attachments)
5385               (const :tag "Automatically save attachments of new messages" 
5386                      auto-save-all-attachments)
5387               (const :tag "Delete external attachments of a message when expunging it." 
5388                      auto-delete-message-external-body)
5389               (const :tag "Enable all addons" t)))
5390
5391 (defcustom vm-disable-modes-before-encoding 
5392   '(auto-fill-mode font-lock-mode ispell-minor-mode flyspell-mode
5393                    abbrev-mode adaptive-fill-mode)
5394   "*A list of minor modes to disable before encoding a message.
5395 These modes may slow down (font-lock and *spell) encoding and may
5396 cause trouble (abbrev-mode)."
5397   :group 'vm
5398   :type '(repeat symbol))
5399
5400 (provide 'vm-vars)
5401
5402 ;;; vm-vars.el ends here