mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-26 10:49:38 +00:00
fix bug missing references to example blocks
* lisp/ob-ref.el (org-babel-ref-resolve): Don't change location when looking at the contents. * testing/lisp/test-ob.el (test-ob/catches-all-references): Test enforcing the correct behavior.
This commit is contained in:
parent
a5ed98e452
commit
c21692506d
@ -174,9 +174,10 @@ the variable."
|
||||
(lob-info (setq type 'lob))
|
||||
(id (setq type 'id))
|
||||
((and (looking-at org-babel-src-name-regexp)
|
||||
(progn (forward-line 1)
|
||||
(or (looking-at org-babel-src-block-regexp)
|
||||
(looking-at org-babel-multi-line-header-regexp))))
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(or (looking-at org-babel-src-block-regexp)
|
||||
(looking-at org-babel-multi-line-header-regexp))))
|
||||
(setq type 'source-block))
|
||||
(t (while (not (setq type (org-babel-ref-at-ref-p)))
|
||||
(forward-line 1)
|
||||
|
@ -431,6 +431,22 @@ duplicate results block."
|
||||
(org-babel-next-src-block 1)
|
||||
(should (looking-at org-babel-src-block-regexp))))
|
||||
|
||||
(ert-deftest test-ob/catches-all-references ()
|
||||
(org-test-with-temp-text "
|
||||
#+NAME: literal-example
|
||||
#+BEGIN_EXAMPLE
|
||||
A literal example
|
||||
on two lines
|
||||
#+END_EXAMPLE
|
||||
|
||||
#+NAME: read-literal-example
|
||||
#+BEGIN_SRC emacs-lisp :var x=literal-example
|
||||
(concatenate 'string x \" for me.\")
|
||||
#+END_SRC"
|
||||
(org-babel-next-src-block 1)
|
||||
(should (string= (org-babel-execute-src-block)
|
||||
"A literal example\non two lines for me."))))
|
||||
|
||||
(provide 'test-ob)
|
||||
|
||||
;;; test-ob ends here
|
||||
|
Loading…
Reference in New Issue
Block a user