* mh-e/mh-comp.el (mh-send-letter):
[bpt/emacs.git] / lisp / mh-e / mh-e.el
index f7990c0..00c1c89 100644 (file)
@@ -1,20 +1,21 @@
 ;;; mh-e.el --- GNU Emacs interface to the MH mail system
 
 ;; Copyright (C) 1985, 1986, 1987, 1988,
 ;;; 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 Free Software Foundation, Inc.
+;;   1990, 1992, 1993, 1994, 1995, 1997, 1999,
+;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;;   Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
-;; Version: 8.0.3
+;; Version: 8.2
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
 
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; MH-E is an Emacs interface to the MH mail system.
 
 
 ;;; Commentary:
 
 ;; 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 22, 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
 ;; (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/.
 
 ;; MH (Message Handler) is a powerful mail reader. See
 ;; http://rand-mh.sourceforge.net/.
 (require 'mh-buffers)
 (require 'mh-compat)
 
 (require 'mh-buffers)
 (require 'mh-compat)
 
-(eval-and-compile
-  (defvar mh-xemacs-flag (featurep 'xemacs)
-    "Non-nil means the current Emacs is XEmacs."))
-
 (mh-do-in-xemacs
   (require 'mh-xemacs))
 
 (mh-do-in-xemacs
   (require 'mh-xemacs))
 
 ;; Try to keep variables local to a single file. Provide accessors if
 ;; variables are shared. Use this section as a last resort.
 
 ;; 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" "Version number of MH-E.")
+(defconst mh-version "8.2" "Version number of MH-E.")
 
 ;; Variants
 
 
 ;; Variants
 
     "/usr/contrib/mh/bin/"              ; BSDI
     "/usr/pkg/bin/"                     ; NetBSD
     "/usr/local/bin/"
     "/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
   "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
@@ -560,7 +556,7 @@ ARGS are passed to COMMAND as command line arguments."
     process))
 
 (defun mh-exec-cmd-env-daemon (env command filter &rest args)
     process))
 
 (defun mh-exec-cmd-env-daemon (env command filter &rest args)
-  "In ennvironment ENV, execute mh-command COMMAND in the background.
+  "In environment ENV, execute mh-command COMMAND in the background.
 
 ENV is nil or a string of space-separated \"var=value\" elements.
 Signals an error if process does not complete successfully.
 
 ENV is nil or a string of space-separated \"var=value\" elements.
 Signals an error if process does not complete successfully.
@@ -720,7 +716,7 @@ keyword, introduced in Emacs 22."
 See `mh-variant'."
   :group 'mh-e
   :type '(repeat (directory))
 See `mh-variant'."
   :group 'mh-e
   :type '(repeat (directory))
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E "8.0"))
 
 (defun mh-variants ()
   "Return a list of installed variants of MH on the system.
 
 (defun mh-variants ()
   "Return a list of installed variants of MH on the system.
@@ -750,10 +746,10 @@ is described by the variable `mh-variants'."
       (cond
        ((mh-variant-mh-info dir))
        ((mh-variant-nmh-info dir))
       (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)
 
 (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:
   ;;
   ;; MH does not have the -version option.
   ;; Its version number is included in the output of "-help" as:
   ;;
@@ -783,9 +779,9 @@ is described by the variable `mh-variants'."
                 (mh-progs       ,dir)
                 (flists         nil)))))))))
 
                 (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)))
   ;; 'mhparam -version' output:
   ;; mhparam (GNU mailutils 0.3.2)
   (let ((mhparam (expand-file-name "mhparam" dir)))
@@ -798,7 +794,7 @@ This assumes that a temporary buffer is setup."
         (let ((version (match-string 1))
               (mh-progs dir))
           `(,version
         (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)
             (mh-lib-progs   ,(mh-profile-component "libdir"))
             (mh-lib         ,(mh-profile-component "etcdir"))
             (mh-progs       ,dir)
@@ -806,7 +802,7 @@ This assumes that a temporary buffer is setup."
                               (expand-file-name "flists" dir)))))))))
 
 (defun mh-variant-nmh-info (dir)
                               (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)))
   ;; `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)))
@@ -830,7 +826,7 @@ This assumes that a temporary buffer is setup."
   (and (file-regular-p file) (file-executable-p file)))
 
 (defun mh-variant-set-variant (variant)
   (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
 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
@@ -870,7 +866,7 @@ variant."
 
 (defun mh-variant-p (&rest variants)
   "Return t if variant is any of VARIANTS.
 
 (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)))))
   (let ((variant-in-use
          (cadr (assoc 'variant (assoc mh-variant-in-use (mh-variants))))))
     (not (null (member variant-in-use variants)))))
@@ -878,8 +874,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
 (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)))
 
     (mh-exec-cmd-quiet nil "mhparam" "-component" component)
     (mh-profile-component-value component)))
 
@@ -901,12 +898,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
 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)))
   (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))
   (let ((valid-list (mapcar (lambda (x) (car x)) (mh-variants))))
     (cond
      ((eq variant 'none))
@@ -916,7 +924,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))
         (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"))))
         (message "%s installed as MH variant" mh-variant-in-use))
        (t
         (message "No MH variant found on the system"))))
@@ -925,7 +933,8 @@ finally GNU mailutils."
         (message "Warning: %s variant not found. Autodetecting..." variant)
         (mh-variant-set 'autodetect)))
      (t
         (message "Warning: %s variant not found. Autodetecting..." variant)
         (mh-variant-set 'autodetect)))
      (t
-      (message "Unknown variant; use %s"
+      (message "Unknown variant %s; use %s"
+               variant
                (mapconcat '(lambda (x) (format "%s" (car x)))
                           (mh-variants) " or "))))))
 
                (mapconcat '(lambda (x) (format "%s" (car x)))
                           (mh-variants) " or "))))))
 
@@ -934,14 +943,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
 
 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
 `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'
 
 When this variable is changed, MH-E resets `mh-progs', `mh-lib',
 `mh-lib-progs', `mh-flists-present-flag', and `mh-variant-in-use'
@@ -955,7 +964,7 @@ necessary and can actually cause problems."
          (set-default symbol value)     ;Done in mh-variant-set-variant!
          (mh-variant-set value))
   :group 'mh-e
          (set-default symbol value)     ;Done in mh-variant-set-variant!
          (mh-variant-set value))
   :group 'mh-e
-  :package-version '(MH-E "8.0"))
+  :package-version '(MH-E "8.0"))
 
 \f
 
 
 \f
 
@@ -1986,7 +1995,7 @@ you would use \"(mh-set-cmd-note 4)\"."
   :package-version '(MH-E . "7.0"))
 
 (defun mh-scan-format-file-check (symbol value)
   :package-version '(MH-E . "7.0"))
 
 (defun mh-scan-format-file-check (symbol value)
-  "Check if desired setting is legal.
+  "Check if desired setting is valid.
 Throw an error if user tries to set `mh-scan-format-file' to
 anything but t when `mh-adaptive-cmd-note-flag' is on. Otherwise,
 set SYMBOL to VALUE."
 Throw an error if user tries to set `mh-scan-format-file' to
 anything but t when `mh-adaptive-cmd-note-flag' is on. Otherwise,
 set SYMBOL to VALUE."
@@ -2002,7 +2011,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
 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
 turn on the `mh-adaptive-cmd-note-flag' option.
 
 You can also set this option to \"Use Default scan Format\" to get the
@@ -2025,7 +2034,7 @@ Emacs start with 0)."
   :package-version '(MH-E . "6.0"))
 
 (defun mh-adaptive-cmd-note-flag-check (symbol value)
   :package-version '(MH-E . "6.0"))
 
 (defun mh-adaptive-cmd-note-flag-check (symbol value)
-  "Check if desired setting is legal.
+  "Check if desired setting is valid.
 Throw an error if user tries to turn on
 `mh-adaptive-cmd-note-flag' when `mh-scan-format-file' isn't t.
 Otherwise, set SYMBOL to VALUE."
 Throw an error if user tries to turn on
 `mh-adaptive-cmd-note-flag' when `mh-scan-format-file' isn't t.
 Otherwise, set SYMBOL to VALUE."
@@ -2381,198 +2390,334 @@ of citations entirely, choose \"None\"."
   :group 'mh-show
   :package-version '(MH-E . "8.0"))
 
   :group 'mh-show
   :package-version '(MH-E . "8.0"))
 
-;; Keep fields alphabetized. Mention source, if known.
+;; These entries have been intentionally excluded by the developers.
+;;  "Comments:"                         ; RFC 2822 - show this one
+;;  "Fax:"                              ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+;;  "Mail-System-Version:"              ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+;;  "Mailer:"                           ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+;;  "Organization:"                     ;
+;;  "Phone:"                            ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+;;  "Reply-By:"                         ; RFC 2156
+;;  "Reply-To:"                         ; RFC 2822
+;;  "Sender:"                           ;
+;;  "User-Agent:"                       ; Similar to X-Mailer, so display it.
+;;  "X-Mailer:"                         ;
+;;  "X-Operator:"                       ; Similar to X-Mailer, so display it
+
+;; Keep fields alphabetized (set sort-fold-case to t first).
+;; Mention source, if known.
 (defvar mh-invisible-header-fields-internal
 (defvar mh-invisible-header-fields-internal
-  '("Approved:"
-    "Autoforwarded:"
+  '(
+    "Abuse-Reports-To:"                 ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Accept-Language:"
+    "AcceptLanguage:"
+    "Accreditor:"                       ; Habeas
+    "Also-Control:"                     ; H. Spencer: News Article Format and Transmission, June 1994
+    "Alternate-recipient:"              ; RFC 2156
+    "Approved-By:"                      ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Approved:"                         ; RFC 1036
+    "Article-Names:"                    ; H. Spencer: News Article Format and Transmission, June 1994
+    "Article-Updates:"                  ; H. Spencer: News Article Format and Transmission, June 1994
+    "Authentication-Results:"
+    "Auto-forwarded:"                   ; RFC 2156
+    "Autoforwarded:"                    ; RFC 2156
     "Bestservhost:"
     "Bestservhost:"
+    "Bytes:"
+    "Cancel-Key:"                       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Cancel-Lock:"                      ; NNTP posts
     "Cancel-Lock:"                      ; NNTP posts
-    "Content-"                          ; RFC 2045
-    "Delivered-To:"              ; Egroups/yahoogroups mailing list manager
-    "Delivery-Date:"                    ; MH
+    "Comment:"                          ; Shows up with DomainKeys
+    "Content-"                          ; RFC 2045, 1123, 1766, 1864, 2045, 2110, 2156, 2183, 2912
+    "Control:"                          ; RFC 1036
+    "Conversion-With-Loss:"             ; RFC 2156
+    "Conversion:"                       ; RFC 2156
+    "Delivered-To:"                     ; Egroups/yahoogroups mailing list manager
+    "Delivery-Date:"                    ; RFC 2156
     "Delivery:"
     "Delivery:"
-    "DomainKey-Signature:"              ;http://antispam.yahoo.com/domainkeys
-    "Encoding:"
+    "Discarded-X400-"                   ; RFC 2156
+    "Disclose-Recipients:"              ; RFC 2156
+    "Disposition-Notification-Options:" ; RFC 2298
+    "Disposition-Notification-To:"      ; RFC 2298
+    "Distribution:"                     ; RFC 1036
+    "DKIM-"                             ; http://antispam.yahoo.com/domainkeys
+    "DL-Expansion-History:"             ; RFC 2156
+    "DomainKey-"                        ; http://antispam.yahoo.com/domainkeys
+    "DomainKey-Signature:"
+    "Encoding:"                         ; RFC 1505
     "Envelope-to:"
     "Envelope-to:"
-    "Errors-To:"
+    "Errors-To:"                        ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Expires:"                          ; RFC 1036
+    "Expiry-Date:"                      ; RFC 2156
     "Face:"                             ; Gnus Face header
     "Face:"                             ; Gnus Face header
+    "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/
     "Forwarded:"                        ; MH
     "From "                             ; sendmail
     "Forwarded:"                        ; MH
     "From "                             ; sendmail
-    "Importance:"                       ; MS Outlook
-    "In-Reply-To:"                      ; MH
-    "Lines:"
-    "List-"                             ; Mailman mailing list manager
-    "List-"                             ; Unknown mailing list managers
-    "List-Subscribe:"                   ; Unknown mailing list managers
-    "List-Unsubscribe:"                 ; Unknown mailing list managers
+    "Generate-Delivery-Report:"         ; RFC 2156
+    "Importance:"                       ; RFC 2156, 2421
+    "In-Reply-To:"                      ; RFC 2822
+    "Incomplete-Copy:"                  ; RFC 2156
+    "Keywords:"                         ; RFC 2822
+    "Language:"                         ; RFC 2156
+    "Lines:"                            ; RFC 1036
+    "List-"                             ; RFC 2369, 2919
+    "Mail-Copies-To:"                   ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Mail-Followup-To:"                 ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Mail-from:"                        ; MH
     "Mail-from:"                        ; MH
-    "Mailing-List:"              ; Egroups/yahoogroups mailing list manager
+    "Mail-Reply-To:"                    ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Mailing-List:"                     ; Egroups/yahoogroups mailing list manager
+    "Message-Content:"                  ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Message-Id:"                       ; RFC 822
     "Message-Id:"                       ; RFC 822
+    "Message-Type:"                     ; RFC 2156
     "Mime-Version"                      ; RFC 2045
     "Mime-Version"                      ; RFC 2045
+    "Msgid:"
     "NNTP-"                             ; News
     "NNTP-"                             ; News
+    "Obsoletes:"                        ; RFC 2156
     "Old-Return-Path:"
     "Old-Return-Path:"
-    "Original-Encoded-Information-Types:"  ; X400
+    "OpenPGP:"
+    "Original-Encoded-Information-Types:"  ; RFC 2156
     "Original-Lines:"                   ; mail to news
     "Original-Lines:"                   ; mail to news
-    "Original-NNTP-"                    ; mail to news
     "Original-Newsgroups:"              ; mail to news
     "Original-Newsgroups:"              ; mail to news
+    "Original-NNTP-"                    ; mail to news
     "Original-Path:"                    ; mail to news
     "Original-Received:"                ; mail to news
     "Original-Path:"                    ; mail to news
     "Original-Received:"                ; mail to news
+    "Original-Recipt:"                  ; RFC 2298
     "Original-To:"                      ; mail to news
     "Original-X-"                       ; mail to news
     "Original-To:"                      ; mail to news
     "Original-X-"                       ; mail to news
-    "Originator:"
+    "Origination-Client:"               ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Originator:"                       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "P1-Content-Type:"                  ; X400
     "P1-Message-Id:"                    ; X400
     "P1-Recipient:"                     ; X400
     "P1-Content-Type:"                  ; X400
     "P1-Message-Id:"                    ; X400
     "P1-Recipient:"                     ; X400
-    "Path:"
-    "Precedence:"
+    "Path:"                             ; RFC 1036
+    "Pics-Label:"                       ; W3C
+    "Posted-To:"                        ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Precedence:"                       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Prev-Resent"                       ; MH
     "Prev-Resent"                       ; MH
-    "Priority:"
-    "Received:"                         ; RFC 822
+    "Prevent-NonDelivery-Report:"       ; RFC 2156
+    "Priority:"                         ; RFC 2156
+    "Read-Receipt-To:"                  ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Received-SPF:"                     ; Gmail
     "Received-SPF:"                     ; Gmail
-    "References:"
+    "Received:"                         ; RFC 822
+    "References:"                       ; RFC 2822
+    "Registered-Mail-Reply-Requested-By:"       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Remailed-"                         ; MH
     "Remailed-"                         ; MH
+    "Replaces:"                         ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Replied:"                          ; MH
     "Replied:"                          ; MH
-    "Resent"                            ; MH
+    "Resent-"                           ; RFC 2822
     "Return-Path:"                      ; RFC 822
     "Return-Path:"                      ; RFC 822
-    "Sensitivity:"                      ; MS Outlook
+    "Return-Receipt-Requested:"         ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Return-Receipt-To:"                ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "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/
     "Status:"                           ; sendmail
     "Status:"                           ; sendmail
+    "Supersedes:"                       ; H. Spencer: News Article Format and Transmission, June 1994
+    "Telefax:"                          ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Thread-"
     "Thread-"
+    "Thread-Index:"
+    "Thread-Topic:"
+    "Translated-By:"                    ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "Translation-Of:"                   ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Ua-Content-Id:"                    ; X400
     "Ua-Content-Id:"                    ; X400
-;;  "User-Agent:"                       ; Similar to X-Mailer, so display it.
     "Via:"                              ; MH
     "Via:"                              ; MH
-    "X-AOL-IP:"                         ; AOL WebMail
-    "X-Abuse-Info:"
     "X-Abuse-and-DMCA-"
     "X-Abuse-and-DMCA-"
-    "X-Accept-Language:"
+    "X-Abuse-Info:"
     "X-Accept-Language:"                ; Netscape/Mozilla
     "X-Ack:"
     "X-Accept-Language:"                ; Netscape/Mozilla
     "X-Ack:"
+    "X-Admin:"                          ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Administrivia-To:"
     "X-Administrivia-To:"
+    "X-AMAZON"                          ; Amazon.com
     "X-AntiAbuse:"                      ; cPanel
     "X-AntiAbuse:"                      ; cPanel
+    "X-Antivirus-Scanner:"
+    "X-AOL-IP:"                         ; AOL WebMail
     "X-Apparently-From:"                ; MS Outlook
     "X-Apparently-To:"           ; Egroups/yahoogroups mailing list manager
     "X-Apparently-From:"                ; MS Outlook
     "X-Apparently-To:"           ; Egroups/yahoogroups mailing list manager
+    "X-Attribution:"
+    "X-AuditID:"
+    "X-Authenticated-Info:"             ; Verizon.net?
     "X-Authenticated-Sender:"           ; AT&T Message Center (webmail)
     "X-Authentication-Warning:"         ; sendmail
     "X-Authenticated-Sender:"           ; AT&T Message Center (webmail)
     "X-Authentication-Warning:"         ; sendmail
+    "X-Authority-Analysis:"
     "X-Barracuda-"                      ; Barracuda spam scores
     "X-Beenthere:"                      ; Mailman mailing list manager
     "X-Barracuda-"                      ; Barracuda spam scores
     "X-Beenthere:"                      ; Mailman mailing list manager
+    "X-Bigfish:"
     "X-Bogosity:"                       ; bogofilter
     "X-Bogosity:"                       ; bogofilter
-    "X-BrightmailFiltered:"             ; Brightmail
     "X-Brightmail-Tracker:"             ; Brightmail
     "X-Brightmail-Tracker:"             ; Brightmail
+    "X-BrightmailFiltered:"             ; Brightmail
     "X-Bugzilla-"                       ; Bugzilla
     "X-Bugzilla-"                       ; Bugzilla
-    "X-Complaints-To:"
+    "X-Campaignid:"
+    "X-Comment:"                        ; AT&T Mailennium
+    "X-Complaints-To:"                  ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-Confirm-Reading-To:"             ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-Content-Filtered-By:"
     "X-ContentStamp:"                   ; NetZero
     "X-ContentStamp:"                   ; NetZero
+    "X-Country-Chain:"                  ; http://www.declude.com/x-note.htm
+    "X-Cr-Hashedpuzzle:"
+    "X-Cr-Puzzleid:"
     "X-Cron-Env:"
     "X-Cron-Env:"
-    "X-DMCA"
+    "X-DCC-Usenix-Metrics:"
+    "X-Declude-"                        ; http://www.declude.com/x-note.htm
+    "X-Dedicated:"
     "X-Delivered"
     "X-Delivered"
+    "X-DH-Virus-"
+    "X-DMCA"
+    "X-Domain:"
+    "X-Echelon-Distraction"
     "X-EFL-Spamscore:"                  ; MIT alumni spam filtering
     "X-EFL-Spamscore:"                  ; MIT alumni spam filtering
+    "X-eGroups-"                        ; Egroups/yahoogroups mailing list manager
+    "X-EID:"
     "X-ELNK-Trace:"                     ; Earthlink mailer
     "X-ELNK-Trace:"                     ; Earthlink mailer
+    "X-Enigmail-Version:"
     "X-Envelope-Date:"                  ; GNU mailutils
     "X-Envelope-Date:"                  ; GNU mailutils
-    "X-Envelope-From:"
+    "X-Envelope-From:"                  ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Envelope-Sender:"
     "X-Envelope-Sender:"
-    "X-Envelope-To:"
+    "X-Envelope-To:"                    ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-EviteMessageId:"                 ; evite.com
     "X-Evolution:"                      ; Evolution mail client
     "X-Evolution:"                      ; Evolution mail client
-    "X-Face:"
+    "X-ExtLoop"
+    "X-Face:"                           ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-fmx-"
     "X-Folder:"                         ; Spam
     "X-From-Line"
     "X-Gmail-"                          ; Gmail
     "X-Gnus-Mail-Source:"               ; gnus
     "X-Folder:"                         ; Spam
     "X-From-Line"
     "X-Gmail-"                          ; Gmail
     "X-Gnus-Mail-Source:"               ; gnus
+    "X-Google-"                         ; Google mail
+    "X-Google-Sender-Auth:"
     "X-Greylist:"                       ; milter-greylist-1.2.1
     "X-Greylist:"                       ; milter-greylist-1.2.1
-    "X-Habeas-SWE-1:"                   ; Spam
-    "X-Habeas-SWE-2:"                   ; Spam
-    "X-Habeas-SWE-3:"                   ; Spam
-    "X-Habeas-SWE-4:"                   ; Spam
-    "X-Habeas-SWE-5:"                   ; Spam
-    "X-Habeas-SWE-6:"                   ; Spam
-    "X-Habeas-SWE-7:"                   ; Spam
-    "X-Habeas-SWE-8:"                   ; Spam
-    "X-Habeas-SWE-9:"                   ; Spam
+    "X-Habeas-SWE-"                     ; Spam
     "X-Hashcash:"                       ; hashcash
     "X-Hashcash:"                       ; hashcash
+    "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/
     "X-Info:"                           ; NTMail
     "X-Info:"                           ; NTMail
-    "X-IronPort-AV:"                    ; IronPort AV
+    "X-IronPort-"                       ; IronPort AV
+    "X-ISI-4-30-3-MailScanner:"
+    "X-J2-"
     "X-Juno-"                           ; Juno
     "X-Juno-"                           ; Juno
-    "X-List-Host:"                      ; Unknown mailing list managers
+    "X-Key:"
+    "X-List-Host:"                      ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-List-Subscribe:"                 ; Unknown mailing list managers
     "X-List-Unsubscribe:"               ; Unknown mailing list managers
     "X-Listprocessor-"                  ; ListProc(tm) by CREN
     "X-List-Subscribe:"                 ; Unknown mailing list managers
     "X-List-Unsubscribe:"               ; Unknown mailing list managers
     "X-Listprocessor-"                  ; ListProc(tm) by CREN
-    "X-Listserver:"                     ; Unknown mailing list managers
-    "X-Loop:"                           ; Unknown mailing list managers
+    "X-Listserver:"                     ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-Loop:"                           ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-Lrde-Mailscanner:"
     "X-Lumos-SenderID:"                 ; Roving ConstantContact
     "X-Lumos-SenderID:"                 ; Roving ConstantContact
-    "X-MAIL-INFO:"                      ; NetZero
-    "X-MB-Message-"                     ; AOL WebMail
-    "X-MHE-Checksum:"                   ; Checksum added during index search
-    "X-MIME-Autoconverted:"             ; sendmail
-    "X-MIMETrack:"
-    "X-MS-"                             ; MS Outlook
     "X-Mail-from:"                      ; fastmail.fm
     "X-Mail-from:"                      ; fastmail.fm
-    "X-MailScanner"                     ; ListProc(tm) by CREN
+    "X-MAIL-INFO:"                      ; NetZero
+    "X-Mailer_"
     "X-Mailing-List:"                   ; Unknown mailing list managers
     "X-Mailman-Approved-At:"            ; Mailman mailing list manager
     "X-Mailman-Version:"                ; Mailman mailing list manager
     "X-Mailing-List:"                   ; Unknown mailing list managers
     "X-Mailman-Approved-At:"            ; Mailman mailing list manager
     "X-Mailman-Version:"                ; Mailman mailing list manager
+    "X-MailScanner"                     ; ListProc(tm) by CREN
+    "X-Mailutils-Message-Id"            ; GNU Mailutils
     "X-Majordomo:"                      ; Majordomo mailing list manager
     "X-Majordomo:"                      ; Majordomo mailing list manager
+    "X-MB-Message-"                     ; AOL WebMail
+    "X-MDaemon-Deliver-To:"
+    "X-MDRemoteIP:"
     "X-Message-Id"
     "X-Message-Id"
+    "X-Message-Type:"
     "X-MessageWall-Score:"              ; Unknown mailing list manager, AUC TeX
     "X-MessageWall-Score:"              ; Unknown mailing list manager, AUC TeX
-    "X-MimeOLE:"                        ; MS Outlook
+    "X-MHE-Checksum:"                   ; Checksum added during index search
+    "X-MIME-Autoconverted:"             ; sendmail
+    "X-MIMEOLE:"                        ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/sendmail
+    "X-MIMETrack:"
     "X-Mms-"                            ; T-Mobile pictures
     "X-Mozilla-Status:"                 ; Netscape/Mozilla
     "X-Mms-"                            ; T-Mobile pictures
     "X-Mozilla-Status:"                 ; Netscape/Mozilla
+    "X-MS-"                             ; MS Outlook
     "X-Msmail-"                         ; MS Outlook
     "X-Msmail-"                         ; MS Outlook
+    "X-MSMail-Priority"                 ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-NAI-Spam-"                       ; Network Associates Inc. SpamKiller
     "X-News:"                           ; News
     "X-NAI-Spam-"                       ; Network Associates Inc. SpamKiller
     "X-News:"                           ; News
-    "X-No-Archive:"
+    "X-Newsreader:"                     ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-No-Archive:"                     ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Notes-Item:"                     ; Lotus Notes Domino structured header
     "X-OperatingSystem:"
     "X-Notes-Item:"                     ; Lotus Notes Domino structured header
     "X-OperatingSystem:"
-    ;;"X-Operator:"                     ; Similar to X-Mailer, so display it
+    "X-ORBL:"
     "X-Orcl-Content-Type:"
     "X-Orcl-Content-Type:"
+    "X-Organization:"
+    "X-Original-Arrival-Type:"          ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Original-Complaints-To:"
     "X-Original-Date:"                  ; SourceForge mailing list manager
     "X-Original-To:"
     "X-Original-Trace:"
     "X-OriginalArrivalTime:"            ; Hotmail
     "X-Original-Complaints-To:"
     "X-Original-Date:"                  ; SourceForge mailing list manager
     "X-Original-To:"
     "X-Original-Trace:"
     "X-OriginalArrivalTime:"            ; Hotmail
+    "X-Originating-Email:"              ; Hotmail
     "X-Originating-IP:"                 ; Hotmail
     "X-Originating-IP:"                 ; Hotmail
+    "X-pair-"
+    "X-PGP:"
+    "X-PID:"
+    "X-PMG-"
+    "X-PMX-Version:"
     "X-Postfilter:"
     "X-Priority:"                       ; MS Outlook
     "X-Postfilter:"
     "X-Priority:"                       ; MS Outlook
+    "X-Proofpoint-"                    ; Proofpoint mail filter
     "X-Provags-ID:"
     "X-Provags-ID:"
+    "X-PSTN-"
     "X-Qotd-"                           ; User added
     "X-Qotd-"                           ; User added
-    "X-RM"
+    "X-RCPT-TO:"                        ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Received-Date:"
     "X-Received:"
     "X-Received-Date:"
     "X-Received:"
+    "X-Report-Abuse-To:"                ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Request-"
     "X-Resolved-to:"                    ; fastmail.fm
     "X-Return-Path-Hint:"               ; Roving ConstantContact
     "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
     "X-SA-Exim-"                        ; Exim SpamAssassin
     "X-Roving-"                         ; Roving ConstantContact
     "X-SA-Exim-"                        ; Exim SpamAssassin
+    "X-Sasl-enc:"                       ; Apple Mail
     "X-SBClass:"                        ; Spam
     "X-SBNote:"                         ; Spam
     "X-SBPass:"                         ; Spam
     "X-SBClass:"                        ; Spam
     "X-SBNote:"                         ; Spam
     "X-SBPass:"                         ; Spam
+    "X-SBRS:"
     "X-SBRule:"                         ; Spam
     "X-SBRule:"                         ; Spam
-    "X-SMTP-"
-    "X-Sasl-enc:"                       ; Apple Mail
     "X-Scanned-By:"
     "X-Scanned-By:"
-    "X-Sender:"
+    "X-Sender:"                         ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Server-Date:"
     "X-Server-Uuid:"
     "X-Server-Date:"
     "X-Server-Uuid:"
+    "X-Service-Code:"
     "X-Sieve:"                          ; Sieve filtering
     "X-Sieve:"                          ; Sieve filtering
+    "X-SMTP-"
     "X-Source"
     "X-Spam-"                           ; Spamassassin
     "X-SpamBouncer:"                    ; Spam
     "X-Source"
     "X-Spam-"                           ; Spamassassin
     "X-SpamBouncer:"                    ; Spam
+    "X-SPF-"
     "X-Status"
     "X-Status"
+    "X-Submission-Address:"
     "X-Submissions-To:"
     "X-Submissions-To:"
+    "X-Sun-Charset:"
     "X-Telecom-Digest"
     "X-Trace:"
     "X-UID"
     "X-Telecom-Digest"
     "X-Trace:"
     "X-UID"
-    "X-UIDL:"
+    "X-UIDL:"                           ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-Unity"
     "X-UNTD-"                           ; NetZero
     "X-UNTD-"                           ; NetZero
+    "X-URI:"                            ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
+    "X-URL:"                            ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-USANET-"                         ; usa.net
     "X-USANET-"                         ; usa.net
+    "X-Usenet-Provider"
     "X-UserInfo1:"
     "X-UserInfo1:"
-    "X-VSMLoop:"                        ; NTMail
-    "X-Virus-Scanned"                   ; amavisd-new
+    "X-Virus-"                          ;
     "X-Vms-To:"
     "X-Vms-To:"
+    "X-VSMLoop:"                        ; NTMail
     "X-WebTV-Signature:"
     "X-Wss-Id:"                         ; Worldtalk gateways
     "X-WebTV-Signature:"
     "X-Wss-Id:"                         ; Worldtalk gateways
+    "X-X-Sender:"                       ; http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "X-Yahoo"
     "X-Yahoo"
-    "X-eGroups-"                 ; Egroups/yahoogroups mailing list manager
-    "X-pgp:"
-    "X-submission-address:"
+    "X-Yahoo-Newman-"
+    "X-YMail-"
     "X400-"                             ; X400
     "X400-"                             ; X400
-    "Xref:")
+    "Xref:"                             ; RFC 1036
+    )
   "List of default header fields that are not to be shown.
 
 Do not alter this variable directly. Instead, add entries from
   "List of default header fields that are not to be shown.
 
 Do not alter this variable directly. Instead, add entries from
@@ -2601,9 +2746,11 @@ Header fields that you would like to hide that aren't listed in
 with a couple of caveats. Regular expressions are not allowed.
 Unique fields should have a \":\" suffix; otherwise, the element
 can be used to render invisible an entire class of fields that
 with a couple of caveats. Regular expressions are not allowed.
 Unique fields should have a \":\" suffix; otherwise, the element
 can be used to render invisible an entire class of fields that
-start with the same prefix. If you think a header field should be
-generally ignored, report a bug (see URL
-`https://sourceforge.net/tracker/?group_id=13357&atid=113357').
+start with the same prefix.
+
+If you think a header field should be generally ignored, please
+update SF #1916032 (see URL
+`https://sourceforge.net/tracker/index.php?func=detail&aid=1916032&group_id=13357&atid=113357').
 
 See also `mh-clean-message-header-flag'."
 
 
 See also `mh-clean-message-header-flag'."
 
@@ -2623,7 +2770,11 @@ can check off any field that you would like to see.
 Header fields that you would like to hide that aren't listed can
 be added to the option `mh-invisible-header-fields'.
 
 Header fields that you would like to hide that aren't listed can
 be added to the option `mh-invisible-header-fields'.
 
-See also `mh-clean-message-header-flag'."
+See also `mh-clean-message-header-flag'.
+
+If you think a header field should be added to this list, please
+update SF #1916032 (see URL
+`https://sourceforge.net/tracker/index.php?func=detail&aid=1916032&group_id=13357&atid=113357')."
   :type `(set ,@(mapcar (lambda (x) `(const ,x))
                         mh-invisible-header-fields-internal))
   :set (lambda (symbol value)
   :type `(set ,@(mapcar (lambda (x) `(const ,x))
                         mh-invisible-header-fields-internal))
   :set (lambda (symbol value)
@@ -2944,6 +3095,16 @@ folder, which is also available in `mh-current-folder'."
   :group 'mh-alias
   :package-version '(MH-E . "8.0"))
 
   :group 'mh-alias
   :package-version '(MH-E . "8.0"))
 
+(defcustom-mh mh-annotate-msg-hook nil
+  "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
+  :package-version '(MH-E . "8.1"))
+
 (defcustom-mh mh-before-commands-processed-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding refile and delete requests.
 
 (defcustom-mh mh-before-commands-processed-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding refile and delete requests.
 
@@ -3082,6 +3243,14 @@ This can be done with this hook which is called when
   :group 'mh-search
   :package-version '(MH-E . "8.0"))
 
   :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.
 
 (defcustom-mh mh-quit-hook nil
   "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
 
@@ -3301,7 +3470,7 @@ consumed by `defface-mh'.")
 The :inherit keyword is available on all supported versions of
 GNU Emacs and XEmacs from at least 21.5.23 on.")
 
 The :inherit keyword is available on all supported versions of
 GNU Emacs and XEmacs from at least 21.5.23 on.")
 
-(defvar mh-min-colors-defined-flag (and (not mh-xemacs-flag)
+(defvar mh-min-colors-defined-flag (and (not (featurep 'xemacs))
                                         (>= emacs-major-version 22))
   "Non-nil means `defface' supports min-colors display requirement.")
 
                                         (>= emacs-major-version 22))
   "Non-nil means `defface' supports min-colors display requirement.")