diff options
| author | Noam Postavsky | 2017-11-15 07:03:23 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2017-11-15 07:05:35 -0500 |
| commit | 1faade882165de2e9bd63702c59c8f26531c18ed (patch) | |
| tree | f46f490b6ba6f8bcb449a0260a459bb09a29deb0 | |
| parent | 796c7f7a949c83d64ae37cadb9a0ca28a2f1823a (diff) | |
| download | emacs-1faade882165de2e9bd63702c59c8f26531c18ed.tar.gz emacs-1faade882165de2e9bd63702c59c8f26531c18ed.zip | |
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.el | 10 |
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." | |||
| 2565 | (setq did-apply t))) | 2565 | (setq did-apply t))) |
| 2566 | ;; Element (STRING . POS) means STRING was deleted. | 2566 | ;; Element (STRING . POS) means STRING was deleted. |
| 2567 | (`(,(and string (pred stringp)) . ,(and pos (pred integerp))) | 2567 | (`(,(and string (pred stringp)) . ,(and pos (pred integerp))) |
| 2568 | (when (let ((apos (abs pos))) | 2568 | (let ((valid-marker-adjustments nil) |
| 2569 | (or (< apos (point-min)) (> apos (point-max)))) | 2569 | (apos (abs pos))) |
| 2570 | (error "Changes to be undone are outside visible portion of buffer")) | 2570 | (when (or (< apos (point-min)) (> apos (point-max))) |
| 2571 | (let (valid-marker-adjustments) | 2571 | (error "Changes to be undone are outside visible portion of buffer")) |
| 2572 | ;; Check that marker adjustments which were recorded | 2572 | ;; Check that marker adjustments which were recorded |
| 2573 | ;; with the (STRING . POS) record are still valid, ie | 2573 | ;; with the (STRING . POS) record are still valid, ie |
| 2574 | ;; the markers haven't moved. We check their validity | 2574 | ;; the markers haven't moved. We check their validity |
| @@ -2579,7 +2579,7 @@ Return what remains of the list." | |||
| 2579 | (let* ((marker-adj (pop list)) | 2579 | (let* ((marker-adj (pop list)) |
| 2580 | (m (car marker-adj))) | 2580 | (m (car marker-adj))) |
| 2581 | (and (eq (marker-buffer m) (current-buffer)) | 2581 | (and (eq (marker-buffer m) (current-buffer)) |
| 2582 | (= pos m) | 2582 | (= apos m) |
| 2583 | (push marker-adj valid-marker-adjustments)))) | 2583 | (push marker-adj valid-marker-adjustments)))) |
| 2584 | ;; Insert string and adjust point | 2584 | ;; Insert string and adjust point |
| 2585 | (if (< pos 0) | 2585 | (if (< pos 0) |