Created
June 23, 2024 00:36
-
-
Save jgarvin/ae7e58939e75c0d52153e71b42646968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun etc-maybe-recenter () | |
(unless (or | |
;; don't interfere with erc scroll-to-bottom | |
(derived-mode-p 'erc-mode 'term-mode 'shell-mode 'eshell-mode) | |
(not (eq (get-buffer-window (current-buffer) t) (selected-window))) | |
(equal (window-point) (point-max)) | |
(region-active-p) | |
) | |
(recenter))) | |
(defvar etc-recenter-timer nil) | |
(progn | |
(when etc-recenter-timer | |
(cancel-timer etc-recenter-timer)) | |
(setq etc-recenter-timer nil) | |
(setq etc-recenter-timer (run-with-idle-timer 0.25 t #'etc-maybe-recenter))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment