1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-23 07:18:53 +00:00

named code blocks are replaced with their results

* lisp/ob.el (org-babel-find-named-result): Downcase "name" before comparison.
* testing/lisp/test-ob.el (test-ob/does-not-replace-a-block-with-the-results):
  Test that named code blocks are replaced with their results.
This commit is contained in:
Eric Schulte 2011-11-14 10:31:58 -07:00
parent 16e4e9b5cc
commit 83dfaa5c8f
2 changed files with 12 additions and 1 deletions

View File

@ -1409,7 +1409,7 @@ buffer or nil if no such result exists."
(when (re-search-forward
(concat org-babel-result-regexp
"[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t)
(when (and (string= "name" (match-string 1))
(when (and (string= "name" (downcase (match-string 1)))
(or (looking-at org-babel-src-block-regexp)
(looking-at org-babel-multi-line-header-regexp)))
(throw 'is-a-code-block (org-babel-find-named-result name (point))))

View File

@ -420,6 +420,17 @@ duplicate results block."
#+end_src"
(should (string= "#+begin_src emacs-lisp" (org-babel-execute-src-block)))))
(ert-deftest test-ob/does-not-replace-a-block-with-the-results ()
(org-test-with-temp-text "#+NAME: foo
#+BEGIN_SRC emacs-lisp
'foo
#+END_SRC\n"
(org-babel-next-src-block 1)
(should (eq 'foo (org-babel-execute-src-block)))
(goto-char (point-min))
(org-babel-next-src-block 1)
(should (looking-at org-babel-src-block-regexp))))
(provide 'test-ob)
;;; test-ob ends here