unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25874: 24.4; sendmail-query-user-about-smtp allows nil function
@ 2017-02-25 18:20 hackerb9
  2017-02-27  3:26 ` npostavs
  0 siblings, 1 reply; 3+ messages in thread
From: hackerb9 @ 2017-02-25 18:20 UTC (permalink / raw)
  To: 25874

[-- Attachment #1: Type: text/plain, Size: 3424 bytes --]

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'

[-- Attachment #2: Type: text/html, Size: 3630 bytes --]

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

* bug#25874: 24.4; sendmail-query-user-about-smtp allows nil function
  2017-02-25 18:20 bug#25874: 24.4; sendmail-query-user-about-smtp allows nil function hackerb9
@ 2017-02-27  3:26 ` npostavs
  2017-03-07  4:11   ` npostavs
  0 siblings, 1 reply; 3+ messages in thread
From: npostavs @ 2017-02-27  3:26 UTC (permalink / raw)
  To: hackerb9; +Cc: 25874

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

tags 25874 patch
quit

hackerb9@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1116 bytes --]

From 449169796a4a14abc4ff34aa78c5308b53ee20a3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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)))))
 \f
-- 
2.11.1


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

* bug#25874: 24.4; sendmail-query-user-about-smtp allows nil function
  2017-02-27  3:26 ` npostavs
@ 2017-03-07  4:11   ` npostavs
  0 siblings, 0 replies; 3+ messages in thread
From: npostavs @ 2017-03-07  4:11 UTC (permalink / raw)
  To: hackerb9; +Cc: 25874

tags 25874 fixed
close 25874 26.1
quit

npostavs@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).





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

end of thread, other threads:[~2017-03-07  4:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-25 18:20 bug#25874: 24.4; sendmail-query-user-about-smtp allows nil function hackerb9
2017-02-27  3:26 ` npostavs
2017-03-07  4:11   ` npostavs

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).