diff options
| author | Phillip Lord | 2016-06-10 22:30:49 +0100 |
|---|---|---|
| committer | Phillip Lord | 2016-06-11 20:32:31 +0100 |
| commit | 291fe0aade6560490abbe5c08d231c18edbb4737 (patch) | |
| tree | 3d6e16d93a94ec251a0eb01781c517d7916e7b23 /lisp/emulation | |
| parent | 6921f4a5961fb53f8fb24d1a5a3f94266f990f6e (diff) | |
| download | emacs-291fe0aade6560490abbe5c08d231c18edbb4737.tar.gz emacs-291fe0aade6560490abbe5c08d231c18edbb4737.zip | |
Revert "Fix viper undo breakage from undo-boundary changes"
This reverts commit c0139e32f1f3bb287b04e02a69a7848d6a040003.
Diffstat (limited to 'lisp/emulation')
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 43 | ||||
| -rw-r--r-- | lisp/emulation/viper-init.el | 9 |
2 files changed, 38 insertions, 14 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 6b8fa46362d..93cf3b0fb10 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -631,7 +631,7 @@ | |||
| 631 | (viper-over-whitespace-line)) | 631 | (viper-over-whitespace-line)) |
| 632 | (indent-to-left-margin)) | 632 | (indent-to-left-margin)) |
| 633 | (viper-add-newline-at-eob-if-necessary) | 633 | (viper-add-newline-at-eob-if-necessary) |
| 634 | (viper-complete-complex-command-for-undo) | 634 | (viper-adjust-undo) |
| 635 | 635 | ||
| 636 | (if (eq viper-current-state 'emacs-state) | 636 | (if (eq viper-current-state 'emacs-state) |
| 637 | (viper-restore-cursor-color 'after-emacs-mode) | 637 | (viper-restore-cursor-color 'after-emacs-mode) |
| @@ -1570,7 +1570,7 @@ If the prefix argument ARG is non-nil, it is used instead of `val'." | |||
| 1570 | (if (and (eolp) (not (bolp))) | 1570 | (if (and (eolp) (not (bolp))) |
| 1571 | (backward-char 1)) | 1571 | (backward-char 1)) |
| 1572 | )) | 1572 | )) |
| 1573 | (viper-complete-complex-command-for-undo) ; take care of undo | 1573 | (viper-adjust-undo) ; take care of undo |
| 1574 | ;; If the prev cmd was rotating the command ring, this means that `.' has | 1574 | ;; If the prev cmd was rotating the command ring, this means that `.' has |
| 1575 | ;; just executed a command from that ring. So, push it on the ring again. | 1575 | ;; just executed a command from that ring. So, push it on the ring again. |
| 1576 | ;; If we are just executing previous command , then don't push viper-d-com | 1576 | ;; If we are just executing previous command , then don't push viper-d-com |
| @@ -1671,7 +1671,6 @@ invokes the command before that, etc." | |||
| 1671 | 1671 | ||
| 1672 | (undo-start) | 1672 | (undo-start) |
| 1673 | (undo-more 2) | 1673 | (undo-more 2) |
| 1674 | (viper-complete-complex-command-for-undo) | ||
| 1675 | ;;(setq undo-beg-posn (or undo-beg-posn (point)) | 1674 | ;;(setq undo-beg-posn (or undo-beg-posn (point)) |
| 1676 | ;; undo-end-posn (or undo-end-posn (point))) | 1675 | ;; undo-end-posn (or undo-end-posn (point))) |
| 1677 | ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt) | 1676 | ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt) |
| @@ -1711,17 +1710,37 @@ invokes the command before that, etc." | |||
| 1711 | ;; The following two functions are used to set up undo properly. | 1710 | ;; The following two functions are used to set up undo properly. |
| 1712 | ;; In VI, unlike Emacs, if you open a line, say, and add a bunch of lines, | 1711 | ;; In VI, unlike Emacs, if you open a line, say, and add a bunch of lines, |
| 1713 | ;; they are undone all at once. | 1712 | ;; they are undone all at once. |
| 1714 | (defun viper-complete-complex-command-for-undo () | 1713 | (defun viper-adjust-undo () |
| 1715 | (setq undo-auto-disable-boundaries nil) | 1714 | (if viper-undo-needs-adjustment |
| 1716 | (setq viper-undo-in-complex-command nil) | 1715 | (let ((inhibit-quit t) |
| 1717 | (undo-boundary)) | 1716 | tmp tmp2) |
| 1717 | (setq viper-undo-needs-adjustment nil) | ||
| 1718 | (if (listp buffer-undo-list) | ||
| 1719 | (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list)) | ||
| 1720 | (progn | ||
| 1721 | (setq tmp2 (cdr tmp)) ; the part after mark | ||
| 1722 | |||
| 1723 | ;; cut tail from buffer-undo-list temporarily by direct | ||
| 1724 | ;; manipulation with pointers in buffer-undo-list | ||
| 1725 | (setcdr tmp nil) | ||
| 1726 | |||
| 1727 | (setq buffer-undo-list (delq nil buffer-undo-list)) | ||
| 1728 | (setq buffer-undo-list | ||
| 1729 | (delq viper-buffer-undo-list-mark buffer-undo-list)) | ||
| 1730 | ;; restore tail of buffer-undo-list | ||
| 1731 | (setq buffer-undo-list (nconc buffer-undo-list tmp2))) | ||
| 1732 | (setq buffer-undo-list (delq nil buffer-undo-list))))) | ||
| 1733 | )) | ||
| 1718 | 1734 | ||
| 1719 | 1735 | ||
| 1720 | (defun viper-set-complex-command-for-undo () | 1736 | (defun viper-set-complex-command-for-undo () |
| 1721 | (when (not viper-undo-in-complex-command) | 1737 | (if (listp buffer-undo-list) |
| 1722 | (setq undo-auto-disable-boundaries t) | 1738 | (if (not viper-undo-needs-adjustment) |
| 1723 | (setq viper-undo-in-complex-command t) | 1739 | (let ((inhibit-quit t)) |
| 1724 | (undo-boundary))) | 1740 | (setq buffer-undo-list |
| 1741 | (cons viper-buffer-undo-list-mark buffer-undo-list)) | ||
| 1742 | (setq viper-undo-needs-adjustment t))))) | ||
| 1743 | |||
| 1725 | 1744 | ||
| 1726 | ;;; Viper's destructive Command ring utilities | 1745 | ;;; Viper's destructive Command ring utilities |
| 1727 | 1746 | ||
| @@ -2585,7 +2604,7 @@ These keys are ESC, RET, and LineFeed." | |||
| 2585 | (delete-char 1 t) | 2604 | (delete-char 1 t) |
| 2586 | (insert char)) | 2605 | (insert char)) |
| 2587 | 2606 | ||
| 2588 | (viper-complete-complex-command-for-undo) | 2607 | (viper-adjust-undo) |
| 2589 | (backward-char arg) | 2608 | (backward-char arg) |
| 2590 | )) | 2609 | )) |
| 2591 | 2610 | ||
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index c1e76629477..104245b7571 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el | |||
| @@ -370,8 +370,13 @@ Use `\\[viper-set-expert-level]' to change this.") | |||
| 370 | ;; VI-style Undo | 370 | ;; VI-style Undo |
| 371 | 371 | ||
| 372 | ;; Used to 'undo' complex commands, such as replace and insert commands. | 372 | ;; Used to 'undo' complex commands, such as replace and insert commands. |
| 373 | (viper-deflocalvar viper-undo-in-complex-command nil) | 373 | (viper-deflocalvar viper-undo-needs-adjustment nil) |
| 374 | (put 'viper-undo-in-complex-command 'permanent-local t) | 374 | (put 'viper-undo-needs-adjustment 'permanent-local t) |
| 375 | |||
| 376 | ;; A mark that Viper puts on buffer-undo-list. Marks the beginning of a | ||
| 377 | ;; complex command that must be undone atomically. If inserted, it is | ||
| 378 | ;; erased by viper-change-state-to-vi and viper-repeat. | ||
| 379 | (defconst viper-buffer-undo-list-mark 'viper) | ||
| 375 | 380 | ||
| 376 | (defcustom viper-keep-point-on-undo nil | 381 | (defcustom viper-keep-point-on-undo nil |
| 377 | "Non-nil means not to move point while undoing commands. | 382 | "Non-nil means not to move point while undoing commands. |