From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martyn Jago Subject: Re: [babel][patch] provide consistent result removal (type `wrap') Date: Tue, 24 Jan 2012 16:18:57 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpj5i-00050g-Bi for emacs-orgmode@gnu.org; Tue, 24 Jan 2012 11:19:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rpj5b-0008Jj-A3 for emacs-orgmode@gnu.org; Tue, 24 Jan 2012 11:19:26 -0500 Received: from lo.gmane.org ([80.91.229.12]:53708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpj5a-0008Jc-SA for emacs-orgmode@gnu.org; Tue, 24 Jan 2012 11:19:19 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rpj5Y-0005hU-4h for emacs-orgmode@gnu.org; Tue, 24 Jan 2012 17:19:16 +0100 Received: from 88-96-171-142.dsl.zen.co.uk ([88.96.171.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 Jan 2012 17:19:16 +0100 Received: from martyn.jago by 88-96-171-142.dsl.zen.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 Jan 2012 17:19:16 +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: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain [...] Oops - patch provided at start of this thread is malformed and should be ignored. The correct patch is provided below for consideration. Apologies for the noise. Best, Martyn Martyn Jago writes: > Patch to fix `org-babel-result-end' command to provide consistent result > removal where result is type `wrap' --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-org-babel-result-end-command-to-provide-consiste.patch Content-Description: fix org-babel-result-end command result type wrap >From 7b6f37164848931321c0f25d567cf65df2e5a4af Mon Sep 17 00:00:00 2001 From: Martyn Jago Date: Tue, 24 Jan 2012 16:12:29 +0000 Subject: [PATCH] Fix `org-babel-result-end' command to provide consistent result removal where result is type `wrap'. * lisp/ob.el: Fix `org-babel-result-end' command to provide consistent result removal where result is type `wrap'. Prior to this fix multiple (org-ctrl-c-ctrl-c) commands will add multiple newlines to the end of results (one newline per block execution). This fixes the test `test-ob/org-babel-remove-result--results-wrap' * testing/lisp/test-ob.el: Uncomment test since it now passes. --- lisp/ob.el | 3 ++- testing/lisp/test-ob.el | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index e8a6d88..4541226 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -1920,7 +1920,8 @@ code ---- the results are extracted in the syntax of the source (prvs (org-list-prevs-alist struct))) (org-list-get-list-end (point-at-bol) struct prvs))) ((looking-at "^\\([ \t]*\\):RESULTS:") - (re-search-forward (concat "^" (match-string 1) ":END:"))) + (progn (re-search-forward (concat "^" (match-string 1) ":END:")) + (forward-char 1) (point))) (t (let ((case-fold-search t)) (if (looking-at (concat "[ \t]*#\\+begin_\\([^ \t\n\r]+\\)")) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 178556e..7dccd22 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -771,20 +771,20 @@ replacement happens correctly." * next heading")) -;; TODO FIXME Activate when Eric's trailing newline fix has been committed -;; (ert-deftest test-ob/org-babel-remove-result--results-wrap () -;; (test-ob-verify-result-and-removed-result -;; ":RESULTS: -;; hello there -;; :END:" -;; -;; "* org-babel-remove-result -;; -;; +begin_src emacs-lisp :results wrap -;; \"hello there\" -;; #+end_src -;; -;; * next heading")) +(ert-deftest test-ob/org-babel-remove-result--results-wrap () + "Test `org-babel-remove-result' with :results wrap." + (test-ob-verify-result-and-removed-result + ":RESULTS: +hello there +:END:" + + "* org-babel-remove-result + +#+begin_src emacs-lisp :results wrap +\"hello there\" +#+end_src + +* next heading")) (ert-deftest test-ob/org-babel-remove-result--results-org () "Test `org-babel-remove-result' with :results org." -- 1.7.3.4 --=-=-= Content-Type: text/plain . --=-=-=--