From 201321c92911c6cf8464fb96943e5c858066ec44 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 28 Nov 2024 16:10:23 -0500 Subject: [PATCH] feat(lib): backport safe-local-variable-directories Necessary to silence safe-local-variable warnings/prompts for $EMACSDIR and $DOOMDIR, later. --- lisp/doom-compat.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lisp/doom-compat.el b/lisp/doom-compat.el index 726332622..796c8c3ef 100644 --- a/lisp/doom-compat.el +++ b/lisp/doom-compat.el @@ -137,5 +137,19 @@ and return the value found in PLACE instead." (assq mode major-mode-remap-defaults))) mode))) +;; Introduced in Emacs 30+ +(unless (boundp 'safe-local-variable-directories) + (defvar safe-local-variable-directories ()) + (define-advice hack-local-variables-filter + (:around (fn variables dir-name) backport-safe-local-variable-directories) + (let ((enable-local-variables + (if (delq nil (mapcar (lambda (dir) + (and dir-name dir + (file-equal-p dir dir-name))) + safe-local-variable-directories)) + :all + enable-local-variables))) + (funcall fn variables dir-name)))) + (provide 'doom-compat) ;;; doom-compat.el ends here