about summary refs log tree commit diff stats
path: root/lisp/+scratch.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+scratch.el')
-rw-r--r--lisp/+scratch.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/lisp/+scratch.el b/lisp/+scratch.el new file mode 100644 index 0000000..976b08c --- /dev/null +++ b/lisp/+scratch.el
@@ -0,0 +1,29 @@
1;;; +scratch.el -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(require 'scratch)
6
7(defun +scratch-immortal ()
8 "Bury, don't kill \"*scratc*\" buffer.
9For `kill-buffer-query-functions'."
10 (if (eq (current-buffer) (get-buffer "*scratch*"))
11 (progn (bury-buffer)
12 nil)
13 t))
14
15(defun +scratch-buffer-setup ()
16 "Add comment to `scratch' buffer and name it accordingly."
17 (let* ((mode (format "%s" major-mode))
18 (string (concat "Scratch buffer for:" mode "\n\n")))
19 (when scratch-buffer
20 (save-excursion
21 (insert string)
22 (goto-char (point-min))
23 (comment-region (point-at-bol) (point-at-eol)))
24 (next-line 2))
25 (rename-buffer (concat "*scratch<" mode ">*") t)))
26
27
28(provide '+scratch)
29;;; +scratch.el ends here