summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2017-12-06 10:51:24 -0800
committerJohn Wiegley <johnw@newartisans.com>2017-12-06 10:51:24 -0800
commitbeee6b8d4d9b77696adb0a66c71ae566f56c8941 (patch)
treef9467189851413352b50286f00c1da0fb43c5c77
parent75428f870ddfc260283f87534591b787dc242fd0 (diff)
downloademacs-beee6b8d4d.tar.gz
use-package-defaults predicate must also receive the package name
-rw-r--r--lisp/use-package/use-package-core.el14
-rw-r--r--lisp/use-package/use-package-ensure.el2
2 files changed, 8 insertions, 8 deletions
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el
index 4ab8a84a358..fd7d56b271d 100644
--- a/lisp/use-package/use-package-core.el
+++ b/lisp/use-package/use-package-core.el
@@ -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))))))
diff --git a/lisp/use-package/use-package-ensure.el b/lisp/use-package/use-package-ensure.el
index 46de5a8a3a4..3ae8201dc24 100644
--- a/lisp/use-package/use-package-ensure.el
+++ b/lisp/use-package/use-package-ensure.el
@@ -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)