1

I am trying to prompt for a timestamp to be added in the properties drawer, and to re-use the value outside of the drawer so it can be visible when reading/editing the note.

I am already using the %\N expansion element for string prompts, and it works fine. However, when using it with a date prompt, it throws a type error indicating the capture is expecting a string. Below is a simplified template I am trying to make work:

  ("l" "log" entry
  (file "inbox/main.org") "* Test log \n %^{Test}t  %\\1)"
  :empty-lines 1)

I tried using a format-time-string function on %\\1 thinking that maybe that would give the expected string to the program with the added benefit of being more readable. It did not work.

Is it possible to re-use the value obtained from date prompt in a capture template without prompting twice ?

4
  • If I'm reading the code right, only the values gathered from string prompts are saved, not for any other prompts, So date prompts, tag prompts, property prompts etc are just not collected, so the %\N mechanism cannot be used with them. You might want to post an RFE on the Org mode mailing list.
    – NickD
    Commented May 21 at 12:36
  • Thank you for checking it out. I subscribed to the mailing list, I am still waiting for their reply. I wil report back if I get some answer on their part, or if I manage to find a work around, whichever comes first.
    – lyndhurst
    Commented May 21 at 12:54
  • 1
    I was finally able to post a feature request on the mailing list. If anyone has the same problem I had, there is a link to a thread I started on the subject on the org-roam discourse forum. You can find there two working solutions to this problem. The first is a patch to the org-capture-fill-template function from the source code. The second is a function that can be used in a hook after capture. The latter only works if the date prompt sets a property value.
    – lyndhurst
    Commented May 22 at 9:44
  • This feature has actually been pushed to the master branch of the Org mode git repo. It is not available in any release yet, but it will be in Org 9.8. See this answer for more information.
    – NickD
    Commented Jul 13 at 21:10

0

Your Answer

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

Browse other questions tagged or ask your own question.