Sacha on Supplying an Argument to a Capture Template Function

Org mode capture templates are more flexible than you might think. You can specify that the entry be stored in a file in a variety of ways. You can, for instance, ask that it be put in a date tree at the proper place. That’s just what you want for something like a journal or other date-based file. You can check the documentation to see the available methods.

The most general method is to supply a function that determines where to place the captured data. One downside of that is that you can’t specify an argument to the function. That’s not fatal, of course, because you can always supply nearly identical functions to different templates that have the argument specified implicitly. Of course, as programmers we find that an objectionable solution.

Happily, Sacha Chua has our backs with a neat hack to supply an argument to a template function. The idea is to pass your argument as a property that gets saved in the template’s plist and then have the function retrieve the argument with plist-get. Check out Chua’s post for the details and an example.

This entry was posted in General and tagged , . Bookmark the permalink.