1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

(gnus)Scoring Tips: New tip regarding header continuation lines

* doc/misc/gnus.texi (Scoring Tips): New "Continuation lines
when scoring on other headers" tip.
This commit is contained in:
Sean Whitton 2025-07-21 09:54:02 +01:00
parent 3b2bfdfef6
commit 8f00d36b63

View file

@ -21169,6 +21169,29 @@ You may also consider doing something similar with @code{expunge}.
If you say stuff like @code{[^abcd]*}, you may get unexpected results. If you say stuff like @code{[^abcd]*}, you may get unexpected results.
That will match newlines, which might lead to, well, The Unknown. Say That will match newlines, which might lead to, well, The Unknown. Say
@code{[^abcd\n]*} instead. @code{[^abcd\n]*} instead.
@item Continuation lines when scoring on other headers
When scoring on other headers using the @code{Head} or @code{All} match
keys and regexp matching, your regular expression must take into account
header continuation lines. For example, this naive attempt to match
messages including a particular address in the @code{To} field:
@lisp
("head" "^To: .*\\bspwhitton@@spwhitton\\.name\\b" r)
@end lisp
will fail to match a message with a @code{To} header like this:
@example
To: A long description of the Emacs devel list <emacs-devel@@gnu.org>,
spwhitton@@spwhitton.name, 12345@@debbugs.gnu.org
@end example
You can handle this issue with a regexp of this form:
@lisp
("head" "^To: .*\\(?:\n[\s\t].*\\)*\\bspwhitton@@spwhitton\\.name\\b" r)
@end lisp
@end table @end table