From 1bb2a3c23a49bcb36ab02e5b2cf79909861dbffe Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 24 Jan 2012 07:23:43 -0700 Subject: [PATCH] fixed two issues with noweb reference expansion * lisp/ob.el (org-babel-expand-noweb-references): Only allow reference names which start and end with non-whitespace characters. Also, raise errors as appropriate given org-babel-noweb-error-langs. --- lisp/ob.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index a32993a82..e525b23e4 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -2150,7 +2150,8 @@ block but are passed literally to the \"example-block\"." (with-temp-buffer (insert body) (goto-char (point-min)) (setq index (point)) - (while (and (re-search-forward "<<\\(.+?\\)>>" nil t)) + (while (and (re-search-forward "<<\\([^ \t].+?[^ \t]\\|[^ \t]\\)>>" + nil t)) (save-match-data (setf source-name (match-string 1))) (save-match-data (setq evaluate (string-match "\(.*\)" source-name))) (save-match-data @@ -2215,7 +2216,8 @@ block but are passed literally to the \"example-block\"." body))) (setq expansion (cons sep (cons full expansion))))))))) - (mapconcat #'identity (nreverse (cdr expansion)) "")) + (and expansion + (mapconcat #'identity (nreverse (cdr expansion)) ""))) ;; possibly raise an error if named block doesn't exist (if (member lang org-babel-noweb-error-langs) (error "%s" (concat