I reorganized my init Emacs files to install them under version control. The layout of the file system is as follows:
/home/axel/.user_config/emacs
├── development.el
├── general.el
├── init.el
├── packages.el
└── writing.el
packages.elcontains a list of packages that Emacs should install at startup, if they are not already installed. This works without problems after execution rm -rf ~/.emacs.d/*. When I start Emacs after this, all the packages listed in packages.elare installed. However, when I manually add a package (for example markdown-mode+) to the list pfl-packagesin packages.el, the new package does not install when I restart Emacs. Removing the content ~/.emacs.d/solves this problem again, but I would like to be able to add the package names to the list that Emacs automatically installs at startup. Did I miss something important during Emacs initialization?
Please view the contents of the relevant files below.
The file ~/.emacscontains the following:
(add-to-list 'load-path "~/.user_config/emacs/")
(load-library "init")
The file ~/.user_config/emacs/init.elcontains:
;;;; loads the different libraries to set up Emacs accordingly
;; load the library that sets up package repositories and syncing
(load-library "packages")
;; load the library that sets up the general behavior of Emacs
(load-library "general")
(load-library "writing")
(load-library "development")
The file packages.elcontains the following:
;;;; this library sets up package repositories and allows for syncing packages
;;;; between different machines
;;;; to add packages to the syncing, add their repository names to the list `pfl-packages'
;;; set up package repositories from which additional packages can be installed
;; set up ELPA and MELPA repositories
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives
'("org" . "http://orgmode.org/elpa/"))
;;; set up package syncing to allow for syncing between different machines
;; list of packages to sync
(setq pfl-packages
'(
color-theme-sanityinc-solarized
company
company-auctex
company-c-headers
company-irony
company-quickhelp
elpy
ess
flycheck-irony
irony
magit
markdown-mode
markdown-mode+
rainbow-delimiters
smart-tabs-mode
yasnippet
))
;; refresh package list if it is not already available
(when (not package-archive-contents) (package-refresh-contents))
;; install packages from the list that are not yet installed
(dolist (pkg pfl-packages)
(when (and (not (package-installed-p pkg)) (assoc pkg package-archive-contents))
(package-install pkg)))
source