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'
(:config '(t) t)
(:init nil t)
(:catch t (lambda (args)
(:catch t (lambda (name args)
(not use-package-expand-minimally)))
(:defer use-package-always-defer
(lambda (args)
(lambda (name args)
(and use-package-always-defer
(not (plist-member args :defer))
(not (plist-member args :demand)))))
(:demand use-package-always-demand
(lambda (args)
(lambda (name args)
(and use-package-always-demand
(not (plist-member args :defer))
(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
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
which case it receives the list of keywords (in normalized form),
and should return nil or t according to whether defaulting should
be attempted."
which case it receives the name of the package (as a symbol) and
a list of keywords (in normalized form). It should return nil or
t according to whether defaulting should be attempted."
:type `(repeat
(list (choice :tag "Keyword"
,@(mapcar #'(lambda (k) (list 'const k))
@ -534,7 +534,7 @@ extending any keys already present."
(cl-dolist (spec use-package-defaults)
(when (let ((func (nth 2 spec)))
(if (and func (functionp func))
(funcall func args)
(funcall func name args)
(eval func)))
(setq args (use-package-plist-maybe-put
args (nth 0 spec) (eval (nth 1 spec))))))

View file

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