From 5cd3c0590cd9d96b97f014b07a1a66ad1a654ef1 Mon Sep 17 00:00:00 2001 From: Thierry Pouplier Date: Fri, 18 Sep 2026 12:48:11 -0400 Subject: [PATCH] fix(doom): restore gortium/read-dir-local deleted in 343dc24 Commit 343dc24 accidentally dropped the defun (=void-function on file open) while inserting area-view-body at the same location. Restores the byte-identical helper that reads .dir-locals.el vars for the project-aware agenda and mu4e project shortcuts. --- doom/.config/doom/README.org | 14 ++++++++++++++ doom/.config/doom/config.el | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/doom/.config/doom/README.org b/doom/.config/doom/README.org index 6f0eac9..91e03a0 100644 --- a/doom/.config/doom/README.org +++ b/doom/.config/doom/README.org @@ -4127,6 +4127,20 @@ Per-area key: \"a\"+area-name (unique). Aggregates: \"pw\" (all personal), \"ww\ (gortium/inject-area-views) (add-hook 'org-agenda-mode-hook #'gortium/inject-area-views) + +(defun gortium/read-dir-local (var) + "Read variable VAR from .dir-locals.el in `default-directory'. +Returns nil if file doesn't exist or VAR isn't set." + (let ((dir-locals (expand-file-name ".dir-locals.el" default-directory))) + (when (file-exists-p dir-locals) + (with-temp-buffer + (insert-file-contents dir-locals) + (goto-char (point-min)) + (let* ((sexp (ignore-errors (read (current-buffer)))) + (nil-entry (assq nil sexp))) + (when nil-entry + (cdr (assq var (cdr nil-entry))))))))) + (defun gortium/project-aware-agenda () "Launch org-agenda scoped to the current Projectile project. Reads `gortium/project-agenda-entry' from .dir-locals.el and merges diff --git a/doom/.config/doom/config.el b/doom/.config/doom/config.el index 802e07e..e7700a0 100644 --- a/doom/.config/doom/config.el +++ b/doom/.config/doom/config.el @@ -3184,6 +3184,20 @@ Per-area key: \"a\"+area-name (unique). Aggregates: \"pw\" (all personal), \"ww\ (gortium/inject-area-views) (add-hook 'org-agenda-mode-hook #'gortium/inject-area-views) + +(defun gortium/read-dir-local (var) + "Read variable VAR from .dir-locals.el in `default-directory'. +Returns nil if file doesn't exist or VAR isn't set." + (let ((dir-locals (expand-file-name ".dir-locals.el" default-directory))) + (when (file-exists-p dir-locals) + (with-temp-buffer + (insert-file-contents dir-locals) + (goto-char (point-min)) + (let* ((sexp (ignore-errors (read (current-buffer)))) + (nil-entry (assq nil sexp))) + (when nil-entry + (cdr (assq var (cdr nil-entry))))))))) + (defun gortium/project-aware-agenda () "Launch org-agenda scoped to the current Projectile project. Reads `gortium/project-agenda-entry' from .dir-locals.el and merges