From fd5cc62ca58343e929a0b3c6ca5e7e763c588222 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 20 Sep 2012 19:12:39 +0200 Subject: [PATCH] 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. --- lisp/org-element.el | 1 + testing/lisp/test-org-element.el | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lisp/org-element.el b/lisp/org-element.el index d753f2589..973fcbb3e 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 1318e86fe..345099d06 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))))