I'm currently using org-mode to organize my init files — specifically, working off a fork of emacs24-starter-kit. Recently, I had come across the idea of using org-tables to organize some of my things — I've had great success in configuring package-archive
, package-pinned-packages
and even pretty-symbols-alist
for elisp-mode
and lisp-interaction-mode
.
I've hit a snag, though, in trying to create a list of packages that must be installed on every instance of emacs I use, on all machines I have emacs installed. The code looks like this on org-mode:
#+NAME:package-settings
| name | repository |
|--------------------+--------------|
| dired+ | MELPA |
| form-feed | MELPA-stable |
| org-bullets | MELPA-stable |
| org-plus-contrib | org |
| powerline | MELPA-stable |
| rainbow-delimiters | MELPA-stable |
| yasnippet | MELPA-stable |
| color-theme | MELPA |
#+begin_src emacs-lisp :var name=package-settings[,0] repository=package-settings[,1]
(when (require 'package nil 'noerror)
(progn
(require 'cl)
(setq package-pinned-packages (pairlis name repository))
(setq *pkg-to-install
(let (result)
(dolist (entry name result)
(setq result (append result (list (make-symbol entry)))))))
(dolist (pkg *pkg-to-install)
(when (not (package-installed-p pkg))
(package-install pkg)))
(package-initialize))) ; and reinitialize again
#+end_src
However, when I do this, I get the following error message:
package-compute-transaction: Package `dired+-' is unavailable
Pressing C-x C-e
on the affected sexp (i.e. (dolist pkg...
) gets me this:
Debugger entered--Lisp error: (error "Package `dired+-' is unavailable")
signal(error ("Package `dired+-' is unavailable"))
error("Package `%s-%s' is unavailable" dired+ "")
package-compute-transaction(nil ((dired+)))
package-install(dired+)
(progn (package-install pkg))
(if (not (package-installed-p pkg)) (progn (package-install pkg)))
(while --dolist-tail-- (setq pkg (car --dolist-tail--)) (if (not (package-installed-p pkg)) (progn (package-install pkg))) (setq --dolist-tail-- (cdr --dolist-tail--)))
(let ((--dolist-tail-- *pkg-to-install) pkg) (while --dolist-tail-- (setq pkg (car --dolist-tail--)) (if (not (package-installed-p pkg)) (progn (package-install pkg))) (setq --dolist-tail-- (cdr --dolist-tail--))))
eval((let ((--dolist-tail-- *pkg-to-install) pkg) (while --dolist-tail-- (setq pkg (car --dolist-tail--)) (if (not (package-installed-p pkg)) (progn (package-install pkg))) (setq --dolist-tail-- (cdr --dolist-tail--)))) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
I honestly don't know what could be wrong here. I managed to finangle the fact that org-babel
exports the vars as (let ((name (quote ("dired+" "form-feed" ...)))...)...)
by using make-symbol
, but I've hit the limit in terms of my (admittedly still rather sketchy at places) understanding of elisp.
(package-refresh-contents)
.