summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-11-15 11:18:26 -0700
committerEric Schulte <schulte.eric@gmail.com>2011-11-15 11:18:26 -0700
commitc21692506d8742523e0f8d558e97699be3a15dd0 (patch)
treeed4ede1eeacda2c4dd905e01c6c5804af196adc2
parenta5ed98e4525e87b01d35c0e99db0c7e52365899c (diff)
downloadorg-mode-c21692506d8742523e0f8d558e97699be3a15dd0.tar.gz
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.
-rw-r--r--lisp/ob-ref.el7
-rw-r--r--testing/lisp/test-ob.el16
2 files changed, 20 insertions, 3 deletions
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index 9534aac..b7988ee 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -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)
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index ef854cb..ceaafb3 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -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