unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Lazily loading notmuch into Emacs
@ 2020-06-01 17:36 Sean Whitton
  2020-06-02 11:41 ` David Edmondson
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Whitton @ 2020-06-01 17:36 UTC (permalink / raw)
  To: notmuch

Hello,

I don't want to put (require 'notmuch) into my Emacs init because that
will slow down initial Emacs startup a fair bit, especially since my
(file which is equivalent to) notmuch-config.el does quite a bit of
processing to populate notmuch-saved-searches.

So I have this:

    ;; Ensure notmuch does its `message-mode' configuration and that my
    ;; notmuch-config.el gets loaded before certain commands happen.  An
    ;; alternative to advising `compose-mail' and friends here would be
    ;; to remap its keys to `notmuch-mua-new-mail', but it is nice to
    ;; have things work correctly if some lisp code somewhere calls
    ;; `compose-mail' or friends
    (defun spw/load-notmuch (&rest ignore)
      (require 'notmuch))
    (dolist (cmd '(compose-mail
                   compose-mail-other-window
                   compose-mail-other-frame
                   notmuch-jump-search
                   notmuch-hello))
      (advice-add cmd :before #'spw/load-notmuch))

    (global-set-key "\C-cs" #'notmuch-search)
    (global-set-key "\C-cm" #'notmuch-jump-search)
    (global-set-key "\C-cM" #'notmuch-hello)

This is not a very idiomatic way to make use of an ELPA package,
however.  Does anyone have a better approach that does not involve
advice-add?  I'm using the elpa-notmuch package on Debian.

-- 
Sean Whitton

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

end of thread, other threads:[~2020-06-02 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 17:36 Lazily loading notmuch into Emacs Sean Whitton
2020-06-02 11:41 ` David Edmondson
2020-06-02 21:50   ` Sean Whitton

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).