I use a function,
ensure-packages-installed to "bootstrap" packages in my
.emacs file. This ensures that if the package isn't already install. The follow is at the top of my
; ; Set up Emacs package system. ; (require 'package) ;(add-to-list 'package-archives ; '("elpa" . "http://elpa.gnu.org/packages")) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) ;(add-to-list 'package-archives ; '("marmalade" . "https://marmalade-repo.org/packages/") t) (package-initialize) ; fetch the list of packages available (or (file-exists-p package-user-dir) (package-refresh-contents)) (defun ensure-packages-installed (&rest packages) (mapcar (lambda (package) (unless (package-installed-p package) (package-install package))) packages)) (ensure-packages-installed 'company-mode 'exec-path-from-shell 'evil 'haskell-mode 'intero 'idris-mode 'org 'projectile 'solarized-theme )
However, when I add
company-mode to the list it, I get the following error:
Warning (initialization): An error occurred while loading `/Users/steshaw/.emacs': error: Package `company-mode-' is unavailable To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `--debug-init' option to view a complete error backtrace.