all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathias Dahl <brakjoller@hotmail.com>
Subject: Re: saving dired buffers
Date: 15 Jul 2004 16:36:17 +0200	[thread overview]
Message-ID: <ur7rde3ry.fsf@hotmail.com> (raw)
In-Reply-To: yg7vfgp8jxj.fsf@fermat.math.uvsq.fr

Matthias <cimosque@free.fr> writes:

> Mathias Dahl <brakjoller@hotmail.com> 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

      reply	other threads:[~2004-07-15 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-15 12:46 saving dired buffers Mathias Dahl
2004-07-15 13:43 ` Matthias
2004-07-15 14:36   ` Mathias Dahl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ur7rde3ry.fsf@hotmail.com \
    --to=brakjoller@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.