From b3abbab63254fd18e1c7bad56d3401b49dd8604c Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sun, 31 Aug 2025 16:38:30 -0700 Subject: [PATCH] Don't touch window configuration in erc-fill prompt hook * lisp/erc/erc-fill.el (erc-fill--wrap-indent-prompt): While computing the prompt indentation's text size, don't bother saving and restoring the window configuration because unwanted scrolls are now believed to be unlikely because of other changes. --- lisp/erc/erc-fill.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 291dcc2e306..cbe91861e48 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -616,7 +616,9 @@ to be disabled. On Emacs 28 and below, return END minus BEG." ;; `with-selected-window' seems to interfere with the implementation ;; of `erc-scrolltobottom-all' in ERC 5.6, which needs improvement. (if (fboundp 'buffer-text-pixel-size) - ;; `buffer-text-pixel-size' can move point! + ;; This `save-excursion' is likely unnecessary. It was originally + ;; meant to protect point from `buffer-text-pixel-size', which no + ;; longer runs in the selected window's buffer. (save-excursion (save-restriction (narrow-to-region beg end) @@ -745,12 +747,7 @@ See `erc-fill-wrap-mode' for details." ;; Clear an existing `line-prefix' before measuring (bug#64971). (remove-text-properties erc-insert-marker erc-input-marker '(line-prefix nil wrap-prefix nil)) - ;; Restoring window configuration seems to prevent unwanted - ;; recentering reminiscent of `scrolltobottom'-related woes. - (let ((c (and (get-buffer-window) (current-window-configuration))) - (len (erc-fill--wrap-measure erc-insert-marker erc-input-marker))) - (when c - (set-window-configuration c)) + (let ((len (erc-fill--wrap-measure erc-insert-marker erc-input-marker))) (put-text-property erc-insert-marker erc-input-marker 'line-prefix `(space :width (- erc-fill--wrap-value ,len)))))