[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dired: make dired-maybe-insert-subdir always skip trivial files

From: Filipp Gunbin
Subject: dired: make dired-maybe-insert-subdir always skip trivial files
Date: Thu, 25 Dec 2014 21:21:36 +0300

When `dired-maybe-insert-subdir' is called on a subdir not yet present
in the dired buffer, it inserts that subdir and skips to a first
"non-trivial" file.

But when it is already present, the point jumps to the header line and
stays there.

Below is the fix which makes it select the first non-trivial file
always.  Is it ok to apply?


diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index bb93cce..acc7e76 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2062,7 +2062,10 @@ See Info node `(emacs)Subdir switches' for more details."
     ;; inserted *after* opoint.
     (setq dirname (file-name-as-directory dirname))
     (or (and (not switches)
-            (dired-goto-subdir dirname))
+            (when (dired-goto-subdir dirname)
+              (unless (dired-subdir-hidden-p dirname)
+                (dired-initial-position dirname))
+              t))
        (dired-insert-subdir dirname switches no-error-if-not-dir-p))
     ;; Push mark so that it's easy to find back.  Do this after the
     ;; insert message so that the user sees the `Mark set' message.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]