use-package-defaults predicate must also receive the package name

This commit is contained in:
John Wiegley 2017-12-06 10:51:24 -08:00
parent 75428f870d
commit beee6b8d4d
2 changed files with 8 additions and 8 deletions

View file

@ -148,15 +148,15 @@ See also `use-package-defaults', which uses this value."
'(;; this '(t) has special meaning; see `use-package-handler/:config' '(;; this '(t) has special meaning; see `use-package-handler/:config'
(:config '(t) t) (:config '(t) t)
(:init nil t) (:init nil t)
(:catch t (lambda (args) (:catch t (lambda (name args)
(not use-package-expand-minimally))) (not use-package-expand-minimally)))
(:defer use-package-always-defer (:defer use-package-always-defer
(lambda (args) (lambda (name args)
(and use-package-always-defer (and use-package-always-defer
(not (plist-member args :defer)) (not (plist-member args :defer))
(not (plist-member args :demand))))) (not (plist-member args :demand)))))
(:demand use-package-always-demand (:demand use-package-always-demand
(lambda (args) (lambda (name args)
(and use-package-always-demand (and use-package-always-demand
(not (plist-member args :defer)) (not (plist-member args :defer))
(not (plist-member args :demand)))))) (not (plist-member args :demand))))))
@ -168,9 +168,9 @@ is a form that can be evaluated to determine whether or not to
assign a default value; if it evaluates to nil, then the default assign a default value; if it evaluates to nil, then the default
value is not assigned even if the keyword is not present in the value is not assigned even if the keyword is not present in the
`use-package' form. This third element may also be a function, in `use-package' form. This third element may also be a function, in
which case it receives the list of keywords (in normalized form), which case it receives the name of the package (as a symbol) and
and should return nil or t according to whether defaulting should a list of keywords (in normalized form). It should return nil or
be attempted." t according to whether defaulting should be attempted."
:type `(repeat :type `(repeat
(list (choice :tag "Keyword" (list (choice :tag "Keyword"
,@(mapcar #'(lambda (k) (list 'const k)) ,@(mapcar #'(lambda (k) (list 'const k))
@ -534,7 +534,7 @@ extending any keys already present."
(cl-dolist (spec use-package-defaults) (cl-dolist (spec use-package-defaults)
(when (let ((func (nth 2 spec))) (when (let ((func (nth 2 spec)))
(if (and func (functionp func)) (if (and func (functionp func))
(funcall func args) (funcall func name args)
(eval func))) (eval func)))
(setq args (use-package-plist-maybe-put (setq args (use-package-plist-maybe-put
args (nth 0 spec) (eval (nth 1 spec)))))) args (nth 0 spec) (eval (nth 1 spec))))))

View file

@ -200,7 +200,7 @@ manually updated package."
(add-to-list 'use-package-defaults (add-to-list 'use-package-defaults
'(:ensure (list use-package-always-ensure) '(:ensure (list use-package-always-ensure)
(lambda (args) (lambda (name args)
(and use-package-always-ensure (and use-package-always-ensure
(not (plist-member args :load-path))))) t) (not (plist-member args :load-path))))) t)