4

I'm trying to create an org-capture template that creates a task and (important part) automatically adds a parent's property to this new task. I'm comfortable creating new capture templates--I'm just unsure of the latter part.

If it matters I'm trying to "inherit" the CATEGORY property to my new tasks.

Also, I prefer not to use property inheritance if I can help it. The documentation is very clear that this can adversely affect performance.

3
  • 1
    The CATEGORY property (and a few others) is always inherited.
    – erikstokes
    Jun 18, 2015 at 3:03
  • 1
    @erikstokes, going off of an excerpt from the Org Mode manual it was my impression that the behavior you described only occurs while in org-agenda mode. I'd like to physically assign the parent CATEGORY to new child tasks (preferably through org-capture). I'm ignorant to possible functions that can read parent properties, which is what I believe I need in this case.
    – kgo
    Jun 18, 2015 at 11:49
  • The usual way to see the category is with org-get-category which does inheritance. You could also use org-entry-get. However putting these into a capture template in the obvious way doesn't seem to work.
    – erikstokes
    Jun 18, 2015 at 23:17

1 Answer 1

2

Here's how you can get the properties from the "parent" in a tree. Does this help you with what you're trying to achieve?

* foo  
  :PROPERTIES:
  :CATEGORY: awesome
  :END:
** bar 
Run commands like these
#+BEGIN_SRC emacs-lisp
(org-set-property "CATEGORY"
          (save-excursion (org-up-heading-safe)
                  (org-entry-get (point) "CATEGORY")))
#+END_SRC
*** baz 
http://orgmode.org/manual/Using-the-property-API.html
1
  • This looks like it will do exactly what I need it to. I'll test it soon and get back. Thanks for your help!
    – kgo
    Jun 19, 2015 at 12:37

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.