From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: question on org-element-interpret-data and when it works Date: Mon, 26 Feb 2018 11:10:13 +0100 Message-ID: <87k1v0ysca.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqFjh-0003Ea-Ih for emacs-orgmode@gnu.org; Mon, 26 Feb 2018 05:10:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqFjd-0008S4-Bz for emacs-orgmode@gnu.org; Mon, 26 Feb 2018 05:10:21 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:41606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqFjc-0008Rd-Va for emacs-orgmode@gnu.org; Mon, 26 Feb 2018 05:10:17 -0500 In-Reply-To: (John Kitchin's message of "Sun, 25 Feb 2018 16:12:14 -0800") 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: John Kitchin Cc: org-mode-email Hello, John Kitchin writes: > I am trying to find some ways to programatically modify org-elements that > use fewer regexps and motion commands. It seems like org-dp ( > https://github.com/tj64/org-dp) was intended to do that but it is not clear > enough how you might use it, and it also doesn't seem to support > plain-lists yet. [...] > It works on some things, e.g. headlines, src blocks. I put the point on one > of those things, run this command, and then I can paste it somewhere to see > that it did indeed work. > > But, it does not work on plain-lists, or paragraphs. I either get an empty > string, or Wrong type argument: char-or-string-p, nil > > Is it possible to do what I am describing? Am I just missing how to get the > element data in the right form? You cannot change a non-terminal element without changing its contents. In particular plain-lists, tables and paragraphs are fully defined by their contents, i.e., they do not decorate contents like headlines. In this case, data returned by `org-element-context' is incomplete in this case. You probably need to parse the buffer between :begin and :end and modify structure recursively. Regards, -- Nicolas Goaziou