Hi,
while configuring the notmuch Emacs front end, I was having trouble
getting `notmuch-fcc-dirs' to work as expected. I figured out that my
issue was, that I was composing mails using `compose-mail' instead of
`notmuch-mua-mail'. Since notmuch-mua.el provides a mail-user-agent,
configuring message to use the notmuch mail user agent wasn't that
difficult, but it would be nice if that would be stated in emacs-tips
of the notmuch documentation. Maybe you can add a section to it, so
others don't fall into that trap? I wasn't using Emacs as a mail
client before, so I didn't have much experience in configuring a
user-agent before.
Since `compose-mail' is defined in simple.el, I didn't find a nice way
to load notmuch lazy using use-package. I ended up writing a hook
around `compose-mail' to load notmuch on demand like so:
(use-package notmuch
:ensure t
:commands (notmuch
notmuch-mua-mail
notmuch-mua-send-and-exit
notmuch-mua-kill-buffer
notmuch-mua-send-hook)
:custom
(mail-user-agent 'notmuch-user-agent)
:init
(defun +notmuch-load-on-compose (&rest _)
"Load notmuch and remove this advice from `compose-mail'."
(require 'notmuch)
(advice-remove 'compose-mail #'+notmuch-load-on-compose))
(advice-add 'compose-mail :before '+notmuch-load-on-compose))
Do you know if there is a nicer way of loading notmuch lazy, as soon
as `compose-mail' is called? Sadly, an autoload in the
`notmuch-user-agent' doesn't work. I don't want to rebind
`compose-mail' to `notmuch-mua-mail' and rely on the key-bind, since
other Emacs functions, like `report-emacs-bug' are calling
`compose-mail' directly and I would like those to work out of the box,
without the need to manually load notmuch beforehand.
Looking forward into playing around with notmuch.
Regards,
Christoph
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org