summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-01-30 10:12:32 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-01-30 10:12:32 +0100
commit485f2185102bda83b66098060a0e56cc602002e8 (patch)
treec9471fb08b31c55470be8c26fe113c781818f152
parent04bf4189221114c9cc8f996d47108cd89660d92b (diff)
parent7efa0f2879226695ad9b309c9263a4d1b5d79e89 (diff)
downloadorg-mode-485f2185102bda83b66098060a0e56cc602002e8.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-element.el4
-rw-r--r--testing/lisp/test-ob-exp.el102
-rw-r--r--testing/lisp/test-org-element.el7
3 files changed, 61 insertions, 52 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 6bd0091..5af2d6e 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2878,7 +2878,7 @@ Assume point is at the beginning of the babel call."
(save-excursion
(catch :no-object
(when (let ((case-fold-search nil))
- (looking-at "\\<call_\\([^ \t\n[(]+\\)[([]"))
+ (looking-at "call_\\([^ \t\n[(]+\\)[([]"))
(goto-char (match-end 1))
(let* ((begin (match-beginning 0))
(call (match-string-no-properties 1))
@@ -2932,7 +2932,7 @@ Assume point is at the beginning of the inline src block."
(save-excursion
(catch :no-object
(when (let ((case-fold-search nil))
- (looking-at "\\<src_\\([^ \t\n[{]+\\)[{[]"))
+ (looking-at "src_\\([^ \t\n[{]+\\)[{[]"))
(goto-char (match-end 1))
(let ((begin (match-beginning 0))
(language (match-string-no-properties 1))
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index a625c35..b0a3ab2 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -199,57 +199,65 @@ Here is one at the end of a line. {{{results(=2=)}}}
(org-test-with-expanded-babel-code (buffer-string)))))))
(ert-deftest ob-exp/exports-inline-code ()
- (let ((org-babel-inline-result-wrap "=%s=")
- (org-export-use-babel t))
- (should
- (string-match "\\`src_emacs-lisp\\(?:\\[]\\)?{(\\+ 1 1)}$"
- (org-test-with-temp-text
- "src_emacs-lisp[:exports code]{(+ 1 1)}"
- (org-babel-exp-process-buffer)
- (buffer-string))))
- (should
- (string-match "\\`src_emacs-lisp\\(?:\\[]\\)?{(\\+ 1 1)}$"
- (org-test-with-temp-text
- "src_emacs-lisp[ :exports code ]{(+ 1 1)}"
- (org-babel-exp-process-buffer)
- (buffer-string))))
- (should
- (string-match "\\`src_emacs-lisp\\(?:\\[]\\)?{(\\+ 1 1)} {{{results(=2=)}}}$"
- (org-test-with-temp-text
- "src_emacs-lisp[:exports both]{(+ 1 1)}"
- (org-babel-exp-process-buffer)
- (buffer-string))))
- (should
- (string-match "\\`{{{results(=2=)}}}$"
+ (should
+ (equal "src_emacs-lisp[]{(+ 1 1)}"
+ (org-test-with-temp-text "src_emacs-lisp[:exports code]{(+ 1 1)}"
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string))))
+ (should
+ (equal "src_emacs-lisp[]{(+ 1 1)}"
+ (org-test-with-temp-text "src_emacs-lisp[ :exports code ]{(+ 1 1)}"
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string))))
+ (should
+ (equal "src_emacs-lisp[]{(+ 1 1)} {{{results(=2=)}}}"
+ (org-test-with-temp-text "src_emacs-lisp[:exports both]{(+ 1 1)}"
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string))))
+ (should
+ (equal "{{{results(=2=)}}}"
+ (org-test-with-temp-text
+ "src_emacs-lisp[:exports results :results scalar]{(+ 1 1)}"
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string))))
+ (should
+ (equal "foosrc_emacs-lisp[]{(+ 1 1)}"
+ (org-test-with-temp-text
+ "foosrc_emacs-lisp[:exports code]{(+ 1 1)}"
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string))))
+ (should
+ (let ((text "src_emacs lisp{(+ 1 1)}"))
+ (string-match (regexp-quote text)
(org-test-with-temp-text
- "src_emacs-lisp[:exports results :results scalar]{(+ 1 1)}"
- (org-babel-exp-process-buffer)
- (buffer-string))))
- (should
- (let ((text "foosrc_emacs-lisp[:exports code]{(+ 1 1)}"))
- (string-match (regexp-quote text)
- (org-test-with-temp-text
- text
- (org-babel-exp-process-buffer)
- (buffer-string)))))
- (should
- (let ((text "src_emacs lisp{(+ 1 1)}"))
- (string-match (regexp-quote text)
- (org-test-with-temp-text
- text
- (org-babel-exp-process-buffer)
- (buffer-string)))))
- (should
- (string-match
- (replace-regexp-in-string
- "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_sh[]{...} or src_sh{...}
- (regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line.
+ text
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
+ (org-babel-exp-process-buffer))
+ (buffer-string)))))
+ (should
+ (string-match
+ (replace-regexp-in-string
+ "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_sh[]{...} or src_sh{...}
+ (regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line.
Here is one at the end of a line. src_sh[]{echo 2}
src_sh[]{echo 3} Here is one at the beginning of a line.
Here is one that is also evaluated: src_sh[]{echo 4} {{{results(=4=)}}}")
- nil t)
- (org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076"
- (org-narrow-to-subtree)
+ nil t)
+ (org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076"
+ (org-narrow-to-subtree)
+ (let ((org-babel-inline-result-wrap "=%s=")
+ (org-export-use-babel t))
(org-test-with-expanded-babel-code (buffer-string)))))))
(ert-deftest ob-exp/exports-inline-code-double-eval ()
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 9252521..eba39d3 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1223,6 +1223,10 @@ Some other text
(should
(org-test-with-temp-text "src_emacs-lisp{(+ 1 1)}"
(org-element-map (org-element-parse-buffer) 'inline-src-block 'identity)))
+ ;; With prefix.
+ (should
+ (org-test-with-temp-text "foosrc_emacs-lisp[]{(+ 1 1)}"
+ (org-element-map (org-element-parse-buffer) 'inline-src-block 'identity)))
;; With switches.
(should
(org-test-with-temp-text "src_emacs-lisp[:foo bar]{(+ 1 1)}"
@@ -1236,9 +1240,6 @@ Some other text
(org-element-map (org-element-parse-buffer) 'inline-src-block 'identity)))
;; Invalid syntax.
(should-not
- (org-test-with-temp-text "foosrc_emacs-lisp[]{(+ 1 1)}"
- (org-element-map (org-element-parse-buffer) 'inline-src-block 'identity)))
- (should-not
(org-test-with-temp-text "src_emacs-lisp[]foo{(+ 1 1)}"
(org-element-map (org-element-parse-buffer) 'inline-src-block 'identity)))
;; Invalid language name