From: Bob Newell <bobnewell@bobnewell.net>
To: Max Evans <visitantar@protonmail.com>
Cc: info-gnus-english@gnu.org
Subject: Re: Need help writing predicate function
Date: Mon, 04 Dec 2023 14:17:09 -1000 [thread overview]
Message-ID: <87sf4hlcze.yefxa@eyvdhhtlc.fdtbvgc.info> (raw)
In-Reply-To: <231pPe4tQmLilpsi6Jaf16YkW-PECPaVCl_TdBCz-ZfFfeiqbDkJrVszHjfFJ-VYJJ4Tr3RQjiIodRmv_qkktQzOBYSBkepBOyfZ9E8ovzM=@protonmail.com> (Max Evans's message of "Mon, 04 Dec 2023 16:44:35 +0000")
I do something similar to change identity and/or input
language based on addressee. I just put it in a hook
(add-hook 'message-setup-hook 'rjn-change-stuff-by-addressee t)
and that works for me; the appropriate identity gets chosen
via gnus-alias-use-identity when the message reply is set up.
My complete code is this. It is not the same as you ask but
easily modified. You'd only need the upper half.
(defun rjn-change-stuff-by-addressee ()
(interactive)
(let ((addressee (message-fetch-field "To"))
netaddr person smtppref)
(if addressee
(setq netaddr (cadr (mail-extract-address-components addressee))))
(if netaddr
(setq person (car (bbdb-search (bbdb-records) :mail netaddr))))
(if person
(setq smtppref (bbdb-record-field person 'smtp)))
(if smtppref
(gnus-alias-use-identity smtppref))
)
(let ((addressee (message-fetch-field "To"))
netaddr person langpref)
(if addressee
(setq netaddr (cadr (mail-extract-address-components addressee))))
(if netaddr
(progn
(setq person (car (bbdb-search (bbdb-records) :mail netaddr)))))
(if person
(setq langpref (bbdb-record-field person 'language)))
(if langpref
(set-input-method langpref)))
)
--
Bob Newell
Honolulu, Hawai`i
- Via GNU/Linux/Emacs/Gnus/BBDB
prev parent reply other threads:[~2023-12-05 0:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 16:44 Max Evans
2023-12-04 18:05 ` Eric S Fraga
2023-12-05 0:17 ` Bob Newell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sf4hlcze.yefxa@eyvdhhtlc.fdtbvgc.info \
--to=bobnewell@bobnewell.net \
--cc=info-gnus-english@gnu.org \
--cc=visitantar@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).