From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thibault Marin Subject: Preserving links when using org-element-interpret-data Date: Wed, 05 Oct 2016 23:14:30 -0500 Message-ID: <87vax62jx5.fsf@dell-desktop.WORKGROUP> Reply-To: thibault.marin@gmx.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs04v-0000Fd-Jg for emacs-orgmode@gnu.org; Thu, 06 Oct 2016 00:14:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bs04q-0004YH-Go for emacs-orgmode@gnu.org; Thu, 06 Oct 2016 00:14:41 -0400 Received: from mout.gmx.net ([212.227.17.21]:50776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs04q-0004Xk-7R for emacs-orgmode@gnu.org; Thu, 06 Oct 2016 00:14:36 -0400 Received: from dell-desktop ([99.47.196.62]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LejNC-1b79Sp0ZsU-00qOeH for ; Thu, 06 Oct 2016 06:14:33 +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" To: emacs-orgmode@gnu.org Hi all, I am trying to use the org-element tools to modify an org file from elisp code and I was wondering if the `org-element-parse-buffer' / `org-element-interpret-data' combo should result in the same content as the original buffer. I am having issues with links where the target and the description are both =file:= entries. My original org looks like this: #+NAME: org-data #+begin_example ,#+TITLE: test [[file:a.png][file:a.png]] #+end_example The elisp code parses the org file and outputs the result from `org-element-interpret-data': #+NAME: org-interpret #+BEGIN_SRC emacs-lisp :var org-data=org-data :results verbatim (let (org-tree) (with-temp-buffer (insert org-data) (setq org-tree (org-element-parse-buffer))) (org-element-interpret-data org-tree)) #+END_SRC #+RESULTS: org-interpret : "#+TITLE: test : : [[file:a.png][[[file:a.png]]]] : " The input link is transformed from #+begin_example [[file:a.png][file:a.png]] #+end_example to #+begin_example [[file:a.png][[[file:a.png]]]] #+end_example Are the additional brackets in the description expected? Is there any way to achieve what I want: I am trying to get org-element-interpret-data to output the same link syntax as the input (in my real application, I am changing the filename). Thanks in advance for the help. P.S.: Here is my version information: #+BEGIN_SRC emacs-lisp :results drawer (concat (emacs-version) "\n" (replace-regexp-in-string "@.*)" "@ ... )" (org-version nil t))) #+END_SRC #+RESULTS: :RESULTS: GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5) of 2016-09-05 on trouble, modified by Debian Org-mode version 8.3.6 (release_8.3.6-1179-ga9ae0e @ ... ) :END: