Customize the list of packages that emacs-prelude provides

2.3k views Asked by At

I see at this link how emacs prelude ensures that a set of packages is installed when emacs starts. I was wondering if I could somehow extend the variable prelude-packages to add some other packages, without changing the prelude-packages.el file?

Barring that I was wondering how I could define a list of packages that are installed at start-up if they aren't currently installed.

3

There are 3 answers

0
AdrieanKhisbe On BEST ANSWER

Prelude recommends to use

(prelude-require-packages '(some-package some-other-package))

if you have several package. Or in case you want to add just one package:

(prelude-require-package 'some-package)

If you want you can still maintain your package list in a variable:

(setq my-packages '(drupal-mode nginx-mode toto-mode)
(prelude-require-package my-packages)
0
justinhj On

In your .emacs file you could add code like this (very similar to the code in the link you sent) to check if each package is installed and install it if is not:

(dolist (package '(eredis anything erlang elnode)) 
  (unless (package-installed-p package)
    (package-install package)))

In answer to your question there's no reason you can't do this after the prelude code has run.

0
kaustavdm On

You can place a .el file in personal/ directory in Prelude. Prelude loads any .el file it finds there in an alphabetical order. Below is the content of my personal/00-packages.el file.:

(require 'package)
(add-to-list 'package-archives
             '("marmalade" .
               "http://marmalade-repo.org/packages/"))
(package-initialize)

;; My packages
(setq prelude-packages (append '(
                                 drupal-mode
                                 nginx-mode
                                 ) prelude-packages))

;; Install my packages
(prelude-install-packages)

"00" is added to the file name to ensure that the file is loaded before all personal customizations. Add any new package you need to the list being appended to prelude-packages.

Also, if you want to use any mode that is not available in MELPA or Marmalade, you can simply drop the mode's file in personal folder and Prelude will pick it up while loading. If there are any customizations to that mode, simply create another .el file and add the Emacs Lisp code there.