mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-11 09:20:32 +00:00
org-babel-where-is-src-block-result: Fix inside affiliated parsed keyword
* lisp/ob-core.el (org-babel-where-is-src-block-result): Do not assume that parent has contents-end and that we are inside contents, but not inside secondary object/affiliated keyword. * testing/lisp/test-ob.el (test-ob/inline-src_blk-default-results-replace-line-1): Add tests. Reported-by: Tom Gillespie <tgbugs@gmail.com> Link: https://orgmode.org/list/CA+G3_PNt7WqkCzChV+dx1FeSPgTEVkNSE41a3qC5wv3g+jTwrQ@mail.gmail.com
This commit is contained in:
parent
54c09c84e9
commit
9fd547dd3a
@ -2187,11 +2187,8 @@ to HASH."
|
||||
((or `inline-babel-call `inline-src-block)
|
||||
;; Results for inline objects are located right after them.
|
||||
;; There is no RESULTS line to insert either.
|
||||
(let ((limit (pcase (org-element-type (org-element-parent context))
|
||||
(`section (org-element-end
|
||||
(org-element-parent context)))
|
||||
(_ (org-element-contents-end
|
||||
(org-element-parent context))))))
|
||||
(let ((limit (or (org-element-contents-end (org-element-parent context))
|
||||
(org-element-end (org-element-parent context)))))
|
||||
(goto-char (org-element-end context))
|
||||
(skip-chars-forward " \t\n" limit)
|
||||
(throw :found
|
||||
|
@ -404,7 +404,21 @@ at the beginning of a line."
|
||||
"src_emacs-lisp{(+ 1 2)}\n{{{results(=3=)}}}"
|
||||
(org-test-with-temp-text "src_emacs-lisp{(+ 1 2)}\n{{{results(=2=)}}}"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")) (org-babel-execute-maybe))
|
||||
(buffer-string))))))
|
||||
(buffer-string)))))
|
||||
;; Handle inline src blocks inside parsed affiliated keyword.
|
||||
(should
|
||||
(equal
|
||||
"#+caption: src_elisp{1} {{{results(=1=)}}}\n#+begin_src emacs-lisp\n1\n#+end_src"
|
||||
(org-test-with-temp-text "#+caption: <point>src_elisp{1}\n#+begin_src emacs-lisp\n1\n#+end_src"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")) (org-babel-execute-maybe))
|
||||
(buffer-string))))
|
||||
;; Handle inline src blocks inside heading title.
|
||||
(should
|
||||
(equal
|
||||
"* Heading src_elisp{1} {{{results(=1=)}}}"
|
||||
(org-test-with-temp-text "* Heading <point>src_elisp{1}"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")) (org-babel-execute-maybe))
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-ob/inline-src_blk-default-results-replace-line-2 ()
|
||||
;; src_ at bol line 2...
|
||||
|
Loading…
Reference in New Issue
Block a user