I'd like to understand how to retrieve the tags for a headline that is being processed by a clock mode report formula. Suppose I have a clock report table defined like this.

#+BEGIN: clocktable :maxlevel 2 :scope nil :formula "$3='(headline-get-tags $1)::@2$3=string(\"Tags\")"                                                                       

I can define a simple formula that returns the length of the headline, but I have yet to find an easy way to find the tags associated with the headline.

(defun headline-get-tags (headline)
  "Return the tags for a headline"
  (length headline)) 

Is there a simple way to get the tags with a headline?

  • I don't think this quite answers your question, but org-get-tags-string returns the tags on the current headline (i.e. where point is) as a :-seperated string.
    – erikstokes
    Feb 9 '15 at 13:03
  • Yes, I had found that function as well, but it's not quite it. I think the problem is a bit more complicated, because I don't think the table formula has full access to the complete headline. Feb 9 '15 at 13:30

Clock tables support a :properties option:

#+BEGIN: clocktable :properties ("ALLTAGS")

And it turns out that tags are available by the special property name ALLTAGS. Here are the others:


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.