[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving dired buffers

From: Mathias Dahl
Subject: Re: saving dired buffers
Date: 15 Jul 2004 16:36:17 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Matthias <address@hidden> writes:

> Mathias Dahl <address@hidden> 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?"

  (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))
      ;; 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 via email to

[Prev in Thread] Current Thread [Next in Thread]