]> code.delx.au - gnu-emacs/blobdiff - lisp/mh-e/mh-e.el
Doc fixes
[gnu-emacs] / lisp / mh-e / mh-e.el
index e1f1c561051ed646f1622ec63dd15f8910b4c3ac..2723fb5e684caa9ab1f1e5e714e1910078af8bcd 100644 (file)
@@ -1,12 +1,11 @@
 ;;; mh-e.el --- GNU Emacs interface to the MH mail system
 
-;; Copyright (C) 1985, 1986, 1987, 1988,
-;;  1990, 1992, 1993, 1994, 1995, 1997, 1999,
-;;  2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2012
+;;   Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
-;; Version: 8.0.3+cvs
+;; Version: 8.3.1
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
 
 ;; MH-E is an Emacs interface to the MH mail system.
 
-;; MH-E is supported by GNU Emacs 21 and 22, as well as XEmacs 21
+;; MH-E is supported in GNU Emacs 21 and higher, as well as XEmacs 21
 ;; (except for versions 21.5.9-21.5.16). It is compatible with MH
 ;; versions 6.8.4 and higher, all versions of nmh, and GNU mailutils
-;; 0.4 and higher.
+;; 1.0 and higher. Gnus is also required; version 5.10 or higher is
+;; recommended.
 
 ;; MH (Message Handler) is a powerful mail reader. See
 ;; http://rand-mh.sourceforge.net/.
 ;; Try to keep variables local to a single file. Provide accessors if
 ;; variables are shared. Use this section as a last resort.
 
-(defconst mh-version "8.0.3+cvs" "Version number of MH-E.")
+(defconst mh-version "8.3.1" "Version number of MH-E.")
 
 ;; Variants
 
     "/usr/contrib/mh/bin/"              ; BSDI
     "/usr/pkg/bin/"                     ; NetBSD
     "/usr/local/bin/"
-    "/usr/local/bin/mu-mh/"             ; GNU mailutils - default
-    "/usr/bin/mu-mh/")                  ; GNU mailutils - packaged
+    "/usr/local/bin/mu-mh/"             ; GNU mailutils MH - default
+    "/usr/bin/mu-mh/")                  ; GNU mailutils MH - packaged
   "List of directories to search for variants of the MH variant.
 The list `exec-path' is searched in addition to this list.
 There's no need for users to modify this list. Instead add extra
@@ -282,8 +282,10 @@ Elements have the form (SEQUENCE . MESSAGES).")
 (defvar mh-show-buffer nil
   "Buffer that displays message for this folder.")
 
-(defvar mh-showing-mode nil
-  "If non-nil, show the message in a separate window.")
+(define-minor-mode mh-showing-mode
+  "Minor mode to show the message in a separate window."
+  ;; FIXME: maybe this should be moved to mh-show.el.
+  :lighter " Show")
 
 (defvar mh-view-ops nil
   "Stack of operations that change the folder view.
@@ -340,7 +342,7 @@ Name of the Previous sequence.")
   "Non-nil means that we have \"flists\".")
 
 (defvar mh-index-data-file ".mhe_index"
-  "MH-E specific file where index seach info is stored.")
+  "MH-E specific file where index search info is stored.")
 
 (defvar mh-letter-header-field-regexp "^\\([A-Za-z][A-Za-z0-9-]*\\):")
 
@@ -501,8 +503,7 @@ Adds double-quotes around entire string and quotes the characters
 The side effects are what is desired. Any output is assumed to be
 an error and is shown to the user. The output is not read or
 parsed by MH-E."
-  (save-excursion
-    (set-buffer (get-buffer-create mh-log-buffer))
+  (with-current-buffer (get-buffer-create mh-log-buffer)
     (let* ((initial-size (mh-truncate-log-buffer))
            (start (point))
            (args (mh-list-to-string args)))
@@ -521,8 +522,7 @@ parsed by MH-E."
   "In environment ENV, execute mh-command COMMAND with ARGS.
 ENV is nil or a string of space-separated \"var=value\" elements.
 Signals an error if process does not complete successfully."
-  (save-excursion
-    (set-buffer (get-buffer-create mh-temp-buffer))
+  (with-current-buffer (get-buffer-create mh-temp-buffer)
     (erase-buffer)
     (let ((process-environment process-environment))
       ;; XXX: We should purge the list that split-string returns of empty
@@ -542,8 +542,7 @@ otherwise the default filter `mh-process-daemon' is used. See
 `set-process-filter' for more details of FILTER.
 
 ARGS are passed to COMMAND as command line arguments."
-  (save-excursion
-    (set-buffer (get-buffer-create mh-log-buffer))
+  (with-current-buffer (get-buffer-create mh-log-buffer)
     (mh-truncate-log-buffer))
   (let* ((process-connection-type nil)
          (process (apply 'start-process
@@ -614,7 +613,8 @@ Output is expected to be shown to user, not parsed by MH-E."
   (mh-exchange-point-and-mark-preserving-active-mark))
 
 ;; Shush compiler.
-(defvar mark-active)                    ; XEmacs
+(mh-do-in-xemacs
+  (defvar mark-active))
 
 (defun mh-exchange-point-and-mark-preserving-active-mark ()
   "Put the mark where point is now, and point where the mark is now.
@@ -645,9 +645,8 @@ Set mark after inserted text."
     (insert (if (integerp status)
                 (format "%s: exit code %d\n" command status)
               (format "%s: %s\n" command status)))
-    (save-excursion
-      (let ((error-message (buffer-substring (point-min) (point-max))))
-        (set-buffer (get-buffer-create mh-log-buffer))
+    (let ((error-message (buffer-substring (point-min) (point-max))))
+      (with-current-buffer (get-buffer-create mh-log-buffer)
         (mh-truncate-log-buffer)
         (insert error-message)))
     (error "%s failed, check buffer %s for error message"
@@ -738,16 +737,15 @@ is described by the variable `mh-variants'."
 
 (defun mh-variant-info (dir)
   "Return MH variant found in DIR, or nil if none present."
-  (save-excursion
-    (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
-      (set-buffer tmp-buffer)
+  (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
+    (with-current-buffer tmp-buffer
       (cond
        ((mh-variant-mh-info dir))
        ((mh-variant-nmh-info dir))
-       ((mh-variant-mu-mh-info dir))))))
+       ((mh-variant-gnu-mh-info dir))))))
 
 (defun mh-variant-mh-info (dir)
-  "Return info for MH variant in DIR assuming a temporary buffer is setup."
+  "Return info for MH variant in DIR assuming a temporary buffer is set up."
   ;; MH does not have the -version option.
   ;; Its version number is included in the output of "-help" as:
   ;;
@@ -777,9 +775,9 @@ is described by the variable `mh-variants'."
                 (mh-progs       ,dir)
                 (flists         nil)))))))))
 
-(defun mh-variant-mu-mh-info (dir)
-  "Return info for GNU mailutils variant in DIR.
-This assumes that a temporary buffer is setup."
+(defun mh-variant-gnu-mh-info (dir)
+  "Return info for GNU mailutils MH variant in DIR.
+This assumes that a temporary buffer is set up."
   ;; 'mhparam -version' output:
   ;; mhparam (GNU mailutils 0.3.2)
   (let ((mhparam (expand-file-name "mhparam" dir)))
@@ -792,7 +790,7 @@ This assumes that a temporary buffer is setup."
         (let ((version (match-string 1))
               (mh-progs dir))
           `(,version
-            (variant        mu-mh)
+            (variant        gnu-mh)
             (mh-lib-progs   ,(mh-profile-component "libdir"))
             (mh-lib         ,(mh-profile-component "etcdir"))
             (mh-progs       ,dir)
@@ -800,7 +798,7 @@ This assumes that a temporary buffer is setup."
                               (expand-file-name "flists" dir)))))))))
 
 (defun mh-variant-nmh-info (dir)
-  "Return info for nmh variant in DIR assuming a temporary buffer is setup."
+  "Return info for nmh variant in DIR assuming a temporary buffer is set up."
   ;; `mhparam -version' outputs:
   ;; mhparam -- nmh-1.1-RC1 [compiled on chaak at Fri Jun 20 11:03:28 PDT 2003]
   (let ((mhparam (expand-file-name "mhparam" dir)))
@@ -824,7 +822,7 @@ This assumes that a temporary buffer is setup."
   (and (file-regular-p file) (file-executable-p file)))
 
 (defun mh-variant-set-variant (variant)
-  "Setup the system variables for the MH variant named VARIANT.
+  "Set up the system variables for the MH variant named VARIANT.
 If VARIANT is a string, use that key in the alist returned by the
 function `mh-variants'.
 If VARIANT is a symbol, select the first entry that matches that
@@ -864,7 +862,7 @@ variant."
 
 (defun mh-variant-p (&rest variants)
   "Return t if variant is any of VARIANTS.
-Currently known variants are 'MH, 'nmh, and 'mu-mh."
+Currently known variants are 'MH, 'nmh, and 'gnu-mh."
   (let ((variant-in-use
          (cadr (assoc 'variant (assoc mh-variant-in-use (mh-variants))))))
     (not (null (member variant-in-use variants)))))
@@ -872,8 +870,9 @@ Currently known variants are 'MH, 'nmh, and 'mu-mh."
 (defun mh-profile-component (component)
   "Return COMPONENT value from mhparam, or nil if unset."
   (save-excursion
-    ;; MH and nmh use -components, Mailutils uses -component. Since MH
-    ;; and nmh work with an unambiguous prefix, the `s' is dropped here.
+    ;; MH and nmh use -components, GNU mailutils MH uses -component.
+    ;; Since MH and nmh work with an unambiguous prefix, the `s' is
+    ;; dropped here.
     (mh-exec-cmd-quiet nil "mhparam" "-component" component)
     (mh-profile-component-value component)))
 
@@ -895,12 +894,23 @@ Returns nil if the component is not in the buffer."
 Sets `mh-progs', `mh-lib', `mh-lib-progs' and
 `mh-flists-present-flag'.
 If the VARIANT is \"autodetect\", then first try nmh, then MH and
-finally GNU mailutils."
+finally GNU mailutils MH."
   (interactive
    (list (completing-read
           "MH variant: "
           (mapcar (lambda (x) (list (car x))) (mh-variants))
           nil t)))
+
+  ;; TODO Remove mu-mh backwards compatibility in 9.0.
+  (when (and (stringp variant)
+             (string-match "^mu-mh"  variant))
+    (message
+     (format "%s\n%s; %s" "The variant name mu-mh has been renamed to gnu-mh"
+             "and will be removed in MH-E 9.0"
+             "try M-x customize-option mh-variant"))
+    (sit-for 5)
+    (setq variant (concat "gnu-mh" (substring variant (match-end 0)))))
+
   (let ((valid-list (mapcar (lambda (x) (car x)) (mh-variants))))
     (cond
      ((eq variant 'none))
@@ -910,7 +920,7 @@ finally GNU mailutils."
         (message "%s installed as MH variant" mh-variant-in-use))
        ((mh-variant-set-variant 'mh)
         (message "%s installed as MH variant" mh-variant-in-use))
-       ((mh-variant-set-variant 'mu-mh)
+       ((mh-variant-set-variant 'gnu-mh)
         (message "%s installed as MH variant" mh-variant-in-use))
        (t
         (message "No MH variant found on the system"))))
@@ -919,8 +929,9 @@ finally GNU mailutils."
         (message "Warning: %s variant not found. Autodetecting..." variant)
         (mh-variant-set 'autodetect)))
      (t
-      (message "Unknown variant; use %s"
-               (mapconcat '(lambda (x) (format "%s" (car x)))
+      (message "Unknown variant %s; use %s"
+               variant
+               (mapconcat (lambda (x) (format "%s" (car x)))
                           (mh-variants) " or "))))))
 
 (defcustom-mh mh-variant 'autodetect
@@ -928,14 +939,14 @@ finally GNU mailutils."
 
 The default setting of this option is \"Auto-detect\" which means
 that MH-E will automatically choose the first of nmh, MH, or GNU
-mailutils that it finds in the directories listed in
+mailutils MH that it finds in the directories listed in
 `mh-path' (which you can customize), `mh-sys-path', and
 `exec-path'. If MH-E can't find MH at all, you may have to
 customize `mh-path' and add the directory in which the command
 \"mhparam\" is located. If, on the other hand, you have both nmh
-and mailutils installed (for example) and `mh-variant-in-use' was
-initialized to nmh but you want to use mailutils, then you can
-set this option to \"mailutils\".
+and GNU mailutils MH installed (for example) and
+`mh-variant-in-use' was initialized to nmh but you want to use
+GNU mailutils MH, then you can set this option to \"gnu-mh\".
 
 When this variable is changed, MH-E resets `mh-progs', `mh-lib',
 `mh-lib-progs', `mh-flists-present-flag', and `mh-variant-in-use'
@@ -1166,7 +1177,7 @@ lowercase for mailing lists and uppercase for people."
   "*Non-nil means to expand aliases entered in the minibuffer.
 
 In other words, aliases entered in the minibuffer will be
-expanded to the full address in the message draft. By default,
+expanded to the full address in the message draft.  By default,
 this expansion is not performed."
   :type 'boolean
   :group 'mh-alias
@@ -1996,7 +2007,7 @@ set SYMBOL to VALUE."
 The default setting for this option is \"Use MH-E scan Format\". This
 means that the format string will be taken from the either
 `mh-scan-format-mh' or `mh-scan-format-nmh' depending on whether MH or
-nmh (or GNU mailutils) is in use. This setting also enables you to
+nmh (or GNU mailutils MH) is in use. This setting also enables you to
 turn on the `mh-adaptive-cmd-note-flag' option.
 
 You can also set this option to \"Use Default scan Format\" to get the
@@ -2436,7 +2447,7 @@ of citations entirely, choose \"None\"."
     "Followup-To:"                      ; RFC 1036
     "For-Approval:"                     ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "For-Comment:"                      ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
-    "For-Handdling:"                    ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "For-Handling:"                     ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Forwarded:"                        ; MH
     "From "                             ; sendmail
     "Generate-Delivery-Report:"         ; RFC 2156
@@ -2467,7 +2478,7 @@ of citations entirely, choose \"None\"."
     "Original-NNTP-"                    ; mail to news
     "Original-Path:"                    ; mail to news
     "Original-Received:"                ; mail to news
-    "Original-Recipt:"                  ; RFC 2298
+    "Original-Recipient:"               ; RFC 2298
     "Original-To:"                      ; mail to news
     "Original-X-"                       ; mail to news
     "Origination-Client:"               ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
@@ -2497,7 +2508,7 @@ of citations entirely, choose \"None\"."
     "Seal-Send-Time:"
     "See-Also:"                         ; H. Spencer: News Article Format and Transmission, June 1994
     "Sensitivity:"                      ; RFC 2156, 2421
-    "Speach-Act:"                       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Speech-Act:"                       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Status:"                           ; sendmail
     "Supersedes:"                       ; H. Spencer: News Article Format and Transmission, June 1994
     "Telefax:"                          ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
@@ -2577,6 +2588,7 @@ of citations entirely, choose \"None\"."
     "X-HPL-"
     "X-HR-"
     "X-HTTP-UserAgent:"
+    "X-Hz"                             ; Hertz
     "X-Identity:"                       ; http://www.declude.com/x-note.htm
     "X-Image-URL:"
     "X-IMAP:"                           ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
@@ -2642,6 +2654,7 @@ of citations entirely, choose \"None\"."
     "X-PMX-Version:"
     "X-Postfilter:"
     "X-Priority:"                       ; MS Outlook
+    "X-Proofpoint-"                    ; Proofpoint mail filter
     "X-Provags-ID:"
     "X-PSTN-"
     "X-Qotd-"                           ; User added
@@ -2652,6 +2665,7 @@ of citations entirely, choose \"None\"."
     "X-Request-"
     "X-Resolved-to:"                    ; fastmail.fm
     "X-Return-Path-Hint:"               ; Roving ConstantContact
+    "X-RIM-"                           ; Research In Motion (i.e. BlackBerry)
     "X-RM"
     "X-RocketYMMF:"                     ; Yahoo
     "X-Roving-"                         ; Roving ConstantContact
@@ -3078,9 +3092,10 @@ folder, which is also available in `mh-current-folder'."
   :package-version '(MH-E . "8.0"))
 
 (defcustom-mh mh-annotate-msg-hook nil
-  "Hook run by `mh-annotate-msg' after annotation.
-Variables that are useful in this hook include `mh-current-folder',
-the current folder, and `mh-annotate-list', the messages annotated."
+  "Hook run whenever a message is sent and after the scan lines and message are annotated.
+Hook functions can access the current folder name with
+`mh-current-folder' and obtain the message numbers of the
+annotated messages with `mh-annotate-list'."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sending-mail
@@ -3224,6 +3239,14 @@ This can be done with this hook which is called when
   :group 'mh-search
   :package-version '(MH-E . "8.0"))
 
+(defcustom-mh mh-pack-folder-hook nil
+  "Hook run by \\<mh-folder-mode-map>\\[mh-pack-folder] after renumbering the messages.
+Hook functions can access the current folder name with `mh-current-folder'."
+  :type 'hook
+  :group 'mh-hooks
+  :group 'mh-folder
+  :package-version '(MH-E . "8.2"))
+
 (defcustom-mh mh-quit-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
 
@@ -3700,5 +3723,4 @@ The background and foreground are used in the image."
 ;; sentence-end-double-space: nil
 ;; End:
 
-;; arch-tag: cce884de-bd37-4104-9963-e4439d5ed22b
 ;;; mh-e.el ends here