summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2017-11-15 07:03:23 -0500
committerNoam Postavsky <npostavs@gmail.com>2017-11-15 07:05:35 -0500
commit1faade882165de2e9bd63702c59c8f26531c18ed (patch)
treef46f490b6ba6f8bcb449a0260a459bb09a29deb0
parent796c7f7a949c83d64ae37cadb9a0ca28a2f1823a (diff)
downloademacs-1faade882165de2e9bd63702c59c8f26531c18ed.tar.gz
Fix marker adjustment for undo (Bug#29118)
* lisp/simple.el (primitive-undo): Compare marker against absolute value of POS, because the sign of POS is irrelevant to markers.
-rw-r--r--lisp/simple.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 4db81071b58..65906c88693 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2565,10 +2565,10 @@ Return what remains of the list."
(setq did-apply t)))
;; Element (STRING . POS) means STRING was deleted.
(`(,(and string (pred stringp)) . ,(and pos (pred integerp)))
- (when (let ((apos (abs pos)))
- (or (< apos (point-min)) (> apos (point-max))))
- (error "Changes to be undone are outside visible portion of buffer"))
- (let (valid-marker-adjustments)
+ (let ((valid-marker-adjustments nil)
+ (apos (abs pos)))
+ (when (or (< apos (point-min)) (> apos (point-max)))
+ (error "Changes to be undone are outside visible portion of buffer"))
;; Check that marker adjustments which were recorded
;; with the (STRING . POS) record are still valid, ie
;; the markers haven't moved. We check their validity
@@ -2579,7 +2579,7 @@ Return what remains of the list."
(let* ((marker-adj (pop list))
(m (car marker-adj)))
(and (eq (marker-buffer m) (current-buffer))
- (= pos m)
+ (= apos m)
(push marker-adj valid-marker-adjustments))))
;; Insert string and adjust point
(if (< pos 0)