4

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?

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

1 Answer 1

1

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

1
  • 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
    Commented Nov 4, 2017 at 0:23

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.