[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30669: Suppress "No MH variant found" messages

From: Mike Kupfer
Subject: bug#30669: Suppress "No MH variant found" messages
Date: Sun, 04 Mar 2018 13:59:01 -0800

Glenn Morris wrote:

> Minor revision:

Hi Glenn, thanks for the patch.  I ran it through some tests and made a
couple tweaks.

The first tweak is needed for the patch to be usable.  Without it, MH-E
recognizes which MH variants are installed, but it doesn't pick one,
which breaks both reading mail and sending it.  I fixed that by adding

    (or mh-variant-in-use (mh-variant-set mh-variant))

to #'mh-find-path.

The second tweak improves the error reporting in the case where no MH
variants can be found.  It's independent of this fix, but the issue came
up in my testing, so I figured I'd deal with it now.

The patch with both tweaks included is

diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el
--- a/lisp/mh-e/mh-comp.el
+++ b/lisp/mh-e/mh-comp.el
@@ -1054,6 +1054,7 @@
 (defun mh-insert-x-mailer ()
   "Append an X-Mailer field to the header.
 The versions of MH-E, Emacs, and MH are shown."
+  (or mh-variant-in-use (mh-variant-set mh-variant))
   ;; Lazily initialize mh-x-mailer-string.
   (when (and mh-insert-x-mailer-flag (null mh-x-mailer-string))
     (setq mh-x-mailer-string
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -410,6 +410,8 @@
   (require 'gnus)
+(defvar mh-variant)
 (defun mh-version ()
   "Display version information about MH-E and the MH mail handling system."
@@ -430,6 +432,7 @@
   ;; Emacs version.
   (insert (emacs-version) "\n\n")
   ;; MH version.
+  (or mh-variant-in-use (mh-variant-set mh-variant))
   (if mh-variant-in-use
       (insert mh-variant-in-use "\n"
               " mh-progs:\t" mh-progs "\n"
@@ -876,6 +879,7 @@
 (defun mh-variant-p (&rest variants)
   "Return t if variant is any of VARIANTS.
 Currently known variants are `MH', `nmh', and `gnu-mh'."
+  (or mh-variant-in-use (mh-variant-set mh-variant))
   (let ((variant-in-use
          (cadr (assoc 'variant (assoc mh-variant-in-use (mh-variants))))))
     (not (null (member variant-in-use variants)))))
@@ -941,6 +945,8 @@
       (when (not (mh-variant-set-variant variant))
         (message "Warning: %s variant not found. Autodetecting..." variant)
         (mh-variant-set 'autodetect)))
+     ((null valid-list)
+      (message "Unknown variant %s; can't find MH anywhere" variant))
       (message "Unknown variant %s; use %s"
@@ -972,6 +978,7 @@
   :set (lambda (symbol value)
          (set-default symbol value)     ;Done in mh-variant-set-variant!
          (mh-variant-set value))
+  :initialize 'custom-initialize-default
   :group 'mh-e
   :package-version '(MH-E . "8.0"))
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -177,6 +177,7 @@
 variables if you need to run with different values between MH and
   (unless mh-find-path-run
+    (or mh-variant-in-use (mh-variant-set mh-variant))
     ;; Sanity checks.
     (if (and (getenv "MH")
              (not (file-readable-p (getenv "MH"))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]