0

I want the date in front of the day, captured with file+olp+datetree and type week as an active date so I can look the entry up in the agenda. The date which I'm talking about is underlined red in the following picture:

part of captured journal with dates underlined

I know I could add an active timestamp to every entry with %T, but then my agenda will be poluted from all entries. I just want the day active so that a single entry is visible in my agenda, allowing me to jump to the daily journal from the agenda.

Section from my capture template:

    ("d" "New work journal entry" entry 
    (file+olp+datetree workjournalfile) 
    "* %?" :tree-type week)

1 Answer 1

1

You might want to try customizing the option org-datetree-add-timestamp to t. That will not make the date you want active, but it will add an active timestamp to the entry on the next line: that should be enough to be able to find it from the agenda.

EDIT: I tested it and it works as the OP expects.

I start with a minimal init file:

(setq org-capture-templates '(
                              ("d" "New work journal entry" entry 
                               (file+olp+datetree "/tmp/work/journal.org") 
                               "* %?" :tree-type week)))

(setq org-agenda-files '("/tmp/work/journal.org"))

(setq org-datetree-add-timestamp t)

That adds the capture template the OP describes, adds the journal to the agenda file list and sets the variable as I suggested above.

I start emacs with emacs -q -l /path/to/minimal/init.el, capture a bunch of entries and display the agenda. Here's what the journal.org file looks like at the end of that:



* 2022

** 2022-W39

*** 2022-10-01 Saturday
<2022-10-01 Sat>
**** foo
**** bar
**** baz

Note that the time stamp is added to the day entry of the datetree, whereas all subordinate entries do not get one.

The weekly agenda (M-x org-agenda a since I have not set up the recommended keybindings in the init file) shows this:

Week-agenda (W39):
Monday     26 September 2022 W39
Tuesday    27 September 2022
Wednesday  28 September 2022
Thursday   29 September 2022
Friday     30 September 2022
Saturday    1 October 2022
  journal:    2022-10-01 Saturday
Sunday      2 October 2022

As you can see, a single entry for the date, not three entries for the items. Pressing <RET> on the agenda item takes me to the day entry in the journal.

Isn't that what you wanted to achieve?

1
  • I've deleted my last comment because it clearly was wrong: this answer is absolutely correct and fixes my problem. Thank you very much!
    – fklappan
    Oct 31, 2022 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.