From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joost Kremers Subject: Re: Programmatically handling org files Date: Mon, 12 Sep 2016 23:22:49 +0200 Message-ID: <87sht4dd92.fsf@fastmail.fm> References: <87twdlcpg8.fsf@fastmail.fm> <87fup5f07e.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjYh2-0007Lc-PL for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 17:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjYgy-0004xP-Kq for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 17:23:08 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:37920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjYgw-0004uW-8d for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 17:23:04 -0400 In-reply-to: <87fup5f07e.fsf@gmail.com> 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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org On Mon, Sep 12 2016, Thorsten Jolitz wrote: > by "non-org Emacs packages" you mean Emacs packages written in Elisp, > but not part of Org-mode? Yes, exactly. My wording wasn't entirely clear, I admit. > The org-mode parser converts an Org document into a nested list and > provides many convenience functions to work on this parse tree. So > org-element.el (and maybe ox.el too) is the core library for converting > an Org text document into an Elisp data structure and working with that, So IIUC org-element.el is mainly for getting the contents of an org buffer in such a way that a program can work with it, but not really for modifying the contents of the buffer itself in such a way that it's still a valid org document, right? > If you feel you don't need the whole parse tree, but rather want to act > locally on the Org element at point, Yes. :-) > you might want to look at > org-dp.el Cool, I will do that! > with just two core functions (create and rewire an Org > element) and a mapping functions (plus quite a few utilities in > org-dp.el and org-dp-lib.el): [snip example] > Using this system, creating or rewiring an Org Element from Elisp > requires only to define the values of the interpreted parameters, all > the low level stuff (actually creating and inserting the new/modified > element in text form) is left to the interpreters (from org-element.el). > > You just declare what you want and don't worry anymore how it is done > (=> dp stands for declarative programming, in this context at least ;-) That sounds pretty cool, thanks! -- Joost Kremers Life has its moments