Subject: bug#31737: 26.1.50; Gnus does not use mailutils movemail

From: Robert Pluim <[email-masked]>
Date: Thu, 14 Jun 2018 16:37:59 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Robert Pluim <[email-masked]>
>> Cc: [email-masked],  [email-masked],  [email-masked]
>> Date: Thu, 14 Jun 2018 14:14:28 +0200
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> From: Robert Pluim <[email-masked]>
>> >> Cc: Eli Zaretskii <[email-masked]>,  Colin Baxter <[email-masked]>,  [email-masked]
>> >> Date: Wed, 13 Jun 2018 16:08:53 +0200
>> >> 
>> >> Eli, were you thinking that mail-source should duplicate the movemail
>> >> detection logic in rmail? Or should it just assume Mailutils movemail
>> >> and pass '--emacs'?
>> >
>> > The former.
>> 
>> Something like this? Testing definitely required by someone who uses
>> mailutils movemail for Gnus. Not sure this is emacs-26 material
>> anymore.
>
> We could install on emacs-26 something much simpler: just call
> "movemail", without assuming it's in exec-directory, if
> mail-source-movemail-program is nil, and don't use the "--emacs"
> option.

Even simpler (Iʼm tempted to put ""Don't merge to master." in the ChangeLog).

2018-06-14  Robert Pluim  <[email-masked]>

	* lisp/gnus/mail-source.el (mail-source-movemail-program): Change
	default to "movemail".
	(mail-source-movemail): Pass just mail-source-movemail-program to
	call-process instead of fully specifying it relative to
	exec-directory.  Ensures that we will find Mailutils movemail if
	it is installed.  (Bug#31737)

diff --git i/etc/NEWS w/etc/NEWS
index 938644215f..0f67ca572a 100644
--- i/etc/NEWS
+++ w/etc/NEWS
@@ -46,6 +46,14 @@ often cause crashes.  Set it to nil if you really need those fonts.
 
 * Changes in Specialized Modes and Packages in Emacs 26.2
 
+** Gnus
+
+---
+*** Mailutils movemail will now be used if found at runtime.
+The default value of mail-source-movemail-program is now "movemail".
+This ensures that the movemail program from GNU Mailutils will be used
+if found in 'exec-path', even if it was not found at build time.
+
 ** Shell mode
 
 ---
diff --git i/lisp/gnus/mail-source.el w/lisp/gnus/mail-source.el
index d2850f4cee..22d3eb374f 100644
--- i/lisp/gnus/mail-source.el
+++ w/lisp/gnus/mail-source.el
@@ -301,9 +301,9 @@ mail-source-idle-time-delay
   :group 'mail-source
   :type 'number)
 
-(defcustom mail-source-movemail-program nil
+(defcustom mail-source-movemail-program "movemail"
   "If non-nil, name of program for fetching new mail."
-  :version "22.1"
+  :version "26.2"
   :group 'mail-source
   :type '(choice (const nil) string))
 
@@ -682,12 +682,16 @@ mail-source-movemail
 	      (setq errors (generate-new-buffer " *mail source loss*"))
 	      (let ((default-directory "/"))
 		(setq result
+                      ;; call-proces looks in exec-path, which
+                      ;; contains exec-directory, so will find
+                      ;; Mailutils movemail if it exists, else it will
+                      ;; find "our" movemail in exec-directory.
+                      ;; Bug#31737
 		      (apply
 		       'call-process
 		       (append
 			(list
-			 (or mail-source-movemail-program
-			     (expand-file-name "movemail" exec-directory))
+			 mail-source-movemail-program
 			 nil errors nil from to)))))
 	      (when (file-exists-p to)
 		(set-file-modes to mail-source-default-file-modes))