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:
Eric Schulte 2011-11-15 11:18:26 -07:00
parent a5ed98e452
commit c21692506d
2 changed files with 20 additions and 3 deletions

View File

@ -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)

View File

@ -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