* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
@ 2015-07-06 14:20 Drew Adams
2015-07-06 17:49 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Drew Adams @ 2015-07-06 14:20 UTC (permalink / raw)
To: 20992
1. Doc string:
"...If you have save..." should be "...If you have saved..."
2. It is not very clear just what "Virtual Dired mode" is. Apparently
it is a minor mode. But there is no minor-mode variable. And the mode
command does not have `-mode' in the name, and it is not defined using
`define-minor-mode' (why)? The major mode seems to be `dired-mode' (at
least for a virtual-dired buffer created from a Dired buffer). But
there is no access to the major-mode lighter and its menu in the mode
line. And the doc could be clearer wrt just what parts (e.g. commands)
of Dired mode are available and what parts are not. Also, the doc says
that the format is that of `ls -lR', but that suggests that the listing
is recursive, with subdirs inserted, which is not necessarily the case.
And it seems that the listing switches are taken from the Dired buffer
from which the virtual mode is derived.
In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
of 2014-10-20 on LEG570
Bzr revision: 118168 rgm@gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2015-07-06 14:20 bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear Drew Adams
@ 2015-07-06 17:49 ` Drew Adams
2020-03-31 0:30 ` Michael Heerdegen
2019-09-29 22:44 ` Stefan Kangas
2021-12-02 23:14 ` Phil Sainty
2 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2015-07-06 17:49 UTC (permalink / raw)
To: 20992
> 2. It is not very clear just what "Virtual Dired mode" is.
> Apparently it is a minor mode.
My bad about this being a minor mode. It is apparently just
major mode Dired, with a different `mode-name' value.
The mode name should perhaps not be `Virtual Dired', but
`Dired (Virtual)' or some such. But see below - I don't
find anything particularly "virtual" about this.
> And the doc could be clearer wrt just what parts (e.g.
> commands) of Dired mode are available and what parts are not.
> Also, the doc says that the format is that of `ls -lR', but that
> suggests that the listing is recursive, with subdirs inserted, which
> is not necessarily the case. And it seems that the listing switches
> are taken from the Dired buffer from which the virtual mode is derived.
That part of the bug report is still appropriate.
4. It's not clear from the doc just how `virtual-dired' changes
Dired mode. It doesn't seem particularly "virtual", but it's not
clear what is meant by that word here.
Seems that this is in fact just Dired mode, and that it is the
opposite of a virtual Dired mode: it puts an ordinary `ls'
listing into Dired mode, no?
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2015-07-06 14:20 bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear Drew Adams
2015-07-06 17:49 ` Drew Adams
@ 2019-09-29 22:44 ` Stefan Kangas
2021-12-02 23:14 ` Phil Sainty
2 siblings, 0 replies; 14+ messages in thread
From: Stefan Kangas @ 2019-09-29 22:44 UTC (permalink / raw)
To: Drew Adams; +Cc: 20992
Drew Adams <drew.adams@oracle.com> writes:
> 1. Doc string:
>
> "...If you have save..." should be "...If you have saved..."
I fixed that on master. I don't know enough about virtual-dired to
investigate the rest of this bug report.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2015-07-06 17:49 ` Drew Adams
@ 2020-03-31 0:30 ` Michael Heerdegen
2020-03-31 1:23 ` Drew Adams
0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2020-03-31 0:30 UTC (permalink / raw)
To: Drew Adams; +Cc: 20992
Drew Adams <drew.adams@oracle.com> writes:
> 4. It's not clear from the doc just how `virtual-dired' changes
> Dired mode. It doesn't seem particularly "virtual", but it's not
> clear what is meant by that word here.
>
> Seems that this is in fact just Dired mode, and that it is the
> opposite of a virtual Dired mode: it puts an ordinary `ls'
> listing into Dired mode, no?
More or less yes, I guess. My impression after reading the available
docs, and when trying to use it, is that the purpose is to get a dired
like listing from somewhere else, e.g. an external source, or from a
saved file (e.g. a dired buffer from a later Emacs session saved to a
file) into a dired-like mode to have access to some of its commands. It
is virtual in the sense that the contents do not necessarily need to
reflect the contents of an existing directory. This is only checked if
you switch to the real dired mode. A better wording might have been
"offline" dired mode or so.
If saving dired buffers is indeed one of the purposes, this case would
also need some fine tuning: when opening the saved file, it is currently
just in fundamental-mode. And after switching to virtual-dired the
buffer is immediately marked as modified and you need to save or discard
changes when you want to kill the buffer although you didn't change
anything at all.
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2020-03-31 0:30 ` Michael Heerdegen
@ 2020-03-31 1:23 ` Drew Adams
2020-03-31 2:53 ` Michael Heerdegen
0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2020-03-31 1:23 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20992
> > 4. It's not clear from the doc just how `virtual-dired' changes
> > Dired mode. It doesn't seem particularly "virtual", but it's not
> > clear what is meant by that word here.
> >
> > Seems that this is in fact just Dired mode, and that it is the
> > opposite of a virtual Dired mode: it puts an ordinary `ls'
> > listing into Dired mode, no?
>
> More or less yes, I guess. My impression after reading the available
> docs, and when trying to use it, is that the purpose is to get a dired
> like listing from somewhere else, e.g. an external source, or from a
> saved file (e.g. a dired buffer from a later Emacs session saved to a
> file) into a dired-like mode to have access to some of its commands.
That's what I understood too.
> It is virtual in the sense that the contents do not necessarily need to
> reflect the contents of an existing directory. This is only checked if
> you switch to the real dired mode.
Dired contents do not, anyway, need to reflect the
contents of an existing directory. A Dired buffer
can show an arbitrary list of files and directories.
E.g., this opens a Dired buffer named `foobar', with 3
entries: files bookmark+.el and dired+.el, and directory
THROW. (Well, any of those 3 could be a directory or a
file name.)
(dired '("foobar"
"~/somedir/THROW"
"~/somedir/bookmark+.el"
"~/somedir/dired+.el")
nil)
The difference, I think, is how the listing is generated.
Instead of passing a list of file/dir names (possibly
absolute) and `ls' switches to `dired', for virtual-dired
you pass a "rendered" listing (I guess).
> A better wording might have been
> "offline" dired mode or so.
That's not a great word for this, IMO.
I don't have a good idea either, though. Is the listing
essentially pre-rendered? If so, then that term might
be OK. I really don't know.
(I have nothing to say about the rest of your message.
I know nothing about that.)
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2020-03-31 1:23 ` Drew Adams
@ 2020-03-31 2:53 ` Michael Heerdegen
2021-12-02 9:48 ` Lars Ingebrigtsen
0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2020-03-31 2:53 UTC (permalink / raw)
To: Drew Adams; +Cc: 20992
Drew Adams <drew.adams@oracle.com> writes:
> The difference, I think, is how the listing is generated.
> Instead of passing a list of file/dir names (possibly
> absolute) and `ls' switches to `dired', for virtual-dired
> you pass a "rendered" listing (I guess).
Yes, that might be the truth.
> I don't have a good idea either, though. Is the listing
> essentially pre-rendered? If so, then that term might
> be OK.
AFAIK It has to be in the buffer where you invoke that mode. I don't
think enabling virtual-dired mode does any
formatting/re-indenting/sorting or such.
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2020-03-31 2:53 ` Michael Heerdegen
@ 2021-12-02 9:48 ` Lars Ingebrigtsen
2021-12-02 14:59 ` Michael Heerdegen
0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-02 9:48 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20992
Michael Heerdegen <michael_heerdegen@web.de> writes:
>> The difference, I think, is how the listing is generated.
>> Instead of passing a list of file/dir names (possibly
>> absolute) and `ls' switches to `dired', for virtual-dired
>> you pass a "rendered" listing (I guess).
>
> Yes, that might be the truth.
I've now altered the doc string in Emacs 29 to note that 1) the command
is rarely useful for anything, and 2) try to describe what it does.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2021-12-02 9:48 ` Lars Ingebrigtsen
@ 2021-12-02 14:59 ` Michael Heerdegen
2021-12-02 15:41 ` Lars Ingebrigtsen
0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2021-12-02 14:59 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 20992
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I've now altered the doc string in Emacs 29 to note that 1) the
> command is rarely useful for anything, and 2) try to describe what it
> does.
Thanks, Lars. Should we add that virtual dired buffers can be used to
remember/save marks in dired, or is that too obvious?
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2021-12-02 14:59 ` Michael Heerdegen
@ 2021-12-02 15:41 ` Lars Ingebrigtsen
2021-12-02 16:25 ` Michael Heerdegen
0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-02 15:41 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20992
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Thanks, Lars. Should we add that virtual dired buffers can be used to
> remember/save marks in dired, or is that too obvious?
It wasn't obvious to me, so please do go ahead and add that to the doc
string. 😄
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2021-12-02 15:41 ` Lars Ingebrigtsen
@ 2021-12-02 16:25 ` Michael Heerdegen
2021-12-02 16:45 ` Lars Ingebrigtsen
0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2021-12-02 16:25 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 20992
Lars Ingebrigtsen <larsi@gnus.org> writes:
> It wasn't obvious to me, so please do go ahead and add that to the doc
> string. 😄
I...[loses courage] ok, but note this is not something I know, it is
something I did (and it seemed to work). Are we sure that it doesn't
only work by accident most of the time? For me this is just the, more
or less, only use case for virtual dired buffers: I can remember marks
by just saving a dired buffer and reopen it later with virtual-dired to
continue working with the files in it.
AFAIR this didn't ever work so super sexy - Emacs didn't recognize the
contents as (virtual) dired, I have to M-x virtual-dired explicitly, and
this command modifies the buffer (though it didn't touch the text), so I
have to save it again... I guess there is at least room for improvement
before we advertise this method in the docstring.
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2021-12-02 16:25 ` Michael Heerdegen
@ 2021-12-02 16:45 ` Lars Ingebrigtsen
0 siblings, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-02 16:45 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20992
Michael Heerdegen <michael_heerdegen@web.de> writes:
> I...[loses courage] ok, but note this is not something I know, it is
> something I did (and it seemed to work). Are we sure that it doesn't
> only work by accident most of the time?
No, not really. 😀 It seems like a fun hack, but I'd guess it will
break in a lot of cases.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2015-07-06 14:20 bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear Drew Adams
2015-07-06 17:49 ` Drew Adams
2019-09-29 22:44 ` Stefan Kangas
@ 2021-12-02 23:14 ` Phil Sainty
2021-12-02 23:47 ` Michael Heerdegen
2021-12-02 23:50 ` Phil Sainty
2 siblings, 2 replies; 14+ messages in thread
From: Phil Sainty @ 2021-12-02 23:14 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Lars Ingebrigtsen, 20992
Michael Heerdegen writes:
> AFAIR this didn't ever work so super sexy - Emacs didn't recognize the
> contents as (virtual) dired, I have to M-x virtual-dired explicitly,
> and
> this command modifies the buffer (though it didn't touch the text), so
> I
> have to save it again...
FWIW...
Funnily enough I was encountering these things just the other day.
I had some saved dired buffers, wished that Emacs would automatically
invoke `dired-virtual-mode' on them, noticed the 'modification' issue
while I was at it, and ended up doing this to my config:
;; Recognise saved dired buffers.
;; Supports both 'ls' and 'find+ls' dired buffers.
;; Regexp is fairly specific, to avoid false-positives.
(add-to-list 'magic-mode-alist
(cons (rx (seq (seq bos " /" (+ not-newline) ":\n ")
(or (seq "total used in directory"
(+ not-newline) "\n" (+ space))
(seq "find " (+ not-newline) " -ls\n"
(regexp " +[0-9]+ +[0-9]+ +")))
(regexp "[-d]\\(?:[-r][-w][-xs]\\)\\{3\\}")
(regexp " +[0-9]+ ")))
#'my-dired-virtual-mode))
(defun my-dired-virtual-mode ()
"Enable `dired-virtual-mode' without marking the buffer as modified."
(with-silent-modifications
(dired-virtual-mode)))
I'd be surprised if that regexp was good enough for general use, but
that was good enough for my purpose at the time.
Apologies for the seemingly-arbitrary mix of rx and string syntax...
I'd decided to convert it to rx and then found it getting less readable
instead of more readable, and so it wound up like this :)
-Phil
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2021-12-02 23:14 ` Phil Sainty
@ 2021-12-02 23:47 ` Michael Heerdegen
2021-12-02 23:50 ` Phil Sainty
1 sibling, 0 replies; 14+ messages in thread
From: Michael Heerdegen @ 2021-12-02 23:47 UTC (permalink / raw)
To: Phil Sainty; +Cc: Lars Ingebrigtsen, 20992
Phil Sainty <psainty@orcon.net.nz> writes:
> ;; Recognise saved dired buffers.
> ;; Supports both 'ls' and 'find+ls' dired buffers.
> ;; Regexp is fairly specific, to avoid false-positives.
> (add-to-list 'magic-mode-alist
> (cons (rx (seq (seq bos " /" (+ not-newline) ":\n ")
> (or (seq "total used in directory"
> (+ not-newline) "\n" (+ space))
> (seq "find " (+ not-newline) " -ls\n"
> (regexp " +[0-9]+ +[0-9]+ +")))
> (regexp "[-d]\\(?:[-r][-w][-xs]\\)\\{3\\}")
> (regexp " +[0-9]+ ")))
> #'my-dired-virtual-mode))
I wonder if we can get this to work reliably - or if we could instead
make saving dired buffers somehow special, by silently adding some kind
of tag or so.
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
2021-12-02 23:14 ` Phil Sainty
2021-12-02 23:47 ` Michael Heerdegen
@ 2021-12-02 23:50 ` Phil Sainty
1 sibling, 0 replies; 14+ messages in thread
From: Phil Sainty @ 2021-12-02 23:50 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Lars Ingebrigtsen, 20992
Well I now see that `dired-virtual-mode' actually suggests some
config, which I'd managed to not notice:
> Useful on `magic-mode-alist' with the regexp
>
> "^ \\(/[^ /]+\\)+/?:$"
>
> to put saved Dired buffers automatically into Virtual Dired mode.
>
> Also useful for `auto-mode-alist' like this:
>
> (add-to-list 'auto-mode-alist
> '("[^/]\\.dired\\'" . dired-virtual-mode))
I note that the suggested regexp doesn't support directory paths
containing spaces.
I'd opted to match more of the output than that, as it seemed a bit
brittle to assume a dired buffer based only on the first line.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2021-12-02 23:50 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-06 14:20 bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear Drew Adams
2015-07-06 17:49 ` Drew Adams
2020-03-31 0:30 ` Michael Heerdegen
2020-03-31 1:23 ` Drew Adams
2020-03-31 2:53 ` Michael Heerdegen
2021-12-02 9:48 ` Lars Ingebrigtsen
2021-12-02 14:59 ` Michael Heerdegen
2021-12-02 15:41 ` Lars Ingebrigtsen
2021-12-02 16:25 ` Michael Heerdegen
2021-12-02 16:45 ` Lars Ingebrigtsen
2019-09-29 22:44 ` Stefan Kangas
2021-12-02 23:14 ` Phil Sainty
2021-12-02 23:47 ` Michael Heerdegen
2021-12-02 23:50 ` Phil Sainty
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).