From 7bbdbe5ecce291a5bbed6d2c94ddd94ba286ce43 Mon Sep 17 00:00:00 2001
From: Vedang Manerikar <ved.manerikar@gmail.com>
Date: Sat, 28 Dec 2024 11:16:28 +0530
Subject: [PATCH] Reset denote-journal dir after denote dir to ensure correct
 value

The default value of `denote-journal-extras-directory` derives from
the default value of `denote-directory`.

Since I change this default value for myself, I need to also change
the `denote-journal-extras-directory` (or more the require after my
`denote-directory` variable is defined).

Redefining it is fine with me.
---
 unravel-emacs.org                | 3 ++-
 unravel-modules/unravel-study.el | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/unravel-emacs.org b/unravel-emacs.org
index 2b69678..b120798 100644
--- a/unravel-emacs.org
+++ b/unravel-emacs.org
@@ -5712,7 +5712,8 @@ Prot is the developer and maintainer of this package.
     ;; Remember to check the doc strings of those variables.
     (let ((dir (string-trim (shell-command-to-string "echo $DENOTE_DIRECTORY"))))
       (when (not (string-empty-p dir))
-        (setq denote-directory (expand-file-name dir))))
+        (setq denote-directory (expand-file-name dir))
+        (setq denote-journal-extras-directory (expand-file-name "journal" denote-directory))))
     (setq denote-infer-keywords t)
     (setq denote-sort-keywords t)
     (setq denote-excluded-directories-regexp "data") ; external data related to headings is stored in these directories (web archives)
diff --git a/unravel-modules/unravel-study.el b/unravel-modules/unravel-study.el
index 49649ef..1728981 100644
--- a/unravel-modules/unravel-study.el
+++ b/unravel-modules/unravel-study.el
@@ -72,7 +72,8 @@
   ;; Remember to check the doc strings of those variables.
   (let ((dir (string-trim (shell-command-to-string "echo $DENOTE_DIRECTORY"))))
     (when (not (string-empty-p dir))
-      (setq denote-directory (expand-file-name dir))))
+      (setq denote-directory (expand-file-name dir))
+      (setq denote-journal-extras-directory (expand-file-name "journal" denote-directory))))
   (setq denote-infer-keywords t)
   (setq denote-sort-keywords t)
   (setq denote-excluded-directories-regexp "data") ; external data related to headings is stored in these directories (web archives)