Catch errors in evil-collection-define-key
Like errors related to prefix keys already being defined
This commit is contained in:
parent
d226a50061
commit
31ba858177
|
@ -305,8 +305,12 @@ function adds the ability to filter keys on the basis of
|
||||||
(setq filtered-bindings (nreverse filtered-bindings))
|
(setq filtered-bindings (nreverse filtered-bindings))
|
||||||
(cond ((null filtered-bindings))
|
(cond ((null filtered-bindings))
|
||||||
((and (boundp map-sym) (keymapp (symbol-value map-sym)))
|
((and (boundp map-sym) (keymapp (symbol-value map-sym)))
|
||||||
(apply #'evil-define-key*
|
(condition-case-unless-debug err
|
||||||
state (symbol-value map-sym) filtered-bindings))
|
(apply #'evil-define-key*
|
||||||
|
state (symbol-value map-sym) filtered-bindings)
|
||||||
|
(error
|
||||||
|
(message "evil-collection: error setting key in %s %S"
|
||||||
|
map-sym err))))
|
||||||
((boundp map-sym)
|
((boundp map-sym)
|
||||||
(user-error "evil-collection: %s is not a keymap" map-sym))
|
(user-error "evil-collection: %s is not a keymap" map-sym))
|
||||||
(t
|
(t
|
||||||
|
@ -315,8 +319,15 @@ function adds the ability to filter keys on the basis of
|
||||||
(fset fun `(lambda (&rest args)
|
(fset fun `(lambda (&rest args)
|
||||||
(when (and (boundp ',map-sym) (keymapp ,map-sym))
|
(when (and (boundp ',map-sym) (keymapp ,map-sym))
|
||||||
(remove-hook 'after-load-functions #',fun)
|
(remove-hook 'after-load-functions #',fun)
|
||||||
(apply #'evil-define-key*
|
(condition-case-unless-debug err
|
||||||
',state ,map-sym ',filtered-bindings))))
|
(apply #'evil-define-key*
|
||||||
|
',state ,map-sym ',filtered-bindings)
|
||||||
|
(error
|
||||||
|
(message
|
||||||
|
,(format
|
||||||
|
"evil-collection: error setting key in %s %%S"
|
||||||
|
map-sym)
|
||||||
|
err))))))
|
||||||
(add-hook 'after-load-functions fun t))))))
|
(add-hook 'after-load-functions fun t))))))
|
||||||
|
|
||||||
(defun evil-collection-inhibit-insert-state (map-sym)
|
(defun evil-collection-inhibit-insert-state (map-sym)
|
||||||
|
|
Loading…
Reference in New Issue