From 1475b4acb8e0e163a2edee2d4b1f6dc256fe41a4 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Sun, 15 Sep 2024 17:46:29 +0200 Subject: [PATCH] CUSTOM: Add functions to reload .dir-locals.el --- config_new.org | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/config_new.org b/config_new.org index e0d116c..f6f9247 100644 --- a/config_new.org +++ b/config_new.org @@ -635,3 +635,23 @@ https://github.com/remyferre/comment-dwim-2 (set-exec-path-from-shell-PATH) #+END_SRC + +** Reload dir-locals.el + +#+BEGIN_SRC emacs-lisp +(defun myrmi/reload-dir-locals-for-current-buffer () + "Reload dir locals for the current buffer" + (interactive) + (let ((enable-local-variables :all)) + (hack-dir-local-variables-non-file-buffer))) + +(defun myrmi/reload-dir-locals-for-all-buffers-in-this-directory () + "For every buffer with the same `default-directory` as the + current buffer, reload dir-locals." + (interactive) + (let ((dir default-directory)) + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (when (equal default-directory dir) + (myrmi/reload-dir-locals-for-current-buffer)))))) +#+END_SRC