emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Property inheritance in Org-collector
@ 2011-01-08  8:40 Christian Moe
  2011-01-08 12:41 ` d.tchin
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Moe @ 2011-01-08  8:40 UTC (permalink / raw)
  To: Eric Schulte, Org Mode

Hi,

I'm trying to use an Org document as the database for a textbook 
analysis and Org-collector.el to output reports.

With org-use-property-inheritance set to `t', and working in sparse 
trees, I fail to get inherited properties to show up in the dynamic 
block: the value returned is 0. Is this the expected behavior, and is 
there any way to change things so I can get inherited properties?

Yours,
Christian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Property inheritance in Org-collector
  2011-01-08  8:40 Property inheritance in Org-collector Christian Moe
@ 2011-01-08 12:41 ` d.tchin
  2011-01-08 21:17   ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: d.tchin @ 2011-01-08 12:41 UTC (permalink / raw)
  To: emacs-orgmode

Christian Moe <mail <at> christianmoe.com> writes:

> 
> Hi,
> 
> I'm trying to use an Org document as the database for a textbook 
> analysis and Org-collector.el to output reports.
> 
> With org-use-property-inheritance set to `t', and working in sparse 
> trees, I fail to get inherited properties to show up in the dynamic 
> block: the value returned is 0. Is this the expected behavior, and is 
> there any way to change things so I can get inherited properties?
> 

I am interested by this too. I tried to have inherited properties and 
had the same problem whereas I fixed org-use-property-inheritance 
to 't. 

I test that inheritance work with the following test :

* Inheritance
#+BEGIN: propview  :cols (ITEM test) :scope tree 
:conds ((string= test "appear")) 
| "ITEM"        | "test"   |
|---------------+----------|
| "First level" | "appear" |
|---------------+----------|
|               |          |
#+END:

#+BEGIN: propview :cols (ITEM CATEGORY) :scope tree 
:conds ((string= CATEGORY "level")) 
| "ITEM"               | "CATEGORY" |
|----------------------+------------|
| "First level"        | "level"    |
| "Test inheritance 1" | "level"    |
| "Test inheritance 2" | "level"    |
|----------------------+------------|
|                      |            |
#+END:

** First level
  :PROPERTIES:
  :test:     appear
  :CATEGORY:  level
  :COLUMNS:  %34ITEM %plats %ingredient
  :END:     
*** Test inheritance 1
    (org-entry-get (point) "test" t)
**** Test inheritance 2
     (org-entry-get (point) "test" t)
** Second level
*** Test inheritance 3
    (org-entry-get (point) "test" t)



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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: Property inheritance in Org-collector
  2011-01-08 12:41 ` d.tchin
@ 2011-01-08 21:17   ` Eric Schulte
  2011-01-11 14:21     ` d.tchin
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2011-01-08 21:17 UTC (permalink / raw)
  To: d.tchin; +Cc: emacs-orgmode

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Property inheritance in Org-collector
  2011-01-08 21:17   ` Eric Schulte
@ 2011-01-11 14:21     ` d.tchin
  0 siblings, 0 replies; 4+ messages in thread
From: d.tchin @ 2011-01-11 14:21 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric <at> gmail.com> writes:

I used new version of org-collector as you suggested. It works well.

Thank you.

Regards.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-11 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08  8:40 Property inheritance in Org-collector Christian Moe
2011-01-08 12:41 ` d.tchin
2011-01-08 21:17   ` Eric Schulte
2011-01-11 14:21     ` d.tchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).