feat(lib): backport safe-local-variable-directories

Necessary to silence safe-local-variable warnings/prompts for $EMACSDIR
and $DOOMDIR, later.
This commit is contained in:
Henrik Lissner
2024-11-28 16:10:23 -05:00
parent da08aa2d7d
commit 201321c929

View File

@ -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