From 58ab5fc5e29396d12aefa7248402dcb6df742680 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 5 Dec 2021 22:37:41 -0600 Subject: Stuff... --- lisp/+scratch.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lisp/+scratch.el (limited to 'lisp/+scratch.el') 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 @@ +;;; +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 -- cgit 1.4.1-21-gabe81