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.
This commit is contained in:
parent
796c7f7a94
commit
1faade8821
1 changed files with 5 additions and 5 deletions
|
@ -2565,10 +2565,10 @@ Return what remains of the list."
|
||||||
(setq did-apply t)))
|
(setq did-apply t)))
|
||||||
;; Element (STRING . POS) means STRING was deleted.
|
;; Element (STRING . POS) means STRING was deleted.
|
||||||
(`(,(and string (pred stringp)) . ,(and pos (pred integerp)))
|
(`(,(and string (pred stringp)) . ,(and pos (pred integerp)))
|
||||||
(when (let ((apos (abs pos)))
|
(let ((valid-marker-adjustments nil)
|
||||||
(or (< apos (point-min)) (> apos (point-max))))
|
(apos (abs pos)))
|
||||||
(error "Changes to be undone are outside visible portion of buffer"))
|
(when (or (< apos (point-min)) (> apos (point-max)))
|
||||||
(let (valid-marker-adjustments)
|
(error "Changes to be undone are outside visible portion of buffer"))
|
||||||
;; Check that marker adjustments which were recorded
|
;; Check that marker adjustments which were recorded
|
||||||
;; with the (STRING . POS) record are still valid, ie
|
;; with the (STRING . POS) record are still valid, ie
|
||||||
;; the markers haven't moved. We check their validity
|
;; the markers haven't moved. We check their validity
|
||||||
|
@ -2579,7 +2579,7 @@ Return what remains of the list."
|
||||||
(let* ((marker-adj (pop list))
|
(let* ((marker-adj (pop list))
|
||||||
(m (car marker-adj)))
|
(m (car marker-adj)))
|
||||||
(and (eq (marker-buffer m) (current-buffer))
|
(and (eq (marker-buffer m) (current-buffer))
|
||||||
(= pos m)
|
(= apos m)
|
||||||
(push marker-adj valid-marker-adjustments))))
|
(push marker-adj valid-marker-adjustments))))
|
||||||
;; Insert string and adjust point
|
;; Insert string and adjust point
|
||||||
(if (< pos 0)
|
(if (< pos 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue