From 169ce333e29afcc7c30ba3ce52f2f90c6e2a58d4 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 14 Apr 2020 18:24:32 +0100 Subject: [PATCH 1/1] dot/gnus.el: Make `<' and `>' be punctuation when splitting mail. Email addresses are commonly written between angle brackets in header lines. I sometimes want to be able to parse out an entire email address, or at least a local-part, from a header, as part of a Gnus split specifier. But Gnus prepends a `.*' to the split regexp, so one needs to take special precautions to start in the right place, typically by using `\_<' to align to the start of a symbol. But if `<' is a symbol character, then this won't work. Worse, Gnus typically also tries to align to a word boundary by sneaking in `\<'. But then we have `\<\_<', which rejects an email address starting enclosed in `<' ... `>' altogether. Fortunately, the syntax table used by Gnus while splitting email is configurable, so we can override this silliness. --- dot/gnus.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dot/gnus.el b/dot/gnus.el index 1625542..8b19908 100644 --- a/dot/gnus.el +++ b/dot/gnus.el @@ -117,6 +117,21 @@ ;; bogus. (setq gnus-level-unsubscribed 6) +;; Reconfigure the `nnmail-split-fancy' syntax table to be less mad. +(setq nnmail-split-fancy-syntax-table + (let ((table (make-syntax-table))) + + ;; This is from upstream. I don't know what it's for. + (modify-syntax-entry ?% "." table) + + ;; Email addresses are often wrapped in `<...>', so don't consider + ;; those to be part of the address. + (modify-syntax-entry ?< "(>" table) + (modify-syntax-entry ?> ")<" table) + + ;; Done. + table)) + ;;;-------------------------------------------------------------------------- ;;; Magic for sending mail the correct way. -- 2.11.0