diff options
author | John Wiegley <johnw@newartisans.com> | 2014-03-02 13:51:12 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2014-03-02 13:51:12 -0600 |
commit | 11195fa213a786c985bbfb105b57c6c2b795e6b8 (patch) | |
tree | 0bccf1f84adfc426717f853a20ede5c1e35eb0c9 /lisp/use-package/bind-key.el | |
parent | 0f7d54d1db28f8db2c3f03be125e06e347464393 (diff) | |
parent | f0776c2aeb3f7f0af66597e10a3e4469ca26629d (diff) | |
download | emacs-11195fa213a786c985bbfb105b57c6c2b795e6b8.tar.gz emacs-11195fa213a786c985bbfb105b57c6c2b795e6b8.tar.bz2 emacs-11195fa213a786c985bbfb105b57c6c2b795e6b8.zip |
Merge pull request from npostavs/bind-vector
let bind-key accept vectors, add docstring
GitHub-reference: https://github.com/jwiegley/use-package/issues/92
Diffstat (limited to 'lisp/use-package/bind-key.el')
-rw-r--r-- | lisp/use-package/bind-key.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index 1081486b99f..5ef7570cdef 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el @@ -122,12 +122,19 @@ (defvar personal-keybindings nil) (defmacro bind-key (key-name command &optional keymap) + "Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed). + +KEY-NAME may be a vector, in which case it passed straight to +`define-key'. Or it may be a string to be interpreted as +spelled-out keystrokes, e.g., \"C-c C-z\". See documentation of +`edmacro-mode' for details." (let ((namevar (make-symbol "name")) (keyvar (make-symbol "key")) (bindingvar (make-symbol "binding")) (entryvar (make-symbol "entry"))) `(let* ((,namevar ,(eval key-name)) - (,keyvar (read-kbd-macro ,namevar)) + (,keyvar (if (vectorp ,namevar) ,namevar + (read-kbd-macro ,namevar))) (,bindingvar (lookup-key (or ,keymap global-map) ,keyvar))) (let ((,entryvar (assoc (cons ,namevar (quote ,keymap)) |