summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2013-09-20 15:07:15 -0600
committerEric Schulte <schulte.eric@gmail.com>2013-09-20 15:09:43 -0600
commit136bdc0e83358fa3f6af1d8b3b0cd71cace61efe (patch)
tree434b3a4b81dc90ae594c108c76d7efb6e5e2b20a
parent32315be4da09c00602b60236a638f01545ca319c (diff)
downloadorg-mode-136bdc0e83358fa3f6af1d8b3b0cd71cace61efe.tar.gz
org-babel-remove-result option keep result keyword
This patch is based off of a request and an initial patch supplied by Daniele Pizzolli. * lisp/ob-core.el (org-babel-remove-result): Added an option to keep the results keyword when removing the content of results.
-rw-r--r--lisp/ob-core.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index cc6b7a9..e2404c1 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2159,15 +2159,17 @@ code ---- the results are extracted in the syntax of the source
(set-marker visible-beg nil)
(set-marker visible-end nil))))))
-(defun org-babel-remove-result (&optional info)
+(defun org-babel-remove-result (&optional info keep-keyword)
"Remove the result of the current source block."
(interactive)
- (let ((location (org-babel-where-is-src-block-result nil info)) start)
+ (let ((location (org-babel-where-is-src-block-result nil info)))
(when location
- (setq start (- location 1))
(save-excursion
- (goto-char location) (forward-line 1)
- (delete-region start (org-babel-result-end))))))
+ (goto-char location)
+ (when (looking-at org-babel-result-regexp)
+ (delete-region
+ (if keep-keyword (1+ (match-end 0)) (match-beginning 0))
+ (progn (forward-line 1) (org-babel-result-end))))))))
(defun org-babel-result-end ()
"Return the point at the end of the current set of results."