1
0
mirror of https://github.com/jojojames/evil-collection.git synced 2024-06-29 07:50:50 +02:00

Calc: Fix extension loading

This commit is contained in:
Pierre Neidhardt 2018-05-24 18:34:32 +02:00
parent 0b05e784ec
commit 4fedc08c33

View File

@ -31,10 +31,16 @@
(defconst evil-collection-calc-maps '(calc-mode-map)) (defconst evil-collection-calc-maps '(calc-mode-map))
(defun evil-collection-calc-ext-setup () (defun evil-collection-calc-setup ()
"Set up `evil' bindings for `calc'. "Set up `evil' bindings for `calc'."
Since calc bindings are set on-demand when calc-ext is load, we (evil-collection-util-inhibit-insert-state calc-mode-map)
need to call it in its load hook." (evil-set-initial-state 'calc-mode 'normal)
;; Calc sets up its bindings just-in-time for its "extensions". I don't think
;; it's worth copying this clumsy design (for what performance benefit?),
;; while making the bindings much harder to maintain.
(require 'calc-ext)
(evil-define-key 'normal calc-mode-map (evil-define-key 'normal calc-mode-map
"0" 'calcDigit-start "0" 'calcDigit-start
"1" 'calcDigit-start "1" 'calcDigit-start
@ -163,12 +169,5 @@ need to call it in its load hook."
(evil-define-key 'visual calc-mode-map (evil-define-key 'visual calc-mode-map
"d" 'calc-kill-region)) "d" 'calc-kill-region))
(defun evil-collection-calc-setup ()
"Set up `evil' bindings for `calc'."
(evil-collection-util-inhibit-insert-state calc-mode-map)
(evil-set-initial-state 'calc-mode 'normal)
(evil-collection-calc-ext-setup)
(add-hook 'calc-ext-load-hook 'evil-collection-calc-ext-setup))
(provide 'evil-collection-calc) (provide 'evil-collection-calc)
;;; evil-collection-calc.el ends here ;;; evil-collection-calc.el ends here