diff options
| author | Daniel Mendler | 2021-02-10 14:01:59 +0100 |
|---|---|---|
| committer | Daniel Mendler | 2021-02-10 15:23:44 +0100 |
| commit | ec750952f4cde13023554da3a94964f024ee4f71 (patch) | |
| tree | 5db8756c85b088e14dfe71c958bfb7ff4146bb2e | |
| parent | a248658910204bb20b64eedba7d1c1f32bbaca94 (diff) | |
| download | emacs-ec750952f4cde13023554da3a94964f024ee4f71.tar.gz emacs-ec750952f4cde13023554da3a94964f024ee4f71.zip | |
bind-key: Use new symbols for kmapvar
| -rw-r--r-- | lisp/use-package/bind-key.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index fef23740c67..13fd02ab89b 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el | |||
| @@ -168,16 +168,19 @@ or operates on menu data structures, so you should write it so it | |||
| 168 | can safely be called at any time." | 168 | can safely be called at any time." |
| 169 | (let ((namevar (make-symbol "name")) | 169 | (let ((namevar (make-symbol "name")) |
| 170 | (keyvar (make-symbol "key")) | 170 | (keyvar (make-symbol "key")) |
| 171 | (kmapvar (make-symbol "kmap")) | ||
| 171 | (kdescvar (make-symbol "kdesc")) | 172 | (kdescvar (make-symbol "kdesc")) |
| 172 | (bindingvar (make-symbol "binding"))) | 173 | (bindingvar (make-symbol "binding"))) |
| 173 | `(let* ((,namevar ,key-name) | 174 | `(let* ((,namevar ,key-name) |
| 174 | (,keyvar (if (vectorp ,namevar) ,namevar | 175 | (,keyvar (if (vectorp ,namevar) ,namevar |
| 175 | (read-kbd-macro ,namevar))) | 176 | (read-kbd-macro ,namevar))) |
| 176 | (kmap (if (and ,keymap (symbolp ,keymap)) (symbol-value ,keymap) ,keymap)) | 177 | (,kmapvar (or (if (and ,keymap (symbolp ,keymap)) |
| 178 | (symbol-value ,keymap) ,keymap) | ||
| 179 | global-map)) | ||
| 177 | (,kdescvar (cons (if (stringp ,namevar) ,namevar | 180 | (,kdescvar (cons (if (stringp ,namevar) ,namevar |
| 178 | (key-description ,namevar)) | 181 | (key-description ,namevar)) |
| 179 | (if (symbolp ,keymap) ,keymap (quote ,keymap)))) | 182 | (if (symbolp ,keymap) ,keymap (quote ,keymap)))) |
| 180 | (,bindingvar (lookup-key (or kmap global-map) ,keyvar))) | 183 | (,bindingvar (lookup-key ,kmapvar ,keyvar))) |
| 181 | (let ((entry (assoc ,kdescvar personal-keybindings)) | 184 | (let ((entry (assoc ,kdescvar personal-keybindings)) |
| 182 | (details (list ,command | 185 | (details (list ,command |
| 183 | (unless (numberp ,bindingvar) | 186 | (unless (numberp ,bindingvar) |
| @@ -186,11 +189,11 @@ can safely be called at any time." | |||
| 186 | (setcdr entry details) | 189 | (setcdr entry details) |
| 187 | (add-to-list 'personal-keybindings (cons ,kdescvar details)))) | 190 | (add-to-list 'personal-keybindings (cons ,kdescvar details)))) |
| 188 | ,(if predicate | 191 | ,(if predicate |
| 189 | `(define-key (or kmap global-map) ,keyvar | 192 | `(define-key ,kmapvar ,keyvar |
| 190 | '(menu-item "" nil :filter (lambda (&optional _) | 193 | '(menu-item "" nil :filter (lambda (&optional _) |
| 191 | (when ,predicate | 194 | (when ,predicate |
| 192 | ,command)))) | 195 | ,command)))) |
| 193 | `(define-key (or kmap global-map) ,keyvar ,command))))) | 196 | `(define-key ,kmapvar ,keyvar ,command))))) |
| 194 | 197 | ||
| 195 | ;;;###autoload | 198 | ;;;###autoload |
| 196 | (defmacro unbind-key (key-name &optional keymap) | 199 | (defmacro unbind-key (key-name &optional keymap) |