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.
This commit is contained in:
Nicolas Goaziou 2012-09-20 19:12:39 +02:00
parent 8447ea8341
commit fd5cc62ca5
2 changed files with 5 additions and 0 deletions

View File

@ -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)))))

View File

@ -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))))