[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] get current headline?
From: |
Rasmus |
Subject: |
Re: [O] get current headline? |
Date: |
Sat, 20 Feb 2016 16:45:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hi,
Matt Price <address@hidden> writes:
> I feel like I should know how to do this -- how od I retrieve the current
> headline as an org-element object?
>
> context: I want to take a headline like this
>
> ** Jane Doe
> - demonstrates an understanding of research topic :: yes
> - Annotated Bibliography :: very nicely done
> - Grammar and Spelling :: no major problems, but see inline comments
> - Further Comments :: see file
> - Grade :: A
>
> And set the headline's "GRADE" property to the value of the "- Grade ::"
> line. But, I want to make sure that I'm still in the current headline when
> I set the property (rather than accidentally navigating to the next
> headline, because the current headline doesn't contain a "- Grade ::" lin).
>
> Tanks as always for the help! I'm pretty sure I've asked this question
> before but can't find the answer...
Would this do what you want?
(save-excursion
(org-back-to-heading)
(org-element-at-point))
If you have a more sophisticated parse tree you could use
org-element-lineage.
Rasmus
--
Don't slow down Johnny, leave the Cadillac runnin'