master 6534d67a1f7: Fix rect mark mess up in unselected windows
Michael Heerdegen via Mailing list for Emacs changes <[email protected]> Thu, 30 Jul 2026 23:18:54 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: master commit 6534d67a1f71e495192fe5d30c843d7b923dca46 Author: Michael Heerdegen <[email protected]> Commit: Michael Heerdegen <[email protected]> Fix rect mark mess up in unselected windows * lisp/rect.el (rectangle--highlight-for-redisplay): Move `save-excursion' inside `with-selected-window' to ensure it always takes effect. (Bug#81451) --- lisp/rect.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/rect.el b/lisp/rect.el index a603c2143e6..bbf270e5837 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -868,16 +868,16 @@ Ignores `line-move-visual'." (eq (nth 5 rol) (point))) rol) (t - (save-excursion - (let* ((pt (point)) - (nrol nil) - (old (if (eq 'rectangle (car-safe rol)) - (nthcdr 6 rol) - (funcall redisplay-unhighlight-region-function rol) - nil))) - (cl-assert (eq (window-buffer window) (current-buffer))) - ;; `rectangle--pos-cols' looks up the `selected-window's parameter! - (with-selected-window window + (let* ((pt (point)) + (nrol nil) + (old (if (eq 'rectangle (car-safe rol)) + (nthcdr 6 rol) + (funcall redisplay-unhighlight-region-function rol) + nil))) + (cl-assert (eq (window-buffer window) (current-buffer))) + ;; `rectangle--pos-cols' looks up the `selected-window's parameter! + (with-selected-window window + (save-excursion (let* ((cols (rectangle--pos-cols start end)) (startcol (car cols)) (endcol (cdr cols)) @@ -976,12 +976,12 @@ Ignores `line-move-visual'." (and (zerop (forward-line 1)) (bolp) (<= (point) end-pt)))) - ) - ) - (mapc #'delete-overlay old) - `(rectangle ,(buffer-chars-modified-tick) - ,start ,end ,(rectangle--crutches) ,pt - ,@nrol)))))) + )) + ) + (mapc #'delete-overlay old) + `(rectangle ,(buffer-chars-modified-tick) + ,start ,end ,(rectangle--crutches) ,pt + ,@nrol))))) (defun rectangle--unhighlight-for-redisplay (orig rol) (if (not (eq 'rectangle (car-safe rol)))