From 9f75de5bb43135b6d72dc28ffa4c6e3470daa35e Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 30 Jul 2022 01:40:48 -0400 Subject: org: Avoid hard-coding notes location in multiple places Use org-directory instead. --- init.el | 8 +++++--- lisp/km-org-agenda.el | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index 8db1724..94c836c 100644 --- a/init.el +++ b/init.el @@ -154,7 +154,9 @@ org-goto-max-level 3) (setq org-startup-folded t) - (setq org-default-notes-file "~/notes/tasks.org") + (setq org-directory (expand-file-name "~/notes/")) + (setq org-default-notes-file (concat (file-name-as-directory org-directory) + "tasks.org")) (setq org-reverse-note-order t) (setq org-refile-targets '((nil :maxlevel . 2)) @@ -380,8 +382,8 @@ #'km/org-agenda-set-restriction-lock)) :config - (setq org-directory "~/notes/") - (setq org-agenda-files "~/notes/agenda-files") + (setq org-agenda-files (concat (file-name-as-directory org-directory) + "agenda-files")) (add-hook 'org-agenda-finalize-hook #'km/org-agenda-cd-and-read-dir-locals) (add-hook 'org-agenda-finalize-hook #'km/org-agenda-store-current-span) diff --git a/lisp/km-org-agenda.el b/lisp/km-org-agenda.el index c0f9539..ded7afc 100644 --- a/lisp/km-org-agenda.el +++ b/lisp/km-org-agenda.el @@ -33,7 +33,7 @@ (defun km/org-agenda-cd-and-read-dir-locals () (unless (get 'org-agenda-files 'org-restrict) - (setq default-directory (expand-file-name "~/notes/")) + (setq default-directory org-directory) (hack-local-variables))) (defun km/org-agenda-store-current-span () -- cgit v1.2.3