From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Use of attribute :parent in org-element.el
Date: Fri, 19 Apr 2013 15:20:16 +0200 [thread overview]
Message-ID: <871ua6ejxr.fsf@gmail.com> (raw)
Hi List,
while playing around a bit with two quite useful functions from
org-element.el described here
,--------------------------------------------------------------------
| The library ends by furnishing `org-element-at-point' function, and
| a way to give information about document structure around point
| with `org-element-context'.
`--------------------------------------------------------------------
a few questions arose. I used org-outside-org.org from Worg
(http://orgmode.org/worg/org-tutorials/org-outside-org.html) as an
example file, here is an excerpt of its tree-structure:
,----------------------------------
| buffer: org-outside-org.org
| 15:* Introduction
| 46:* Org-mode everywhere
| 50:** File Structuring
| 54:*** Orgstruct
| 94:*** Outline with Outshine [...]
`----------------------------------
Each of the headlines in this file has a property drawer like this:
,-----------------------------
| :PROPERTIES:
| :CUSTOM_ID: file-structuring
| :END:
`-----------------------------
1. Question wrt Attribute :parent
(i) With point before the property-drawer of headline
,--------------------
| ** File Structuring
`--------------------
evaluating this
,-------------------------------------
| (format "%s" (org-element-at-point))
`-------------------------------------
yields
,-----------------------------------------------------------------------
| "(property-drawer (:begin 2381 :end 2438 :hiddenp outline
| :contents-begin 2397 :contents-end 2429 :post-blank 0 :post-affiliated
| 2381 :parent nil))"
`-----------------------------------------------------------------------
(ii) With point before headline
,--------------------
| ** File Structuring
`--------------------
evaluating
,-------------------------------------
| (format "%s" (org-element-at-point))
`-------------------------------------
yields
,---------------------------------------------------------------------
| "(headline (:raw-value File Structuring :begin 2361 :end 11523
| :pre-blank 0 :hiddenp nil :contents-begin 2381 :contents-end 11522
| :level 2 :priority nil :tags nil :todo-keyword nil :todo-type nil
| :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil
| :quotedp nil :CUSTOM_ID file-structuring :CATEGORY worg :title File
| Structuring))"
`---------------------------------------------------------------------
The use of the :parent attribute is surprising for me. I would have
expected something like ':parent org-mode everywhere' in the second
example, i.e. the title of the 1st level subtree containing the 2nd
level headline at point.
I'm not sure what I would have expected in the first example. What is
the parent of an element that is contained in a greater element that has
a parent? Is it nil, or is it the parent of its containing greater
element?
--
cheers,
Thorsten
next reply other threads:[~2013-04-19 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 13:20 Thorsten Jolitz [this message]
2013-04-19 15:07 ` Use of attribute :parent in org-element.el Nicolas Goaziou
2013-04-19 15:37 ` Thorsten Jolitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871ua6ejxr.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.