1

When I capture an item in org-capture, I have a template which adds "DATE_CAPTURED: %T" to it.

How do I make it so that DATE_CAPTURED is added inside a PROPERTY drawer?

Also, how would I make any org-mode-automated property (like DEADLINE, CLOSED, or SCHEDULED) get added to the PROPERTY drawer, instead of directly under the headline?

  • org-mode relies heavily upon finding the DEADLINE / SCHEDULED / CLOSED directly underneath the main heading when performing searches used to create the *Org Agenda* buffer; and other types of searches. Moving them to a property drawer will break functionality of many built-in features. – lawlist Aug 6 '16 at 19:06
  • I like to see everything in my capture window while I am editing/creating the entry, so I actually include the property drawers in my template along with certain spacing and line-endings \n. I use the following format for the current date in my DEADLINE and/or SCHEDULED: <%<%Y-%m-%d %a> You could have an entry that states something like: :DATE_CAPTURED: <%<%Y-%m-%d %a>>\n – lawlist Aug 6 '16 at 19:12
4

You could use this function and the hook in init.el

(defun add-property-with-date-captured ()
  "Add DATE_CAPTURED property to the current item."
  (interactive)
  (org-set-property "DATE_CAPTURED" (format-time-string "%F")))

(add-hook 'org-capture-before-finalize-hook 'add-property-with-date-captured)

which will add to the current heading in your capture buffer property DATE_CAPTURED with the date in ISO 8601 format when you'll end the capturing (after pressing C-c C-c in the capture buffer). So, you'll see the DATE_CAPTURED property in the capture file.

  • thx this works well. yet when i have a capture template that already creates a drawer, this will add an additional drawer. is there anyway around that? – zeltak Oct 1 '16 at 7:31
  • Does it create second PROPERTIES drawer? – Konstantin Morenko Oct 1 '16 at 12:05
  • yes it does do that. – zeltak Oct 1 '16 at 12:45
  • Which code do you use to create first (your) drawer into template? You could create question and gave link to. – Konstantin Morenko Oct 1 '16 at 17:13

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.