35 lines
1.0 KiB
EmacsLisp
35 lines
1.0 KiB
EmacsLisp
;;; module-scratch.el --- scratch buffer enhancements
|
|
;;; Commentary:
|
|
;;; Scratch buffer enhancements for Emacs.
|
|
;;;
|
|
;;; Code:
|
|
|
|
(require 'module-pkg)
|
|
(pkg/require 'scratch)
|
|
(pkg/require 'persistent-scratch)
|
|
|
|
(defun my-set-scratch-mode ()
|
|
"Set default scratch mode."
|
|
(funcall 'text-mode))
|
|
|
|
(persistent-scratch-setup-default)
|
|
(setq persistent-scratch-directory "~/.local/state/emacs/"
|
|
persistent-scratch-autosave-interval 30
|
|
persistent-scratch-what-to-save '(((:current . "*scratch*") .
|
|
(major-mode point narrowing)))
|
|
persistent-scratch-save-file (expand-file-name
|
|
"scratch" persistent-scratch-directory))
|
|
|
|
(unless (file-exists-p persistent-scratch-directory)
|
|
(make-directory persistent-scratch-directory t))
|
|
|
|
(add-hook 'scratch-create-buffer-hook 'my-set-scratch-mode)
|
|
(add-hook 'after-init-hook #'persistent-scratch-autosave-mode)
|
|
|
|
(global-set-key (kbd "C-c s") #'persistent-scratch-save)
|
|
(global-set-key (kbd "C-c r") #'persistent-scratch-restore)
|
|
|
|
(provide 'module-scratch)
|
|
|
|
;;; module-scratch.el ends here.
|