RFC: the patch to `org-babel-remove-inline-result-one-or-many'
removes inline results, too.
Do you see any bad consequences?
On Fri, 30 Jan 2015, Daniele Pizzolli wrote:
Hello Charles,
"Charles C. Berry" writes:
On Fri, 30 Jan 2015, Daniele Pizzolli wrote:
[discussion of extra whitespace bug deleted]
There is now a bugfix on master. I've also added 'interactive' to
`org-babel-remove-inline-result'.
Is there a way to evaluate a buffer an then remove inline results or
better, to get the very same buffer after:
Yes.
See attached patch which should clean *all* results (except `raw' results)
from a buffer when `org-babel-remove-result-one-or-many' is called with a
prefix.
Before pushing this, I'd like some feedback on the wisdom of doing what
the patch does.
Wwhy not have also
org-babel-remove-inline-result-one-or-many and
org-babel-remove-all-result-one-or-many to remove all the babel result
with one function call?
Easy enough, but is this really needed? What about call block/line
results?
This is useful for me because I want to easily discard the results to
have the commit with only the changes in the source. I hope others find
this a reasonable facility. It is like a 'make clean' for your org
files.
I think extending `org-babel-remove-all-result-one-or-many' to cover
inline results is innocuous. So if nobody raises an objection, I will
push the patch.
I got that you want to clean up your buffer. But an issue with adding
more functions is 'feature bloat'. If you really need
`org-babel-remove-result-all' and
`org-babel-remove-inline-result-one-or-many' you can have private
functions.
Patch attached.
Thank you.
Regarding patches, if you haven't signed FSF copyright papers a TINYCHANGE
is needed in the commit message.
I am not sure about the default of discarding keyword
Deleting the result line can cause some disorder, but it is the default
in org-babel-remove-result. Also the naming can be confusing.
Alas. Then there is the user error I have made of re-using names.
Best,
Chuck
From af94ed1c07a914ba686076c83a08f80c3b21c32b Mon Sep 17 00:00:00 2001
From: Charles Berry <ccbe...@ucsd.edu>
Date: Fri, 30 Jan 2015 19:14:51 -0800
Subject: [PATCH 2/2] ob-core.el: `org-babel-remove-result-one-or-many' removes
inline results
* ob-core.el (org-babel-remove-result-one-or-many): Remove all results
of babel executables, including inline results.
---
lisp/ob-core.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index ceda1aa..6c8a587 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2339,13 +2339,16 @@ Leading whitespace is trimmed."
(org-element-property :post-blank el)))))))))
(defun org-babel-remove-result-one-or-many (x)
- "Remove the result of the current source block.
-If called with a prefix argument, remove all result blocks
-in the buffer."
+ "Remove the result of the current (inline) source block.
+If called with a prefix argument, remove all result blocks and
+macros in the buffer."
(interactive "P")
(if x
- (org-babel-map-src-blocks nil (org-babel-remove-result))
- (org-babel-remove-result)))
+ (org-babel-map-executables nil
+ (org-babel-remove-result)
+ (org-babel-remove-inline-result))
+ (org-babel-remove-result)
+ (org-babel-remove-inline-result)))
(defun org-babel-result-end ()
"Return the point at the end of the current set of results."
--
1.9.3 (Apple Git-50)