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

Recovering deleted ZWEI buffers.

    Date: Sat, 9 Jan 88 21:01 PST
    From: Jerry Bakin <Jerry@MARLOWE.inference.dialnet.symbolics.com>

    Ok Ok,  it was pretty stupid of me to delete a buffer I really wanted.

    Actually, it was just a typo, I was in the buffer editor and typed a "D"
    instead of an "S".

    Hmm, I can undelete files, is there some way to undelete a buffer?

    Anyway, the buffer was gone, and I wanted it back.

    Here's what I did.  It seems to work.  I must say, while dynamic windows
    were not crucial to this, it sure made it easy to crawl through the area
    when I could click describe on a structure. 

Can we quote you on this?  How would you have gone about
it without using the output history?  Wonder if it's doable
entirely from within the editor.


    ;;; -*- Syntax: Zetalisp; Base: 10; Mode: LISP; Package: ZWEI -*-

    1;;; To "recover a buffer":
0    1;;;  1)  Use find-buffers in a dynamic listener to list ALL buffers
0    1;;;          (substr implies only those buffers with substr in their name)
0    1;;;  2)  Use recover-buffer and click over the buffer
0    1;;;  3)  Use copy output history into editor and make the final0 1edits.

0    (defun find-buffers (&optional substr)
	zwei:*zmacs-buffer-area* #'si:region-predicate-structure 
	#'(lambda (region address header leader size)
	    (when (typep header 'buffer)
	      (if substr
		  (when (string-search substr (send header :name))
		    (format t "~%~S" header))
		  (format t "~%~S" header))))))

    (defun recover-buffer (b)
      (let ((*interval* b))
	(loop with bp = (send *interval* :first-bp)
	      do (format t "~%~A" (bp-line bp))
	      while bp 
	      do (setf bp (forward-line bp)))))

Thanks for another winning utility!  Most everyone
will need it sooner or later.