diff options
author | John Wiegley <johnw@newartisans.com> | 2017-04-03 12:34:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-03 12:34:01 -0700 |
commit | 2db2b56b17ac9a5125cce4bc2b41298bd1d34476 (patch) | |
tree | 5c438b514758cf0762f9cb6ced538a0072cc2a0f /lisp/use-package/use-package.el | |
parent | 9f90129b95c67633e764f82bab6eaed215fb0696 (diff) | |
parent | e5e335424c3455b06d8942f7cda2d17f04612713 (diff) | |
download | emacs-2db2b56b17ac9a5125cce4bc2b41298bd1d34476.tar.gz emacs-2db2b56b17ac9a5125cce4bc2b41298bd1d34476.tar.bz2 emacs-2db2b56b17ac9a5125cce4bc2b41298bd1d34476.zip |
Merge pull request from raxod502/fix-bind-key-filter
Don't mutilate keyword arguments in :bind
GitHub-reference: https://github.com/jwiegley/use-package/issues/447
Diffstat (limited to 'lisp/use-package/use-package.el')
-rw-r--r-- | lisp/use-package/use-package.el | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 8515ce2f376..02a358c7145 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -964,12 +964,34 @@ 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))) + ;; Currently, the handling of keyword + ;; arguments by `use-package' and `bind-key' + ;; is non-uniform and undocumented. As a + ;; result, `use-package-normalize-pairs' (as + ;; it is currently implemented) does not + ;; correctly handle the keyword-argument + ;; syntax of `bind-keys'. A permanent solution + ;; to this problem will require a careful + ;; consideration of the desired + ;; keyword-argument interface for + ;; `use-package' and `bind-key'. However, in + ;; the meantime, we have a quick patch to fix + ;; a serious bug in the handling of keyword + ;; arguments. Namely, the code below would + ;; normally unwrap lists that were passed as + ;; keyword arguments (for example, the + ;; `:filter' argument in `:bind') without + ;; the (not (keywordp last-item)) clause. See + ;; #447 for further discussion. + (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) |