]> code.delx.au - dotemacs/blob - text-edit/my-new-scratch-buffer.el
SSH_AUTH_SOCK
[dotemacs] / text-edit / my-new-scratch-buffer.el
1 ;;; -*- lexical-binding: t -*-
2
3 (setq initial-scratch-message nil)
4 (setq initial-major-mode 'emacs-lisp-mode)
5
6 (defun my/new-scratch-buffer ()
7 "Create a new scratch buffer to work in. (could be *scratch* - *scratchX*)"
8 (interactive)
9 (let ((n 0)
10 bufname)
11 (while (progn
12 (setq bufname (concat "*scratch"
13 (if (= n 0) "" (int-to-string n))
14 "*"))
15 (setq n (1+ n))
16 (get-buffer bufname)))
17 (switch-to-buffer (get-buffer-create bufname))
18 (funcall initial-major-mode)))
19
20 (provide 'my-new-scratch-buffer)