Subject: bug#70593: 30.0.50; Dired: buffers of renamed dirs are broken

From: Drew Adams <[email-masked]>
Date: Fri, 10 May 2024 16:52:04 +0000

> > > Not sure what you mean.  Even in vanilla Emacs,
> > > I think subdir insertion is supported.  E.g.:
> > >
> > > M-: (dired (list "foobar" "/tata/file.txt"
> > >                  "/toto/dir/" "/titi/"))
> >
> > Hmm, indeed, this works in -Q.  Seems one of my local hacks broke this
> > case.
> 
> No no... not my fault: this does only work when starting from a buffer
> whose `default-directory' is a parent of the listed directories.  Else I
> get (in master emacs -Q) a buffer looking like
> 
>  /home/micha/.config:
>   drwxr-xr-x 24 micha micha 4096 Nov 22 14:27 /home/micha/Treasure
>   drwxr-xr-x  4 micha micha 4096 Mai  7 17:38 /home/micha/bin
> 
> and hitting i gives me the error "dired-insert-subdir-validate:
> /home/micha/Treasure/: Not in this directory tree".

Sorry, you're right; good point.

Dired+ redefines `dired-insert-subdir-validate'
to be a no-op, to allow inserting dirs that
aren't under `default-directory'.

And it redefines `dired-insert-subdir-newpos'
so that if arg NEW-DIR isn't a descendant of a
directory in the buffer then the new position
is at eob.

So if you load dired+.el in `emacs -Q' I think
you'll see that `i' on a directory line (any
directory line) will insert a listing of that
directory.

Or just evaluate the Dired+ definitions of
`dired-maybe-insert-subdir',
`dired-insert-subdir-validate', and
`dired-insert-subdir-newpos'.
___

However, including a nondirectory file (e.g.
"/tata/file.txt" in my example) does raise the
error, because `ls-lisp-insert-directory' tries
to insert it as a directory.  (I'm on Windows,
so ls-lisp is used.)

(file-error "Reading directory"
  "Directory doesn't exist or is inaccessible"
  "z:/path/to/the/file.txt")

(Something in my setup (but not Dired+) shows
the error message in *Messages* but doesn't
open the debugger for it.)

HTH.