[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Handling "via" addresses
From: |
Sam Steingold |
Subject: |
Re: Handling "via" addresses |
Date: |
Tue, 05 Jul 2022 14:47:29 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) |
> * Roland Winkler <jvaxyre@tah.bet> [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." <emacs-devel@gnu.org>
>> Subject: whatever
>> Newsgroups: gmane.emacs.devel
>> To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> Reply-To: John Doe <john@doe.me>
>>
>> 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." <emacs-devel@gnu.org>
"carlmarcos" for
From: carlmarcos--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
"Stefan Monnier via Users list for the" for
From: Stefan Monnier via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
--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.\"
<emacs-devel@gnu.org>")
=> ("Po Lu via" "emacs-devel@gnu.org")
(mail-extract-address-components "carlmarcos--- via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org>")
=> ("carlmarcos" "help-gnu-emacs@gnu.org")
(mail-extract-address-components "Stefan Monnier via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org>")
=> ("Stefan Monnier via Users list for the" "help-gnu-emacs@gnu.org")
--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.
- Re: Handling "via" addresses, Sam Steingold, 2022/07/01
- Re: Handling "via" addresses,
Sam Steingold <=
- Re: Handling "via" addresses, Roland Winkler, 2022/07/05
- Re: Handling "via" addresses, Sam Steingold, 2022/07/06
- Re: Handling "via" addresses, Sam Steingold, 2022/07/06
- Re: Handling "via" addresses, Roland Winkler, 2022/07/06
- Re: Handling "via" addresses, Sam Steingold, 2022/07/07
- Re: Handling "via" addresses, Sam Steingold, 2022/07/07
- Re: Handling "via" addresses, Roland Winkler, 2022/07/08
- Re: Handling "via" addresses, Sam Steingold, 2022/07/12