From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: How to change a link? Date: Thu, 16 Oct 2014 00:28:51 +0200 Message-ID: <874mv5ynks.fsf@gmail.com> References: <87a94yjia9.fsf@wmi.amu.edu.pl> <87zjcxzttn.fsf@gmail.com> <878ukhk6f1.fsf@wmi.amu.edu.pl> <87iojlzm4k.fsf@gmail.com> <877g01joiw.fsf@wmi.amu.edu.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeX49-00044Q-Hi for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 18:29:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeX44-0005vY-7z for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 18:29:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:45283) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeX44-0005v6-1m for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 18:29:04 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XeX42-0000rQ-5X for emacs-orgmode@gnu.org; Thu, 16 Oct 2014 00:29:02 +0200 Received: from e178189238.adsl.alicedsl.de ([85.178.189.238]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Oct 2014 00:29:02 +0200 Received: from tjolitz by e178189238.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Oct 2014 00:29:02 +0200 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 Marcin Borkowski writes: > I see. What is the most interesting for me is the idea of > getting/setting properties, that's what I was looking for. Thats exactly what org-dp (https://github.com/tj64/org-dp) is about: getting and setting element properties instead of working on the textual representation in the buffer. Here the commentary section of org-dp.el: ,---- | ** Commentary | | Functions for declarative local programming with Org elements. They | allow to declare what should be done and leave the low-level work, | the "how-to", to the Org parser/interpreter framework. | | With other words, org-dp acts on the internal representation of Org | elements rather than on their textual representation, and leaves | the transformation between both representations to the | parser/interpreter framework. To create or modify an element, you | call the parser to open it up, rewire its internals, and then call | the interpreter to build the element again based on its modified | internals. | | Since all Org elements are uniformely represented as nested lists | internally, with their properties stored as key-val pairs in | plists, they can be treated in a much more uniform way when dealing | with the internal representation instead of the highly variable | textual representations. A big advantage of plists is that only | those properties that are actually accessed matter, so when | transforming one Org element into another on the internal level one | does not have to worry about not matching properties as long as | these are not used by the interpreter when building the textual | representation of the transformed element. | | Library org-dp is meant for programming at the local level, | i.e. without any (contextual) information except those about the | parsed element at point. It is designed to make using the Org-mode | parser/interpreter framework at local level as convenient as using | it at the global level (with a complete parse-tree produced by | `org-element-parse-buffer` available). It takes care of the | org-element caching mechanism in that it only acts on copies of the | locally parsed elements at point, never on the original parsed (and | cached) object itself. `---- With just a few functions: ,---- | (defun* org-dp-create (elem-type &optional contents insert-p | affiliated &rest args) | | (defun* org-dp-rewire (elem-type &optional contents replace | affiliated element &rest args) | | (defun org-dp-map (fun-with-args rgxp &optional match-pos | backward-search-p beg end silent-p) | | (defun org-dp-contents (&optional element interpret-p no-properties-p) | | (defun* org-dp-prompt (&optional elem elem-lst &key noprompt- [...] `---- you can do almost all you local Org programming (i.e. doing stuff "at-point" without the need for a complete parse-tree) by getting and setting element properties, thats why I called the library ,---- | org-dp.el --- Declarative Local Programming with Org Elements `---- it allows to leave most of the low-level parsing and interpreting stuff to the parser framework, you only need to 'declare' the element-type and the property values to create or modify elements. -- cheers, Thorsten