Monday, July 04 2011

El-Get

Of course, my emacs setup is managed in a private git repository. Some people on #emacs are using git submodules (or was it straight import) for managing external repositories in there, but all I can say is that I frown on this idea. I want an easy canonical list of packages I depend on to run emacs, and I want this documentation to be usable as-is. Enters El-Get!

So now my setup looks like this:

(require 'el-get)
(add-to-list 'el-get-recipe-path "~/dev/emacs/el-get/recipes")
(setq el-get-verbose t)

;; personal recipes
(setq el-get-sources
      '((:name el-get :branch "master")

	(:name magit
	       :before (global-set-key (kbd "C-x C-z") 'magit-status))

	(:name expand-region
	       :before (global-set-key (kbd "C-@") 'er/expand-region))

	(:name descbinds-anything
	       :after (progn
			(descbinds-anything-install)
			(global-set-key (kbd "C-h b") 'descbinds-anything)))

	(:name goto-last-change
	       :before (global-set-key (kbd "C-x C-/") 'goto-last-change))))

;; my packages
(setq dim-packages
      (append
       ;; list of packages we use straight from official recipes
       '(gnus bbdb switch-window vkill google-maps pgdevenv-el
	      mbsync asciidoc smex geiser xcscope multiple-cursors
	      anything descbinds-anything pcmpl-git magit-view-file
	      emacs-goodies-el sicp auto-dictionnary keywiz pandoc-mode
	      pgsql-linum-format psvn rect-mark crontab-mode icomplete+
	      php-mode-improved rainbow-delimiters muse deft dpans2texi
	      markdown-mode color-theme-solarized protobuf-mode paredit)

       (mapcar 'el-get-as-symbol (mapcar 'el-get-source-name el-get-sources))))

(el-get 'sync dim-packages)

So now you have a pretty good documentation of the packages you want installed, where to get them, and how to install them. For the advanced methods (such as elpa or apt-get), you basically just need the package name. When relying on a bare git repository, you need to give some more information, such as the URL to clone and the build steps if any. Then also what features to require and maybe where to find the texinfo documentation of the package, for automatic inclusion into your local Info menu.

The good news is that not only you now have a solid readable description of all that in a central place, but this very description is all (el-get) needs to do its magic. This command will check that each and every package is installed on your system (in el-get-dir) and if that's not the case, it will actually install it. Then, it will init the packages: that means caring about the load-path, the Info-directory-list (and dir texinfo menu building) the loading of the emacs-lisp files, and finally it will require the features.