Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] don't kill err-buffer if `sendmail-send-it' fails
@ 2013-02-27 19:07 Daimrod
  2013-03-13 21:53 ` Daimrod
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Daimrod @ 2013-02-27 19:07 UTC (permalink / raw)
  To: Gnus


[-- Attachment #1.1: Type: text/plain, Size: 222 bytes --]

Hi,

Here is a small patch for `sendmail-send-it' that I've made while I was
trying to understand why I couldn't connect to my imap server.

I've just added a boolean to avoid to kill the error buffer if an error
occurs.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: sendmail-sent-it.patch --]
[-- Type: text/x-diff, Size: 1618 bytes --]

--- old	2013-02-27 19:53:00.000000000 +0100
+++ new	2013-02-27 19:57:03.000000000 +0100
@@ -6,6 +6,7 @@
   (let ((errbuf (if mail-interactive
 		    (generate-new-buffer " sendmail errors")
 		  0))
+        err?
 	(tembuf (generate-new-buffer " sendmail temp"))
 	(multibyte enable-multibyte-characters)
 	(case-fold-search nil)
@@ -170,21 +171,27 @@
 		     (exit-value (apply 'call-process-region args)))
 		(cond ((or (null exit-value) (eq 0 exit-value)))
 		      ((numberp exit-value)
+               (setq err? t)
 		       (error "Sending...failed with exit value %d" exit-value))
 		      ((stringp exit-value)
+               (setq err? t)
 		       (error "Sending...terminated by signal: %s" exit-value))
 		      (t
+               (setq err? t)
 		       (error "SENDMAIL-SEND-IT -- fall through: %S" exit-value))))
-	    (or fcc-was-found
-		(error "No recipients")))
+	    (unless fcc-was-found
+          (setq err? t)
+          (error "No recipients")))
 	  (if mail-interactive
 	      (with-current-buffer errbuf
 		(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)))))))
+		(when (not (zerop (buffer-size)))
+          (setq err? t)
+          (error "Sending...failed to %s"
+                 (buffer-substring (point-min) (point-max)))))))
       (kill-buffer tembuf)
-      (if (bufferp errbuf)
-	  (kill-buffer errbuf)))))
+      (when (and (bufferp errbuf)
+                 (not err?))
+        (kill-buffer errbuf)))))

[-- Attachment #1.3: Type: text/plain, Size: 21 bytes --]


-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-02-27 19:07 [PATCH] don't kill err-buffer if `sendmail-send-it' fails Daimrod
@ 2013-03-13 21:53 ` Daimrod
  2013-05-05 15:03 ` Daimrod
  2013-08-01 16:21 ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: Daimrod @ 2013-03-13 21:53 UTC (permalink / raw)
  To: Gnus

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

Daimrod <daimrod@gmail.com> writes:
> Hi,
>
> Here is a small patch for `sendmail-send-it' that I've made while I was
> trying to understand why I couldn't connect to my imap server.
>
> I've just added a boolean to avoid to kill the error buffer if an error
> occurs.
>
>
> --- old	2013-02-27 19:53:00.000000000 +0100
> +++ new	2013-02-27 19:57:03.000000000 +0100
> @@ -6,6 +6,7 @@
>    (let ((errbuf (if mail-interactive
>  		    (generate-new-buffer " sendmail errors")
>  		  0))
> +        err?
>  	(tembuf (generate-new-buffer " sendmail temp"))
>  	(multibyte enable-multibyte-characters)
>  	(case-fold-search nil)
> @@ -170,21 +171,27 @@
>  		     (exit-value (apply 'call-process-region args)))
>  		(cond ((or (null exit-value) (eq 0 exit-value)))
>  		      ((numberp exit-value)
> +               (setq err? t)
>  		       (error "Sending...failed with exit value %d" exit-value))
>  		      ((stringp exit-value)
> +               (setq err? t)
>  		       (error "Sending...terminated by signal: %s" exit-value))
>  		      (t
> +               (setq err? t)
>  		       (error "SENDMAIL-SEND-IT -- fall through: %S" exit-value))))
> -	    (or fcc-was-found
> -		(error "No recipients")))
> +	    (unless fcc-was-found
> +          (setq err? t)
> +          (error "No recipients")))
>  	  (if mail-interactive
>  	      (with-current-buffer errbuf
>  		(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)))))))
> +		(when (not (zerop (buffer-size)))
> +          (setq err? t)
> +          (error "Sending...failed to %s"
> +                 (buffer-substring (point-min) (point-max)))))))
>        (kill-buffer tembuf)
> -      (if (bufferp errbuf)
> -	  (kill-buffer errbuf)))))
> +      (when (and (bufferp errbuf)
> +                 (not err?))
> +        (kill-buffer errbuf)))))

up.

No comment on this?

-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-02-27 19:07 [PATCH] don't kill err-buffer if `sendmail-send-it' fails Daimrod
  2013-03-13 21:53 ` Daimrod
@ 2013-05-05 15:03 ` Daimrod
  2013-08-01 16:21 ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: Daimrod @ 2013-05-05 15:03 UTC (permalink / raw)
  To: Gnus

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

Daimrod <daimrod@gmail.com> writes:

> Hi,
>
> Here is a small patch for `sendmail-send-it' that I've made while I was
> trying to understand why I couldn't connect to my imap server.
>
> I've just added a boolean to avoid to kill the error buffer if an error
> occurs.
>
>
> --- old	2013-02-27 19:53:00.000000000 +0100
> +++ new	2013-02-27 19:57:03.000000000 +0100
> @@ -6,6 +6,7 @@
>    (let ((errbuf (if mail-interactive
>  		    (generate-new-buffer " sendmail errors")
>  		  0))
> +        err?
>  	(tembuf (generate-new-buffer " sendmail temp"))
>  	(multibyte enable-multibyte-characters)
>  	(case-fold-search nil)
> @@ -170,21 +171,27 @@
>  		     (exit-value (apply 'call-process-region args)))
>  		(cond ((or (null exit-value) (eq 0 exit-value)))
>  		      ((numberp exit-value)
> +               (setq err? t)
>  		       (error "Sending...failed with exit value %d" exit-value))
>  		      ((stringp exit-value)
> +               (setq err? t)
>  		       (error "Sending...terminated by signal: %s" exit-value))
>  		      (t
> +               (setq err? t)
>  		       (error "SENDMAIL-SEND-IT -- fall through: %S" exit-value))))
> -	    (or fcc-was-found
> -		(error "No recipients")))
> +	    (unless fcc-was-found
> +          (setq err? t)
> +          (error "No recipients")))
>  	  (if mail-interactive
>  	      (with-current-buffer errbuf
>  		(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)))))))
> +		(when (not (zerop (buffer-size)))
> +          (setq err? t)
> +          (error "Sending...failed to %s"
> +                 (buffer-substring (point-min) (point-max)))))))
>        (kill-buffer tembuf)
> -      (if (bufferp errbuf)
> -	  (kill-buffer errbuf)))))
> +      (when (and (bufferp errbuf)
> +                 (not err?))
> +        (kill-buffer errbuf)))))

bump again.

Could I have some feedback on this? Am I the only one who find it
useful? Did I miss something like an option to enable debugging?

-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-02-27 19:07 [PATCH] don't kill err-buffer if `sendmail-send-it' fails Daimrod
  2013-03-13 21:53 ` Daimrod
  2013-05-05 15:03 ` Daimrod
@ 2013-08-01 16:21 ` Lars Magne Ingebrigtsen
  2013-08-06 17:54   ` Daimrod
  2 siblings, 1 reply; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 16:21 UTC (permalink / raw)
  To: Daimrod; +Cc: Gnus

Daimrod <daimrod@gmail.com> writes:

> Here is a small patch for `sendmail-send-it' that I've made while I was
> trying to understand why I couldn't connect to my imap server.

Looks good, but it's more than 10 lines, so it needs copyright
assignment papers.  Do you have such paperwork on file with the FSF?

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-08-01 16:21 ` Lars Magne Ingebrigtsen
@ 2013-08-06 17:54   ` Daimrod
  2013-08-06 20:24     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Daimrod @ 2013-08-06 17:54 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Gnus

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

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Daimrod <daimrod@gmail.com> writes:
>
>> Here is a small patch for `sendmail-send-it' that I've made while I was
>> trying to understand why I couldn't connect to my imap server.
>
> Looks good, but it's more than 10 lines, so it needs copyright
> assignment papers.  Do you have such paperwork on file with the FSF?

I have already a copyright assignment for Emacs. (my number is 793656)

Regards,

-- 
Daimrod/Greg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-08-06 17:54   ` Daimrod
@ 2013-08-06 20:24     ` Lars Magne Ingebrigtsen
  2013-08-07 11:02       ` Daimrod
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-06 20:24 UTC (permalink / raw)
  To: Daimrod; +Cc: Gnus

Daimrod <daimrod@gmail.com> writes:

> I have already a copyright assignment for Emacs. (my number is 793656)

Ah, so you're Grégoire Jadi.

Could you re-spin the patch?  It doesn't really apply since the file
names in the patch are "new" and "old", which doesn't really exist in
the Emacs tree.

The naming convention "err?" is not used in Emacs, so rename that
variable to something else.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
  and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html



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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-08-06 20:24     ` Lars Magne Ingebrigtsen
@ 2013-08-07 11:02       ` Daimrod
  2013-08-12 17:24         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Daimrod @ 2013-08-07 11:02 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Gnus


[-- Attachment #1.1: Type: text/plain, Size: 691 bytes --]

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Daimrod <daimrod@gmail.com> writes:
>
>> I have already a copyright assignment for Emacs. (my number is 793656)
>
> Ah, so you're Grégoire Jadi.

Yes.

> Could you re-spin the patch?  It doesn't really apply since the file
> names in the patch are "new" and "old", which doesn't really exist in
> the Emacs tree.
>
> The naming convention "err?" is not used in Emacs, so rename that
> variable to something else.

Is `debug' a better name? (`errp' sounds weird)

I think it's a good idea to switch to the error buffer, otherwise users
won't know it exists, so I've added a call to
`switch-to-buffer-other-window'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-lisp-mail-sendmail.el-sendmail-send-it-Do-not-kill-t.patch --]
[-- Type: text/x-diff, Size: 2333 bytes --]

From c47092e75db9e622b83770152224479b9a870a49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@gmail.com>
Date: Wed, 7 Aug 2013 12:45:21 +0200
Subject: [PATCH] * lisp/mail/sendmail.el (sendmail-send-it): Do not kill the
 error buffer if an error occurs.

---
 lisp/mail/sendmail.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index e1dee32..8b93cf2 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))
+        (debug 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 debug t)
 		       (error "Sending...failed with exit value %d" exit-value))
 		      ((stringp exit-value)
+                       (setq debug t)
 		       (error "Sending...terminated by signal: %s" exit-value))
 		      (t
+                       (setq debug 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 debug 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 debug))
+          (kill-buffer errbuf)
+        (switch-to-buffer-other-window errbuf)))))
 
 (autoload 'rmail-output-to-rmail-buffer "rmailout")
 
-- 
1.8.0.2722.gc0242e5


[-- Attachment #1.3: Type: text/plain, Size: 23 bytes --]



-- 
Daimrod/Greg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] don't kill err-buffer if `sendmail-send-it' fails
  2013-08-07 11:02       ` Daimrod
@ 2013-08-12 17:24         ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-12 17:24 UTC (permalink / raw)
  To: Daimrod; +Cc: Gnus

Daimrod <daimrod@gmail.com> writes:

> Is `debug' a better name? (`errp' sounds weird)
>
> I think it's a good idea to switch to the error buffer, otherwise users
> won't know it exists, so I've added a call to
> `switch-to-buffer-other-window'.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
  and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html



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

end of thread, other threads:[~2013-08-12 17:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 19:07 [PATCH] don't kill err-buffer if `sendmail-send-it' fails Daimrod
2013-03-13 21:53 ` Daimrod
2013-05-05 15:03 ` Daimrod
2013-08-01 16:21 ` Lars Magne Ingebrigtsen
2013-08-06 17:54   ` Daimrod
2013-08-06 20:24     ` Lars Magne Ingebrigtsen
2013-08-07 11:02       ` Daimrod
2013-08-12 17:24         ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).