summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-04-04 20:13:42 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-04-04 20:13:42 -0700
commitab2bd375ee064936ba61cdfee1b4d832541a0af0 (patch)
treed5d56cda57ec7008547c4a4ef5b5a3801f0344d7
parentc23f91464c4b68fb0190a8f395f302ab9f1e451d (diff)
downloadtxr-ab2bd375ee064936ba61cdfee1b4d832541a0af0.tar.gz
txr-ab2bd375ee064936ba61cdfee1b4d832541a0af0.tar.bz2
txr-ab2bd375ee064936ba61cdfee1b4d832541a0af0.zip
Connect -n option to linenoise noninteractive mode.
* parser.c (repl): Set noninteractive mode from noninteractive option. * txr.c (help): Mention effect of -n upon listener. * txr.1: Documented effect of -n/--noninteractive on the listener.
-rw-r--r--parser.c3
-rw-r--r--txr.117
-rw-r--r--txr.c2
3 files changed, 21 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index 20e5a094..bf80b2b7 100644
--- a/parser.c
+++ b/parser.c
@@ -55,6 +55,7 @@
#include "cadr.h"
#include "struct.h"
#include "parser.h"
+#include "txr.h"
#if HAVE_TERMIOS
#include "linenoise/linenoise.h"
#endif
@@ -986,6 +987,8 @@ val repl(val bindings, val in_stream, val out_stream)
if (histfile_u8)
lino_hist_load(ls, histfile_u8);
+ lino_set_noninteractive(ls, opt_noninteractive);
+
while (!done) {
val prompt = format(nil, lit("~d> "), counter, nao);
val prev_counter = counter;
diff --git a/txr.1 b/txr.1
index 31f3d468..60f3bc5f 100644
--- a/txr.1
+++ b/txr.1
@@ -458,7 +458,10 @@ Invoke the interactive \*(TX debugger. See the DEBUGGER section.
.coIP --noninteractive
This option affects behavior related to \*(TX's
.code *std-input*
-stream. Normally, if this stream is connected to a terminal device, it is
+stream. It also has a another, unrelated effect, on the
+behavior of the interactive listener; see below.
+
+Normally, if this stream is connected to a terminal device, it is
automatically marked as having the real-time property when \*(TX starts up (see
the functions .code stream-set-prop and
.codn real-time-stream-p ).
@@ -478,6 +481,18 @@ returned by that function has behaviors that are better suited for scanning
interactive input. A more detailed explanation is given under the description
of this function.
+If the
+.code -n
+option is effect and \*(TX enters into the interactive listener,
+the listener operates in
+.IR "plain mode" .
+The listener reads buffered lines
+from the operating system without any character-based editing features
+or history navigation. In plain mode, no prompts appear and no
+terminal control escape sequences are generated. The only output is
+the results of evaluation, related diagnostic messages, and any output
+generated by the evaluated expressions themselves.
+
.coIP -v
Verbose operation. Detailed logging is enabled.
diff --git a/txr.c b/txr.c
index afe07971..5b0ade21 100644
--- a/txr.c
+++ b/txr.c
@@ -125,6 +125,8 @@ static void help(void)
"-d Debugger mode.\n"
"-n Noninteractive input mode for standard input stream,\n"
" even if its connected to a terminal device.\n"
+" Also, forces the interactive listener into\n"
+" 'plain mode' without editing features.\n"
"-a N Generate array variables up to N dimensions.\n"
" N is a decimal integer. The default value is 1.\n"
" Additional dimensions beyond N are fudged\n"