emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Property inheritance in Org-collector


From: Eric Schulte
Subject: Re: [Orgmode] Re: Property inheritance in Org-collector
Date: Sat, 08 Jan 2011 14:17:27 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Unfortunately inheritance of properties in Org-mode requires explicitly
requesting the property by name (aside from a couple of built-in
Org-mode properties e.g. CATEGORY)

I've just pushed up a change to org-collector which allows properties to
be explicitly inherited using a new :inherit keyword, this is
demonstrated in the example below.  Having to explicitly mention the
property to be inherited is not ideal, but hopefully it is sufficient.

Cheers -- Eric

* Inheritance
#+BEGIN: propview  :cols (ITEM test CATEGORY) :scope tree :inherit (test)
| "ITEM"             | "test"   | "CATEGORY"    |
|--------------------+----------+---------------|
| "Inheritance"      | 0        | "inheritence" |
| "First level"      | "appear" | "level"       |
| "Test inheritance" | "appear" | "level"       |
|--------------------+----------+---------------|
|                    |          |               |
#+END:

** First level
  :PROPERTIES:
  :test:     appear
  :CATEGORY:  level
  :COLUMNS:  %34ITEM %plats %ingredient
  :END:     

#+begin_src emacs-lisp
  (org-entry-get (point) "CATEGORY" t)
#+end_src

#+results:
: level

*** Test inheritance
The org-collector uses the org-entry-properties function to collect
properties.  Notice that this function *only* inherits some special
properties known to Org-mode
#+begin_src emacs-lisp
  (flet ((to-table (lst) (mapcar (lambda (pair) (list (car pair) (cdr pair))) 
lst)))
   (to-table (org-entry-properties)))
#+end_src

#+results:
| FILE     | /home/eschulte/Desktop/inheritence.org |
| BLOCKED  |                                        |
| CATEGORY | level                                  |

in such properties are mentioned explicitly in the code of
org-entry-properties, and the special function org-get-categories is
used to collect (and inherit) categories.  In fact even calling
org-entry-get inside of this subtree with inheritance explicitly set
to t is not sufficient to 

#+begin_src emacs-lisp
  (org-entry-get (point) "CATEGORY" t)
#+end_src

#+results:
: level

#+begin_src emacs-lisp
  (org-entry-get (point) "test" t)
#+end_src

#+results:
: appear

I expect to have the same behavior for CATEGORY and test properties.
If you evaluate lisp expression you will notice that inheritance seems 
to works.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]