forked from mirrors/org-mode
ob-core: Fix Invalid search bound (wrong side of point)
* lisp/ob-core.el (org-babel-where-is-src-block-result): Return nil when anonymous results would be located outside of the container of the source block. * testing/lisp/test-ob.el (test-ob/where-is-src-block-result): Add test. Reported-by: Dominik Schrempf <dominik.schrempf@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/105309>
This commit is contained in:
parent
5660047846
commit
0f3cb188a9
|
@ -1962,11 +1962,16 @@ to HASH."
|
|||
;; Named results expect but none to be found.
|
||||
(name)
|
||||
;; No possible anonymous results at the very end of
|
||||
;; buffer.
|
||||
((eobp))
|
||||
;; buffer or outside CONTEXT parent.
|
||||
((eq (point)
|
||||
(or (org-element-property
|
||||
:contents-end (org-element-property :parent context))
|
||||
(point-max))))
|
||||
;; Check if next element is an anonymous result below
|
||||
;; the current block.
|
||||
((let* ((next (org-element-at-point))
|
||||
((let* ((next (save-excursion
|
||||
(skip-chars-forward " \t\n")
|
||||
(org-element-at-point)))
|
||||
(end (save-excursion
|
||||
(goto-char
|
||||
(org-element-property :post-affiliated next))
|
||||
|
|
|
@ -1623,6 +1623,10 @@ echo \"$data\"
|
|||
(should-not
|
||||
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n(+ 1 1)\n#+END_SRC"
|
||||
(org-babel-where-is-src-block-result)))
|
||||
(should-not
|
||||
(org-test-with-temp-text
|
||||
"- item\n #+BEGIN_SRC emacs-lisp\n(+ 1 1)\n#+END_SRC\n\n"
|
||||
(org-babel-where-is-src-block-result)))
|
||||
;; When optional argument INSERT is non-nil, add RESULTS keyword
|
||||
;; whenever no RESULTS can be found.
|
||||
(should
|
||||
|
|
Loading…
Reference in a new issue