feat: backport safe-local-variable-directories from Emacs 30
This commit is contained in:
parent
ad5e3dcce8
commit
e02d3c79a9
1 changed files with 21 additions and 0 deletions
21
lisp/init.el
21
lisp/init.el
|
@ -13,4 +13,25 @@
|
|||
(doom-require 'doom-projects)
|
||||
(doom-require 'doom-editor)
|
||||
|
||||
;; COMPAT: `safe-local-variable-directories' was introduced in Emacs 30.1
|
||||
(unless (boundp 'safe-local-variable-directories)
|
||||
(defvar safe-local-variable-directories ())
|
||||
(define-advice hack-local-variables-filter (:around (fn variables dir-name) respect)
|
||||
(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))))
|
||||
|
||||
;; Ensure .dir-locals.el in $EMACSDIR and $DOOMDIR are always respected
|
||||
(add-to-list 'safe-local-variable-directories doom-emacs-dir)
|
||||
(add-to-list 'safe-local-variable-directories doom-user-dir)
|
||||
|
||||
;;; Support for Doom-specific file extensions
|
||||
(add-to-list 'auto-mode-alist '("/\\.doom\\(?:project\\|module\\|profile\\)?\\'" . lisp-data-mode))
|
||||
(add-to-list 'auto-mode-alist '("/\\.doomrc\\'" . emacs-lisp-mode))
|
||||
|
||||
;;; init.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue