From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joost Kremers Subject: Get the text of a node Date: Wed, 23 Oct 2019 10:54:28 +0200 Message-ID: <877e4vj0zf.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:60435) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNFT9-00070f-LX for emacs-orgmode@gnu.org; Wed, 23 Oct 2019 08:10:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNFT8-0007Ev-Ii for emacs-orgmode@gnu.org; Wed, 23 Oct 2019 08:10:27 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:35649) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNFT7-0007Dj-3E for emacs-orgmode@gnu.org; Wed, 23 Oct 2019 08:10:25 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B047E21C29 for ; Wed, 23 Oct 2019 08:10:22 -0400 (EDT) Received: from Swift.fastmail.com (ip5f5ac91d.dynamic.kabel-deutschland.de [95.90.201.29]) by mail.messagingengine.com (Postfix) with ESMTPA id E928B80062 for ; Wed, 23 Oct 2019 08:10:21 -0400 (EDT) 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" To: emacs-orgmode@gnu.org Hi all, I was wondering if there's a way to programmatically get the text of a node in an Org buffer. Basically, I have a buffer that looks something like this: #+BEGIN_SRC org * Top header ** Subheader :PROPERTIES: :Custom_ID: some_id :END: Text starts here, possibly with additional subheaders #+END_SRC What I would like to extract is the text below "Subheader", but without the :PROPERTIES: block. I've looked at the org-element library, but I haven't been able to figure out how to use it to extract just the plain text. I use the :Custom_ID: property to find the relevant subheading and I know I can use (org-back-to-heading) to get point to the Subheader containing the relevant :PROPERTIES: block. Obviously, I could then narrow the buffer to the subheader, use a text search to move point past the line containing :END: and then extract the text from there until (point-max). I'm just wondering if this may break in unexpected circumstances and whether there's a better way. TIA Joost -- Joost Kremers Life has its moments