diff --git a/init.el b/init.el index 5d50c70..56ec62a 100644 --- a/init.el +++ b/init.el @@ -128,7 +128,11 @@ This is a single element list with that element being the file's trusted status. (apply oldfun args))))) (advice-add 'trusted-content-p :around #'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 (setq gc-cons-threshold 80000000 @@ -1277,7 +1281,24 @@ to `posframe-show' if the display is graphical." (setq flycheck-display-errors-function nil) (defun my/flycheck-if-trusted () (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) (defun my/sly-notes-at-point (&optional pos buffer)