bind-keymap fixes

Override argument no longer ignored.  Not adding keymap to list of
commands. `eval' no longer appears to be necessary, using direct
invocation of bind-key*.
This commit is contained in:
Russell Black 2015-04-11 18:08:58 -06:00
parent f1a00054b1
commit a53b5062c4

View file

@ -674,24 +674,22 @@ deferred until the prefix key sequence is pressed."
(use-package-error (format "Could not load package.el: %s" package)) (use-package-error (format "Could not load package.el: %s" package))
(if (and (boundp keymap-symbol) (if (and (boundp keymap-symbol)
(keymapp (symbol-value keymap-symbol))) (keymapp (symbol-value keymap-symbol)))
(let ((key (key-description (this-command-keys-vector))) (let* ((kv (this-command-keys-vector))
(key (key-description kv))
(keymap (symbol-value keymap-symbol))) (keymap (symbol-value keymap-symbol)))
(if override (if override
;; eval form is necessary to avoid compiler error (bind-key* key keymap)
`(eval `(bind-key* ,key ,keymap))
(bind-key key keymap)) (bind-key key keymap))
(setq unread-command-events (setq unread-command-events
(listify-key-sequence (this-command-keys-vector)))) (listify-key-sequence kv)))
(use-package-error (use-package-error
(format "use-package: package.el %s failed to define keymap %s" (format "use-package: package.el %s failed to define keymap %s"
package keymap-symbol))))) package keymap-symbol)))))
(defun use-package-handler/:bind-keymap (defun use-package-handler/:bind-keymap
(name-symbol keyword arg rest state &optional override) (name-symbol keyword arg rest state &optional override)
(let* (commands (let ((form (mapcar
(form (mapcar
#'(lambda (binding) #'(lambda (binding)
(push (cdr binding) commands)
`(,(if override `(,(if override
'bind-key* 'bind-key*
'bind-key) 'bind-key)
@ -699,12 +697,12 @@ deferred until the prefix key sequence is pressed."
#'(lambda () #'(lambda ()
(interactive) (interactive)
(use-package-autoload-keymap (use-package-autoload-keymap
',(cdr binding) ',name-symbol nil)))) arg))) ',(cdr binding) ',name-symbol ,override)))) arg)))
(use-package-concat (use-package-concat
(use-package-process-keywords name-symbol (use-package-process-keywords name-symbol
(use-package-sort-keywords (use-package-sort-keywords
(use-package-plist-maybe-put rest :defer t)) (use-package-plist-maybe-put rest :defer t))
(use-package-plist-append state :commands commands)) state)
`((ignore ,@form))))) `((ignore ,@form)))))
(defun use-package-handler/:bind-keymap* (name-symbol keyword arg rest state) (defun use-package-handler/:bind-keymap* (name-symbol keyword arg rest state)