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

Recovering deleted ZWEI buffers.



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. 

Jerry.

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

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

0(defun find-buffers (&optional substr)
  (si:map-over-objects-in-area
    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)))))