12

I maintain a number of elisp packages (e.g. codesearch, emacs-ycmd, traad) that would benefit from being able to install the external programs that they use, saving time and effort for some users. For example, with codesearch.el it would be nice to be able to download, compile, and install the codesearch tools (written in go, not elisp) for users. This would remove at least one barrier for using the package.

Are there any "best practices" for doing this? For example, where should I put the external programs?

If if you don't have any direct advice, can you refer me to any packages that do something like this (and, ideally, that do it well)?

abingham
  • 927
  • 6
  • 18
  • 1
    I'm afraid it might be somewhere between extremely difficult and impossible, considering you have no control whether the user's Emacs OS uses Linux, Windows or Mac OS as the bootloader;-). – mbork Oct 30 '14 at 18:07
  • 2
    I'm afraid it's better to decouple the external program from the Emacs package for maximum flexibility. The approach of providing the external software with the Emacs package seems works out best for stuff like included Ruby/Python/TeX/... files that get interpreted. The opposite approach of providing the Emacs Lisp code with a package installed via your system's package manager (like mu and notmuch do) is less flexible because you can't have autoloads. – wasamasa Oct 30 '14 at 21:20
  • It looks like you two are right. The only examples I can find of emacs packages providing external dependencies are e.g. jedi which bundles up some python scripts in the elpa package. – abingham Oct 31 '14 at 06:40
  • is this something we will be able to do in Emacs 25 with dynamic-loading? – wdkrnls Nov 01 '14 at 01:33

2 Answers2

3

There's no "best practices" for that, no. Nor any kind of existing support for it. I think if it's installed specifically for package Foo, then the place to install it would be within the directory of package Foo.

As for how to do it, asuming your Elisp package is installed via ELPA, then you might want to try to add in your main Elisp file something like:

(eval-when-compile (call-process "make"))

and then provide an appropriate Makefile. Of course, for it to work in "most" platforms, you'll probably want something a bit more sophisticated.

Stefan
  • 26,154
  • 3
  • 46
  • 84
1

You might want to look into providing an el-get recipe for installing your package.

See section 9 "Authoring Recipes" in the info file.

The :build/system-type facility may be of particular interest, if you have variable requirements across different platforms. See section 9.5 "Build" for details.

phils
  • 48,657
  • 3
  • 76
  • 115