From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: saving dired buffers Date: 15 Jul 2004 16:36:17 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1089902276 13444 80.91.224.253 (15 Jul 2004 14:37:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Jul 2004 14:37:56 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 15 16:37:44 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bl7Ml-0004La-00 for ; Thu, 15 Jul 2004 16:37:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bl7PF-0000rN-0Y for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jul 2004 10:40:17 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-han1.dfn.de!news-lei1.dfn.de!news1.uni-leipzig.de!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 59 Original-X-Trace: news.uni-berlin.de mjb1a3bwuo3+LkOdByB5Tw+apKvLkTSLutiGWt5mQbv8AWTdkW User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:124311 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19646 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19646 Matthias writes: > Mathias Dahl wrote: > > > (...) Is it possible to save this buffer so that I don't need to > > make the search again the next time I want to perform operations > > (moslty searching) in the large collection of files? > > You should read about `virtual dired' in the Dired-X info manual. Here > is a quotation from that manual: > > ,---- > | Using "Virtual Dired" means putting a buffer with Dired-like > | contents in Dired mode. The files described by the buffer contents > | need not actually exist. This is useful if you want to peruse an `ls > | -lR' output file, for example one you got from an FTP server. You can > | use all motion commands usually available in Dired. You can also use > | it to save a Dired buffer in a file and resume it in a later session. > `---- That is EXACTLY what I wanted! In the meantime, though, I was able to hack together this: (defun wake-up-saved-dired-buffer () "This function can be used to make a \"live\" dired buffer from one saved to disk as an ordinary text file. To try it out, open up dired in some buffer and save the buffer as a the file my-dired-save.txt. Close the buffer and open it again. You will now have a normal text file but with dired contents. Now run this function. I have not tested all types of dired commands but it seems to work for the things I needed it for at the moment. IMHO, this is kind of useful when you want to save large listings that you have got from find-dired or find-grep-dired. Maybe someone can merge this into all the different session-saving packages out there?" (interactive) (goto-char (point-min)) ;; Find the dir name (if (not (search-forward-regexp " \\(.*\\):$")) (error "This is no saved dired buffer") (let ((dir (match-string 1)) (m1)) ;; Enter dired-mode (dired-mode dir) ;; dired needs the variable dired-subdir-alist (set (make-local-variable 'dired-subdir-alist) nil) (setq m1 (make-marker)) (set-marker m1 1) (setq dired-subdir-alist (list (cons dir m1)))))) :) /Mathias - re-inventing the wheel