help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] Restoring killed buffers


From: Slawomir Nowaczyk
Subject: Re: [h-e-w] Restoring killed buffers
Date: Sat, 22 Jul 2006 22:56:33 +0200

On Fri, 21 Jul 2006 10:37:52 -0700 (PDT)
"Robert A. Lerche" <address@hidden> wrote:

#> *sigh* the same thing happened to me yesterday!  I foolishly opened a
#> scratch buffer to hold some notes I was taking (under some pressure)
#> and accidentally killed it.  Moral: if you want to be warned to save a
#> buffer that has mods, do find-file (of a new file), not just create a
#> buffer!

Having killed *scratch* buffer containing important information
multiple times, I have put the following into my .emacs:

(push (lambda () (not (member (buffer-name) '("*scratch*")))) 
kill-buffer-query-functions)

It was useful... but not enough. After closing emacs several times
while important information was in *scratch*, I added:

(add-hook 'auto-save-hook (lambda () (if (equal (current-buffer) (get-buffer 
"*scratch*")) (save-buffer))))
(add-hook 'kill-emacs-hook (lambda () (with-current-buffer (get-buffer 
"*scratch*") (save-buffer))))
(with-current-buffer (get-buffer "*scratch*")
  (setq buffer-file-name "e:\\programs\\configs\\home\\.scratch.emcs")
  (revert-buffer nil t t)
  (setq buffer-save-without-query t))

I have yet to break *this* setting ;)

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( address@hidden )

If vegetarians love animals so much, why do they eat all their food???





reply via email to

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