aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/use-package/use-package-bind-key.el7
-rw-r--r--lisp/use-package/use-package-core.el10
-rw-r--r--test/lisp/use-package/use-package-tests.el15
3 files changed, 29 insertions, 3 deletions
diff --git a/lisp/use-package/use-package-bind-key.el b/lisp/use-package/use-package-bind-key.el
index b26c812bf58..d8fe56dfaa5 100644
--- a/lisp/use-package/use-package-bind-key.el
+++ b/lisp/use-package/use-package-bind-key.el
@@ -128,8 +128,11 @@ deferred until the prefix key sequence is pressed."
128 (name keyword args rest state &optional bind-macro) 128 (name keyword args rest state &optional bind-macro)
129 (use-package-concat 129 (use-package-concat
130 (use-package-process-keywords name rest state) 130 (use-package-process-keywords name rest state)
131 `((,(if bind-macro bind-macro 'bind-keys) 131 `(,@(mapcar
132 :package ,name ,@(use-package-normalize-commands args))))) 132 #'(lambda (xs)
133 `(,(if bind-macro bind-macro 'bind-keys)
134 :package ,name ,@(use-package-normalize-commands xs)))
135 (use-package-split-list-at-keys :break args)))))
133 136
134(defun use-package-handler/:bind* (name keyword arg rest state) 137(defun use-package-handler/:bind* (name keyword arg rest state)
135 (use-package-handler/:bind name keyword arg rest state 'bind-keys*)) 138 (use-package-handler/:bind name keyword arg rest state 'bind-keys*))
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el
index e700c1c110b..df65e04b9a0 100644
--- a/lisp/use-package/use-package-core.el
+++ b/lisp/use-package/use-package-core.el
@@ -180,7 +180,8 @@ t according to whether defaulting should be attempted."
180(defcustom use-package-merge-key-alist 180(defcustom use-package-merge-key-alist
181 '((:if . (lambda (new old) `(and ,new ,old))) 181 '((:if . (lambda (new old) `(and ,new ,old)))
182 (:after . (lambda (new old) `(:all ,new ,old))) 182 (:after . (lambda (new old) `(:all ,new ,old)))
183 (:defer . (lambda (new old) old))) 183 (:defer . (lambda (new old) old))
184 (:bind . (lambda (new old) (append new (list :break) old))))
184 "Alist of keys and the functions used to merge multiple values. 185 "Alist of keys and the functions used to merge multiple values.
185For example, if the following form is provided: 186For example, if the following form is provided:
186 187
@@ -472,6 +473,13 @@ This is in contrast to merely setting it to 0."
472 (nconc ys (list x))))) 473 (nconc ys (list x)))))
473 (cons (cdr ys) (cdr zs)))) 474 (cons (cdr ys) (cdr zs))))
474 475
476(defun use-package-split-list-at-keys (key lst)
477 (when lst
478 (let* ((xs (use-package-split-list (apply-partially #'eq key) lst))
479 (args (car xs))
480 (tail (cdr xs)))
481 (cons args (use-package-split-list-at-keys key (cdr tail))))))
482
475;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 483;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
476;; 484;;
477;;; Keywords 485;;; Keywords
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el
index 5ba6db8a4b5..5aab6bb1170 100644
--- a/test/lisp/use-package/use-package-tests.el
+++ b/test/lisp/use-package/use-package-tests.el
@@ -1769,6 +1769,21 @@
1769 t)) 1769 t))
1770 (bind-keys :package helm ("C-c d" . helm-mini))))) 1770 (bind-keys :package helm ("C-c d" . helm-mini)))))
1771 1771
1772(ert-deftest use-package-test/585 ()
1773 (match-expansion
1774 (use-package bug
1775 :bind (:map bug-map ("C-a" . alpha))
1776 :bind (("C-b" . beta)))
1777 `(progn
1778 (unless (fboundp 'alpha)
1779 (autoload #'alpha "bug" nil t))
1780 (unless (fboundp 'beta)
1781 (autoload #'beta "bug" nil t))
1782 (bind-keys :package bug :map bug-map
1783 ("C-a" . alpha))
1784 (bind-keys :package bug
1785 ("C-b" . beta)))))
1786
1772(ert-deftest bind-key/:prefix-map () 1787(ert-deftest bind-key/:prefix-map ()
1773 (match-expansion 1788 (match-expansion
1774 (bind-keys :prefix "<f1>" 1789 (bind-keys :prefix "<f1>"