summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2014-02-06 14:29:29 -0700
committerEric Schulte <schulte.eric@gmail.com>2014-02-06 14:30:30 -0700
commite583eaa8f11fdbe2d122b6a272eae5db768a6169 (patch)
tree116b20d1803e2e286a9e476efc5be8d055024663
parent61dbb840810ed8452ae02fa9e10896936a75d9d4 (diff)
downloadorg-mode-e583eaa8f11fdbe2d122b6a272eae5db768a6169.tar.gz
fix bug when results butt up against headline
* lisp/ob-core.el (org-babel-examplize-region): Don't treat exampleized regions adjoining headlines as inline examples.
-rw-r--r--lisp/ob-core.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 95258e9..d0c9efd 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2291,11 +2291,16 @@ file's directory then expand relative links."
"Comment out region using the inline '==' or ': ' org example quote."
(interactive "*r")
(let ((chars-between (lambda (b e)
- (not (string-match "^[\\s]*$" (buffer-substring b e)))))
+ (not (string-match "^[\\s]*$"
+ (buffer-substring b e)))))
(maybe-cap (lambda (str) (if org-babel-capitalize-examplize-region-markers
- (upcase str) str))))
- (if (or (funcall chars-between (save-excursion (goto-char beg) (point-at-bol)) beg)
- (funcall chars-between end (save-excursion (goto-char end) (point-at-eol))))
+ (upcase str) str)))
+ (beg-bol (save-excursion (goto-char beg) (point-at-bol)))
+ (end-bol (save-excursion (goto-char end) (point-at-bol)))
+ (end-eol (save-excursion (goto-char end) (point-at-eol))))
+ (if (and (not (= end end-bol))
+ (or (funcall chars-between beg-bol beg)
+ (funcall chars-between end end-eol)))
(save-excursion
(goto-char beg)
(insert (format org-babel-inline-result-wrap