From: Grégoire Jadi Date: Mon, 12 Aug 2013 17:25:22 +0000 (+0200) Subject: * mail/sendmail.el (sendmail-send-it): Don't kill the error buffer on error X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~302 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7997a2f181ae0dc36726af0c8afbaf86595a8290;p=emacs.git * mail/sendmail.el (sendmail-send-it): Don't kill the error buffer on error This makes debugging easier. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa4d0289ee5..290af08f765 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-08-12 Grégoire Jadi + + * mail/sendmail.el (sendmail-send-it): Don't kill the error buffer + if sending fails. This makes debugging easier. + 2013-08-12 Juanma Barranquero * xml.el (xml-parse-tag-1): Use looking-at (this reverts change in diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index e1dee3295f2..4fdd75c68a6 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -1114,6 +1114,7 @@ external program defined by `sendmail-program'." (let ((errbuf (if mail-interactive (generate-new-buffer " sendmail errors") 0)) + (error nil) (tembuf (generate-new-buffer " sendmail temp")) (multibyte enable-multibyte-characters) (case-fold-search nil) @@ -1278,10 +1279,13 @@ external program defined by `sendmail-program'." (exit-value (apply 'call-process-region args))) (cond ((or (null exit-value) (eq 0 exit-value))) ((numberp exit-value) + (setq error t) (error "Sending...failed with exit value %d" exit-value)) ((stringp exit-value) + (setq error t) (error "Sending...terminated by signal: %s" exit-value)) (t + (setq error t) (error "SENDMAIL-SEND-IT -- fall through: %S" exit-value)))) (or fcc-was-found (error "No recipients"))) @@ -1290,12 +1294,15 @@ external program defined by `sendmail-program'." (goto-char (point-min)) (while (re-search-forward "\n\n* *" nil t) (replace-match "; ")) - (if (not (zerop (buffer-size))) - (error "Sending...failed to %s" - (buffer-substring (point-min) (point-max))))))) + (unless (zerop (buffer-size)) + (setq error t) + (error "Sending...failed to %s" + (buffer-substring (point-min) (point-max))))))) (kill-buffer tembuf) - (if (bufferp errbuf) - (kill-buffer errbuf))))) + (if (and (bufferp errbuf) + (not error)) + (kill-buffer errbuf) + (switch-to-buffer-other-window errbuf))))) (autoload 'rmail-output-to-rmail-buffer "rmailout")