mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 22:40:51 -08:00
Don't mutilate keyword arguments in :bind
The parsing logic in `use-package-normalize-pairs' is not designed to
deal with keyword arguments. However, `use-package-normalize-pairs' is
used to process the arguments to :bind, which can include keyword
arguments. These keyword arguments are supposed to be passed untouched
to the underlying `bind-keys' function, but there is a clause in
`use-package-normalize-pairs' that replaces lists with their first
element. Thus an invocation like:
(use-package company
:bind (:map company-active-map
:filter (company-explicit-action-p)
("RET" . company-complete-selection)))
Generates code like this:
(bind-keys
:map company-active-map
:filter company-explicit-action-p
("RET" . company-complete-selection))
Which generates an error since `company-explicit-action-p' is now
being referenced as a variable rather than a function.
The proper solution is to refactor the logic that goes into parsing
uses of :bind, but this commit adds a temporary patch to eliminate the
above problem, while trying to be as reverse-compatible as possible.
In particular it just inhibits the list-to-first-element
transformation when the previous element processed was a keyword.
This commit is contained in:
parent
9f90129b95
commit
d5d320e607
1 changed files with 9 additions and 6 deletions
|
|
@ -964,12 +964,15 @@ If RECURSED is non-nil, recurse into sublists."
|
|||
((use-package-is-pair arg key-pred val-pred)
|
||||
(list arg))
|
||||
((and (not recursed) (listp arg) (listp (cdr arg)))
|
||||
(mapcar #'(lambda (x)
|
||||
(let ((ret (use-package-normalize-pairs
|
||||
key-pred val-pred name label x t)))
|
||||
(if (listp ret)
|
||||
(car ret)
|
||||
ret))) arg))
|
||||
(let ((last-item nil))
|
||||
(mapcar #'(lambda (x)
|
||||
(prog1
|
||||
(let ((ret (use-package-normalize-pairs
|
||||
key-pred val-pred name label x t)))
|
||||
(if (and (listp ret) (not (keywordp last-item)))
|
||||
(car ret)
|
||||
ret))
|
||||
(setq last-item x))) arg)))
|
||||
(t arg)))
|
||||
|
||||
(defun use-package-normalize-binder (name keyword args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue