summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-03 20:53:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-03 20:53:08 -0700
commit230696053c026fc959d190166c16ed8bf3eaa21d (patch)
tree4e3137a3e63a52d79221f4d2baac81e46629c847 /match.c
parent5664ef6838f6027a1db5520cb4d749e21fd1fc7a (diff)
downloadtxr-230696053c026fc959d190166c16ed8bf3eaa21d.tar.gz
txr-230696053c026fc959d190166c16ed8bf3eaa21d.tar.bz2
txr-230696053c026fc959d190166c16ed8bf3eaa21d.zip
@(output) evaluates destination as Lisp.
* match.c (v_output): Use txeval on the destination only if compatibility is 142 or lower, or it is a meta expression (so that @var and @(expr) still work without having to use the compatibility option). * txr.1: Documented and put in compatibility notes.
Diffstat (limited to 'match.c')
-rw-r--r--match.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/match.c b/match.c
index db0f1845..2e65cd84 100644
--- a/match.c
+++ b/match.c
@@ -3219,7 +3219,13 @@ static val v_output(match_files_ctx *c)
} else if (!keywordp(first(dest_spec))) {
uses_or2;
val form = first(dest_spec);
- val val = txeval(specline, form, c->bindings);
+ val sym = if2(consp(form), car(form));
+ int tx = ((opt_compat && opt_compat <= 142) ||
+ (sym == var_s) || (sym == expr_s));
+ val val = if3(tx,
+ txeval(specline, form, c->bindings),
+ eval_with_bindings(form, specline, c->bindings,
+ specline));
dest = or2(val, dest);
pop(&dest_spec);
}