diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-06 21:15:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-06 21:15:40 -0700 |
commit | 3f0fd8d5fb35b9d1ad6a348a6767d5ca562e08ec (patch) | |
tree | 97f00d6728cd0f475e60c62233d6f9258bdadc1c | |
parent | d69c6738731c24a8336f2734cee48547320d589c (diff) | |
download | txr-3f0fd8d5fb35b9d1ad6a348a6767d5ca562e08ec.tar.gz txr-3f0fd8d5fb35b9d1ad6a348a6767d5ca562e08ec.tar.bz2 txr-3f0fd8d5fb35b9d1ad6a348a6767d5ca562e08ec.zip |
listener: :p and :prompt commands.
* parser.c (repl): Support :p and :prompt commands for
printing the current prompt, which is useful in plain mode.
* txr.1: Document the new commands under Interactive Listener.
Also plain mode is documented again here, though it is
described for -n/--noninteractive.
-rw-r--r-- | parser.c | 8 | ||||
-rw-r--r-- | txr.1 | 34 |
2 files changed, 42 insertions, 0 deletions
@@ -948,6 +948,8 @@ val repl(val bindings, val in_stream, val out_stream) char *prompt_u8 = 0; val quit_k = intern(lit("quit"), keyword_package); val read_k = intern(lit("read"), keyword_package); + val prompt_k = intern(lit("prompt"), keyword_package); + val p_k = intern(lit("p"), keyword_package); val counter_sym = intern(lit("*n"), user_package); val var_counter_sym = intern(lit("*v"), user_package); val result_hash_sym = intern(lit("*r"), user_package); @@ -1051,6 +1053,12 @@ val repl(val bindings, val in_stream, val out_stream) val form = lisp_parse(line, out_stream, colon_k, name, colon_k); if (form == quit_k) { done = t; + } else if (form == prompt_k) { + pprinl(prompt, out_stream); + counter = prev_counter; + } else if (form == p_k) { + pprinl(prev_counter, out_stream); + counter = prev_counter; } else { val value = if3(form != read_k, eval_intrinsic(form, nil), @@ -52668,6 +52668,40 @@ command in GNU Bash. When \*(TX is resumed, the interactive listener will re-display the edited line and restore the previous cursor position. +.SS* Print the Prompt + +The +.code :print +command prints the current prompt, followed by a newline, without +incrementing the prompt number. The +.code :p +command prints just the current prompt number, followed by a newline, +without incrementing the number. + +These comments are useful in plain mode, in which no prompts are +printed. See Plain Mode below. + +.SS* Plain Mode + +When the input device isn't an interactive terminal, or if the +.code -n +or +.code --noninteractive +command line operations are used when invoking \*(TX, +the listener operates in +.IR "plain mode" . +It reads input without providing any editing features: no completion, +history recall, selection, or copy and paste. Only the line editing +features provided by the operating system are available. +No prompts appear; however, there is still an incrementing counter, +and the numbered variables +.codn *1 , +.codn *2 , +.code ... +for accessing evaluation results are established. +Lines are still entered into the history, and the interactive profile +is still processed, as usual. + .SS* Interactive Profile File When the listener starts up, it looks for file called |