1

In this example I changed the date for Entered to 12/07/2019 at the capture editing stage. Yet it gets filed under today's date. How can file it under the right date, that is 12/07/2019? Ideally in one step. But if not, the obvious additional steps would be 1/ create a headline for 12/07/2019, and its parents. 2/ org-refile under the hl created in 1/. How to do 1/?

org-capture enter image description here

PS: I'm using a variant of the capture proposed here:

(defun my-org-capture ()
  "Read file name to capture to."
  (interactive)
  (setq my-org-capture-filename
        (read-file-name "Capture to: " "~/Documents/write/notes/journal"
                        "inbox.org" t))
  (call-interactively #'org-capture))
1

The capture template you linked to is the key here:

 ("j" "Journal" entry
      (file+olp+datetree "~/Documents/write/notes/journal/inbox.org")
      "* %?
Entered on %U
  %i
  %a")

The date you are modifying is in the content of the entry: the %U gets replaced with the current timestamp which you are then modifying.

However the 'file+olp+datetree' target defines where the entry will actually go, and in this case the default for a datetree is to add a heading for today's date. That heading is not related to the content of the entry that you are editing.

What you want here is to override the default behavior of datetree. If you always want to be prompted, add the optional :time-prompt property to your capture template. If most of the time the default behavior is what you want, you can leave the template as-is and instead use a C-1 prefix to trigger the prompt.

From the Org Template elements documentation:

 ‘:time-prompt’
      Prompt for a date/time to be used for date/week trees and when
      filling the template.  Without this property, capture uses the
      current date and time.  Even if this property has not been
      set, you can force the same behavior by calling ‘org-capture’
      with a ‘C-1’ prefix argument.
1
  • The C-1 C-c j worked, thanks. How about the rest of the question? "1/ create a headline for 12/07/2019, and its parents." – Erwann Jan 24 '20 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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