Customize the list of packages that emacs-prelude provides
Asked Answered
H

3

9

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.

Helsie answered 9/8, 2012 at 0:40 Comment(0)
S
6

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)
Sidewheel answered 24/2, 2015 at 15:51 Comment(0)
S
8

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.

Siderolite answered 17/1, 2013 at 13:20 Comment(0)
S
6

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)
Sidewheel answered 24/2, 2015 at 15:51 Comment(0)
J
1

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.

Jaysonjaywalk answered 9/8, 2012 at 23:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.