summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-09-20 09:01:11 -0600
committerEric Schulte <schulte.eric@gmail.com>2011-09-20 09:01:20 -0600
commitded9f87ebce5975cda9ddc22f1fe5fde70a12128 (patch)
tree9d4f55d3ac09ea4ffc2c940f4e4b86c9b001539f
parenta7d89a80fb87cb7ffeb4bc2fcb74e1ce7377d4ce (diff)
downloadorg-mode-ded9f87ebce5975cda9ddc22f1fe5fde70a12128.tar.gz
org-test-with-temp-text allows variable inputs holding strings
* testing/org-test.el (org-test-with-temp-text): Allow variable inputs holding strings.
-rw-r--r--testing/org-test.el21
1 files changed, 10 insertions, 11 deletions
diff --git a/testing/org-test.el b/testing/org-test.el
index 7789cbe..da62892 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -166,17 +166,16 @@ files."
mode holding TEXT. If the string \"<point>\" appears in TEXT
then remove it and place the point there before running BODY."
(declare (indent 1))
- `(with-temp-buffer
- (org-mode)
- ,(let ((point (string-match (regexp-quote "<point>") text)))
- (if point
- `(progn
- (insert `(replace-match "" nil nil text))
- (goto-char ,(match-beginning 0)))
- `(progn
- (insert ,text)
- (goto-char (point-min)))))
- ,@body))
+ (let ((inside-text (if (stringp text) text (eval text))))
+ `(with-temp-buffer
+ (org-mode)
+ ,(let ((point (string-match (regexp-quote "<point>") inside-text)))
+ (if point
+ `(progn (insert `(replace-match "" nil nil inside-text))
+ (goto-char ,(match-beginning 0)))
+ `(progn (insert ,inside-text)
+ (goto-char (point-min)))))
+ ,@body)))
;;; Navigation Functions