1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

MH-E: fix check for nmh or Mailutils installation

* 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
This commit is contained in:
Stephen Gildea 2021-09-17 07:01:40 -07:00
parent 6397faaaf9
commit 2598b8874e

View 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