You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are issues with block visual insert performance. In particular, it seems (though I don't have direct proof) that hooks for things are being run many many times. That means that you can have certain things installed that while relatively heavy give reasonable performance in normal usage, but when combined with block visual end up causing a long delay because the hooks are being run many many times. An example of something like that is line numbering.
I encountered this issue in spacemacs, here's the link: syl20bnr/spacemacs#5423. With line numbering active, block inserting into a 100 rows could easily give a delay of a couple of seconds.
Original comment byFrank Fischer (Bitbucket: lyro, GitHub: lyro):
Block visual insertion just repeats the insertion on the first line on all other line using the standard repeat system (i.e. it executes the "dot" command on the successive lines). If we disable certain hooks the result is hard to predict.
Actually I do not know what I should say. Yes, you can disable some hooks, but it's hard to detect which hooks should be disabled. You try to advice evil-cleanup-insert-state so that some hooks are disabled during the execution of this function (that functions actually runs the repeated insertion).
The performance issues on my system were mostly related to linum-mode. My initial solution was to patch evil-insert to check vcount and disable linum-mode then enabling linum-mode when evil returned to normal-state. This could be wrapped in some additional conditions if the user doesn't use linum-mode in every buffer.
;; in evil-commands.el, evil-insert()
(when (and vcount (> vcount 1))
(linum-mode -1))
;; in .emacs
(evil-normal-state-entry-hook (lambda () (linum-mode t)))
Ultimately this solution is pretty hacky so I opted for something a bit cleaner.
;; in .emacs
(define-key evil-visual-state-map "I" 'string-insert-rectangle)
It's not really in the spirit of Evil, but I use block insertion a lot and was becoming quite annoyed with the performance issues.
Originally reported by: Anonymous
There are issues with block visual insert performance. In particular, it seems (though I don't have direct proof) that hooks for things are being run many many times. That means that you can have certain things installed that while relatively heavy give reasonable performance in normal usage, but when combined with block visual end up causing a long delay because the hooks are being run many many times. An example of something like that is line numbering.
I encountered this issue in spacemacs, here's the link: syl20bnr/spacemacs#5423. With line numbering active, block inserting into a 100 rows could easily give a delay of a couple of seconds.
It seems like emacs perhaps provides ways to avoid running hooks during an automated sequence of edits: https://www.gnu.org/software/emacs/manual/html_node/elisp/Change-Hooks.html.
Is it reasonable to change how hooks are being run during block visual inserts?
The text was updated successfully, but these errors were encountered: