summaryrefslogtreecommitdiff
path: root/lisp/use-package/use-package.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2017-11-28 11:03:47 -0800
committerJohn Wiegley <johnw@newartisans.com>2017-11-28 11:07:36 -0800
commitc72d8567d2627a18b5d4da8184053644ccd576a3 (patch)
tree1f0d3625598b58c8a7929fed9ac11189d2721835 /lisp/use-package/use-package.el
parent903ff8221985fe4e2eee1180c9a662f4e3d37146 (diff)
downloademacs-c72d8567d2627a18b5d4da8184053644ccd576a3.tar.gz
emacs-c72d8567d2627a18b5d4da8184053644ccd576a3.tar.bz2
emacs-c72d8567d2627a18b5d4da8184053644ccd576a3.zip
Corrections to the normalization of :custom
Diffstat (limited to 'lisp/use-package/use-package.el')
-rw-r--r--lisp/use-package/use-package.el31
1 files changed, 14 insertions, 17 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
index 5b732c12179..f38d883285c 100644
--- a/lisp/use-package/use-package.el
+++ b/lisp/use-package/use-package.el
@@ -1411,23 +1411,20 @@ deferred until the prefix key sequence is pressed."
;;; :custom
;;
-(defun use-package-normalize/:custom (name-symbol keyword arg)
+(defun use-package-normalize/:custom (name-symbol keyword args)
"Normalize use-package custom keyword."
- (let ((error-msg (format "%s wants a (<symbol> <form> <optional string comment>) or list of these" name-symbol)))
- (unless (listp arg)
- (use-package-error error-msg))
- (dolist (def arg arg)
- (unless (listp def)
- (use-package-error error-msg))
- (let ((variable (nth 0 def))
- (value (nth 1 def))
- (comment (nth 2 def)))
- (when (or (not variable)
- (and (not value)
- (not (eq value nil)))
- (> (length def) 3)
- (and comment (not (stringp comment))))
- (use-package-error error-msg))))))
+ (cond
+ ((and (= (length args) 1)
+ (listp (car args))
+ (listp (car (car args))))
+ (car args))
+ ((and (= (length args) 1)
+ (listp (car args)))
+ args)
+ (t
+ (use-package-error
+ (concat label " a (<symbol> <value> [comment])"
+ " or list of these")))))
(defun use-package-handler/:custom (name keyword args rest state)
"Generate use-package custom keyword code."
@@ -1437,7 +1434,7 @@ deferred until the prefix key sequence is pressed."
(let ((variable (nth 0 def))
(value (nth 1 def))
(comment (nth 2 def)))
- (unless comment
+ (unless (and comment (stringp comment))
(setq comment (format "Customized with use-package %s" name)))
`(customize-set-variable (quote ,variable) ,value ,comment)))
args)