]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-insert-subdir-doinsert): Preserve point.
authorAndreas Schwab <schwab@suse.de>
Wed, 16 Oct 2002 21:32:41 +0000 (21:32 +0000)
committerAndreas Schwab <schwab@suse.de>
Wed, 16 Oct 2002 21:32:41 +0000 (21:32 +0000)
lisp/dired-aux.el

index ea6cdef8fc690f89c03d281e97efc350ce851629..b34935c45e1b845c61eded12c07275afcff29bd7 100644 (file)
@@ -1728,20 +1728,19 @@ With optional arg REMEMBER-MARKS, return an alist of marked files."
 (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,