* Emacs front end mail-user-agent documentation and loading
@ 2023-08-31 15:41 Christoph
2023-09-01 0:29 ` David Bremner
0 siblings, 1 reply; 3+ messages in thread
From: Christoph @ 2023-08-31 15:41 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Emacs front end mail-user-agent documentation and loading
2023-08-31 15:41 Emacs front end mail-user-agent documentation and loading Christoph
@ 2023-09-01 0:29 ` David Bremner
2023-09-02 7:45 ` Christoph
0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2023-09-01 0:29 UTC (permalink / raw)
To: Christoph, notmuch
Christoph <just.mychris@googlemail.com> writes:
> 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.
The "emacs tips" you refer to is a wiki [1], so feel free to update it.
Customising mail-user-agent is discussed in the "official" manual [2]You
may also have an info version of the same manual, depending on how you
installed notmuch.
>
> 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:
I'm not familiar enough with use-package to comment on that. I agree
that notmuch could be better about autoloading things, but since I
always load notmuch and rarely restart emacs, it hasn't been a priority
for me personally.
[1] https://notmuchmail.org/wikiwriteaccess/
[2] https://notmuchmail.org/doc/latest/notmuch-emacs.html#sending-mail
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Emacs front end mail-user-agent documentation and loading
2023-09-01 0:29 ` David Bremner
@ 2023-09-02 7:45 ` Christoph
0 siblings, 0 replies; 3+ messages in thread
From: Christoph @ 2023-09-02 7:45 UTC (permalink / raw)
To: David Bremner; +Cc: notmuch
> The "emacs tips" you refer to is a wiki [1], so feel free to update it.
I didn't notice that, thanks for pointing that out, I will add
something to it.
> I'm not familiar enough with use-package to comment on that. I agree
> that notmuch could be better about autoloading things, but since I
> always load notmuch and rarely restart emacs, it hasn't been a priority
> for me personally.
`use-package' uses `eval-after-load' and `autoload' for lazy loading
packages. It might be enough to have the `notmuch-user-agent' in its
own file, providing it as a separate feature?
That way, the `notmuch-user-agent' can be required without loading all
of notmuch and then autoloads could load the rest of notmuch when
needed? Didn't test that, just a thought. Maybe this doesn't work
because of the way the user-agent is used.
I will maybe play around with it when I find some time.
-- Christoph
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-02 7:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31 15:41 Emacs front end mail-user-agent documentation and loading Christoph
2023-09-01 0:29 ` David Bremner
2023-09-02 7:45 ` Christoph
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).