emacs: Handling external dependencies

Damien Cassou damien.cassou at gmail.com
Sat Nov 10 07:58:10 PST 2012


Hi,

I recently sent a patch for notmuch emacs that depends on a particular
library. What is the best way to deal with such dependencies?

I can see different solutions:

1) distribute a rewritten version of the dependency so that the code
now belongs to notmuch (e.g., replace the name of the library by
'notmuch'). This has the disadvantage of requiring maintenance when a
new version of the library is released and can also be considered
'stealing' by some authors.

2) use a package manager to load the library. This has the
disadvantage that the now standard package manager is not in
widespread use yet and is not compatible with other OS-based package
managers (such as apt-get in Debian).

3) distribute the dependency with the rest of notmuch and load this
one. This has the disadvantage of possibly shadowing an already
existing version of this library installed through a different means.

4) distribute the dependency with the rest of notmuch (in a separate
"fallback-libs/" directory) and load it only when requiring the
library with the standard load-path does not work. Jonas Bernoulli
gave me a way to do that:

,----
| (or (require 'THE-LIB nil t)
|     (let ((load-path
|           (cons (expand-file-name
|                  "fallback-libs"
|                  (file-name-directory (or load-file-name buffer-file-name)))
|                 load-path)))
|       (require 'THE-LIB)))
`----

What do you think?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill


More information about the notmuch mailing list