Ignore unsafe local variables, but log them
This suppresses the annoying "do you want to apply these unsafe file/dir local variables" prompt by ignoring them (but stills them so at least users are told). Fixes issue mentioned in #4335
This commit is contained in:
parent
a2ccae917e
commit
5e7864838a
1 changed files with 16 additions and 0 deletions
|
@ -26,6 +26,22 @@ employed so that flycheck still does *some* helpful linting.")
|
||||||
|
|
||||||
(use-package! elisp-mode
|
(use-package! elisp-mode
|
||||||
:mode ("\\.Cask\\'" . emacs-lisp-mode)
|
:mode ("\\.Cask\\'" . emacs-lisp-mode)
|
||||||
|
:init
|
||||||
|
;; Instead of pestering the user about accepting unsafe file local variables,
|
||||||
|
;; I'd rather it quietly ignore them...
|
||||||
|
(setq-default enable-local-variables :safe)
|
||||||
|
;; ...but still log them, so we can discover them if we're looking for it.
|
||||||
|
(defadvice! +emacs-lisp-log-unsafe-local-variables-a (variables dir-name)
|
||||||
|
:before #'hack-local-variables-filter
|
||||||
|
(when (eq enable-local-variables :safe)
|
||||||
|
(pcase-dolist (`(,var . ,val) variables)
|
||||||
|
(cond ((memq var ignored-local-variables))
|
||||||
|
((memq var '(mode unibyte coding)))
|
||||||
|
((eq var 'eval))
|
||||||
|
((not (safe-local-variable-p var val))
|
||||||
|
(message "Ignoring unsafe file local variable: %S" var))
|
||||||
|
((risky-local-variable-p var val)
|
||||||
|
(message "Ignoring risky file local variable: %S" var))))))
|
||||||
:config
|
:config
|
||||||
(set-repl-handler! '(emacs-lisp-mode lisp-interaction-mode) #'+emacs-lisp/open-repl)
|
(set-repl-handler! '(emacs-lisp-mode lisp-interaction-mode) #'+emacs-lisp/open-repl)
|
||||||
(set-eval-handler! '(emacs-lisp-mode lisp-interaction-mode) #'+emacs-lisp-eval)
|
(set-eval-handler! '(emacs-lisp-mode lisp-interaction-mode) #'+emacs-lisp-eval)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue