Created
October 12, 2012 10:27
-
-
Save magnars/3878594 to your computer and use it in GitHub Desktop.
create-scratch-buffer
This file contains hidden or 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
(defun create-scratch-buffer nil | |
"create a new scratch buffer to work in. (could be *scratch* - *scratchX*)" | |
(interactive) | |
(let ((n 0) | |
bufname) | |
(while (progn | |
(setq bufname (concat "*scratch" | |
(if (= n 0) "" (int-to-string n)) | |
"*")) | |
(setq n (1+ n)) | |
(get-buffer bufname))) | |
(switch-to-buffer (get-buffer-create bufname)) | |
(emacs-lisp-mode) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about this, letting Emacs uniquely name the buffer for you?