summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <eric.schulte@gmx.com>2012-01-24 07:23:43 -0700
committerEric Schulte <eric.schulte@gmx.com>2012-01-24 07:23:43 -0700
commit1bb2a3c23a49bcb36ab02e5b2cf79909861dbffe (patch)
tree13d846b6ee9173ca1b964a230e29cb2cec8c9a51
parenta706f424033fde4b334cfbd2185812bf5324a7d8 (diff)
downloadorg-mode-1bb2a3c23a49bcb36ab02e5b2cf79909861dbffe.tar.gz
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.
-rw-r--r--lisp/ob.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index a32993a..e525b23 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