Catch layer variable errors at startup

This commit is contained in:
syl20bnr 2015-06-01 00:29:38 -04:00
parent 499973da14
commit 0846591934
1 changed files with 15 additions and 8 deletions

View File

@ -280,14 +280,21 @@ the following keys:
"Set the configuration variables for the passed LAYERS."
(dolist (layer layers)
(let ((variables (spacemacs/mplist-get layer :variables)))
(while variables
(let ((var (pop variables)))
(if (consp variables)
(progn
;; (message "%s" `(set-default ,var ,(pop variables)))
(set-default var (eval (pop variables))))
(spacemacs-buffer/warning "Missing value for variable %s !"
var)))))))
(while variables
(let ((var (pop variables)))
(if (consp variables)
(condition-case err
(set-default var (eval (pop variables)))
('error
(configuration-layer//set-error)
(spacemacs-buffer/append
(format (concat "An error occurred while setting layer "
"variable %s "
"(error: %s). Be sure to quote the value "
"if needed.\n") var err))))
(spacemacs-buffer/warning "Missing value for variable %s !"
var)))))))
(defun configuration-layer/package-usedp (pkg)
"Return non-nil if PKG symbol corresponds to a used package."