From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: [BUG] in `org-element-interpret-data' Date: Thu, 07 Aug 2014 11:15:14 +0200 Message-ID: <87iom4acf1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFJnT-0005HG-9u for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 05:15:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFJnL-0003Uc-JT for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 05:15:43 -0400 Received: from plane.gmane.org ([80.91.229.3]:50431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFJnL-0003SQ-74 for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 05:15:35 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XFJnG-0006Ea-7J for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 11:15:30 +0200 Received: from g231105104.adsl.alicedsl.de ([92.231.105.104]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Aug 2014 11:15:30 +0200 Received: from tjolitz by g231105104.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Aug 2014 11:15:30 +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 Hi List, when interpreting Org elements (type src-block) I frequently encounter the case that the '#+end_src' delimter is not placed on a newline but rather attached to the src-block's value without a linefeed in between. I then have to append a "\n" to the src-block value to make things work, but thats not a nice thing and causes problems in other places. The "\n" should be set by the framework. I think adding something like this at the end of the interpreter-function could solve the problem, but this came out of try-and-error only: #+begin_src emacs-lisp ((( [...] (org-escape-code-in-string value) ;; check for newline (save-match-data (if (looking-at "^$") "" "\n")) "#+END_SRC"))) #+end_src The problem seems to appear a bit randomly, but using my new function #+begin_src emacs-lisp ;; might become `org-element-create' (defun* tj/create-element (&optional insert-p &rest args &key (type 'headline) &allow-other-keys) "Create Org element, maybe insert at point." (let ((strg (org-element-interpret-data (list type args)))) (if insert-p (insert strg) strg))) #+end_src #+results: : tj/create-element I can give an the following example #+begin_src emacs-lisp :results raw (tj/create-element nil :type 'src-block :language "emacs-lisp" :value "(+ 2 2)") #+end_src #+results: #+BEGIN_SRC emacs-lisp (+ 2 2)#+END_SRC -- cheers, Thorsten