]> git.eshelyaron.com Git - emacs.git/commitdiff
MH-E: fix check for nmh or Mailutils installation
authorStephen Gildea <stepheng+emacs@gildea.com>
Fri, 17 Sep 2021 14:01:40 +0000 (07:01 -0700)
committerStephen Gildea <stepheng+emacs@gildea.com>
Fri, 17 Sep 2021 14:10:58 +0000 (07:10 -0700)
* lisp/mh-e/mh-e.el (mh-variant-gnu-mh-info, mh-variant-nmh-info):
Run install-mh, not mhparam, to check whether an MH variant is
installed on the system.  mhparam fails if no user profile is found,
so it is not a reliable check of the state of the system as a whole.

Tested with:
nmh 1.4, nmh 1.7.1, GNU Mailutils 2.2, GNU Mailutils 3.7, GNU Mailutils 3.13

lisp/mh-e/mh-e.el

index 52fb11be6fca87a8da99eee9d763d07e964e4bee..9cbc8cfb73751ea27de4a24c57aa8b3d339c4531 100644 (file)
@@ -785,14 +785,16 @@ is described by the variable `mh-variants'."
 (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:
+  ;; Sample '-version' outputs:
   ;; mhparam (GNU mailutils 0.3.2)
-  (let ((mhparam (expand-file-name "mhparam" dir)))
-    (when (mh-file-command-p mhparam)
+  ;; install-mh (GNU Mailutils 2.2)
+  ;; install-mh (GNU Mailutils 3.7)
+  (let ((install-mh (expand-file-name "install-mh" dir)))
+    (when (mh-file-command-p install-mh)
       (erase-buffer)
-      (call-process mhparam nil '(t nil) nil "-version")
+      (call-process install-mh nil '(t nil) nil "-version")
       (goto-char (point-min))
-      (when (search-forward-regexp "mhparam (\\(GNU [Mm]ailutils \\S +\\))"
+      (when (search-forward-regexp "install-mh (\\(GNU [Mm]ailutils \\S +\\))"
                                    nil t)
         (let ((version (match-string 1))
               (mh-progs dir))
@@ -806,14 +808,15 @@ This assumes that a temporary buffer is set up."
 
 (defun mh-variant-nmh-info (dir)
   "Return info for nmh variant in DIR assuming a temporary buffer is set up."
-  ;; `mhparam -version' outputs:
+  ;; Sample '-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)))
-    (when (mh-file-command-p mhparam)
+  ;; install-mh -- nmh-1.7.1 built October 26, 2019 on build-server-000
+  (let ((install-mh (expand-file-name "install-mh" dir)))
+    (when (mh-file-command-p install-mh)
       (erase-buffer)
-      (call-process mhparam nil '(t nil) nil "-version")
+      (call-process install-mh nil '(t nil) nil "-version")
       (goto-char (point-min))
-      (when (search-forward-regexp "mhparam -- nmh-\\(\\S +\\)" nil t)
+      (when (search-forward-regexp "install-mh -- nmh-\\(\\S +\\)" nil t)
         (let ((version (format "nmh %s" (match-string 1)))
               (mh-progs dir))
           `(,version