Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using properties in org-mode capture templates

Tags:

emacs

org-mode

The org-mode manual mentions a number of properties that can control the behavior of capture templates, but I'm not sure how to use them. The manual itself doesn't include any template examples that use them, and a bit of Googling doesn't turn anything up, either.

I'm trying to use two of the properties in particular: :kill-buffer and either :prepend (if it works with tables) or else :table-line-pos. I'm trying to set up a template for a writing log that adds a new line at the top of a table.

What I tried first, treating them like tags, was this:

("w" "Writing log" table-line (file "~/Dropbox/workrecord.org")
 "|%U|%A||%?|" :prepend:kill-buffer)

But neither property took. It doesn't work either if I only include :killbuffer. If I need to use :table-line-pos, there's the added difficulty of knowing the syntax for including the argument I+1.

Any ideas?

like image 272
Brian Hamilton Avatar asked Jun 20 '12 09:06

Brian Hamilton


1 Answers

You need to assign a value to :kill-buffer, :prepend and friends.

Your code snippet

("w" "Writing log" table-line (file "~/Dropbox/workrecord.org")
 "|%U|%A||%?|" :prepend:kill-buffer)

is not syntactically correct. It should read:

("w" "Writing log" table-line (file "~/Dropbox/workrecord.org")
 "|%U|%A||%?|" :prepend t :kill-buffer t)

so that the capture content will be prepended and the buffer killed (if it didn't already exist before calling capture.)

If this does not work, try setting :table-line-pos to something sensible like "II-3", as shown in the manual (Org 7.8.11). The double-quote are important here, they mean that the value of the property :table-line-pos is a string.

HTH,

like image 70
bzg Avatar answered Nov 07 '22 06:11

bzg