summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lisp/ss-keys.el1
-rw-r--r--lisp/ss-org.el11
-rw-r--r--tests/ss-capture-tests.el31
4 files changed, 43 insertions, 1 deletions
diff --git a/README.md b/README.md
index 637eb9f..23aebb4 100644
--- a/README.md
+++ b/README.md
@@ -174,6 +174,7 @@ The main bindings are:
- `C-c c` for capture
- `C-c n n` to open or create a Denote note
- `C-c n l` to insert a Denote link
+- `C-c n j` to open the full `~/org/journal.org` buffer
- `C-c n M` to open the MOC
- `C-c n d` to open `~/org/journal.org`, narrowed to today when present
- `C-c n p` to open the people CRM
diff --git a/lisp/ss-keys.el b/lisp/ss-keys.el
index fe45572..c83c1e5 100644
--- a/lisp/ss-keys.el
+++ b/lisp/ss-keys.el
@@ -24,6 +24,7 @@
(when (ss-feature-enabled-p 'org)
(global-set-key (kbd "C-c n M") #'ss-open-moc)
+ (global-set-key (kbd "C-c n j") #'ss-open-journal-full)
(global-set-key (kbd "C-c n d") #'ss-open-journal))
(when (ss-feature-enabled-p 'crm)
diff --git a/lisp/ss-org.el b/lisp/ss-org.el
index 7df4d75..4bbd92d 100644
--- a/lisp/ss-org.el
+++ b/lisp/ss-org.el
@@ -17,9 +17,18 @@
(goto-char (point-max)))
(when (fboundp 'ss-journal-goto-date)
(if (ss-journal-goto-date)
- (org-narrow-to-subtree)
+ (progn
+ (org-fold-show-entry)
+ (org-fold-show-subtree)
+ (org-narrow-to-subtree))
(goto-char (point-max)))))
+(defun ss-open-journal-full ()
+ "Open `ss-journal-file' with the full buffer visible."
+ (interactive)
+ (find-file (ss-require-existing-file ss-journal-file))
+ (widen))
+
(defun ss-open-moc ()
"Open the central MOC note."
(interactive)
diff --git a/tests/ss-capture-tests.el b/tests/ss-capture-tests.el
index 4ea4ff6..0af27a5 100644
--- a/tests/ss-capture-tests.el
+++ b/tests/ss-capture-tests.el
@@ -53,6 +53,37 @@
(when (file-exists-p file)
(delete-file file)))))
+(ert-deftest ss-open-journal-reveals-folded-today-subtree ()
+ (let* ((file (make-temp-file "ss-journal" nil ".org"))
+ (ss-journal-file file))
+ (unwind-protect
+ (progn
+ (with-temp-file file
+ (insert "#+title: Journal\n"
+ "* 2026\n"
+ "** 2026-04-09 Thursday\n"
+ "*** Notes\n"
+ "Body\n"))
+ (with-current-buffer (find-file-noselect file)
+ (org-overview))
+ (let ((org-overriding-default-time (encode-time 0 0 12 9 4 2026)))
+ (ss-open-journal)
+ (should (buffer-narrowed-p))
+ (should-not
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward "^\\*\\*\\* Notes$" nil t)
+ (invisible-p (point))))
+ (should-not
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward "^Body$" nil t)
+ (invisible-p (point))))))
+ (when (buffer-live-p (current-buffer))
+ (kill-buffer (current-buffer)))
+ (when (file-exists-p file)
+ (delete-file file)))))
+
(ert-deftest ss-open-journal-keeps-end-fallback-when-today-missing ()
(let* ((file (make-temp-file "ss-journal" nil ".org"))
(ss-journal-file file))