I've read the org-capture template documentation and searched for "Dynamic org-capture templates" but cannot seem to find out how to create the following:

C-c c
"a"
Activity: math              (<--need completion here)
Topic: multiplication       (<--need completion here)
Date: 2017-09-11            (<--need default to todays date)
Start time: 07:00 AM        (<--need to define AM/PM easily)
Duration: 20                (<--easier way to capture time?)
Unit: mins

Whereas if another Activity was chosen, the Options would be different:

C-c c
"a"
Activity: physical education
Type: Yoga
Class: Level 2 flow
Date: 2017-09-11
Start time: 07:00 AM
Duration: 90
Unit: mins

Where in an org-capture-template can I specify the Activity to Option mapping?

How can I use completion to make capturing the data quicker?

  • Anyone have insights into this? – SeaDude Sep 14 '17 at 6:04
  • WOW! No one has a method for accomplishing this one? – SeaDude Sep 20 '17 at 0:17

Although this can likely be achieved by some elaborate Lisp scheme, you would supposedly still have to manually specify which options go with which activities. Thus, it is probably more simple and maintainable to copy-paste a new capture template for each activity. As capture templates can be grouped logically with two-key selectors (e.g., first press a for "activity", then m for "math"), this solution might be equally good in practice. Add the code below to ~/.emacs.d/init.el

(setq org-capture-templates
      (quote
       (("a" "Activity")
        ("am" "Activity (math)" entry (file+headline "/path/to/file" "Log")
         "Activity: math\nTopic: %^{Topic}\nDate: %u\nStart time: %^{Time}\nDuration: %^{Duration}\nUnit: mins" :immediate-finish)
        ("ap" "Activity (physical education)" entry (file+headline "/path/to/file" "Log")
         "Activity: physical education\nType: %^{Type}\nClass: %^{Class}\nDate: %u\nStart time: %^{Time}\nDuration: %^{Duration}\nUnit: mins" :immediate-finish)
        ("ax" "Activity (other)" entry (file+headline "/path/to/file" "Log")
         "Activity: %^{Activity}\n%?\nDate: %u\nStart time: %^{Time}\nDuration: %^{Duration}\nUnit: mins") )))

The resulting menu then looks like this:

Two-key capture template allows logical grouping

  • Thank you for the suggestion. I'd really like a way for IDO or Helm to "pick up" on the entries each time and provide completion or add new. Similar to adding a new file in emacs. Searches for whats existing, then adds a new file if none. – SeaDude Nov 4 '17 at 0:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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