]> git.eshelyaron.com Git - emacs.git/commitdiff
(gnus)Scoring Tips: New tip regarding header continuation lines
authorSean Whitton <spwhitton@spwhitton.name>
Mon, 21 Jul 2025 08:54:02 +0000 (09:54 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 26 Jul 2025 13:39:42 +0000 (15:39 +0200)
* doc/misc/gnus.texi (Scoring Tips): New "Continuation lines
when scoring on other headers" tip.

(cherry picked from commit 8f00d36b63dc6c57ad2fd4f387841e4ac9e68225)

doc/misc/gnus.texi

index bd99eb7234a543d3a0e051f5b9be86c7016de1ca..23be6b9c47d16b8d1f0a11e695b21a23c22eef2f 100644 (file)
@@ -21164,6 +21164,29 @@ You may also consider doing something similar with @code{expunge}.
 If you say stuff like @code{[^abcd]*}, you may get unexpected results.
 That will match newlines, which might lead to, well, The Unknown.  Say
 @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