From 349254d330a2cd3d952ab5a6dcef0360eff3b1a3 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 16 Oct 2002 21:32:41 +0000 Subject: [PATCH] (dired-insert-subdir-doinsert): Preserve point. --- lisp/dired-aux.el | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index ea6cdef8fc6..b34935c45e1 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -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, -- 2.39.2