[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 35c72ae: rectangle--pos-cols shouldn't move point
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 35c72ae: rectangle--pos-cols shouldn't move point |
Date: |
Mon, 24 Jun 2019 13:12:47 -0400 (EDT) |
branch: master
commit 35c72aea449a0e05849cff8d8ad4b9bde25cebb5
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
rectangle--pos-cols shouldn't move point
* lisp/rect.el (rectangle--pos-cols): Don't move point while
calculating the values (bug#25777).
---
lisp/rect.el | 55 ++++++++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/lisp/rect.el b/lisp/rect.el
index ecf6da1..34f79e3e 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -77,34 +77,35 @@ Point is at the end of the segment of this line within the
rectangle."
;; At this stage, we don't know which of start/end is point/mark :-(
;; And in case start=end, it might still be that point and mark have
;; different crutches!
- (let ((cw (window-parameter window 'rectangle--point-crutches)))
- (cond
- ((eq start (car cw))
- (let ((sc (cdr cw))
- (ec (if (eq end (car rectangle--mark-crutches))
- (cdr rectangle--mark-crutches)
- (if rectangle--mark-crutches
- (setq rectangle--mark-crutches nil))
- (goto-char end) (current-column))))
- (if (eq start end) (cons (min sc ec) (max sc ec)) (cons sc ec))))
- ((eq end (car cw))
- (if (eq start (car rectangle--mark-crutches))
- (cons (cdr rectangle--mark-crutches) (cdr cw))
+ (save-excursion
+ (let ((cw (window-parameter window 'rectangle--point-crutches)))
+ (cond
+ ((eq start (car cw))
+ (let ((sc (cdr cw))
+ (ec (if (eq end (car rectangle--mark-crutches))
+ (cdr rectangle--mark-crutches)
+ (if rectangle--mark-crutches
+ (setq rectangle--mark-crutches nil))
+ (goto-char end) (current-column))))
+ (if (eq start end) (cons (min sc ec) (max sc ec)) (cons sc ec))))
+ ((eq end (car cw))
+ (if (eq start (car rectangle--mark-crutches))
+ (cons (cdr rectangle--mark-crutches) (cdr cw))
+ (if rectangle--mark-crutches (setq rectangle--mark-crutches nil))
+ (cons (progn (goto-char start) (current-column)) (cdr cw))))
+ ((progn
+ (if cw (setf (window-parameter nil 'rectangle--point-crutches) nil))
+ (eq start (car rectangle--mark-crutches)))
+ (let ((sc (cdr rectangle--mark-crutches))
+ (ec (progn (goto-char end) (current-column))))
+ (if (eq start end) (cons (min sc ec) (max sc ec)) (cons sc ec))))
+ ((eq end (car rectangle--mark-crutches))
+ (cons (progn (goto-char start) (current-column))
+ (cdr rectangle--mark-crutches)))
+ (t
(if rectangle--mark-crutches (setq rectangle--mark-crutches nil))
- (cons (progn (goto-char start) (current-column)) (cdr cw))))
- ((progn
- (if cw (setf (window-parameter nil 'rectangle--point-crutches) nil))
- (eq start (car rectangle--mark-crutches)))
- (let ((sc (cdr rectangle--mark-crutches))
- (ec (progn (goto-char end) (current-column))))
- (if (eq start end) (cons (min sc ec) (max sc ec)) (cons sc ec))))
- ((eq end (car rectangle--mark-crutches))
- (cons (progn (goto-char start) (current-column))
- (cdr rectangle--mark-crutches)))
- (t
- (if rectangle--mark-crutches (setq rectangle--mark-crutches nil))
- (cons (progn (goto-char start) (current-column))
- (progn (goto-char end) (current-column)))))))
+ (cons (progn (goto-char start) (current-column))
+ (progn (goto-char end) (current-column))))))))
(defun rectangle--col-pos (col kind)
(let ((c (move-to-column col)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 35c72ae: rectangle--pos-cols shouldn't move point,
Lars Ingebrigtsen <=