GNU bug report logs - #20992
25.0.50; `virtual-dired': (1) doc typo, (2) unclear

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 6 Jul 2015 14:22:02 UTC

Severity: minor

Found in version 25.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #40 received at 20992 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 20992 <at> debbugs.gnu.org,
 Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear
Date: Fri, 03 Dec 2021 12:14:28 +1300
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





This bug report was last modified 3 years and 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.