[implementations-list] [PATCH] Remove unused undo-list-munging code.
--- While looking at the code, I noticed that all of this is currently unused. Is that just an oversight, or are you actually planning to use it in the future? If the former, this patch could safely be applied, unless I'm missing something. vimpulse-dependencies.el | 6 ------ vimpulse-visual-mode.el | 31 +------------------------------ 2 files changed, 1 insertions(+), 36 deletions(-) diff --git a/vimpulse-dependencies.el b/vimpulse-dependencies.el index 7b12562..57754e7 100644 --- a/vimpulse-dependencies.el +++ b/vimpulse-dependencies.el @@ -337,12 +337,6 @@ (viper-deflocalvar vimpulse-visual-whitespace-overlay nil "Overlay encompassing text inserted into the buffer to make Block selection at least one column wide.") -(viper-deflocalvar vimpulse-undo-needs-adjust nil - "If true, several commands in the undo-list should be connected.") - -(defconst vimpulse-buffer-undo-list-mark 'vimpulse - "Everything up to this mark is united in the undo-list.") - (defvar vimpulse-visual-height nil "Height of last Visual selection.") diff --git a/vimpulse-visual-mode.el b/vimpulse-visual-mode.el index c3adea4..955c209 100644 --- a/vimpulse-visual-mode.el +++ b/vimpulse-visual-mode.el @@ -859,33 +859,6 @@ (defun vimpulse-visual-remap (from to) "Remap FROM to TO in Visual mode." (vimpulse-remap vimpulse-visual-basic-map from to)) -(defun vimpulse-filter-undos (undo-list) - "Filters all `nil' marks from `undo-list' until the first -occurrence of `vimpulse-buffer-undo-list-mark'." - (cond - ((null undo-list) - nil) - ((eq (car undo-list) 'vimpulse) - (cdr undo-list)) - ((null (car undo-list)) - (vimpulse-filter-undos (cdr undo-list))) - (t - (cons (car undo-list) - (vimpulse-filter-undos (cdr undo-list)))))) - -(defun vimpulse-connect-undos () - "Connects all undo-steps from `buffer-undo-list' up to the -first occurrence of `vimpulse-buffer-undo-list-mark'." - (when (and vimpulse-undo-needs-adjust - (listp buffer-undo-list)) - (setq buffer-undo-list - (vimpulse-filter-undos buffer-undo-list))) - (setq vimpulse-undo-needs-adjust nil)) - -(defun vimpulse-push-buffer-undo-list-mark () - (setq vimpulse-undo-needs-adjust t) - (push vimpulse-buffer-undo-list-mark buffer-undo-list)) - ;;; Ex (defun vimpulse-visual-ex (arg) @@ -1232,9 +1205,7 @@ (defun vimpulse-exit-insert-state () (move-to-column (1+ col) t) ; append spaces (viper-repeat nil))) (viper-repeat nil))))) - (setq vimpulse-visual-insert-coords nil))) - ;; Update undo-list - (vimpulse-connect-undos)) + (setq vimpulse-visual-insert-coords nil)))) (fset 'viper-exit-insert-state 'vimpulse-exit-insert-state) -- 1.7.1
Date: Fri, 21 May 2010 14:45:11 +0200 From: [email protected]
While looking at the code, I noticed that all of this is currently unused. Is that just an oversight, or are you actually planning to use it in the future?
The purpose of `vimpulse-connect-undos' is to collapse a single "edit" like "cwfoo" to a single undo. Right now it's more fine-grained: "cwfoo<Esc>u" undos to the insertion of "foo", so that another "u" is needed to undo the deletion of the original word. The reason this code lies dormant is that although it's relevant, I'm unsure how it goes together with undo-tree.el. Vegard _________________________________________________________________ Få nye Windows Live™ Messenger. http://download.live.com/messenger
On Fri, May 21, 2010 at 08:22:22PM +0000, Vegard Øye wrote:
While looking at the code, I noticed that all of this is currently unused. Is that just an oversight, or are you actually planning to use it in the future?
The purpose of `vimpulse-connect-undos' is to collapse a single "edit" like "cwfoo" to a single undo. Right now it's more fine-grained: "cwfoo<Esc>u" undos to the insertion of "foo", so that another "u" is needed to undo the deletion of the original word.
Well, the purpose is clear, it's just that the code is not used anywhere.
The reason this code lies dormant is that although it's relevant, I'm unsure how it goes together with undo-tree.el.
Yeah. I'm unsure even about how adding `vimpulse' to buffer-undo-list goes together with standard Emacs undo. Maybe Frank could comment -- I assume the original code comes from him? Štěpán P.S.: Maybe you could at least add a code comment in similar cases? Am I the only one who finds it weird to have unused code lying around like this?
Date: Fri, 21 May 2010 22:42:42 +0200 From: [email protected]
The reason this code lies dormant is that although it's relevant, I'm unsure how it goes together with undo-tree.el.
I'm unsure even about how adding `vimpulse' to buffer-undo-list goes together with standard Emacs undo. Maybe Frank could comment -- I assume the original code comes from him?
Yes. `vimpulse-connect-undos' was already there when I started out, but an improved version was added with Frank Fischer's vimpulseext.el. http://trac-git.assembla.com/vimpulse/ticket/3 I'd also like to hear Frank's thoughts on this -- I assume he's aware of undo-tree.el and of how vastly superior it is to redo.el (which hasn't been updated since 1997).
Maybe you could at least add a code comment in similar cases?
Sorry about that. FWIW, I added a little comment in commit [208732af24]. Vegard _________________________________________________________________ Windows 7: Du får hjelp til gjøre mer. Utforsk Windows 7. http://windows.microsoft.com/windows-7
participants (3)
-
Vegard Øye -
Štěpán Něm ec -
Štěpán Němec