Re: Emacs front end mail-user-agent documentation and loading

2023-09-02 Thread Christoph
> 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
___
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]


Re: Emacs front end mail-user-agent documentation and loading

2023-08-31 Thread David Bremner
Christoph  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

___
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]


Emacs front end mail-user-agent documentation and loading

2023-08-31 Thread Christoph
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 -- [email protected]
To unsubscribe send an email to [email protected]