diff options
| author | Stefan Monnier | 2020-02-14 10:52:58 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2020-02-14 10:52:58 -0500 |
| commit | 32f0149266162f8cfd161b35a1fe3744dcd36625 (patch) | |
| tree | 264edf76260d16b7ae359e6d477344c3a5341989 | |
| parent | bbe13596b147b81aebbf48b094f87e2e04f50b55 (diff) | |
| download | emacs-32f0149266162f8cfd161b35a1fe3744dcd36625.tar.gz emacs-32f0149266162f8cfd161b35a1fe3744dcd36625.zip | |
* lisp/simple.el (undo): Use undo--last-change-was-undo-p
| -rw-r--r-- | lisp/simple.el | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 0217ae7c1e6..688dbcc947b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2532,6 +2532,11 @@ A redo record for ordinary undo maps to the following (earlier) undo.") | |||
| 2532 | "Within a run of consecutive undo commands, list remaining to be undone. | 2532 | "Within a run of consecutive undo commands, list remaining to be undone. |
| 2533 | If t, we undid all the way to the end of it.") | 2533 | If t, we undid all the way to the end of it.") |
| 2534 | 2534 | ||
| 2535 | (defun undo--last-change-was-undo-p (undo-list) | ||
| 2536 | (while (and (consp undo-list) (eq (car undo-list) nil)) | ||
| 2537 | (setq undo-list (cdr undo-list))) | ||
| 2538 | (gethash undo-list undo-equiv-table)) | ||
| 2539 | |||
| 2535 | (defun undo (&optional arg) | 2540 | (defun undo (&optional arg) |
| 2536 | "Undo some previous changes. | 2541 | "Undo some previous changes. |
| 2537 | Repeat this command to undo more changes. | 2542 | Repeat this command to undo more changes. |
| @@ -2567,12 +2572,7 @@ as an argument limits undo to changes within the current region." | |||
| 2567 | (or (eq pending-undo-list t) | 2572 | (or (eq pending-undo-list t) |
| 2568 | ;; If something (a timer or filter?) changed the buffer | 2573 | ;; If something (a timer or filter?) changed the buffer |
| 2569 | ;; since the previous command, don't continue the undo seq. | 2574 | ;; since the previous command, don't continue the undo seq. |
| 2570 | (let ((list buffer-undo-list)) | 2575 | (undo--last-change-was-undo-p buffer-undo-list))) |
| 2571 | (while (eq (car list) nil) | ||
| 2572 | (setq list (cdr list))) | ||
| 2573 | ;; If the last undo record made was made by undo | ||
| 2574 | ;; it shows nothing else happened in between. | ||
| 2575 | (gethash list undo-equiv-table)))) | ||
| 2576 | (setq undo-in-region | 2576 | (setq undo-in-region |
| 2577 | (and (or (region-active-p) (and arg (not (numberp arg)))) | 2577 | (and (or (region-active-p) (and arg (not (numberp arg)))) |
| 2578 | (not inhibit-region))) | 2578 | (not inhibit-region))) |
| @@ -2662,11 +2662,6 @@ Contrary to `undo', this will not redo a previous undo." | |||
| 2662 | (interactive "*p") | 2662 | (interactive "*p") |
| 2663 | (let ((undo-no-redo t)) (undo arg))) | 2663 | (let ((undo-no-redo t)) (undo arg))) |
| 2664 | 2664 | ||
| 2665 | (defun undo--last-change-was-undo-p (undo-list) | ||
| 2666 | (while (and (consp undo-list) (eq (car undo-list) nil)) | ||
| 2667 | (setq undo-list (cdr undo-list))) | ||
| 2668 | (gethash undo-list undo-equiv-table)) | ||
| 2669 | |||
| 2670 | (defun undo-redo (&optional arg) | 2665 | (defun undo-redo (&optional arg) |
| 2671 | "Undo the last ARG undos." | 2666 | "Undo the last ARG undos." |
| 2672 | (interactive "*p") | 2667 | (interactive "*p") |