30 lines
787 B
EmacsLisp
30 lines
787 B
EmacsLisp
;;; +scratch.el -*- lexical-binding: t; -*-
|
|
|
|
;;; Code:
|
|
|
|
(require 'scratch)
|
|
|
|
(defun +scratch-immortal ()
|
|
"Bury, don't kill \"*scratc*\" buffer.
|
|
For `kill-buffer-query-functions'."
|
|
(if (eq (current-buffer) (get-buffer "*scratch*"))
|
|
(progn (bury-buffer)
|
|
nil)
|
|
t))
|
|
|
|
(defun +scratch-buffer-setup ()
|
|
"Add comment to `scratch' buffer and name it accordingly."
|
|
(let* ((mode (format "%s" major-mode))
|
|
(string (concat "Scratch buffer for:" mode "\n\n")))
|
|
(when scratch-buffer
|
|
(save-excursion
|
|
(insert string)
|
|
(goto-char (point-min))
|
|
(comment-region (point-at-bol) (point-at-eol)))
|
|
(next-line 2))
|
|
(rename-buffer (concat "*scratch<" mode ">*") t)))
|
|
|
|
|
|
(provide '+scratch)
|
|
;;; +scratch.el ends here
|