From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#20992: 25.0.50; `virtual-dired': (1) doc typo, (2) unclear Date: Fri, 03 Dec 2021 12:14:28 +1300 Message-ID: <93b6b8c57afd8e3ba0205b966d502d4a@webmail.orcon.net.nz> References: <99643ea0-8a24-47b4-95ab-0c21da485539@default> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33713"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: Lars Ingebrigtsen , 20992@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 03 00:15:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msvIG-0008c8-Pe for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Dec 2021 00:15:12 +0100 Original-Received: from localhost ([::1]:50750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msvIE-0006jl-R8 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 18:15:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msvI6-0006jY-II for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 18:15:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msvI6-0003rQ-A7 for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 18:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1msvI5-0000tW-Vw for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 18:15:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <99643ea0-8a24-47b4-95ab-0c21da485539@default> Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Dec 2021 23:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20992 X-GNU-PR-Package: emacs Original-Received: via spool by 20992-submit@debbugs.gnu.org id=B20992.16384868773393 (code B ref 20992); Thu, 02 Dec 2021 23:15:01 +0000 Original-Received: (at 20992) by debbugs.gnu.org; 2 Dec 2021 23:14:37 +0000 Original-Received: from localhost ([127.0.0.1]:49620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msvHg-0000se-Ps for submit@debbugs.gnu.org; Thu, 02 Dec 2021 18:14:37 -0500 Original-Received: from smtp-4.orcon.net.nz ([60.234.4.59]:52515) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msvHe-0000sU-DU for 20992@debbugs.gnu.org; Thu, 02 Dec 2021 18:14:36 -0500 Original-Received: from [10.253.37.70] (port=43115 helo=webmail.orcon.net.nz) by smtp-4.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1msvHY-0002HX-Ao; Fri, 03 Dec 2021 12:14:28 +1300 Original-Received: from ip-14-137-22-223.kinect.net.nz ([14.137.22.223]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Fri, 03 Dec 2021 12:14:28 +1300 X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221356 Archived-At: 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