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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user