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 ;)

Good idea. I tend to just open a new file buffer foo.el and use that, for the 
same reason. Granted, emacs-lisp-mode is different from Lisp Interaction Mode, 
but the former gives me most of what I would use *scratch* for.    



Reply via email to