fix(multiple-cursors): contextually activate minor mode
evil-mc's design is bizarre. Its variables and hooks are lazy loaded rather than declared at top-level, some hooks aren't defined or documented, it's a bit initializer-function drunk, and its minor modes are intended to be perpetually active -- even when no cursors are active (causing #6021). I undo all of that here. Fix: #6021
This commit is contained in:
parent
69340149f9
commit
b2b19e7196
1 changed files with 13 additions and 1 deletions
|
@ -53,7 +53,19 @@
|
||||||
(defvar evil-mc-key-map (make-sparse-keymap))
|
(defvar evil-mc-key-map (make-sparse-keymap))
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(global-evil-mc-mode +1)
|
;; HACK evil-mc's design is bizarre. Its variables and hooks are lazy loaded
|
||||||
|
;; rather than declared at top-level, some hooks aren't defined or
|
||||||
|
;; documented, it's a bit initializer-function drunk, and its minor modes
|
||||||
|
;; are intended to be perpetually active -- even when no cursors are active
|
||||||
|
;; (causing #6021). I undo all of that here.
|
||||||
|
(evil-mc-define-vars)
|
||||||
|
(add-hook 'evil-mc-before-cursors-created #'evil-mc-pause-incompatible-modes)
|
||||||
|
(add-hook 'evil-mc-before-cursors-created #'evil-mc-initialize-active-state)
|
||||||
|
(add-hook 'evil-mc-after-cursors-deleted #'evil-mc-teardown-active-state)
|
||||||
|
(add-hook 'evil-mc-after-cursors-deleted #'evil-mc-resume-incompatible-modes)
|
||||||
|
(advice-add #'evil-mc-initialize-hooks :override #'ignore)
|
||||||
|
(advice-add #'evil-mc-initialize-active-state :before #'turn-on-evil-mc-mode)
|
||||||
|
(advice-add #'evil-mc-teardown-active-state :after #'turn-off-evil-mc-mode)
|
||||||
|
|
||||||
;; REVIEW This is tremendously slow on macos and windows for some reason.
|
;; REVIEW This is tremendously slow on macos and windows for some reason.
|
||||||
(setq evil-mc-enable-bar-cursor (not (or IS-MAC IS-WINDOWS)))
|
(setq evil-mc-enable-bar-cursor (not (or IS-MAC IS-WINDOWS)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue