emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* (org-entry-properties nil 'all) does not return inherited properties
@ 2010-03-22 15:01 Holger Macht
  2010-03-22 17:44 ` Emilio Jesús Gallego Arias
  0 siblings, 1 reply; 7+ messages in thread
From: Holger Macht @ 2010-03-22 15:01 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

(org-entry-properties nil 'all) does not return inherited properties
added with a file directive like that:

#+PROPERTY: propkey propval

Is this by intention? If so, is there a method to get all the properties
of an item, also inherited ones?

Currently I was just able to find (org-entry-get), but this only returns
one specific property of which I need to know the name.

Thanks,
 Holger

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

* Re: (org-entry-properties nil 'all) does not return inherited properties
  2010-03-22 15:01 (org-entry-properties nil 'all) does not return inherited properties Holger Macht
@ 2010-03-22 17:44 ` Emilio Jesús Gallego Arias
  2010-03-22 18:06   ` Holger Macht
  0 siblings, 1 reply; 7+ messages in thread
From: Emilio Jesús Gallego Arias @ 2010-03-22 17:44 UTC (permalink / raw)
  To: emacs-orgmode

Holger Macht <holger@homac.de> writes:

> (org-entry-properties nil 'all) does not return inherited properties
> added with a file directive like that:
>
> #+PROPERTY: propkey propval
>
> Is this by intention? If so, is there a method to get all the properties
> of an item, also inherited ones?
>
> Currently I was just able to find (org-entry-get), but this only returns
> one specific property of which I need to know the name.

See:

,----[ C-h v org-use-property-inheritance RET ]
| org-use-property-inheritance is a variable defined in `org.el'.
| Its value is nil
| 
| Documentation:
| Non-nil means properties apply also for sublevels.
| 
| This setting is chiefly used during property searches. Turning it on can
| cause significant overhead when doing a search, which is why it is not
| on by default.
| 
| When nil, only the properties directly given in the current entry count.
| When t, every property is inherited.  The value may also be a list of
| properties that should have inheritance, or a regular expression matching
| properties that should be inherited.
| 
| However, note that some special properties use inheritance under special
| circumstances (not in searches).  Examples are CATEGORY, ARCHIVE, COLUMNS,
| and the properties ending in "_ALL" when they are used as descriptor
| for valid values of a property.
| 
| Note for programmers:
| When querying an entry with `org-entry-get',  you can control if inheritance
| should be used.  By default, `org-entry-get' looks only at the local
| properties.  You can request inheritance by setting the inherit argument
| to t (to force inheritance) or to `selective' (to respect the setting
| in this variable).
| 
| You can customize this variable.
| 
| [back]
`----

Regards,
Emilio

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

* Re: Re: (org-entry-properties nil 'all) does not return inherited properties
  2010-03-22 17:44 ` Emilio Jesús Gallego Arias
@ 2010-03-22 18:06   ` Holger Macht
  2010-03-22 20:07     ` Emilio Jesús Gallego Arias
  0 siblings, 1 reply; 7+ messages in thread
From: Holger Macht @ 2010-03-22 18:06 UTC (permalink / raw)
  To: Emilio Jesús Gallego Arias; +Cc: emacs-orgmode

On Mo 22. Mär - 18:44:38, Emilio Jesús Gallego Arias wrote:
> Holger Macht <holger@homac.de> writes:
> 
> > (org-entry-properties nil 'all) does not return inherited properties
> > added with a file directive like that:
> >
> > #+PROPERTY: propkey propval
> >
> > Is this by intention? If so, is there a method to get all the properties
> > of an item, also inherited ones?
> >
> > Currently I was just able to find (org-entry-get), but this only returns
> > one specific property of which I need to know the name.
> 
> See:
> 
> ,----[ C-h v org-use-property-inheritance RET ]

Have you tried? At least this doesn't have an effect on
(org-entry-properties in current git head.

Regards,
 Holger


P.S. Sorry for the double post.

> | org-use-property-inheritance is a variable defined in `org.el'.
> | Its value is nil
> | 
> | Documentation:
> | Non-nil means properties apply also for sublevels.
> | 
> | This setting is chiefly used during property searches. Turning it on can
> | cause significant overhead when doing a search, which is why it is not
> | on by default.
> | 
> | When nil, only the properties directly given in the current entry count.
> | When t, every property is inherited.  The value may also be a list of
> | properties that should have inheritance, or a regular expression matching
> | properties that should be inherited.
> | 
> | However, note that some special properties use inheritance under special
> | circumstances (not in searches).  Examples are CATEGORY, ARCHIVE, COLUMNS,
> | and the properties ending in "_ALL" when they are used as descriptor
> | for valid values of a property.
> | 
> | Note for programmers:
> | When querying an entry with `org-entry-get',  you can control if inheritance
> | should be used.  By default, `org-entry-get' looks only at the local
> | properties.  You can request inheritance by setting the inherit argument
> | to t (to force inheritance) or to `selective' (to respect the setting
> | in this variable).
> | 
> | You can customize this variable.
> | 
> | [back]
> `----
> 
> Regards,
> Emilio
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 

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

* Re: (org-entry-properties nil 'all) does not return inherited properties
  2010-03-22 18:06   ` Holger Macht
@ 2010-03-22 20:07     ` Emilio Jesús Gallego Arias
  2010-03-22 21:56       ` Holger Macht
  0 siblings, 1 reply; 7+ messages in thread
From: Emilio Jesús Gallego Arias @ 2010-03-22 20:07 UTC (permalink / raw)
  To: emacs-orgmode

Holger Macht <holger@homac.de> writes:

> On Mo 22. Mär - 18:44:38, Emilio Jesús Gallego Arias wrote:
>> Holger Macht <holger@homac.de> writes:
>> 
>> > (org-entry-properties nil 'all) does not return inherited properties
>> > added with a file directive like that:
>> >
>> > #+PROPERTY: propkey propval
>> >
>> > Is this by intention? If so, is there a method to get all the properties
>> > of an item, also inherited ones?
>> >
>> > Currently I was just able to find (org-entry-get), but this only returns
>> > one specific property of which I need to know the name.
>> 
>> See:
>> 
>> ,----[ C-h v org-use-property-inheritance RET ]
>
> Have you tried? At least this doesn't have an effect on
> (org-entry-properties in current git head.

Sorry Holger I misunderstood your question. I guess you should modify
org-entry-properties in order to include global properties like is done
in the inheritance case.

It could be something like:

(when org-use-property-inheritance
      (setq props (append org-file-properties props)
	    props (append org-global-properties props)
            props (append org-global-properties-fixed props)))

I don't know what may this change break.

Regards,
Emilio

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

* Re: Re: (org-entry-properties nil 'all) does not return inherited properties
  2010-03-22 20:07     ` Emilio Jesús Gallego Arias
@ 2010-03-22 21:56       ` Holger Macht
  2010-03-22 22:34         ` Emilio Jesús Gallego Arias
  2010-03-24 12:37         ` Carsten Dominik
  0 siblings, 2 replies; 7+ messages in thread
From: Holger Macht @ 2010-03-22 21:56 UTC (permalink / raw)
  To: Emilio Jesús Gallego Arias; +Cc: emacs-orgmode

On Mon 22. Mar - 21:07:43, Emilio Jesús Gallego Arias wrote:
> Holger Macht <holger@homac.de> writes:
> 
> > On Mo 22. Mär - 18:44:38, Emilio Jesús Gallego Arias wrote:
> >> Holger Macht <holger@homac.de> writes:
> >> 
> >> > (org-entry-properties nil 'all) does not return inherited properties
> >> > added with a file directive like that:
> >> >
> >> > #+PROPERTY: propkey propval
> >> >
> >> > Is this by intention? If so, is there a method to get all the properties
> >> > of an item, also inherited ones?
> >> >
> >> > Currently I was just able to find (org-entry-get), but this only returns
> >> > one specific property of which I need to know the name.
> >> 
> >> See:
> >> 
> >> ,----[ C-h v org-use-property-inheritance RET ]
> >
> > Have you tried? At least this doesn't have an effect on
> > (org-entry-properties in current git head.
> 
> Sorry Holger I misunderstood your question. I guess you should modify
> org-entry-properties in order to include global properties like is done
> in the inheritance case.

This does exactly what I want, thanks for the pointer. However, I'm
missing the overview to know what impact this might have. Just for
reference:

---
diff --git a/lisp/org.el b/lisp/org.el
index aa22309..ce57451 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12663,7 +12663,11 @@ things up because then unnecessary parsing is avoided."
 		(setq key (org-match-string-no-properties 1)
 		      value (org-trim (or (org-match-string-no-properties 2) "")))
 		(unless (member key excluded)
-		  (push (cons key (or value "")) props)))))
+		  (push (cons key (or value "")) props))))
+	    (when org-use-property-inheritance
+	      (setq props (append org-file-properties props)
+		    props (append org-global-properties props)
+		    props (append org-global-properties-fixed props))))
 	  (if clocksum
 	      (push (cons "CLOCKSUM"
 			  (org-columns-number-to-string (/ (float clocksum) 60.)

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

* Re: (org-entry-properties nil 'all) does not return inherited properties
  2010-03-22 21:56       ` Holger Macht
@ 2010-03-22 22:34         ` Emilio Jesús Gallego Arias
  2010-03-24 12:37         ` Carsten Dominik
  1 sibling, 0 replies; 7+ messages in thread
From: Emilio Jesús Gallego Arias @ 2010-03-22 22:34 UTC (permalink / raw)
  To: emacs-orgmode

Holger Macht <holger@homac.de> writes:

> This does exactly what I want, thanks for the pointer. However, I'm
> missing the overview to know what impact this might have. Just for
> reference:

IMHO, this change should be safe to include.

Regards,
Emilio

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

* Re: Re: (org-entry-properties nil 'all) does not return inherited properties
  2010-03-22 21:56       ` Holger Macht
  2010-03-22 22:34         ` Emilio Jesús Gallego Arias
@ 2010-03-24 12:37         ` Carsten Dominik
  1 sibling, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2010-03-24 12:37 UTC (permalink / raw)
  To: Holger Macht; +Cc: Emilio Jesús Gallego Arias, emacs-orgmode


On Mar 22, 2010, at 10:56 PM, Holger Macht wrote:

> On Mon 22. Mar - 21:07:43, Emilio Jesús Gallego Arias wrote:
>> Holger Macht <holger@homac.de> writes:
>>
>>> On Mo 22. Mär - 18:44:38, Emilio Jesús Gallego Arias wrote:
>>>> Holger Macht <holger@homac.de> writes:
>>>>
>>>>> (org-entry-properties nil 'all) does not return inherited  
>>>>> properties
>>>>> added with a file directive like that:
>>>>>
>>>>> #+PROPERTY: propkey propval
>>>>>
>>>>> Is this by intention? If so, is there a method to get all the  
>>>>> properties
>>>>> of an item, also inherited ones?
>>>>>
>>>>> Currently I was just able to find (org-entry-get), but this only  
>>>>> returns
>>>>> one specific property of which I need to know the name.
>>>>
>>>> See:
>>>>
>>>> ,----[ C-h v org-use-property-inheritance RET ]
>>>
>>> Have you tried? At least this doesn't have an effect on
>>> (org-entry-properties in current git head.
>>
>> Sorry Holger I misunderstood your question. I guess you should modify
>> org-entry-properties in order to include global properties like is  
>> done
>> in the inheritance case.
>
> This does exactly what I want, thanks for the pointer. However, I'm
> missing the overview to know what impact this might have. Just for
> reference:
>
> ---
> diff --git a/lisp/org.el b/lisp/org.el
> index aa22309..ce57451 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -12663,7 +12663,11 @@ things up because then unnecessary parsing  
> is avoided."
> 		(setq key (org-match-string-no-properties 1)
> 		      value (org-trim (or (org-match-string-no-properties 2) "")))
> 		(unless (member key excluded)
> -		  (push (cons key (or value "")) props)))))
> +		  (push (cons key (or value "")) props))))
> +	    (when org-use-property-inheritance
> +	      (setq props (append org-file-properties props)
> +		    props (append org-global-properties props)
> +		    props (append org-global-properties-fixed props))))
> 	  (if clocksum
> 	      (push (cons "CLOCKSUM"
> 			  (org-columns-number-to-string (/ (float clocksum) 60.)
>

On Mar 22, 2010, at 11:34 PM, Emilio Jesús Gallego Arias wrote:

> Holger Macht <holger@homac.de> writes:
>
>> This does exactly what I want, thanks for the pointer. However, I'm
>> missing the overview to know what impact this might have. Just for
>> reference:
>
> IMHO, this change should be safe to include.
>


Hi Holger, hi Emilio,

this is a good attempt at creating a function that gives all
properties of an entry including inherited ones.  However,
there are problems:

1. org-entry-properties is not supposed to give this result.
    It only returns what is present in the entry itself
    (yes, with ALLTAGS being the one exception)

2. The change is still not complete, because it will miss
    properties defined in in the parents and grandparents.

I would accept a patch that introduces a new function for this
purpose.  This function would start with calling org-entry-properties,
then it would walk the hierarchy using org-up-heading-safe, call
org-entry-properties at each stop and add the properties that
are not present yet and that satisfy org-property-inherit-p.
Finally, it would add file and global properties, as you did
in your patch.

Emilio, if Holgers patch was enough for you, just define
a separate function doing the adding of file and global properties
for you.

Finally, please note that property inheritance can slow down things,
so make sure to call these functions as little as possible in your code.

HTH

- Carsten






>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-03-24 20:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-22 15:01 (org-entry-properties nil 'all) does not return inherited properties Holger Macht
2010-03-22 17:44 ` Emilio Jesús Gallego Arias
2010-03-22 18:06   ` Holger Macht
2010-03-22 20:07     ` Emilio Jesús Gallego Arias
2010-03-22 21:56       ` Holger Macht
2010-03-22 22:34         ` Emilio Jesús Gallego Arias
2010-03-24 12:37         ` Carsten Dominik

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).