changeset 47902:d19f02bf4d19

(dired-insert-subdir-doinsert): Preserve point.
author Andreas Schwab <schwab@suse.de>
date Wed, 16 Oct 2002 21:32:41 +0000
parents 29357f0b7ba5
children 3dd6a932b44e
files lisp/dired-aux.el
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Wed Oct 16 21:27:40 2002 +0000
+++ b/lisp/dired-aux.el	Wed Oct 16 21:32:41 2002 +0000
@@ -1728,20 +1728,19 @@
 (defun dired-insert-subdir-doinsert (dirname switches)
   ;; Insert ls output after point.
   ;; Return the boundary of the inserted text (as list of BEG and END).
-  (let ((begin (point)))
-    (message "Reading directory %s..." dirname)
-    (let ((dired-actual-switches
-	   (or switches
-	       (dired-replace-in-string "R" "" dired-actual-switches))))
-      (if (equal dirname (car (car (last dired-subdir-alist))))
-	  ;; If doing the top level directory of the buffer,
-	  ;; redo it as specified in dired-directory.
-	  (dired-readin-insert)
-	(let ((pt (point)))
-	  (dired-insert-directory dirname dired-actual-switches nil nil t)
-	  (goto-char pt))))
-    (message "Reading directory %s...done" dirname)
-    (list begin (point))))
+  (save-excursion
+    (let ((begin (point)))
+      (message "Reading directory %s..." dirname)
+      (let ((dired-actual-switches
+	     (or switches
+		 (dired-replace-in-string "R" "" dired-actual-switches))))
+	(if (equal dirname (car (car (last dired-subdir-alist))))
+	    ;; If doing the top level directory of the buffer,
+	    ;; redo it as specified in dired-directory.
+	    (dired-readin-insert)
+	  (dired-insert-directory dirname dired-actual-switches nil nil t)))
+      (message "Reading directory %s...done" dirname)
+      (list begin (point)))))
 
 (defun dired-insert-subdir-doupdate (dirname elt beg-end)
   ;; Point is at the correct subdir alist position for ELT,