Wilhelm Schuster
Wilhelm Schuster

Reputation: 77

What package manager should I use for emacs?

I have been a vim user for years now and recently started to try out emacs. There are a lot of components available for this editor, like mail clients, IRC clients, etc. All these components need a package manager to update them and to make handling of them easier in general.

On vim there is a plethora of plugin managers (like Vundle or pathogen) and different people use different things.

On the other side, emacs includes package.el with recent versions (which is great to begin with), but there is also el-get and the package.el package list is pretty short.

Should I stick to package.el (and maybe extend the package list with marmalade)? Or do I need el-get for sane package management?

Upvotes: 4

Views: 4048

Answers (1)

Drew
Drew

Reputation: 30701

If you use a recent Emacs version then go with package.el. And add MELPA to the repository list.

Also, it is not the case that all "packages" (or libraries) need a package manager to update them and to make handling of them easier in general. There is a world of useful Emacs Lisp code out there that is not "packaged" and uploaded to a package.el repository.

More importantly, regardless of whether you use package.el to retrieve and "install" packages, you should learn the basics of loading, byte-compiling, and using Emacs Lisp code. Don't just use package.el blindly, without understanding something about Lisp code.

The basics of "installing" Lisp code manually include the following:

  1. In general, you will want to byte-compile libraries that you use, for better performance. Keep in mind this caveat, if you do so:

    1a. Load any source files (*.el) that define Lisp macros that are needed by any of the other Lisp libraries you use.

    1b. Then byte-compile (the macro-defining libraries and) the libraries that use the macro-defining libraries. This is important. It is likely that the latest versions of the macro-using libraries need the latest versions of the macros, and if you compile them without having first loaded the latest macro definitions then you are asking for trouble.

  2. Put any libraries you use in a directory that is in your load-path. Said differently: set variable load-path in your init file (~/.emacs) to a value that includes all directories containing Lisp code that you use.

  3. Generally, you want to use (require 'foo) in your own code (e.g. in your init file), to load library foo.

  4. However, #3 works only if library foo (file foo.el) actually provides feature foo: (provide 'foo). If it does not, you can use (load-library "foo") instead.

    (Note the difference here between using 'foo and "foo": the first refers to feature foo; the second refers to files foo.el and foo.elc.

  5. Finally, before you try to use a library, do yourself a favor and take a look at the Commentary section of the file header. Often it tells you important things about using the library. And even when it does not say something terribly important it might say something useful (e.g. a tip or two).

I mention 1-5 because I see too many (no, not many, but too many) new users just "installing" stuff using a package manager and never taking a look at what the code they are installing is all about: what it is for, how to use it, etc. If there is something in the Commentary then read it; the library author put it there to help you.

Beyond that, have fun!

Upvotes: 11

Related Questions