unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* saving dired buffers
@ 2004-07-15 12:46 Mathias Dahl
  2004-07-15 13:43 ` Matthias
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Dahl @ 2004-07-15 12:46 UTC (permalink / raw)


I have a dired buffer created when running find-dired. To
find all files took a very long time and the content will
not change (the files are read only and changes only once
per year). 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?

/Mathias

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: saving dired buffers
  2004-07-15 12:46 saving dired buffers Mathias Dahl
@ 2004-07-15 13:43 ` Matthias
  2004-07-15 14:36   ` Mathias Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias @ 2004-07-15 13:43 UTC (permalink / raw)


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.
`----

Regards,
-- 
Matthias

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: saving dired buffers
  2004-07-15 13:43 ` Matthias
@ 2004-07-15 14:36   ` Mathias Dahl
  0 siblings, 0 replies; 3+ messages in thread
From: Mathias Dahl @ 2004-07-15 14:36 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-15 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-15 12:46 saving dired buffers Mathias Dahl
2004-07-15 13:43 ` Matthias
2004-07-15 14:36   ` Mathias Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).