changeset 67561:827930ad591b

(wdired-old-point): New internal variable. (wdired-change-to-wdired-mode): Set it buffer-locally. (wdired-abort-changes): Restore point after aborting changes.
author Juri Linkov <juri@jurta.org>
date Wed, 14 Dec 2005 07:45:07 +0000
parents 2d2062823ea5
children 890887cd17a8
files lisp/wdired.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wdired.el	Wed Dec 14 07:44:44 2005 +0000
+++ b/lisp/wdired.el	Wed Dec 14 07:45:07 2005 +0000
@@ -211,6 +211,7 @@
 ;; Local variables (put here to avoid compilation gripes)
 (defvar wdired-col-perm) ;; Column where the permission bits start
 (defvar wdired-old-content)
+(defvar wdired-old-point)
 
 
 (defun wdired-mode ()
@@ -242,6 +243,7 @@
   (interactive)
   (set (make-local-variable 'wdired-old-content)
        (buffer-substring (point-min) (point-max)))
+  (set (make-local-variable 'wdired-old-point) (point))
   (set (make-local-variable 'query-replace-skip-read-only) t)
   (use-local-map wdired-mode-map)
   (force-mode-line-update)
@@ -264,7 +266,8 @@
   (set-buffer-modified-p nil)
   (setq buffer-undo-list nil)
   (run-mode-hooks 'wdired-mode-hook)
-  (message "%s" (substitute-command-keys "Press \\[wdired-finish-edit] when finished \
+  (message "%s" (substitute-command-keys
+		 "Press \\[wdired-finish-edit] when finished \
 or \\[wdired-abort-changes] to abort changes")))
 
 
@@ -348,7 +351,8 @@
   (interactive)
   (let ((inhibit-read-only t))
     (erase-buffer)
-    (insert wdired-old-content))
+    (insert wdired-old-content)
+    (goto-char wdired-old-point))
   (wdired-change-to-dired-mode)
   (set-buffer-modified-p nil)
   (setq buffer-undo-list nil)