* dired: make dired-maybe-insert-subdir always skip trivial files
@ 2014-12-25 18:21 Filipp Gunbin
2014-12-25 19:32 ` Juri Linkov
0 siblings, 1 reply; 4+ messages in thread
From: Filipp Gunbin @ 2014-12-25 18:21 UTC (permalink / raw)
To: emacs-devel
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?
Filipp
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.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: dired: make dired-maybe-insert-subdir always skip trivial files
2014-12-25 18:21 dired: make dired-maybe-insert-subdir always skip trivial files Filipp Gunbin
@ 2014-12-25 19:32 ` Juri Linkov
2014-12-25 19:51 ` Filipp Gunbin
0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2014-12-25 19:32 UTC (permalink / raw)
To: Filipp Gunbin; +Cc: emacs-devel
> 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?
I agree it would be good to make it consistent for both cases:
when it is already present and not present, especially good after fixing
http://debbugs.gnu.org/19436
> - (dired-goto-subdir dirname))
> + (when (dired-goto-subdir dirname)
> + (unless (dired-subdir-hidden-p dirname)
> + (dired-initial-position dirname))
> + t))
Why do you always return t? Wouldn't it be better to use something like
(prog1 (dired-goto-subdir dirname) (unless ...))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: dired: make dired-maybe-insert-subdir always skip trivial files
2014-12-25 19:32 ` Juri Linkov
@ 2014-12-25 19:51 ` Filipp Gunbin
2014-12-25 20:18 ` Juri Linkov
0 siblings, 1 reply; 4+ messages in thread
From: Filipp Gunbin @ 2014-12-25 19:51 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On 25/12/2014 21:32 +0200, Juri Linkov wrote:
>> - (dired-goto-subdir dirname))
>> + (when (dired-goto-subdir dirname)
>> + (unless (dired-subdir-hidden-p dirname)
>> + (dired-initial-position dirname))
>> + t))
>
> Why do you always return t? Wouldn't it be better to use something like
> (prog1 (dired-goto-subdir dirname) (unless ...))
This way, (unless ...) will be evaluated even if `dired-goto-subdir'
returned nil.
Filipp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-25 20:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-25 18:21 dired: make dired-maybe-insert-subdir always skip trivial files Filipp Gunbin
2014-12-25 19:32 ` Juri Linkov
2014-12-25 19:51 ` Filipp Gunbin
2014-12-25 20:18 ` Juri Linkov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).