Re: [PATCH 1/5] emacs: compile and load notmuch-pick.el if present.

Subject: Re: [PATCH 1/5] emacs: compile and load notmuch-pick.el if present.

Date: Sun, 02 Sep 2012 10:54:13 -0300

To: Tomi Ollila, Mark Walters, notmuch@notmuchmail.org

Cc:

From: David Bremner


Tomi Ollila <tomi.ollila@iki.fi> writes:
> I think it would be better to provide a shell script in 
> notmuch-pick directory which byte-compiles and installs notmuch-pick
> in case user wants to install/update notmuch-pick. Whenever notmuch-pick
> is good enough to be shipped inside $(dir) above then the aboce conditional
> is not needed (at all).

I just tried notmuch-pick for the first time, and at least on this
relatively beefy machine, it runs fine uncompiled. 

I'm not sure if it is worth complicating the mainline install. Which
means I guess I am agreeing with Tomi.  It could also be in independant
Makefile rather than a script.

I don't think it's crucial to install notmuch-pick into the main lisp
context of (Debian) packaging I don't think that will work very well.
The way org-mode works is that it ships a seperate contrib lisp
directory; on Debian this is in /usr/share/org-mode/contrib. Then people
who want to use a contrib piece of lisp would just add the following to
their .emacs:

(add-to-list 'load-path "/usr/share/notmuch/contrib/emacs-lisp")
(require 'notmuch-pick)

at least given the changes that Tomi proposes below.
The path is obviously just an example.

> (require 'notmuch-hello)
> (require 'notmuch-show)
> (require 'notmuch) ;; XXX ATM, as notmuch-search-mode-map is defined here
>
> And, at the end, before (provide 'notmuch-pick), execute the lines
> what currenty are contained in (notmuch-pick-init).

Yes, this sounds about right to me. require should also take care of the
"only run this once" part.

FWIW, I'm currently running pick from the source tree as:

(add-to-list 'load-path
	     (expand-file-name "~/blah"))
(when (locate-library "notmuch-pick")
  (eval-after-load 'notmuch
    '(progn 
       (require 'notmuch-pick)
       (notmuch-pick-init))))

it's a bit overengineered, but this way it doesn't crap out on machines
where notmuch-pick is not installed.

Thread: