summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Berry <ccberry@ucsd.edu>2015-01-30 19:27:54 -0800
committerCharles Berry <ccberry@ucsd.edu>2015-01-30 19:27:54 -0800
commit37fc8667e08bb1fbfd238de28b53bf484d67f9fb (patch)
tree573915d38b418ed9bef3750c12d6d8d236d0dd52
parentfe63e59faf7bf9cefc2b48cc9708d611b3f85f8f (diff)
downloadorg-mode-37fc8667e08bb1fbfd238de28b53bf484d67f9fb.tar.gz
ob-core.el: inline src block removal bugfix
* ob.core.el (org-babel-remove-inline-result): Removing an inline src block result removes all whitespace preceding it. The function is now `interactive'. * ob-core.el (org-babel-insert-result): The call to `org-babel-remove-inline-result' preceeds insertion of whitespace and setting location of local variable `inlinep'. Daniele Pizzolli reported that cleaning a buffer by evaluating `org-babel-remove-inline-result' can leave unwanted whitespace. That bug is fixed, and the function is made `interactive'.
-rw-r--r--lisp/ob-core.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index fcc44c1..ceda1aa 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2144,12 +2144,12 @@ INFO may provide the values of these header arguments (in the
(when (or (org-babel-get-inline-src-block-matches)
(org-babel-get-lob-one-liner-matches))
(goto-char (match-end 0))
+ (org-babel-remove-inline-result)
(insert " ")
(point))))
- (existing-result (if inlinep
- (org-babel-remove-inline-result)
- (org-babel-where-is-src-block-result
- t info hash indent)))
+ (existing-result
+ (unless inlinep
+ (org-babel-where-is-src-block-result t info hash indent)))
(bad-inline-p
(when inlinep
(or
@@ -2322,8 +2322,9 @@ INFO may provide the values of these header arguments (in the
(defun org-babel-remove-inline-result ()
"Remove the result of the current inline-src-block or babel call.
-The result must be wrapped in a `results' macro to be
- removed. Extraneous leading whitespace is trimmed."
+The result must be wrapped in a `results' macro to be removed.
+Leading whitespace is trimmed."
+ (interactive)
(let* ((el (org-element-context))
(post-blank (org-element-property :post-blank el)))
(when (memq (org-element-type el) '(inline-src-block inline-babel-call))
@@ -2332,9 +2333,8 @@ The result must be wrapped in a `results' macro to be
(let ((el (org-element-context)))
(when (and (eq (org-element-type el) 'macro)
(string= (org-element-property :key el) "results"))
- (delete-region ; And (only) extra leading whitespace.
- (- (org-element-property :begin el)
- (- post-blank 1))
+ (delete-region ; And leading whitespace.
+ (- (org-element-property :begin el) post-blank)
(- (org-element-property :end el)
(org-element-property :post-blank el)))))))))