From 69a154616e11149df80d22a9279818e1d3fda317 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Wed, 13 Sep 2023 05:42:24 -0700 Subject: [PATCH] Run erc--scrolltobottom-on-pre-insert unconditionally * lisp/erc/erc-goodies.el (erc--scrolltobottom-all): Pass `no-force' argument to `set-window-start'. (erc--scrolltobottom-on-pre-insert): Convert from generic to normal function and drop `erc-input' method completely. A non-nil `insertp' slot means a message is marked for insertion in the read-only portion of the buffer, above the prompt. But conditionally restoring window parameters based on that flag is insufficient because the window still needs adjusting whenever input is typed, regardless of whether it's erased or "inserted." (Bug#64855) --- lisp/erc/erc-goodies.el | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index 6353b813805..6eb015fdd64 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -223,7 +223,7 @@ attempt to restore last `window-start', if known." ((erc--scrolltobottom-window-info) (found (assq window erc--scrolltobottom-window-info)) ((not (erc--scrolltobottom-confirm (nth 2 found))))) - (setf (window-start window) (cadr found))))) + (set-window-start window (cadr found) 'no-force)))) ;; Necessary unless we're sure `erc--scrolltobottom-on-pre-insert' ;; always runs between calls to this function. (setq erc--scrolltobottom-window-info nil)) @@ -280,7 +280,7 @@ Undo that arrangement when disabling `erc-scrolltobottom-mode'." (kill-local-variable 'erc--scrolltobottom-relaxed-commands) (kill-local-variable 'erc--scrolltobottom-window-info))) -(cl-defmethod erc--scrolltobottom-on-pre-insert (_input-or-string) +(defun erc--scrolltobottom-on-pre-insert (_) "Remember the `window-start' before inserting a message." (setq erc--scrolltobottom-window-info (mapcar (lambda (w) @@ -293,11 +293,6 @@ Undo that arrangement when disabling `erc-scrolltobottom-mode'." (if (= ?\n (char-before (point-max))) (1+ c) c)))) (get-buffer-window-list nil nil 'visible)))) -(cl-defmethod erc--scrolltobottom-on-pre-insert ((input erc-input)) - "Remember the `window-start' before inserting a message." - (when (erc-input-insertp input) - (cl-call-next-method))) - (defun erc--scrolltobottom-confirm (&optional scroll-to) "Like `erc-scroll-to-bottom', but use `window-point'. Position current line (with `recenter') SCROLL-TO lines below -- 2.39.5