diff --git a/init.el b/init.el index f8aae10..2a4c14b 100644 --- a/init.el +++ b/init.el @@ -81,10 +81,15 @@ (describe-symbol form)))) ;; Trusted buffer stuff + (defvar-local my/-trusted-content-segment-cache nil + "Cache variable used in my/-trusted-content-segment. +This is a single element list with that element being the file's trusted status.") (defun my/temp-trust-buffer () "Set the current buffers local value of `trusted-content' to \\=:all." (interactive) - (setq-local trusted-content :all) + (setq-local trusted-content :all + ;; reset the cache + my/-trusted-content-segment-cache nil) (cond ((and (buffer-modified-p) (y-or-n-p "Save and reload buffer?")) (save-buffer) @@ -100,7 +105,11 @@ (equal trusted-content :all) buffer-file-name) (propertize "[Temp. Trusted]" 'face 'warning)) - ((not (trusted-content-p)) + ((progn + (unless my/-trusted-content-segment-cache + (setq-local my/-trusted-content-segment-cache + (list (trusted-content-p)))) + (not (car my/-trusted-content-segment-cache))) (propertize "[Untrusted]" 'face 'error))))) (add-to-list 'mode-line-misc-info '(:eval (my/-trusted-content-segment)))