From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Programmatically handling org files Date: Mon, 12 Sep 2016 09:47:27 -0400 Message-ID: References: <87twdlcpg8.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjRbX-0002Hq-JA for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 09:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjRbS-0002aD-KZ for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 09:48:58 -0400 Received: from mail-qk0-f176.google.com ([209.85.220.176]:35433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjRbS-0002Oj-GG for emacs-orgmode@gnu.org; Mon, 12 Sep 2016 09:48:54 -0400 Received: by mail-qk0-f176.google.com with SMTP id t7so38865951qkh.2 for ; Mon, 12 Sep 2016 06:48:31 -0700 (PDT) In-reply-to: <87twdlcpg8.fsf@fastmail.fm> 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: Joost Kremers Cc: org mode Joost Kremers writes: > Hi all, > > I was wondering if there is some sort of (semi)official API for handling > org files programmatically. That's to say, is there a documented way for > non-org Emacs packages to manipulate (the contents of) org files? None that I know of. A non-elisp lib would have to be able to parse the org-files. The grammar of org-files is documented here: http://orgmode.org/worg/dev/org-syntax.html There are libs that can parse org-mode, e.g. http://orgmode.org/worg/org-tools/, some of them may also be able modify the files. The elisp org libraries are light years ahead of them though for what you describe. > Specifically, I'm wondering about creating and deleting entries (by > entries I mean headers with their contents), changing TODO state, moving > entries, that sort of thing. > > Also, I was wondering if there's a way to hook into org-store-link. For > a particular major mode, I would like to be able to define what kind of > link is created when the user calls `org-store-link`. I looked at the > source of `org-store-link` and it looks like the answer is no, but I > thought I'd ask anyway. I could of course create the link myself and add > it to `org-stored-links` but that feels rather hackish and I suspect > will blow up in my face at some point in the future. You want to add a function to org-store-link-functions. The function should check if it is responsible for creating this link (for example by looking at the major mode). If not, it must exit and return nil. If yes, it should return a non-nil value after a calling `org-store-link-props' with a list of properties and values. > > TIA -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu