Is there a way to install ELPA packages from command line?
Asked Answered
H

4

16

I'm interested in standardizing the emacs configurations that a few of us use (~5 people).

Is there a way to install ELPA packages from lisp functions that can be included in a script if we know the set of packages we want? All I can find is how to call up list-packages and install individual packages graphically.

Horsepower answered 12/10, 2013 at 6:7 Comment(0)
A
11

What you need is to use package-install function, like:

(mapc 'package-install install-list)

the install-list variable should contain a list of names of packages that you want to install.

Arlynearlynne answered 12/10, 2013 at 6:45 Comment(0)
D
5

Another thing you can do it make your own package that depends on the other packages that you want installed. Then install that package.

Packages can be installed from file with:

M-x package-install-from-file

or you can make your own package archive with the package in, you can use elpakit to do that.

You can also do this from the command line:

emacs -e "(progn (package-initialize)(package-install 'packagename))"

to install from the operating system command line if you wish.

Dint answered 19/4, 2014 at 21:5 Comment(0)
A
4

You may also want to take a look at cask. It allows you to declare the packages you want to install in file named Cask using a DSL described here. Then from the command line go to the directory and run cask. It will install all the packages declared in the Cask file.

In you init file you will need to add the following lines to use the packages installed by cask.

(require 'cask "~/.cask/cask.el")
(cask-initialize)
Afton answered 6/3, 2014 at 12:17 Comment(0)
I
2

In addition you can get the list of already installed ELPA packages by

(defun eab/print-0 (body)
  "Insert value of body in current-buffer."
  (let ((print-length nil)
        (eval-expression-print-length nil))
    (prin1 `,body (current-buffer))))

(defun eab/package-installed ()
  "Get the list of ELPA installed packages."
  (mapcar (lambda (x) (car x)) package-alist))

(eab/print-0 (eab/package-installed))

and the same for el-get packages

(defun eab/el-get-installed ()
  "Get the list of el-get installed packages."
  (mapcar 'intern
      (el-get-list-package-names-with-status "installed")))

(eab/print-0 (eab/el-get-installed))
Immoralist answered 12/10, 2013 at 8:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.