all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30669: Suppress "No MH variant found" messages
@ 2018-03-01 18:26 Glenn Morris
  2018-03-01 19:27 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2018-03-01 18:26 UTC (permalink / raw)
  To: 30669

Package: emacs,mh-e
Version: 26.1
Severity: minor

It's a long-standing issue that simply loading mh-e.el (eg when building
Emacs) often prints "No MH variant found on the system".

Ref eg https://sourceforge.net/p/mh-e/bugs/484/

Here's an attempt at a fix.
I have no systems configured to read mail with MH,
so this is largely untested.


   Suppress "No MH variant found" message
   * mh-e.el (mh-variant): Don't try to detect till actually needed.
   * mh-e.el (mh-version, mh-variant-p):
   * mh-comp.el (mh-insert-x-mailer): Ensure mh-variant-in-use is set.

diff --git i/lisp/mh-e/mh-comp.el w/lisp/mh-e/mh-comp.el
index cfdd2ae..c57e129 100644
--- i/lisp/mh-e/mh-comp.el
+++ w/lisp/mh-e/mh-comp.el
@@ -1056,6 +1056,7 @@ mh-compose-and-send-mail
 (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 'autodetect))
   ;; 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 i/lisp/mh-e/mh-e.el w/lisp/mh-e/mh-e.el
index 05ff672..94b029b 100644
--- i/lisp/mh-e/mh-e.el
+++ w/lisp/mh-e/mh-e.el
@@ -430,6 +430,7 @@ mh-version
   ;; Emacs version.
   (insert (emacs-version) "\n\n")
   ;; MH version.
+  (or mh-variant-in-use (mh-variant-set 'autodetect))
   (if mh-variant-in-use
       (insert mh-variant-in-use "\n"
               " mh-progs:\t" mh-progs "\n"
@@ -876,6 +877,7 @@ mh-variant-set-variant
 (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 'autodetect))
   (let ((variant-in-use
          (cadr (assoc 'variant (assoc mh-variant-in-use (mh-variants))))))
     (not (null (member variant-in-use variants)))))
@@ -972,6 +974,7 @@ mh-variant
   :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"))
 





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#30669: Suppress "No MH variant found" messages
  2018-03-01 18:26 bug#30669: Suppress "No MH variant found" messages Glenn Morris
@ 2018-03-01 19:27 ` Eli Zaretskii
  2018-03-02  5:08   ` Bill Wohler
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-03-01 19:27 UTC (permalink / raw)
  To: Glenn Morris, Bill Wohler; +Cc: 30669

> From: Glenn Morris <rgm@gnu.org>
> Date: Thu, 01 Mar 2018 13:26:17 -0500
> 
> It's a long-standing issue that simply loading mh-e.el (eg when building
> Emacs) often prints "No MH variant found on the system".
> 
> Ref eg https://sourceforge.net/p/mh-e/bugs/484/
> 
> Here's an attempt at a fix.
> I have no systems configured to read mail with MH,
> so this is largely untested.

Thanks.

Bill, could you please take a look?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30669: Suppress "No MH variant found" messages
  2018-03-01 19:27 ` Eli Zaretskii
@ 2018-03-02  5:08   ` Bill Wohler
  2018-03-03  2:38     ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Bill Wohler @ 2018-03-02  5:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30669

Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Glenn Morris <rgm@gnu.org>
> > Date: Thu, 01 Mar 2018 13:26:17 -0500
> > 
> > It's a long-standing issue that simply loading mh-e.el (eg when building
> > Emacs) often prints "No MH variant found on the system".
> > 
> > Ref eg https://sourceforge.net/p/mh-e/bugs/484/
> > 
> > Here's an attempt at a fix.
> > I have no systems configured to read mail with MH,
> > so this is largely untested.
> 
> Thanks.
> 
> Bill, could you please take a look?

Thanks for the patch. We'll try to address this issue this weekend.

-- 
Bill Wohler <wohler@newt.com> aka <Bill.Wohler@nasa.gov>
http://www.newt.com/wohler/
GnuPG ID:610BD9AD





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30669: Suppress "No MH variant found" messages
  2018-03-02  5:08   ` Bill Wohler
@ 2018-03-03  2:38     ` Glenn Morris
  2018-03-04 21:59       ` Mike Kupfer
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2018-03-03  2:38 UTC (permalink / raw)
  To: Bill Wohler; +Cc: 30669


Minor revision:

diff --git i/lisp/mh-e/mh-comp.el w/lisp/mh-e/mh-comp.el
index cfdd2ae..9415293 100644
--- i/lisp/mh-e/mh-comp.el
+++ w/lisp/mh-e/mh-comp.el
@@ -1056,6 +1056,7 @@ mh-compose-and-send-mail
 (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 i/lisp/mh-e/mh-e.el w/lisp/mh-e/mh-e.el
index 05ff672..7b587a8 100644
--- i/lisp/mh-e/mh-e.el
+++ w/lisp/mh-e/mh-e.el
@@ -410,6 +410,8 @@ mh-run-time-gnus-version
   (require 'gnus)
   gnus-version)
 
+(defvar mh-variant)
+
 ;;;###autoload
 (defun mh-version ()
   "Display version information about MH-E and the MH mail handling system."
@@ -430,6 +432,7 @@ mh-version
   ;; 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 @@ mh-variant-set-variant
 (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)))))
@@ -972,6 +976,7 @@ mh-variant
   :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"))
 





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#30669: Suppress "No MH variant found" messages
  2018-03-03  2:38     ` Glenn Morris
@ 2018-03-04 21:59       ` Mike Kupfer
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Kupfer @ 2018-03-04 21:59 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Bill Wohler, 30669

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)
   gnus-version)
 
+(defvar mh-variant)
+
 ;;;###autoload
 (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))
      (t
       (message "Unknown variant %s; use %s"
                variant
@@ -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
 MH-E."
   (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"))))

cheers,
mike





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-04 21:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 18:26 bug#30669: Suppress "No MH variant found" messages Glenn Morris
2018-03-01 19:27 ` Eli Zaretskii
2018-03-02  5:08   ` Bill Wohler
2018-03-03  2:38     ` Glenn Morris
2018-03-04 21:59       ` Mike Kupfer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.