From dcfe011998108601708ec57ae4ab3c26c29981bf Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 16 Mar 2016 18:13:52 +0100 Subject: [PATCH] org-element: Fix inline src block parsing * lisp/org-element.el (org-element--pair-curly-table): Fix typo. * testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser): Add tests. Reported-by: William Denton --- lisp/org-element.el | 2 +- testing/lisp/test-org-element.el | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 6eabf7661..bec305d79 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -415,7 +415,7 @@ Other brackets are treated as spaces.") (let ((table (make-syntax-table))) (modify-syntax-entry ?\{ "(}" table) (modify-syntax-entry ?\} "){" table) - (dolist (char '(?\[ ?\[ ?\( ?\) ?\< ?\>) table) + (dolist (char '(?\[ ?\] ?\( ?\) ?\< ?\>) table) (modify-syntax-entry char " " table))) "Table used internally to pair only curly brackets. Other brackets are treated as spaces.") diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index ac1f0f598..2e1888533 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1198,7 +1198,24 @@ Some other text (should (eq 'inline-src-block (org-test-with-temp-text "src_emacs-lisp[:foo\nbar]{(+ 1 1)}" - (org-element-type (org-element-context)))))) + (org-element-type (org-element-context))))) + ;; Besides curly brackets, ignore any other bracket type. + (should + (equal "[foo" + (org-test-with-temp-text "src_emacs-lisp{[foo}" + (org-element-property :value (org-element-context))))) + (should + (equal "foo]" + (org-test-with-temp-text "src_emacs-lisp{foo]}" + (org-element-property :value (org-element-context))))) + (should + (equal "(foo" + (org-test-with-temp-text "src_emacs-lisp{foo}" + (org-element-property :value (org-element-context))))) + (should + (equal "foo)" + (org-test-with-temp-text "src_emacs-lisp{foo)}" + (org-element-property :value (org-element-context)))))) ;;;; Inlinetask -- 2.11.4.GIT