From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: (org-entry-properties nil 'all) does not return inherited properties Date: Wed, 24 Mar 2010 13:37:30 +0100 Message-ID: <6B684A45-DD70-4A60-B2A2-18D508727557@gmail.com> References: <20100322150100.GA21387@homac> <877hp48d4p.fsf@baal.ls.fi.upm.es> <20100322180630.GB26505@homac> <87vdcodss0.fsf@babel.ls.fi.upm.es> <20100322215622.GC26505@homac> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NuWrS-0000Gp-9Y for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 16:07:30 -0400 Received: from [140.186.70.92] (port=35981 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NuWrP-0000FO-J9 for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 16:07:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NuWrN-0004Gh-HM for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 16:07:27 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:43521) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NuWrN-0004FT-Cx for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 16:07:25 -0400 Received: by mail-ew0-f216.google.com with SMTP id 8so48223ewy.8 for ; Wed, 24 Mar 2010 13:07:25 -0700 (PDT) In-Reply-To: <20100322215622.GC26505@homac> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Holger Macht Cc: =?ISO-8859-1?Q?Emilio_Jes=FAs_Gallego_Arias?= , emacs-orgmode@gnu.org On Mar 22, 2010, at 10:56 PM, Holger Macht wrote: > On Mon 22. Mar - 21:07:43, Emilio Jes=FAs Gallego Arias wrote: >> Holger Macht writes: >> >>> On Mo 22. M=E4r - 18:44:38, Emilio Jes=FAs Gallego Arias wrote: >>>> Holger Macht writes: >>>> >>>>> (org-entry-properties nil 'all) does not return inherited =20 >>>>> 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 =20 >>>>> properties >>>>> of an item, also inherited ones? >>>>> >>>>> Currently I was just able to find (org-entry-get), but this only =20= >>>>> 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 =20= >> 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 =20= > 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=FAs Gallego Arias wrote: > Holger Macht 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