* Question about adding to inherited properties
@ 2012-04-18 23:05 Bill Wishon
2012-04-20 0:06 ` Bill Wishon
0 siblings, 1 reply; 4+ messages in thread
From: Bill Wishon @ 2012-04-18 23:05 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]
Hi Org-mode Community,
I can't get the example in section 7.1 of the org-mode manual to work as I
expect. Perhaps someone can help me see what I'm doing wrong.
I tried creating this buffer:
* CD collection
** Classic
:PROPERTIES:
:GENRES: Classic
:END:
*** Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glen Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:GENRES+: Baroque
:END:
Then I set the org-use-property-inheritance variable to include GENRES.
Then I wrote the following function
(defun bill-test (property)
"print all inheirited properties"
(interactive "MProperty: ")
(message (concat property " = " (org-entry-get (point) property t))))
Which prints "GENRES = Baroque" when I run it with the point on Goldberg
Variations, based on the manual I expected this to print "GENRES = Classic
Baroque”.
While I think they should all do the same thing, I also tried the following
ways of calling org-entry-get just in case all with the same result.
(org-entry-get (point) property 'selective)
(org-entry-get nil property t)
(org-entry-get nil property 'selective)
I'm using org-version 7.8.09 on Windows with emacs "GNU Emacs 23.3.1
(i386-mingw-nt6.1.7601) of 2011-03-10 on 3249CTO".
Any pointers about what I'm doing wrong would be great.
Thanks,
~>Bill
[-- Attachment #2: Type: text/html, Size: 1567 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about adding to inherited properties
2012-04-18 23:05 Question about adding to inherited properties Bill Wishon
@ 2012-04-20 0:06 ` Bill Wishon
2012-04-20 4:08 ` Nick Dokos
0 siblings, 1 reply; 4+ messages in thread
From: Bill Wishon @ 2012-04-20 0:06 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3964 bytes --]
First, let me say that I'm only a novice elisp hacker... That said after
spending some time debugging I think there may be a disconnect between the
example in the org-manual and the function org-entry-get-with-inheritance.
The manual shows an example in section 7.1 where a GENRES+ adds to a GENRES
property statement in a parent heading. But the docs and code in the
org-entry-get-with-inheritance function seem to implement a model that only
looks up the outline if you don't find anything on the current heading,
even if it's a "+" property.
(defun org-entry-get-with-inheritance (property &optional literal-nil)
"Get entry property, and search higher levels if not present.
The search will stop at the first ancestor which has the property defined.
If the value found is \"nil\", return nil to show that the property
should be considered as undefined (this is the meaning of nil here).
However, if LITERAL-NIL is set, return the string value \"nil\" instead."
(move-marker org-entry-property-inherited-from nil)
(let (tmp)
(unless (org-before-first-heading-p)
(save-excursion
(save-restriction
(widen)
(catch 'ex
(while t
(when (setq tmp (org-entry-get nil property nil 'literal-nil))
>>> In my previous example when we get here org-entry-get returns the value
of the property GENRES which is "Baroque" and executes the following three
functions including the throw, which stops the loop.
>>> Based on the documentation I would think that this function should
check to see if the current property is a "GENRES+" vs. a "GENRES" property
and continue up the outline looking for more GENRES+ properties and only
stop when we find a plain GENRES or reach the top. This looks like what
the (org-up-heading-safe) below is trying to do, but never gets executed
because org-entry-get returned a positive value of "Baroque" when searching
for GENRES on the current entry.
(org-back-to-heading t)
(move-marker org-entry-property-inherited-from (point))
(throw 'ex tmp))
(or (org-up-heading-safe) (throw 'ex nil)))))))
(setq tmp (or tmp
(cdr (assoc property org-file-properties))
(cdr (assoc property org-global-properties))
(cdr (assoc property org-global-properties-fixed))))
(if literal-nil tmp (org-not-nil tmp))))
Thoughts?
~>Bill
On Wed, Apr 18, 2012 at 4:05 PM, Bill Wishon <bill@wishon.org> wrote:
> Hi Org-mode Community,
>
> I can't get the example in section 7.1 of the org-mode manual to work as I
> expect. Perhaps someone can help me see what I'm doing wrong.
>
> I tried creating this buffer:
>
> * CD collection
> ** Classic
> :PROPERTIES:
> :GENRES: Classic
> :END:
> *** Goldberg Variations
> :PROPERTIES:
> :Title: Goldberg Variations
> :Composer: J.S. Bach
> :Artist: Glen Gould
> :Publisher: Deutsche Grammophon
> :NDisks: 1
> :GENRES+: Baroque
> :END:
>
> Then I set the org-use-property-inheritance variable to include GENRES.
>
> Then I wrote the following function
>
> (defun bill-test (property)
> "print all inheirited properties"
> (interactive "MProperty: ")
> (message (concat property " = " (org-entry-get (point) property t))))
>
> Which prints "GENRES = Baroque" when I run it with the point on Goldberg
> Variations, based on the manual I expected this to print "GENRES = Classic
> Baroque”.
>
> While I think they should all do the same thing, I also tried the
> following ways of calling org-entry-get just in case all with the same
> result.
> (org-entry-get (point) property 'selective)
> (org-entry-get nil property t)
> (org-entry-get nil property 'selective)
>
> I'm using org-version 7.8.09 on Windows with emacs "GNU Emacs 23.3.1
> (i386-mingw-nt6.1.7601) of 2011-03-10 on 3249CTO".
>
> Any pointers about what I'm doing wrong would be great.
>
> Thanks,
> ~>Bill
>
[-- Attachment #2: Type: text/html, Size: 4488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about adding to inherited properties
2012-04-20 0:06 ` Bill Wishon
@ 2012-04-20 4:08 ` Nick Dokos
2012-04-25 2:13 ` Bill Wishon
0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2012-04-20 4:08 UTC (permalink / raw)
To: Bill Wishon; +Cc: eric.schulte, emacs-orgmode
Bill Wishon <bill@wishon.org> wrote:
> First, let me say that I'm only a novice elisp hacker... That said
> after spending some time debugging I think there may be a disconnect
> between the example in the org-manual and the function
> org-entry-get-with-inheritance. The manual shows an example in
> section 7.1 where a GENRES+ adds to a GENRES property statement in a
> parent heading. But the docs and code in the
> org-entry-get-with-inheritance function seem to implement a model that
> only looks up the outline if you don't find anything on the current
> heading, even if it's a "+" property.
> (defun org-entry-get-with-inheritance (property &optional literal-nil)
> "Get entry property, and search higher levels if not present. The
> search will stop at the first ancestor which has the property defined.
> If the value found is \"nil\", return nil to show that the property
> should be considered as undefined (this is the meaning of nil here).
> However, if LITERAL-NIL is set, return the string value \"nil\"
> instead."
> (move-marker org-entry-property-inherited-from nil)
> (let (tmp)
> (unless (org-before-first-heading-p)
> (save-excursion
> (save-restriction
> (widen)
> (catch 'ex
> (while t
> (when (setq tmp (org-entry-get nil property nil 'literal-nil))
>
> >>> In my previous example when we get here org-entry-get returns the
> value of the property GENRES which is "Baroque" and executes the
> following three functions including the throw, which stops the loop.
> >>> Based on the documentation I would think that this function should
> check to see if the current property is a "GENRES+" vs. a "GENRES"
> property and continue up the outline looking for more GENRES+
> properties and only stop when we find a plain GENRES or reach the
> top. This looks like what the (org-up-heading-safe) below is trying
> to do, but never gets executed because org-entry-get returned a
> positive value of "Baroque" when searching for GENRES on the current
> entry.
>
> (org-back-to-heading t)
> (move-marker org-entry-property-inherited-from (point))
> (throw 'ex tmp))
> (or (org-up-heading-safe) (throw 'ex nil)))))))
> (setq tmp (or tmp
> (cdr (assoc property org-file-properties))
> (cdr (assoc property org-global-properties))
> (cdr (assoc property org-global-properties-fixed))))
> (if literal-nil tmp (org-not-nil tmp))))
>
> Thoughts?
>
Eric Schulte (cc:ed) implemented accumulating properties with commit
3af89e696a32afcc39f2e3bdb6132ac588d530ae. The commit adds a function
org-update-property-plist which takes care of the '+' case in property
names. But as you observed, it does not seem to work. I don't really
understand what should be happening: what I do know is that when
org-entry-get calls the above function, the props parameter is nil,
whereas the function expects it to contain the inherited sestting. So it
may be that the function is expecting something that is not going to
happen or org-entry-get passes it the wrong thing somehow. I don't know which
one of these two is correct (or perhaps some other thing is wrong), but
in any case there does seem to be a disconnect.
Nick
> ~>Bill
>
> On Wed, Apr 18, 2012 at 4:05 PM, Bill Wishon <bill@wishon.org> wrote:
>
> Hi Org-mode Community,
>
> I can't get the example in section 7.1 of the org-mode manual to work as I expect. Perhaps
> someone can help me see what I'm doing wrong.
>
> I tried creating this buffer:
>
> * CD collection
> ** Classic
> :PROPERTIES:
> :GENRES: Classic
> :END:
> *** Goldberg Variations
> :PROPERTIES:
> :Title: Goldberg Variations
> :Composer: J.S. Bach
> :Artist: Glen Gould
> :Publisher: Deutsche Grammophon
> :NDisks: 1
> :GENRES+: Baroque
> :END:
>
> Then I set the org-use-property-inheritance variable to include GENRES.
>
> Then I wrote the following function
>
> (defun bill-test (property)
> "print all inheirited properties"
> (interactive "MProperty: ")
> (message (concat property " = " (org-entry-get (point) property t))))
>
> Which prints "GENRES = Baroque" when I run it with the point on Goldberg Variations, based on
> the manual I expected this to print "GENRES = Classic Baroque”.
>
> While I think they should all do the same thing, I also tried the following ways of calling
> org-entry-get just in case all with the same result.
> (org-entry-get (point) property 'selective)
> (org-entry-get nil property t)
> (org-entry-get nil property 'selective)
>
> I'm using org-version 7.8.09 on Windows with emacs "GNU Emacs 23.3.1 (i386-mingw-nt6.1.7601) of
> 2011-03-10 on 3249CTO".
>
> Any pointers about what I'm doing wrong would be great.
>
> Thanks,
> ~>Bill
>
>
> ----------------------------------------------------
> Alternatives:
>
> ----------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about adding to inherited properties
2012-04-20 4:08 ` Nick Dokos
@ 2012-04-25 2:13 ` Bill Wishon
0 siblings, 0 replies; 4+ messages in thread
From: Bill Wishon @ 2012-04-25 2:13 UTC (permalink / raw)
To: nicholas.dokos; +Cc: eric.schulte, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]
I think I fixed the problem, but in reading up on how to contribute I
haven't gotten git setup yet or the FSF contribution form done. Should I
do that first before sharing the patch with the group?
Meanwhile is there some sort of test suite to ensure contributions don't
break existing features?
~>Bill
On Thu, Apr 19, 2012 at 9:08 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Eric Schulte (cc:ed) implemented accumulating properties with commit
> 3af89e696a32afcc39f2e3bdb6132ac588d530ae. The commit adds a function
> org-update-property-plist which takes care of the '+' case in property
> names. But as you observed, it does not seem to work. I don't really
> understand what should be happening: what I do know is that when
> org-entry-get calls the above function, the props parameter is nil,
> whereas the function expects it to contain the inherited sestting. So it
> may be that the function is expecting something that is not going to
> happen or org-entry-get passes it the wrong thing somehow. I don't know
> which
> one of these two is correct (or perhaps some other thing is wrong), but
> in any case there does seem to be a disconnect.
>
> Nick
>
[-- Attachment #2: Type: text/html, Size: 1542 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-25 2:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-18 23:05 Question about adding to inherited properties Bill Wishon
2012-04-20 0:06 ` Bill Wishon
2012-04-20 4:08 ` Nick Dokos
2012-04-25 2:13 ` Bill Wishon
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).