1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 22:41:06 -08:00

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.
This commit is contained in:
F. Jason Park 2025-08-31 16:38:30 -07:00
parent 684d091692
commit b3abbab632

View file

@ -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)))))