elscreen
elscreen copied to clipboard
Don't use post-command-hook to notify the changes of elscreen for display's performance
Just repeating forward-char makes texts invisible by too much of requests to redraw display.
Emacs 26.3 on Darwin.
elscreen.el L.573
(defun elscreen-set-screen-modified ()
(elscreen-set-conf-list 'modified-inquirer nil)
(add-hook 'post-command-hook 'elscreen-run-screen-update-hook)) ;; <-- Don't
Using idel-timer with mutex would be the best answer.
Because this issue can be observed in random buffer (After window layout is changed (e.g. split window)?),
there may exist the other problem which mistakenly
calls elscreen-set-screen-modified by judging from incorrect internal state.
My assumption is that post-command-hook is not cleared properly by concurrency issue after elscreen-run-screen-update-hook is added.
It looks just overwriting existing methods could resolve this issue.
;; <override elscreen.el>
(defvar elscreen--update-unlock-idle-timer nil)
(defun elscreen--unlock-update-lock()
(setq elscreen--update-unlock-idle-timer nil))
(defun elscreen-run-screen-update-hook ()
"Override function of elscreen.el to prevent huge performance issue of redisplay."
(unless elscreen--update-unlock-idle-timer
(setq elscreen--update-unlock-idle-timer
(run-with-idle-timer 1 nil #'elscreen--unlock-update-lock))
(when elscreen-frame-confs
(elscreen-notify-screen-modification-suppress
(run-hooks 'elscreen-screen-update-hook)))
(remove-hook 'post-command-hook 'elscreen-run-screen-update-hook)
))
(defun elscreen-set-screen-modified ()
"Override function of elscreen.el to prevent huge performance issue of redisplay."
(unless elscreen--update-unlock-idle-timer
(elscreen-set-conf-list 'modified-inquirer nil)
(add-hook 'post-command-hook 'elscreen-run-screen-update-hook)))
;; </override elscreen.el>