GNU bug report logs -
#25874
24.4; sendmail-query-user-about-smtp allows nil function
Previous Next
Reported by: hackerb9 <at> member.fsf.org
Date: Sat, 25 Feb 2017 18:50:02 UTC
Severity: normal
Tags: fixed, patch
Found in version 24.4
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25874 in the body.
You can then email your comments to 25874 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25874
; Package
emacs
.
(Sat, 25 Feb 2017 18:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
hackerb9 <at> member.fsf.org
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 25 Feb 2017 18:50:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
If you hit Enter at the "Send mail via" prompt, Emacs will misconfigure
itself so it is impossible to send mail.
RECIPE TO REPEAT
1. Start a new mail message using C-x 4 m
2. After composing, hit C-c C-c to send
3. Emacs will prompt "Send mail via: "
(This is sendmail.el:sendmail-query-user-about-smtp asking how you
would like to send mail. Valid responses are: "mail client",
"transport", or "smtp")
4. Hit the Enter key, assuming Emacs will pick a reasonable default
5. Be surprised when you get a mysterious error message:
"Symbol's function definition is void: nil"
6. Hit C-c C-c to try to send the message again, assuming Emacs will
again prompt and you can give a different response.
7. Be even more surprised that instead of asking "Send message via" a
second time, Emacs has memorized that you want to use the function
"nil" to send messages and will simply give the same error message
every time.
One simple fix would be to have the function sendmail-query-once check
if the value of send-mail-function is nil. It is not perfect as it
will still show the user the error message (seen in step 5), but at
least the user can try again. Here is a patch which implements that
fix:
----------------------------------------------------------------------
--- sendmail.el.orig 2014-10-21 14:45:42.000000000 -0700
+++ sendmail.el 2017-02-18 05:58:20.085685326 -0800
@@ -507,15 +507,16 @@
;;;###autoload
(defun sendmail-query-once ()
"Query for `send-mail-function' and send mail with it.
This also saves the value of `send-mail-function' via Customize."
;; If send-mail-function is already setup, we're incorrectly called
;; a second time, probably because someone's using an old value
;; of send-mail-function.
- (when (eq send-mail-function 'sendmail-query-once)
+ (when (or (not (fboundp send-mail-function))
+ (eq send-mail-function 'sendmail-query-once))
(sendmail-query-user-about-smtp))
(funcall send-mail-function))
(defun sendmail-query-user-about-smtp ()
(let* ((options `(("mail client" . mailclient-send-it)
,@(when (and sendmail-program
(executable-find sendmail-program))
----------------------------------------------------------------------
In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
of 2015-03-07 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description: Debian GNU/Linux 8.7 (jessie)
Configured using:
`configure --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
--build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
--libexecdir=/usr/lib --localstatedir=/var/lib
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
--with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-z,relro'
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25874
; Package
emacs
.
(Mon, 27 Feb 2017 03:26:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 25874 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 25874 patch
quit
hackerb9 <at> member.fsf.org writes:
> 3. Emacs will prompt "Send mail via: "
>
> (This is sendmail.el:sendmail-query-user-about-smtp asking how you
> would like to send mail. Valid responses are: "mail client",
> "transport", or "smtp")
>
> 4. Hit the Enter key, assuming Emacs will pick a reasonable default
>
> 5. Be surprised when you get a mysterious error message:
How about making Emacs give a reasonable default then:
[v1-0001-Set-default-when-asking-for-send-mail-function-Bu.patch (text/x-diff, inline)]
From 449169796a4a14abc4ff34aa78c5308b53ee20a3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sun, 26 Feb 2017 22:17:28 -0500
Subject: [PATCH v1] Set default when asking for send-mail-function
(Bug#25874).
* lisp/mail/sendmail.el (sendmail-query-user-about-smtp): Pass first
option as default for `completing-read'.
---
lisp/mail/sendmail.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 70c8ea1f93..42b688fbab 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -555,8 +555,9 @@ sendmail-query-user-about-smtp
(goto-char (point-min))
(display-buffer (current-buffer))
(let ((completion-ignore-case t))
- (completing-read "Send mail via: "
- options nil 'require-match)))))
+ (completing-read
+ (format "Send mail via (default %s): " (caar options))
+ options nil 'require-match nil nil (car options))))))
(customize-save-variable 'send-mail-function
(cdr (assoc-string choice options t)))))
--
2.11.1
Added tag(s) patch.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Mon, 27 Feb 2017 03:26:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25874
; Package
emacs
.
(Tue, 07 Mar 2017 04:11:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 25874 <at> debbugs.gnu.org (full text, mbox):
tags 25874 fixed
close 25874 26.1
quit
npostavs <at> users.sourceforge.net writes:
>
> How about making Emacs give a reasonable default then:
Pushed to master [1: 66b7543eab].
1: 2017-03-06 23:06:29 -0500 66b7543eab5f500f2e7cf0cce9b260991107fc97
Set default when asking for send-mail-function (Bug#25874).
Added tag(s) fixed.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Tue, 07 Mar 2017 04:11:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
25874 <at> debbugs.gnu.org and hackerb9 <at> member.fsf.org
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Tue, 07 Mar 2017 04:11:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 04 Apr 2017 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 78 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.