From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: get current headline? Date: Sat, 20 Feb 2016 16:45:04 +0100 Message-ID: <87fuwn9yin.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX9ii-0000IR-Vw for emacs-orgmode@gnu.org; Sat, 20 Feb 2016 10:45:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aX9id-0004d6-D8 for emacs-orgmode@gnu.org; Sat, 20 Feb 2016 10:45:18 -0500 Received: from plane.gmane.org ([80.91.229.3]:60881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX9id-0004co-6t for emacs-orgmode@gnu.org; Sat, 20 Feb 2016 10:45:15 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aX9iZ-000751-LF for emacs-orgmode@gnu.org; Sat, 20 Feb 2016 16:45:11 +0100 Received: from x590d70c8.dyn.telefonica.de ([89.13.112.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Feb 2016 16:45:11 +0100 Received: from rasmus by x590d70c8.dyn.telefonica.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Feb 2016 16:45:11 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, Matt Price 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'