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 .emacs
:
;
; 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.
company-mode
or justcompany
? – Melioratus Sep 9 '16 at 4:38company
seems to work. It's not mentioned on their website AFAICS. Is this a common emacs package naming convention? i.e. <package> for the package and<package>-mode
for the function to enable the package? – Steven Shaw Sep 9 '16 at 6:21package
is the standard based on examples I read on how to set buffer mode using local variables. – Melioratus Sep 9 '16 at 15:37