Created
June 28, 2011 03:50
-
-
Save rawsyntax/1050449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;resurrect *scratch* buffer | |
;; FROM: Morten Welind | |
;;http://www.geocrawler.com/archives/3/338/1994/6/0/1877802/ | |
(save-excursion | |
(set-buffer (get-buffer-create "*scratch*")) | |
(lisp-interaction-mode) | |
(make-local-variable 'kill-buffer-query-functions) | |
(add-hook 'kill-buffer-query-functions 'kill-scratch-buffer)) | |
(defun kill-scratch-buffer () | |
;; The next line is just in case someone calls this manually | |
(set-buffer (get-buffer-create "*scratch*")) | |
;; Kill the current (*scratch*) buffer | |
(remove-hook 'kill-buffer-query-functions 'kill-scratch-buffer) | |
(kill-buffer (current-buffer)) | |
;; Make a brand new *scratch* buffer | |
(set-buffer (get-buffer-create "*scratch*")) | |
(lisp-interaction-mode) | |
(make-local-variable 'kill-buffer-query-functions) | |
(add-hook 'kill-buffer-query-functions 'kill-scratch-buffer) | |
;; Since we killed it, don't let caller do that. | |
(insert initial-scratch-message) | |
nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment