Re: Handling "via" addresses
Sam Steingold <[email protected]> Tue, 05 Jul 2022 14:47:29 -0400
| Newsgroups | gmane.emacs.bbdb.user |
|---|---|
| Message-ID | <[email protected]> |
> * Roland Winkler <[email protected]> [2022-06-30 20:44:40 -0500]: > > On Wed, Jun 29 2022, Sam Steingold wrote: >> I often see headers like this in Gnus: >> >> From: John Doe via "Emacs development discussions." <[email protected]> >> Subject: whatever >> Newsgroups: gmane.emacs.devel >> To: "[email protected]" <[email protected]> >> Reply-To: John Doe <[email protected]> >> >> and BBDB offers to change the name of the <emacs-devel> record to "John >> Doe", which is clearly wrong. >> >> The correct behavior seems to ignore the "From:" line that looks like that. > > Have you tried to make bbdb-add-name a function (or regexp)? I am afraid this is not feasible. `bbdb-add-name' gets RECORD and NAME. RECORD is the record for <emacs-devel> Name can be: --8<---------------cut here---------------start------------->8--- "Po Lu via" for From: Po Lu via "Emacs development discussions." <[email protected]> "carlmarcos" for From: carlmarcos--- via Users list for the GNU Emacs text editor <[email protected]> "Stefan Monnier via Users list for the" for From: Stefan Monnier via Users list for the GNU Emacs text editor <[email protected]> --8<---------------cut here---------------end--------------->8--- I don't see how `bbdb-add-name' can handle these consistently. However, I am not sure this is BBDB's problem, but rather a "bug" in `mail-extract-address-components': --8<---------------cut here---------------start------------->8--- (mail-extract-address-components "Po Lu via \"Emacs development discussions.\" <[email protected]>") => ("Po Lu via" "[email protected]") (mail-extract-address-components "carlmarcos--- via Users list for the GNU Emacs text editor <[email protected]>") => ("carlmarcos" "[email protected]") (mail-extract-address-components "Stefan Monnier via Users list for the GNU Emacs text editor <[email protected]>") => ("Stefan Monnier via Users list for the" "[email protected]") --8<---------------cut here---------------end--------------->8--- I suppose I might advise `mail-extract-address-components': --8<---------------cut here---------------start------------->8--- (defun mail-extract-handle-via (args) "Handle `via` in email address" (let ((address (car args)) (all (cadr args))) (if (and (null all) (string-match " via \\(.*\\)$" address)) (list (match-string 1 address) nil) (list address all)))) (advice-add 'mail-extract-address-components :filter-args 'mail-extract-handle-via) --8<---------------cut here---------------end--------------->8--- but this only works for a single address (splitting many addressed in one string is hairy). At any rate, this " via " thing does not look like a "me problem" but at least like a "bbdb problem" or maybe even "mail-extr.el" problem... Roland, are you going to deal with this somehow or should I report this as an Emacs bug? -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113 http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com https://honestreporting.com https://www.memritv.org https://jihadwatch.org If you will not bring your husband coffee in bed, his day may start with a beer.