summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-09-20 19:12:39 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-09-20 19:13:40 +0200
commitfd5cc62ca58343e929a0b3c6ca5e7e763c588222 (patch)
tree058673762265b2e81e157c4a004219c66db21aa0
parent8447ea83412829e13a8b6fd23c238e7c6eba3884 (diff)
downloadorg-mode-fd5cc62ca58343e929a0b3c6ca5e7e763c588222.tar.gz
org-element: Fix inline-src-block parsing at the beginning of an item
* lisp/org-element.el (org-element-inline-src-block-successor): Fix inline-src-block parsing at the beginning of an item. * testing/lisp/test-org-element.el: Add test.
-rw-r--r--lisp/org-element.el1
-rw-r--r--testing/lisp/test-org-element.el4
2 files changed, 5 insertions, 0 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index d753f25..973fcbb 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2612,6 +2612,7 @@ LIMIT bounds the search.
Return value is a cons cell whose CAR is `inline-babel-call' and
CDR is beginning position."
(save-excursion
+ (unless (bolp) (backward-char))
(when (re-search-forward org-babel-inline-src-block-regexp limit t)
(cons 'inline-src-block (match-beginning 1)))))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 1318e86..345099d 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -825,6 +825,10 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"
"Test `inline-src-block' parser."
(should
(org-test-with-temp-text "src_emacs-lisp{(+ 1 1)}"
+ (org-element-map (org-element-parse-buffer) 'inline-src-block 'identity)))
+ ;; Test parsing at the beginning of an item.
+ (should
+ (org-test-with-temp-text "- src_emacs-lisp{(+ 1 1)}"
(org-element-map (org-element-parse-buffer) 'inline-src-block 'identity))))