* [babel][patch] provide consistent result removal (type `wrap')
@ 2012-01-24 15:53 Martyn Jago
2012-01-24 16:18 ` Martyn Jago
2012-01-24 16:22 ` Eric Schulte
0 siblings, 2 replies; 4+ messages in thread
From: Martyn Jago @ 2012-01-24 15:53 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
Patch to 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 patch also fixes the test
`test-ob/org-babel-remove-result--results-wrap' which is uncommented in
the patch.
Best, Martyn
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: provide consistent result removal (type `wrap') --]
[-- Type: text/x-patch, Size: 2488 bytes --]
From a4b2f8484ec4810e7a891b4db0caf5463e96a58d Mon Sep 17 00:00:00 2001
From: Martyn Jago <martyn.jago@btinternet.com>
Date: Tue, 24 Jan 2012 15:39:30 +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..895a5b6 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))
(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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [babel][patch] provide consistent result removal (type `wrap')
2012-01-24 15:53 [babel][patch] provide consistent result removal (type `wrap') Martyn Jago
@ 2012-01-24 16:18 ` Martyn Jago
2012-01-24 16:37 ` Eric Schulte
2012-01-24 16:22 ` Eric Schulte
1 sibling, 1 reply; 4+ messages in thread
From: Martyn Jago @ 2012-01-24 16:18 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
[...]
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 <martyn.jago@btinternet.com> writes:
> Patch to fix `org-babel-result-end' command to provide consistent result
> removal where result is type `wrap'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix org-babel-result-end command result type wrap --]
[-- Type: text/x-patch, Size: 2496 bytes --]
From 7b6f37164848931321c0f25d567cf65df2e5a4af Mon Sep 17 00:00:00 2001
From: Martyn Jago <martyn.jago@btinternet.com>
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
[-- Attachment #3: Type: text/plain, Size: 4 bytes --]
.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [babel][patch] provide consistent result removal (type `wrap')
2012-01-24 15:53 [babel][patch] provide consistent result removal (type `wrap') Martyn Jago
2012-01-24 16:18 ` Martyn Jago
@ 2012-01-24 16:22 ` Eric Schulte
1 sibling, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2012-01-24 16:22 UTC (permalink / raw)
To: Martyn Jago; +Cc: emacs-orgmode
Martyn Jago <martyn.jago@btinternet.com> writes:
> Patch to 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 patch also fixes the test
> `test-ob/org-babel-remove-result--results-wrap' which is uncommented in
> the patch.
>
> Best, Martyn
>
Hi Martyn,
Thanks for the patch I tried to apply it and it generated a syntax error
(missing paren). I then re-placed the missing paren (at least where I
thought it would be) and re-ran the test suite to many new failures.
Could you resubmit?
Thanks,
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel][patch] provide consistent result removal (type `wrap')
2012-01-24 16:18 ` Martyn Jago
@ 2012-01-24 16:37 ` Eric Schulte
0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2012-01-24 16:37 UTC (permalink / raw)
To: Martyn Jago; +Cc: emacs-orgmode
Applied, Thanks,
Martyn Jago <martyn.jago@btinternet.com> writes:
> [...]
>
>
> 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 <martyn.jago@btinternet.com> writes:
>
>> Patch to fix `org-babel-result-end' command to provide consistent result
>> removal where result is type `wrap'
>
> .
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-24 16:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24 15:53 [babel][patch] provide consistent result removal (type `wrap') Martyn Jago
2012-01-24 16:18 ` Martyn Jago
2012-01-24 16:37 ` Eric Schulte
2012-01-24 16:22 ` Eric Schulte
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.