Last active
December 28, 2015 01:19
-
-
Save stefaneng/7420118 to your computer and use it in GitHub Desktop.
Emacs macro to ensure that a package is installed before configuring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro ensure-installed-package (package &rest body) | |
"Ensures PACKAGE is installed and then performs body. Place package configurations in BODY" | |
(declare (indent 1)) | |
`(progn | |
(when (not (package-installed-p ,package)) | |
(package-install ,package)) | |
,@body)) | |
;; USAGE: | |
(ensure-installed-package 'haskell-mode | |
;; Configure package here | |
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment