all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Handle empty regexp in `rmail-nonignored-headers'
@ 2008-02-10 16:37 Bastien Guerry
  2008-02-10 19:34 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bastien Guerry @ 2008-02-10 16:37 UTC (permalink / raw)
  To: emacs-devel

The default value for `rmail-nonignored-headers' is "^x-spam-status:".
If the user wants to remove this header from the list of non-ignored
headers, she will set `rmail-nonignored-headers' to the empty string.
This will end up in *not* ignoring any header, which is wrong.

This simple patch fixed this -- can I commit it?

--- rmail.el.~1.447.~	2008-02-06 23:54:33.000000000 +0000
+++ rmail.el	2008-02-10 16:30:56.000000000 +0000
@@ -2329,7 +2329,8 @@
 	  (while (and ignored-headers
 		      (re-search-forward ignored-headers nil t))
 	    (beginning-of-line)
-	    (if (looking-at rmail-nonignored-headers)
+	    (if (and (not (equal rmail-nonignored-headers ""))
+		     (looking-at rmail-nonignored-headers))
 		(forward-line 1)
 	      (delete-region (point)
 			     (save-excursion

-- 
Bastien




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

* Re: Handle empty regexp in `rmail-nonignored-headers'
  2008-02-10 16:37 Handle empty regexp in `rmail-nonignored-headers' Bastien Guerry
@ 2008-02-10 19:34 ` Stefan Monnier
  2008-02-10 22:25   ` Bastien
  2008-02-10 20:03 ` Eli Zaretskii
  2008-02-11  0:17 ` Richard Stallman
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2008-02-10 19:34 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-devel

> The default value for `rmail-nonignored-headers' is "^x-spam-status:".
> If the user wants to remove this header from the list of non-ignored
> headers, she will set `rmail-nonignored-headers' to the empty string.
> This will end up in *not* ignoring any header, which is wrong.

> This simple patch fixed this -- can I commit it?

I'd rather allow rmail-nonignored-headers to be nil (to mean "don't
unignore any headers") and let "" have its standard meaning of "match
everything/everywhere".


        Stefan


> --- rmail.el.~1.447.~	2008-02-06 23:54:33.000000000 +0000
> +++ rmail.el	2008-02-10 16:30:56.000000000 +0000
> @@ -2329,7 +2329,8 @@
>  	  (while (and ignored-headers
>  		      (re-search-forward ignored-headers nil t))
>  	    (beginning-of-line)
> -	    (if (looking-at rmail-nonignored-headers)
> +	    (if (and (not (equal rmail-nonignored-headers ""))
> +		     (looking-at rmail-nonignored-headers))
>  		(forward-line 1)
>  	      (delete-region (point)
>  			     (save-excursion

> -- 
> Bastien




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

* Re: Handle empty regexp in `rmail-nonignored-headers'
  2008-02-10 16:37 Handle empty regexp in `rmail-nonignored-headers' Bastien Guerry
  2008-02-10 19:34 ` Stefan Monnier
@ 2008-02-10 20:03 ` Eli Zaretskii
  2008-02-11  0:17 ` Richard Stallman
  2 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2008-02-10 20:03 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-devel

> From: Bastien Guerry <bzg@altern.org>
> Date: Sun, 10 Feb 2008 16:37:18 +0000
> 
> +	    (if (and (not (equal rmail-nonignored-headers ""))

How about string= instead?

> This simple patch fixed this -- can I commit it?

Yes, please.

Thanks.




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

* Re: Handle empty regexp in `rmail-nonignored-headers'
  2008-02-10 19:34 ` Stefan Monnier
@ 2008-02-10 22:25   ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2008-02-10 22:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The default value for `rmail-nonignored-headers' is "^x-spam-status:".
>> If the user wants to remove this header from the list of non-ignored
>> headers, she will set `rmail-nonignored-headers' to the empty string.
>> This will end up in *not* ignoring any header, which is wrong.
>
>> This simple patch fixed this -- can I commit it?
>
> I'd rather allow rmail-nonignored-headers to be nil (to mean "don't
> unignore any headers") and let "" have its standard meaning of "match
> everything/everywhere".

Yes, I have followed this path.

-- 
Bastien




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

* Re: Handle empty regexp in `rmail-nonignored-headers'
  2008-02-10 16:37 Handle empty regexp in `rmail-nonignored-headers' Bastien Guerry
  2008-02-10 19:34 ` Stefan Monnier
  2008-02-10 20:03 ` Eli Zaretskii
@ 2008-02-11  0:17 ` Richard Stallman
  2008-02-11  1:01   ` Bastien
  2 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2008-02-11  0:17 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-devel

    This simple patch fixed this -- can I commit it?

The patch looks correct.




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

* Re: Handle empty regexp in `rmail-nonignored-headers'
  2008-02-11  0:17 ` Richard Stallman
@ 2008-02-11  1:01   ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2008-02-11  1:01 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

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

Richard Stallman <rms@gnu.org> writes:

>     This simple patch fixed this -- can I commit it?
>
> The patch looks correct.

Following Stefan's advice, I applied this patch instead:


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

diff -u /home/guerry/install/cvs/emacs/lisp/mail/rmail.el.\~1.447.\~ /home/guerry/install/cvs/emacs/lisp/mail/rmail.el
--- /home/guerry/install/cvs/emacs/lisp/mail/rmail.el.~1.447.~	2008-02-01 16:01:27.000000000 +0000
+++ /home/guerry/install/cvs/emacs/lisp/mail/rmail.el	2008-02-10 21:13:03.000000000 +0000
@@ -299,6 +299,7 @@
   "*Regexp to match X header fields that Rmail should show.
 This regexp overrides `rmail-ignored-headers'; if both this regexp
 and that one match a certain header field, Rmail shows the field.
+If this is nil, ignore all header fields in `rmail-ignored-headers'.
 
 This variable is used for reformatting the message header,
 which normally happens once for each message,
@@ -306,7 +307,7 @@
 To make a change in this variable take effect
 for a message that you have already viewed,
 go to that message and type \\[rmail-toggle-header] twice."
-  :type 'regexp
+  :type '(choice (const nil) (regexp))
   :group 'rmail-headers)
 
 ;;;###autoload
@@ -2329,7 +2330,8 @@
 	  (while (and ignored-headers
 		      (re-search-forward ignored-headers nil t))
 	    (beginning-of-line)
-	    (if (looking-at rmail-nonignored-headers)
+	    (if (and rmail-nonignored-headers
+		     (looking-at rmail-nonignored-headers))
 		(forward-line 1)
 	      (delete-region (point)
 			     (save-excursion

Diff finished.  Mon Feb 11 01:00:01 2008

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
Bastien

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

end of thread, other threads:[~2008-02-11  1:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-10 16:37 Handle empty regexp in `rmail-nonignored-headers' Bastien Guerry
2008-02-10 19:34 ` Stefan Monnier
2008-02-10 22:25   ` Bastien
2008-02-10 20:03 ` Eli Zaretskii
2008-02-11  0:17 ` Richard Stallman
2008-02-11  1:01   ` Bastien

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.