Re: add sender without mail if mail is in some ignored-list?

Kevin Brubeck Unhammer <[email protected]> Fri, 27 Mar 2020 14:09:27 +0100
Newsgroups gmane.emacs.bbdb.user
Message-ID <[email protected]>
"Roland Winkler" <[email protected]> čálii:

> On Thu Mar 26 2020 Kevin Brubeck Unhammer wrote:
>> Is there a way in bbdb3 to add senders without adding their mail,
>> if the address is in bbdb-ignore-message-alist (or some other such
>> list)? I get lots of e-mails from
>> 
>>     Some Name <[email protected]>
>> 
>> or
>> 
>>     Other Name <[email protected]>
>> 
>> where I'd like to add a bbdb record with just the name, and no
>> mail field. I typically use `:' (bbdb-mua-display-sender) in Gnus
>> to add people.
>
> I am not sure I understand the details of your situation and what
> you want to achieve.  But it smells to me that setting the user
> variable bbdb-ignore-redundant-mails to a custom function could
> solve your problem.

I tried

(setq
   my-bbdb-ignore-senders (regexp-opt '("[email protected]"))
   bbdb-ignore-redundant-mails (defun my-bbdb-ignore-redundant-mails (record mail)
                                 (if (string-match-p my-bbdb-ignore-senders mail)
                                     (progn
                                       (message "returning t so we ignore %s for %s" mail record)
                                       t)
                                   1)))


and then when I hit `:' on a mail from github with a previously unknown
sender, my *Messages* say

returning t so we ignore [email protected] for [Some Name nil nil nil nil nil nil nil nil nil nil [Some Name Name, Some nil nil nil nil]]
created Some Name’s record with address "[email protected]"

and it adds the e-mail anyway. (My old value for that variable was `1'.)

Should the function return something other than `t' to ignore the e-mail
address?
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEq9A0PxCu5rIo7lbX/DwefQCTFmcFAl59+wcACgkQ/DwefQCT
Fmc0ABAAuR2kVSEC7ocE0zuTELzF0coeNIwFm3631YmWMVIjMVoff/rcTwz6cSD9
Dcdntg1fMRUHjcnwpqg8H/NWdyDpDBC23PfpoigTaTF9TiQaj/XXwW64UqVf6LAt
MjwXJpiw5WIsHOFXn3DsV71/eGITWMqs20tMLwORsJ+YhloTCopCyZHgQ+p/o7QH
53naowdrY12FRigFt48Z83JYAHri0beuEa+Atp3SkJpIuu+VpmtR5UDPyqLh3b0w
RKrGRpaiU2CI8jA9GmFtEvZle3Qd9DU6B4j1Bx1yKdlqYMkC9FdsozRPN+gTgnlK
cT+CbtQP2wA3bZ5mO9dmfGun5U68M73o+Mg4tDz5s5qAvaL4/G9ZlyVy7pnpto2x
bpXQSbpKkn0j+4oHiNwPQtWfObeVcXU5Cdwsu3wzkH6cw3cmiH4zEG+nRYNIEyOq
x6gSRcxqXBQQfxYAM2LL7GWbvr9aXXQEa/Q33fQ3iN3e+CYtMEdzAdtlQT9DabAv
8YMEle9CJHL5UZQWKLiffj6GXZV0x/cJAg6X8ZjxR841nK3kGhRcv9ZX9rh9BxoI
hOFRITo72nBIApaYgKp+2gohpw29qGurijaJ54avAmLs+ndPhunO2M+jAebvu3UG
CzQoKhyAQqT06al4kdx0BrxVgTcokkM14Z/tJEmPP7xzRlFaSV0=
=XT/b
-----END PGP SIGNATURE-----