;;; syd-scratch.el -*- lexical-binding: t; -*- (require 'syd-prelude) ;; Persist the scratch buffer between sessions. Note that it is not persisted ;; between boots. ;; TODO: This could be deferred better. (use-package persistent-scratch :hook (after-init) :custom (persistent-scratch-save-file (file-name-concat syd-data-dir "scratch")) :config ;; The default error/warning message is a bit too error-looking for my tastes. ;; This is the same function, but with a tamer warning message. (defun syd--persistent-scratch--auto-restore () "Automatically restore the scratch buffer once per session." (unless persistent-scratch--auto-restored (condition-case err (persistent-scratch-restore) (error (message "No previous scratch buffer to restore"))) (setq persistent-scratch--auto-restored t))) (advice-add #'persistent-scratch--auto-restore :override #'syd--persistent-scratch--auto-restore) ;; Arrange the activation of autosave and auto-restore (if applicable) on ;; Emacs start. (persistent-scratch-setup-default)) (use-package emacs :custom ((initial-scratch-message (with-temp-buffer (insert-file-contents "/persist/vault/crumb/cool-deer.org") (buffer-string))) ;; Initial major mode for scratch buffer. (initial-major-mode 'fundamental-mode) ;; Disable the initial "help" screen, in favour of starting off in ;; the scratch buffer. (inhibit-splash-screen t) (inhibit-startup-screen t) (inhibit-startup-message t))) (provide 'syd-scratch) ;;; syd-scratch.el ends here