summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-04-16 18:36:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-04-16 18:36:56 -0700
commit566de7d4516c8c0d161a95dafcbb530601306538 (patch)
treec293e50d359d19444b22b56f80abf52cef269a76 /lib.c
parent59c4fe61bdbe56eb215e29535e89ad72c3a2ee4b (diff)
downloadtxr-566de7d4516c8c0d161a95dafcbb530601306538.tar.gz
txr-566de7d4516c8c0d161a95dafcbb530601306538.tar.bz2
txr-566de7d4516c8c0d161a95dafcbb530601306538.zip
streams: force-off indent mode.
The fourth indent mode indent-foff (force off) is introduced. * buf.c (buf_print): Turn on data mode indentation if the current mode is not indent-foff, rather than when it is indent-off. * lib.c (obj_print_impl): The unconditional set_indent_mode calls are replaced with test_neq_set_indent_mode so we only set the mode if it is not forced off. * stream.c (formatv): For the ! directive, turn on data mode identation is not indent-foff, rather than when it is indent-off. (put_string, put_char, width_check): Recognize ident-foff as indentation off. (test_neq_set_indent_mode): New function. (stream_init): Register test-neq-set-indent-mode function and indent-foff variable. * stream.h (indent_mode): New enum constant, indent_foff. (test_neq_set_indent_mode): Declared. * struct.c (struct_inst_print): Turn on data mode indentation if the current mode is not indent-foff, rather than when it is indent-off. * txr.1: Documented.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib.c b/lib.c
index afd6e627..6108f0ff 100644
--- a/lib.c
+++ b/lib.c
@@ -11124,7 +11124,7 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
if (sym == lambda_s && consp(cdr(obj)) && symbolp(second(obj))) {
indent = one;
save_indent = inc_indent(out, indent);
- set_indent_mode(out, num_fast(indent_code));
+ test_neq_set_indent_mode(out, num_fast(indent_foff), num_fast(indent_code));
obj_print_impl(sym, out, pretty, ctx);
if (second(obj)) {
put_string(lit(" (. "), out);
@@ -11137,12 +11137,12 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
goto finish;
} else if (special_operator_p(sym) || macro_form_p(obj, nil)) {
indent = one;
- set_indent_mode(out, num_fast(indent_code));
+ test_neq_set_indent_mode(out, num_fast(indent_foff), num_fast(indent_code));
} else if (fboundp(sym)) {
obj_print_impl(sym, out, pretty, ctx);
indent = one;
save_indent = inc_indent(out, indent);
- set_indent_mode(out, num_fast(indent_code));
+ test_neq_set_indent_mode(out, num_fast(indent_foff), num_fast(indent_code));
iter = obj;
goto finish;
}