Giter Club home page Giter Club logo

tclreadline's Introduction

Linux CI Mac CI

tclreadline -- gnu readline for tcl

Copyright (c) 1998 - 2014, Johannes Zellner [email protected] This software is copyright under the BSD license.

tclreadline

Introduction

This directory contains the sources and documentation for tclreadline, which builds a connection between tcl and the gnu readline.

Documentation

The tclreadline.n nroff man page in this release contains the reference manual entries for tclreadline. If you only want to use tclreadline as a tool for interactive script development, you don't have to read this manual page at all. Simply change your .tclshrc according to the section later in this file.

Compiling and installing tclreadline

This release will probably only build under UNIX (Linux).

Before trying to compile tclreadline you should do the following things:

  1. Make sure you have tcl 8.0 or higher. tclreadline relies on a proper tcl installation: It uses the tclConfig.sh file, which should reside somewhere in /usr/local/lib/ or /usr/local/lib/tcl8.0/...

  2. Make sure you have gnu readline 2.2 or higher. tclreadline uses the gnu readline callback handler, which wasn't implemented in early releases.

  3. The usual ./configure; make; make install sequence should do the rest.

  4. Optionally (or additionally) you can build the executables tclshrl and / or wishrl which are a readline enhanced replacement for tclsh and wish. To compile these executable you should type

     ./configure --enable-tclshrl --enable-wishrl
    

    (or one of these if you want just tclshrl or wishrl). NOTE that these executables need an installed version of tclreadline because they need some script files to run so you can't test tclshrl/wishrl before installing the tclreadline scripts.

    Building statically linked executables is DISCOURAGED but necessary on systems which don't support shared libs.

Using tclreadline for interactive tcl scripting.

copy the sample.tclshrc to $HOME/.tclshrc. If you use another interpreter like wish, you should copy the file sample.tclshrc to $HOME/.wishrc (or whatever the manual page of your interpreter says.) If you have installed tclreadline properly, you are just ready to start: start your favorite interpreter. The tclreadlineSetup.tcl script does the rest.

tclreadline's People

Contributors

bovine avatar chrstphrchvz avatar dbohdan avatar gahr avatar jtojnar avatar laomaiweng avatar lehenbauer avatar markpatton avatar mr-tao avatar q3cpma avatar resuna avatar rkraats avatar snoe925 avatar thesamesam avatar think-nice-things avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tclreadline's Issues

Does anyone build it on the Windows with mingw?

I've tried to build it on the Windows platform.
autoconf, mingw for Windows version I also have installed.
I use git bash:

$  ./configure --enable-tclshrl --enable-wishrl

then get following error

configure: error: cannot find install-sh, install.sh, or shtool in ./aux "."/./aux

Bad directory displayed as default prompt

The default prompt from tclreadline seems to corrupt the displayed path when in user's home directory:

$ tclsh
tclsh8.6 [/usr~/work/firehose_stream] puts "hello"
hello

I don't think the “/usr” should be displayed front of my home-directory based path “~/work/firehose_stream”

The above output is from a ~/.tclshrc that contains simply:

if {$tcl_interactive} {package require tclreadline; ::tclreadline::Loop}

Dangled symlinks INSTALL and aux/*

Hi!

The sources currently have a few symlinks (namely INSTALL and also aux/compile, aux/config.guess, aux/config.sub, aux/depcomp, aux/install-sh, aux/ltmain.sh and aux/missing) which point somewhere inside /usr/local/share/automake-1.15. It's a bit inconvenient to have them, especially if I don't have automake-1.15 installed in /usr/local. Can you remove them (replace by actual files)?

Problem with "attempt to load the shared-library using a relative path too"

This refers to commit 5ada457 (issue #17).

In tclreadlineInit.tcl.in, the line

    foreach dirname {@TCLRL_LIBDIR@ [file dirname [info script]]} {

the list of values for dirname is actually

"@TCLRL_LIBDIR@" "[file" "dirname" "[info" "script]]"

because, inside the braces, the command substitutions don't happen, so the code will end up
erroring while checking "script]]" if the first location fails (the other 3 will fail but not be reported).

The line should, I think, be

      foreach dirname [list @TCLRL_LIBDIR@ [file dirname [info script]]] {

meaning that the locations checked will be the one from configure
and the location of pkgIndex.tcl .

completation auto ignores the hint of "display all posibilities(y/n)"

when double type in TAB, it will auto display all the supported commands. If there are a lot of command, it shuold hint "Display all ??? posibilities(y/n)" and let me make choice. It display this hint, however, it ignores the hint and display all the commands

Display all 303 possibilities? (y or n)
::oo                             eliminate_common_subexpressions  load_simstate_behavior           set_ignore_translate_off
::pkg                            encoding                         load_upf                         set_isolation 
...

proc unknown assumes errorCode exists

When you load tclreadline as the first package in a virgin interpreter, you get an error about errorCode not being set the first time the unknown handler is run.

proc unknown saves and restores errorCode and errorInfo without checking if they exist.

time and namespace eval completer failures

As said in the title, these produce a similar error (e.g. tclreadline::Loop: error. error during evaluation of 'complete(time)' '::tclreadline::ScriptCompleter "\{" 5 6 "time \{"' failed) when hitting TAB:

  • time {
  • namespace eval
  • namespace eval dict {
    The last one is already in the TODO found in tclreadlineCompleter.tcl.

Another question raised by this issue: is there a way to avoid these error message and just do nothing if completion doesn't work?

stub support available or missing?

I am on OSX and using tclreadline installed by the package management system (macports). it has transpired that this tclreadline then only works together with the tclsh linked against the same libtcl8.6.a but memfaults when trying to use it with a differently compiled tclsh (even if same patchlevel, here 8.6.10).
I have been told on comp.lang.tcl that the issue is missing "stub support". the macports package maintainer does not see any configure flag to activate it.

my question: can it be done (ie. tclreadline compiled with stubs enabled so that libtcl is only selected at runtime)? if so, how?

tclreadline break some behaviour of xsct

xsct is a tcl console of AMD Xilinx. It defines some behaviours different from standard tclsh.

xsct% lappend auto_path /usr/lib
xsct% 1
[1]
xsct% package require tclreadline
2.3.8
xsct% 1
invalid command name "1"

After package require tclreadline, these behaviours disappeared.

Environment:

xsct% version
xsct 2022.2.0
SW Build 0 on 2022-10-13-12:09:36
Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
xsct% uname -r
6.3.2-arch1-1

building on macos big sur (ActiveTcl 8.6)

I'm new to macos, so there might be a better way to do this. The main issues were linking to ActiveTcl installation, linking to the readline installed from brew, and using a non-standard $PREFIX for tclreadline. but this worked for me:

  1. brew install readline

  2. git clone this repo

  3. from the repo:

./configure --prefix=$PREFIX \
  --with-tcl=/Library/Frameworks/Tcl.framework/ \
  --with-tk=/Library/Frameworks/Tk.framework/ \
  --with-readline-includes=/usr/local/opt/readline/include/readline/ \
  --with-readline-library='-L/usr/local/opt/readline/lib -lreadline'
  1. make install

  2. in your .bashrc, add:

export TCLLIBPATH="$PREFIX/lib"                                                
export LD_LIBRARY_PATH="$PREFIX/lib"

Colorized prompt.

I've got a possible enhancement for inclusion, colorozed prompts.

The code is not fully fleshed out, (i.e. all the possible combination based on *nix color codes),
but is basically layed out for them.

In tclreadlineSetup.tcl:

     proc color {{clor {}}} {

      set colors {Black Red Green Yellow Blue Purple Cyan White}

      set pre ""
      set colr ""
      regexp -nocase -- "^(\\w*)([join $colors {|}])$" $clor - pre colr


      if {$colr != ""} {
          set idx [lsearch -regexp -nocase $colors $colr]
      }

      set sep ";"

      switch -regexp -nocase -- {$pre} {
          {^b$} {
#        Bold {\e[1;30m}
              set mod 1
              incr idx 30
          }
          {^U$} {
#        Underline {\e[4;30m}
              incr idx 30
              set mod 4
          }
          {^bg$} {
#        Background {\e[40m}
              incr idx 40
              set mod ""
              set sep ""
          }
          {^i$} {
      #  high Intensity {\e[0;90m}
              incr idx 90
              set mod 0
          }
          {^bi$} {
      #  Bold high Intensity   {\e[1;90m}
              incr idx 90
              set mod 1
          }
          {^bgi$} {
      #  BackGround high Intensity   {\e[0;100m}
              incr idx 100
              set mod 0
          }
          {} {
#         Regular color {\e[0;30m}
              if {$colr == ""} {
                  set sep ""
                  set idx ""
                  set mod ""
              } else {
                  incr idx 30
                  set mod 0
              }
          }
      }

     return "\033\[${mod}${sep}${idx}m"

#      return "\033\[1;${idx}m"
    }

    proc colorStr {str {colr {}}} {
      return "[color $colr]$str[color]"
    }

And I used it thus, in tclshrc.tcl,

    proc ::tclreadline::prompt1 {} {
          return "\[ [::tclreadline::colorStr [lindex [split [info hostname] "."] 0] cyan] \] [eval file join [lrange [split [pwd] "/"] end-1 end]] % "
    }

Dangling symlinks in the aux/ dir

Currently, v2.3.5 and the master branch contain symlinks in aux/ which point outside the build tree (aux/compile -> /usr/share/automake-1.15/compile etc.).

The issue is similar to #7.

Could you replace the symlinks by their targets once more?

[PATCH] Add historyexpansion command to enable/disable it and manpage nits

Hello, here's a patch adding a command to enable/disable the very confusing readline history expansion:

diff --git a/sample.tclshrc b/sample.tclshrc
index e600455..9f18252 100644
--- a/sample.tclshrc
+++ b/sample.tclshrc
@@ -62,6 +62,9 @@ if {$tcl_interactive} {
     # command (instead of when cleanly exiting)
     set tclreadline::autosave 1

+    # disable history expansion (e.g. !, !!, !num or ^str1^str2^)
+    # ::tclreadline::readline historyexpansion 0
+
     # go to tclrealdine's main loop.
     #
     tclreadline::Loop
diff --git a/tclreadline.c b/tclreadline.c
index a81d2fc..d253d64 100644
--- a/tclreadline.c
+++ b/tclreadline.c
@@ -99,6 +99,7 @@ static char* tclrl_eof_string            = (char*) NULL;
 static char* tclrl_custom_completer      = (char*) NULL;
 static char* tclrl_last_line             = (char*) NULL;
 static int   tclrl_use_builtin_completer = 1;
+static int   tclrl_use_history_expansion = 1;
 static int   tclrl_history_length        = -1;
 Tcl_Interp*  tclrl_interp                = (Tcl_Interp*) NULL;

@@ -206,12 +207,13 @@ TclReadlineCmd(ClientData clientData, Tcl_Interp *interp, int objc,
         "read", "initialize", "write", "add", "complete",
         "customcompleter", "builtincompleter", "eofchar",
         "reset-terminal", "bell", "text", "update",
-        (char *) NULL
+        "historyexpansion", (char *) NULL
     };
     enum SubCmdIdx {
         TCLRL_READ, TCLRL_INITIALIZE, TCLRL_WRITE, TCLRL_ADD, TCLRL_COMPLETE,
         TCLRL_CUSTOMCOMPLETER, TCLRL_BUILTINCOMPLETER, TCLRL_EOFCHAR,
-        TCLRL_RESET_TERMINAL, TCLRL_BELL, TCLRL_TEXT, TCLRL_UPDATE
+        TCLRL_RESET_TERMINAL, TCLRL_BELL, TCLRL_TEXT, TCLRL_UPDATE,
+        TCLRL_HISTORYEXPANSION
     };

     Tcl_ResetResult(interp); /* clear the result space */
@@ -434,7 +436,6 @@ TclReadlineCmd(ClientData clientData, Tcl_Interp *interp, int objc,

             break;

-
         case TCLRL_TEXT:
             if (objc != 2) {
                 Tcl_WrongNumArgs(interp, 2, objv, "");
@@ -446,6 +447,27 @@ TclReadlineCmd(ClientData clientData, Tcl_Interp *interp, int objc,
                Tcl_NewStringObj(rl_line_buffer ? rl_line_buffer : "", -1));
             break;

+        case TCLRL_HISTORYEXPANSION:
+            if (objc > 3) {
+                Tcl_WrongNumArgs(interp, 2, objv, "?boolean?");
+                return TCL_ERROR;
+            } else if (3 == objc) {
+                int bool = tclrl_use_history_expansion;
+                if (TCL_OK != Tcl_GetBoolean(interp,
+                                 Tcl_GetStringFromObj(objv[2], 0),
+                                 &bool)) {
+                    Tcl_AppendResult(interp,
+                        "wrong # args: should be a boolean value.",
+                        (char*) NULL);
+                    return TCL_ERROR;
+                } else {
+                    tclrl_use_history_expansion = bool;
+                }
+            }
+            Tcl_AppendResult(interp, tclrl_use_history_expansion ? "1" : "0",
+                (char*) NULL);
+            break;
+
         default:
             goto BAD_COMMAND;
             /* NOTREACHED */
@@ -502,23 +524,28 @@ TclReadlineLineCompleteHandler(char* ptr)
          */

         char* expansion = (char*) NULL;
-        int status = history_expand(ptr, &expansion);
-
-        if (status >= 2) {
-            /* TODO: make this a valid tcl output */
-            printf("%s\n", expansion);
-            FREE(ptr);
-            FREE(expansion);
-            return;
-        } else if (status <= -1) {
-            Tcl_AppendResult
-                (tclrl_interp, "error in history expansion: ", expansion, "\n", (char*) NULL);
+        if (tclrl_use_history_expansion) {
+            int status = history_expand(ptr, &expansion);
+
+            if (status >= 2) {
+                /* TODO: make this a valid tcl output */
+                printf("%s\n", expansion);
+                FREE(ptr);
+                FREE(expansion);
+                return;
+            } else if (status <= -1) {
+                Tcl_AppendResult
+                    (tclrl_interp, "error in history expansion: ", expansion, "\n", (char*) NULL);
                 TclReadlineTerminate(TCL_ERROR);
-            FREE(ptr);
-            FREE(expansion);
-            return;
+                FREE(ptr);
+                FREE(expansion);
+                return;
+            } else {
+                Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL);
+            }
         } else {
-            Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL);
+            Tcl_AppendResult(tclrl_interp, ptr, (char*) NULL);
+            expansion = ptr;
         }

     #ifdef EXECUTING_MACRO_NAME
@@ -549,7 +576,9 @@ TclReadlineLineCompleteHandler(char* ptr)
          */
         TclReadlineTerminate(LINE_COMPLETE);
         FREE(ptr);
-        FREE(expansion);
+        if (tclrl_use_history_expansion) {
+            FREE(expansion);
+        }
     }
 }

@@ -670,7 +699,7 @@ TclReadlineCompletion(char* text, int start, int end)
     int status;
     rl_completion_append_character = ' '; /* reset, just in case ... */

-    if (text && ('!' == text[0]
+    if (tclrl_use_history_expansion && text && ('!' == text[0]
             || (start && rl_line_buffer[start - 1] == '!' /* for '$' */))) {
         char* expansion = (char*) NULL;
         int oldlen = strlen(rl_line_buffer);
@@ -893,4 +922,3 @@ TclReadlineParse(char** args, int maxargs, char* buf)
     *args = NULL;
     return nr;
 }
-
diff --git a/tclreadline.n.in b/tclreadline.n.in
index e128d22..b08b92f 100644
--- a/tclreadline.n.in
+++ b/tclreadline.n.in
@@ -170,6 +170,11 @@ idea of the terminal settings using terminalName as the terminal type.
 The form w/o argument might not work if tclreadline was compiled
 with an older version of libreadline.

+.TP 5
+\fB::tclreadline::readline historyexpansion\fP [\fIbool\fP]
+enable or disable history expansion.
+\fBtclreadline::readline historyexpansion\fP returns the current value.
+
 .TP 5
 \fB::tclreadline::readline bell\fP
 Ring the terminal bell, obeying the setting of bell-style
diff --git a/tclreadlineCompleter.tcl b/tclreadlineCompleter.tcl
index 49f5cd5..74d3bf1 100644
--- a/tclreadlineCompleter.tcl
+++ b/tclreadlineCompleter.tcl
@@ -3392,7 +3392,8 @@ namespace eval tclreadline {
         switch -- $pos {
             1 { return [CompleteFromList $text \
                             {read initialize write add complete customcompleter
-                             builtincompleter eofchar reset-terminal bell}]
+                             builtincompleter eofchar reset-terminal bell
+                             historyexpansion}]
             }
             2 {
                 switch -- $cmd {
@@ -3402,6 +3403,7 @@ namespace eval tclreadline {
                     add              { return [DisplayHints <completerLine>] }
                     completer        { return [DisplayHints <line>] }
                     customcompleter  { return [DisplayHints ?scriptCompleter?] }
+                    historyexpansion -
                     builtincompleter { return [CompleteBoolean $text] }
                     eofchar          { return [DisplayHints ?script?] }
                     reset-terminal   {
diff --git a/tclreadlineSetup.tcl.in b/tclreadlineSetup.tcl.in
index 1ba2cc3..e235888 100644
--- a/tclreadlineSetup.tcl.in
+++ b/tclreadlineSetup.tcl.in
@@ -76,13 +76,15 @@ proc unknown args {
     }
     if {[info exists savedErrorCode]} { set errorCode $savedErrorCode }
     if {[info exists savedErrorInfo]} { set errorInfo $savedErrorInfo }
-    if {$name == "!!"} {
-        set newcmd [history event]
-    } elseif {[regexp {^!(.+)$} $name dummy event]} {
-        set newcmd [history event $event]
-    } elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new]} {
-        set newcmd [history event -1]
-        catch {regsub -all -- $old $newcmd $new newcmd}
+    if {[::tclreadline::readline historyexpansion]} {
+        if {$name == "!!"} {
+            set newcmd [history event]
+        } elseif {[regexp {^!(.+)$} $name dummy event]} {
+            set newcmd [history event $event]
+        } elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new]} {
+            set newcmd [history event -1]
+            catch {regsub -all -- $old $newcmd $new newcmd}
+        }
     }
     if {[info exists newcmd]} {
         tclLog $newcmd

and another (on top of the previous one) making the manpage capitalisation a
bit more consistent while solving one or two typos/errors:

diff --git a/tclreadline.n.in b/tclreadline.n.in
index b08b92f..d78d183 100644
--- a/tclreadline.n.in
+++ b/tclreadline.n.in
@@ -84,18 +84,18 @@ Note that all commands reside in the namespace \fB::tclreadline::\fP.

 .TP 5
 \fB::tclreadline::readline add\fP \fIstring\fP
-adds a string to the completer. If the string contains white
+Adds a string to the completer. If the string contains white
 spaces, each of the words will be completed consecutively when
 hitting <Tab>. Example:

     ::tclreadline::readline add "button pathName ?options?"

-typing but<Tab> will complete to button. Hitting <Tab> again
+Typing but<Tab> will complete to button. Hitting <Tab> again
 will complete to "button pathName".  ...

 .TP 5
 \fB::tclreadline::readline complete\fP \fIstring\fP
-returns 1 if \fIstring\fP is a complete tcl command and 0 otherwise.
+Returns 1 if \fIstring\fP is a complete tcl command and 0 otherwise.

 .TP 5
 \fB::tclreadline::readline customcompleter\fP [\fIstring\fP]
@@ -126,7 +126,7 @@ the file tclreadlineSetup.tcl.

 .TP 5
 \fB::tclreadline::readline builtincompleter\fP [\fIbool\fP]
-enable or disable the builtin completer. If the builtin completer
+Enable or disable the builtin completer. If the builtin completer
 is enabled, it will be invoked either if there is no custom completer,
 or the custom completer returned an empty  string. The builtin
 completer is on by default.
@@ -135,7 +135,7 @@ custom completer (also, if called w/o the \fIbool\fP argument).

 .TP 5
 \fB::tclreadline::readline eofchar\fP [\fIscript\fP]
-set a script which will be called, if readline returns the eof character
+Set a script which will be called, if readline returns the eof character
 (this is typically the case if CTRL-D is entered at the very beginning
 of the line). The default for this script is "puts {}; exit". Setting
 this to an empty value disables any action on eof.
@@ -143,37 +143,37 @@ this to an empty value disables any action on eof.

 .TP 5
 \fB::tclreadline::readline initialize\fP \fIhistoryfile\fP
-initialize the tclreadline interface and read the history from
+Initialize the tclreadline interface and read the history from
 the \fIhistoryfile\fP. On success an empty string is returned.
 This command has to be called before any other tclreadline commands.

 .TP 5
 \fB::tclreadline::readline read\fP \fIprompt\fP
-prints the \fIprompt\fP to stdout and enters the tclreadline event
+Prints the \fIprompt\fP to stdout and enters the tclreadline event
 loop. Both readline and X events are processed. Returns the
 (eventually history-expanded) input string.
-\fBtclreadline::readline read\fP rises an error, if an
+\fBtclreadline::readline read\fP raises an error if an
 error occurs while evaluating a script completer.

 .TP 5
 \fB::tclreadline::readline write\fP \fIhistoryfile\fP
-writes the history to the \fIhistoryfile\fP. This command is called
+Writes the history to the \fIhistoryfile\fP. This command is called
 automatically from the internal routine ::tclreadline::Exit.
 If the variable \fBtclreadline::historyLength\fP is non-negative,
 the historyfile will be truncated to hold only this number lines.

 .TP 5
 \fB::tclreadline::readline reset-terminal\fP [\fIterminalName\fP]
-w/o argument: reset the state of the terminal to what it was
+Without argument: reset the state of the terminal to what it was
 before tclreadline was used. With argument: reinitialize readline's
 idea of the terminal settings using terminalName as the terminal type.
-The form w/o argument might not work if tclreadline was compiled
+The form without argument might not work if tclreadline was compiled
 with an older version of libreadline.

 .TP 5
 \fB::tclreadline::readline historyexpansion\fP [\fIbool\fP]
-enable or disable history expansion.
-\fBtclreadline::readline historyexpansion\fP returns the current value.
+Enable or disable history expansion. With no argument, returns the current
+value.

 .TP 5
 \fB::tclreadline::readline bell\fP
@@ -190,7 +190,7 @@ Redraw the current input line.

 .TP 5
 \fB::tclreadline::Print\fP [\fIyes / no\fP]
-turns on or off the default behavior of tclsh to print the result of
+Turns on or off the default behavior of tclsh to print the result of
 every command. This is turned on by default, so it will just behave
 as the tclsh w/o tclreadline. Turning off might be useful, when reading
 binary data for example. If \fB::tclreadline::Print\fP is called w/o
@@ -198,7 +198,7 @@ arguments, it returns the current setting.

 .TP 5
 \fB::tclreadline::Loop\fP [\fIhistoryfile\fP]
-enter the tclreadline main loop. This command is typically called from
+Enter the tclreadline main loop. This command is typically called from
 the startup resource file (something .tclshrc, depending on the interpreter
 you use, see the file `sample.tclshrc'). The main loop sets up some
 completion characteristics as variable -- try something like "puts $b<TAB>" --
@@ -213,7 +213,7 @@ it is probably a good idea to start with tclreadline::Loop

 .TP 5
 \fB::tclreadline::prompt1\fP
-a proc which is called by ::tclreadline::Loop and returns a string
+A proc which is called by ::tclreadline::Loop and returns a string
 which will be displayed as the primary prompt. This prompt will be
 something like "[info nameofexecutable] \\[[pwd]\\]" possibly fancy colored.
 The default proc is defined on entering the ::tclreadline::Loop,
@@ -238,7 +238,7 @@ in the file tclreadlineSetup.tcl in your tclreadline installation directory.

 .TP 5
 \fB::tclreadline::prompt2\fP
-a proc which is called by ::tclreadline::Loop and returns a string
+A proc which is called by ::tclreadline::Loop and returns a string
 which will be displayed as the secondary prompt when interactively
 prompting  for  continuation  of  an incomplete command.

@@ -256,19 +256,19 @@ namespace \fI::tclreadline\fP:

 .TP 5
 \fBtclreadline::version\fP (read-only)
-holds the version string "@VERSION@".
+Holds the version string "@VERSION@".

 .TP 5
 \fBtclreadline::patchLevel\fP (read-only)
-holds the patch level string "@PATCHLEVEL_STR@".
+Holds the patch level string "@PATCHLEVEL_STR@".

 .TP 5
 \fBtclreadline::library\fP (read-only)
-holds the library string "@TCLRL_DIR@".
+Holds the library string "@TCLRL_DIR@".

 .TP 5
 \fBtclreadline::license\fP (read-only)
-holds a BSD license statement.
+Holds a BSD license statement.

 .TP 5
 \fBtclreadline::historyLength\fP
@@ -278,7 +278,7 @@ will not be truncated.  See also \fBtclreadline::write\fP.

 .SH "FILES"

-the \fB.tclshrc\fP file in the HOME directory, which
+The \fB.tclshrc\fP file in the HOME directory, which
 is read on tclsh startup. Alternatively, the name of this initialization
 file might be \fB.wishrc\fP ... depending on what interpreter you use.
 These files should typically contain something like
@@ -292,14 +292,14 @@ These files should typically contain something like
 which will enter the tclreadline main loop.

 .PP
-the \fB.tclsh-history\fP file in the HOME directory. On startup
+The \fB.tclsh-history\fP file in the HOME directory. On startup
 commands will be read from this file. On exit, the readline history
 is written to this file. Note that if you abort tclsh with <cntrl-c>
 no history is written. For the future it is planned to set up a signal
 handler, which will write the history on <ctrl-c> before exiting.

 .PP
-the \fB.inputrc\fP file in the users HOME directory. This file
+The \fB.inputrc\fP file in the users HOME directory. This file
 is used normally for all programs which use the gnu readline (e.g.  bash).
 The `global' readline settings there will be valid also for
 \fBtclreadline\fP. Additionally the .inputrc might hold conditional
@@ -314,7 +314,7 @@ some lines in your .inputrc:
 For further documentation please refer to the gnu readline documentation.

 .SH "BUGS"
-citing the readline manual:  It's too big and too slow.
+Citing the readline manual:  It's too big and too slow.


 .SH "SEE ALSO"

COLUMNS and LINES set, but not updated on SIGWINCH

Following a big discussion yesterday on IRC, tclreadline seems to set those environment variables but for some reason, the SIGWINCH handler normally installed by readline isn't here.
In my case, this caused problems as [exec tput cols] wasn't updating because of the presence of these variables.

the '!' character can not be used in any tcl command in a tclreadline shell.

The ! character is used for history expansion, and thus can not be used as a regular character in tcl commands:

tclsh8.6 [~] set a {!}
tclreadline::Loop: error. error in history expansion: !}: event not found

tclsh8.6 [~] expr {!1}
invalid bareword "ls"
in expression "ls";
should be "$ls" or "{ls}" or "ls(...)" or ...
while evaluating expr {ls}
tclsh8.6 [~] 

Is there any way to tell tclreadline to avoid interpreting the ! character?

I know, the character can be escaped, like in:

set a "\!"
expr "\!1"

but this means I can not copy & paste tcl lines into the tclreadline console.

Use --prefix=/usr/local will cause the following problem: can't find package tclreadline.

On Ubuntu 20.10, I try to compile and install the latest git master version of tclreadline as shown below:

$ sudo apt-get build-dep -y tcl-tclreadline
$ git clone https://github.com/flightaware/tclreadline.git tclreadline.git
$ cd tclreadline.git
$ ./configure --prefix=/usr/local --enable-tclshrl --enable-wishrl
$ make
$ sudo make install

Then I set the $HOME/.tclshrc as noted here, but when I start tclsh, it will complain about the following problem:

$ tclsh
can't find package tclreadline
%

OTOH, it I don't use --prefix=/usr/local, the problem will be fixed. Any hints for this problem will be highly appreciated.

Regards,
HY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.