unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* emacs-notmuch: Set variables based on From when composing
@ 2018-03-12 14:03 Thomas Schneider
  2018-03-16 12:29 ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Schneider @ 2018-03-12 14:03 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

Hello list,

I use notmuch with the Emacs frontend and multiple accounts.  I’d like
it to set the domain part of Message-Id header of any mail I compose to
something sensible, e.g. the FQDN of the host (which does not seem to be
easy, see [0]) or the domain part of the From header.

I was thinking about setting message-user-fqdn based on the From header
in an appropriate hook, but I haven’t found yet where and how to do
this.

In fact, this would be useful for more variables, such as
message-user-organization or message-signature(-file).  Like
notmuch-fcc-dirs, just for other variables.

I’d appreciate any pointers.

Thanks,
	--qsx


[0] https://emacs.stackexchange.com/questions/12649/local-hosts-fqdn-in-emacs-25

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: emacs-notmuch: Set variables based on From when composing
  2018-03-12 14:03 emacs-notmuch: Set variables based on From when composing Thomas Schneider
@ 2018-03-16 12:29 ` David Bremner
  2018-03-17 18:11   ` Thomas Schneider
  0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2018-03-16 12:29 UTC (permalink / raw)
  To: Thomas Schneider, notmuch

Thomas Schneider <qsx@chaotikum.eu> writes:

> Hello list,
>
> I use notmuch with the Emacs frontend and multiple accounts.  I’d like
> it to set the domain part of Message-Id header of any mail I compose to
> something sensible, e.g. the FQDN of the host (which does not seem to be
> easy, see [0]) or the domain part of the From header.

There is some discussion on the wiki of using gnus-alias and
message-templ with notmuch. The latter is more about setting headers.

>
> I was thinking about setting message-user-fqdn based on the From header
> in an appropriate hook, but I haven’t found yet where and how to do
> this.

There is notmuch-mua-send-hook (which by default just runs message-send-hook)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: emacs-notmuch: Set variables based on From when composing
  2018-03-16 12:29 ` David Bremner
@ 2018-03-17 18:11   ` Thomas Schneider
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Schneider @ 2018-03-17 18:11 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

David Bremner <david@tethera.net> writes:

> Thomas Schneider <qsx@chaotikum.eu> writes:
>
>> Hello list,
>>
>> I use notmuch with the Emacs frontend and multiple accounts.  I’d like
>> it to set the domain part of Message-Id header of any mail I compose to
>> something sensible, e.g. the FQDN of the host (which does not seem to be
>> easy, see [0]) or the domain part of the From header.
>
> There is some discussion on the wiki of using gnus-alias and
> message-templ with notmuch. The latter is more about setting headers.

Thanks for the pointer.  gnus-alias seems to work so far.  I also use it
to set the Fcc header to avoid duplicating address matches.

>>> I was thinking about setting message-user-fqdn based on the From header
>> in an appropriate hook, but I haven’t found yet where and how to do
>> this.
>
> There is notmuch-mua-send-hook (which by default just runs
> message-send-hook)

This seems to be run too late, so as for now, I use message-setup-hook
and always define the address I want to send as beforehand.

---
(add-hook 'message-setup-hook
	  (lambda ()
	    (make-local-variable 'message-user-fqdn)
	    (setq message-user-fqdn
		  (car (reverse (split-string
				 (car (mail-header-parse-address
				       (message-field-value "From")))
				 "@"))))))
---

Maybe I could add Message-ID to one of the headers added beforehand so
that I see what is generated.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-17 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 14:03 emacs-notmuch: Set variables based on From when composing Thomas Schneider
2018-03-16 12:29 ` David Bremner
2018-03-17 18:11   ` Thomas Schneider

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).