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.
;; bogus.
(setq gnus-level-unsubscribed 6)
;; 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.
;;;--------------------------------------------------------------------------
;;; Magic for sending mail the correct way.