[Top][All Lists]

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

RE: [External] : dired cons bug?

From: Drew Adams
Subject: RE: [External] : dired cons bug?
Date: Thu, 11 Aug 2022 13:38:53 +0000

> (dired (cons "/home/user" '("/home/user/tmp/test/a/a"
> "/home/user/tmp/test/b/b" "/home/user/tmp/test/c/c")))
> after hitting "x" to execute, then confirming the deletion,
> the buffer will refresh...
> I can revert the buffer using "g".

I think you mean that dired _without_ such a cons arg
can be reverted OK in that scenario.  With a cons arg
it cannot - you'll get an error such as this:

"Reading directory: Directory doesn't exist or is
inaccessible, home/user/tmp/test/a/a", where the
"directory" named is actually the file (or directory)
that you deleted.  (At least when `ls-lisp.el' is
used, as is the case on MS Windows, and probably in

(The error msg says "directory" because the code that
inserts each file or dir in your cons thinks it's
inserting a directory.  That msg, at least, could be
fixed up.)

Yes, as Eli said, you can file a bug report for this.

However, it's definitely not the case that everything
you can do with a normal Dired buffer you can do with
such a Dired buffer, which lists arbitrary files,
from anywhere.

Dired is not using `ls' to manage such a buffer.  It
lists the files and dirs in the cons you pass it, and
it lets you do many operations on them (marking,...),
but there are some Dired operations that aren't
supported in this context.

When you pass a cons, `dired' just lists those files.
If you then perform operations (in Dired or elsewhere)
that change those files, reverting just tries to do
again what you initially did - list the same set of
files from your cons.

So yes, you can revert, but only as long as the list
of files you used is still valid.  If you've deleted
or renamed any of them then you can't revert - Dired 
just tries to relist the same list you provided in
your cons, when you use `g'.

IOW, Dired is showing you a snapshot.  If you change
the state, so the snapshot is no longer faithful of
what the real state is, Dired won't know that, any
more than it would if you gave it a cons in the first
place that had file names that don't correspond to
real files.

Dired listings of arbitrary files and dirs are still
_very_ useful.  They can be from anywhere, including
multiple drives, local and remote, etc.  (And if you
use Bookmark+ you can bookmark them for reuse.)

Dired+ supports the use of cons this way a bit more
than vanilla Emacs.  But the essential limitation
(bug, if you like) remains.

These emacs.SE posts say more about how you can
create and use such Dired buffers that list
arbitrary files:


Dired+ is here:

reply via email to

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