From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] inline source breaks paragraphs Date: Fri, 13 Dec 2013 21:47:25 +0100 Message-ID: <877gb87a1u.fsf@gmail.com> References: <87mwkb7ziz.fsf@med.uni-goettingen.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrZdj-0000ko-Kx for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 15:47:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrZdb-00071D-Rn for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 15:47:15 -0500 Received: from mail-ee0-x22a.google.com ([2a00:1450:4013:c00::22a]:43480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrZdb-00070o-KI for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 15:47:07 -0500 Received: by mail-ee0-f42.google.com with SMTP id e53so1105742eek.1 for ; Fri, 13 Dec 2013 12:47:06 -0800 (PST) In-Reply-To: <87mwkb7ziz.fsf@med.uni-goettingen.de> (Andreas Leha's message of "Sun, 08 Dec 2013 23:23:32 +0100") 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: Andreas Leha Cc: emacs-orgmode@gnu.org, Eric Schulte --=-=-= Content-Type: text/plain Hello, Andreas Leha writes: > inline source -- when on its own line -- breaks the paragraph, which is > unexpected. > > Here is a test file: > > * Test > > This is a broken > src_R[:exports results :results raw]{10} > paragraph. > > > Here is (the relevant part of) the output of the LaTeX export: > > ,---- > | \section{Test} > | \label{sec-1} > | > | This is a broken > | 10 > | > | paragraph. > `---- The attached patch solves the problem. It may be a bit intrusive, though. Eric, what do you think? Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ob-core-Preserve-paragraph-when-evaluating-inline-bl.patch >From 8ec02a2fa79b8601565ca7b226b8c1e4790f3439 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 13 Dec 2013 21:40:33 +0100 Subject: [PATCH] ob-core: Preserve paragraph when evaluating inline blocks * lisp/ob-core.el (org-babel-insert-result): Trim whitespaces around results from inline source blocks. --- lisp/ob-core.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 84caed7..a6945e4 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2048,12 +2048,14 @@ code ---- the results are extracted in the syntax of the source (or (> visible-beg existing-result) (<= visible-end existing-result)))) beg end) - (when (and (stringp result) ; ensure results end in a newline - (not inlinep) - (> (length result) 0) - (not (or (string-equal (substring result -1) "\n") - (string-equal (substring result -1) "\r")))) - (setq result (concat result "\n"))) + ;; Ensure inline results never end with a newline, but regular + ;; results always do. + (cond ((not (stringp result))) + (inlinep (setq result (org-babel-trim result))) + ((and (> (length result) 0) + (not (or (string-equal (substring result -1) "\n") + (string-equal (substring result -1) "\r")))) + (setq result (concat result "\n")))) (unwind-protect (progn (when outside-scope-p (widen)) -- 1.8.5.1 --=-=-=--