diff options
author | John Wiegley <johnw@newartisans.com> | 2015-03-21 03:46:26 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2015-03-21 03:46:26 -0500 |
commit | 8c00f108bfa31bae6dfde16a29e7744f8c8ffc96 (patch) | |
tree | a09a8a910d500e43e76a6851ed5d799c8ea58754 /lisp/use-package | |
parent | 012c37d722f779747abdb747db196eeb552aaf4c (diff) | |
download | emacs-8c00f108bfa31bae6dfde16a29e7744f8c8ffc96.tar.gz emacs-8c00f108bfa31bae6dfde16a29e7744f8c8ffc96.tar.bz2 emacs-8c00f108bfa31bae6dfde16a29e7744f8c8ffc96.zip |
Change use-package to use bind-keys and bind-keys*
Fixes https://github.com/jwiegley/use-package/issues/129
Diffstat (limited to 'lisp/use-package')
-rw-r--r-- | lisp/use-package/bind-key.el | 49 | ||||
-rw-r--r-- | lisp/use-package/use-package.el | 10 |
2 files changed, 28 insertions, 31 deletions
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index 12502c07c38..28b5dbb572b 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el @@ -191,32 +191,35 @@ function symbol (unquoted)." (pop args) (pop args)) args))) - (when (or (and prefix-map - (not prefix)) - (and prefix - (not prefix-map))) + (when (or (and prefix-map (not prefix)) + (and prefix (not prefix-map))) (error "Both :prefix-map and :prefix must be supplied")) (when (and menu-name (not prefix)) (error "If :menu-name is supplied, :prefix must be too")) - `(progn - ,@(when prefix-map - `((defvar ,prefix-map) - ,@(when doc `((put ',prefix-map 'variable-documentation ,doc))) - ,@(if menu-name - `((define-prefix-command ',prefix-map nil ,menu-name)) - `((define-prefix-command ',prefix-map))) - ,@(mapcar - #'(lambda (m) - `(bind-key ,prefix ',prefix-map ,m)) maps))) - ,@(apply - #'nconc - (mapcar (lambda (form) - (if prefix-map - `((bind-key ,(car form) ',(cdr form) ,prefix-map)) - (mapcar - #'(lambda (m) - `(bind-key ,(car form) ',(cdr form) ,m)) maps))) - key-bindings))))) + (macroexp-progn + (append + (when prefix-map + `((defvar ,prefix-map) + ,@(when doc `((put ',prefix-map 'variable-documentation ,doc))) + ,@(if menu-name + `((define-prefix-command ',prefix-map nil ,menu-name)) + `((define-prefix-command ',prefix-map))) + ,@(if maps + (mapcar + #'(lambda (m) + `(bind-key ,prefix ',prefix-map ,m)) maps) + `((bind-key ,prefix ',prefix-map))))) + (apply + #'nconc + (mapcar (lambda (form) + (if prefix-map + `((bind-key ,(car form) ',(cdr form) ,prefix-map)) + (if maps + (mapcar + #'(lambda (m) + `(bind-key ,(car form) ',(cdr form) ,m)) maps) + `((bind-key ,(car form) ',(cdr form)))))) + key-bindings)))))) (defmacro bind-keys* (&rest args) `(bind-keys :map override-global-map ,@args)) diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 4c1433d66d9..5f911e3b718 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -633,19 +633,13 @@ manually updated package." (defun use-package-handler/:bind (name-symbol keyword arg rest state &optional override) - (let* (commands - (form (mapcar - #'(lambda (binding) - (push (cdr binding) commands) - `(,(if override - 'bind-key* - 'bind-key) ,(car binding) #',(cdr binding))) arg))) + (let ((commands (mapcar #'cdr arg))) (use-package-concat (use-package-process-keywords name-symbol (use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) (use-package-plist-append state :commands commands)) - `((ignore ,@form))))) + `((ignore (,(if override 'bind-keys* 'bind-keys) ,@arg)))))) (defun use-package-handler/:bind* (name-symbol keyword arg rest state) (use-package-handler/:bind name-symbol keyword arg rest state t)) |