Improve scratch buffer

This commit is contained in:
2026-01-27 16:57:52 -08:00
parent d0aa0c2986
commit ff9a4cf5b8

25
init.el
View File

@ -128,7 +128,11 @@ This is a single element list with that element being the file's trusted status.
(apply oldfun args))))) (apply oldfun args)))))
(advice-add 'trusted-content-p :around (advice-add 'trusted-content-p :around
#'my/-fix-trusted-content-p-for-remote) #'my/-fix-trusted-content-p-for-remote)
;; Try to fix the scratch buffer
(defun my/-fix-scratch-buffer-trusted-state ()
(setq-local trusted-content :all
my/-trusted-content-segment-cache nil))
(add-hook 'after-init-hook #'my/-fix-scratch-buffer-trusted-state)
;; Increase responsiveness ;; Increase responsiveness
(setq gc-cons-threshold 80000000 (setq gc-cons-threshold 80000000
@ -1277,7 +1281,24 @@ to `posframe-show' if the display is graphical."
(setq flycheck-display-errors-function nil) (setq flycheck-display-errors-function nil)
(defun my/flycheck-if-trusted () (defun my/flycheck-if-trusted ()
(when (trusted-content-p) (when (trusted-content-p)
(flycheck-mode)))) (flycheck-mode)))
;; Disable some warnings in the scratch buffer
(defun my/-flycheck-gen-no-lexical-warning-bytecomp-form ()
"Generate a form suitable for `flycheck-emacs-lisp-check-form'.
This form will ignore lexical binding errors from the byte compiler."
(prin1-to-string (let ((cur-form (read flycheck-emacs-lisp-check-form)))
`(let ((bytecomp--inhibit-lexical-cookie-warning t))
,cur-form))))
(defun my/-disable-checkdoc-in-scratch ()
(require 'flycheck)
(when (and (equal (buffer-name) "*scratch*")
(not buffer-file-name))
(add-to-list (make-local-variable 'flycheck-disabled-checkers)
'emacs-lisp-checkdoc)
(setq-local flycheck-emacs-lisp-check-form
(my/-flycheck-gen-no-lexical-warning-bytecomp-form))))
(add-hook 'lisp-interaction-mode-hook #'my/-disable-checkdoc-in-scratch))
(use-package consult-flycheck) (use-package consult-flycheck)
(defun my/sly-notes-at-point (&optional pos buffer) (defun my/sly-notes-at-point (&optional pos buffer)