diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..432a0b6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: c + +sudo: true + +os: + - linux + - osx + +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install tcl-tk; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --force --overwrite tcl-tk; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install readline; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y tcl8.6-dev; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y lib64readline6-dev; fi + +script: + - autoreconf -vi + - if [ -f /usr/local/lib/tclConfig.sh ]; then ./configure --with-readline-includes=/usr/local/Cellar/readline/7.0.3_1/include --with-readline-library=/usr/local/Cellar/readline/7.0.3_1/lib --with-tcl=/usr/local/lib; else ./configure; fi + - make + - sudo make install diff --git a/configure.ac b/configure.ac index 9a07d3f..a9ddb7d 100644 --- a/configure.ac +++ b/configure.ac @@ -107,7 +107,7 @@ AC_ARG_WITH(tcl-includes, AC_MSG_CHECKING([where to look for tcl.h]) TCL_INCLUDE_DIR="" -for dir in $tcl_includes $prefix/include/ /usr/include; do +for dir in $tcl_includes $prefix/include/ ${TCL_INCLUDE_SPEC#-I} /usr/include; do if test -r $dir/tcl.h; then TCL_INCLUDE_DIR=$dir break diff --git a/sample.tclshrc b/sample.tclshrc index 3e650f9..bc0349e 100644 --- a/sample.tclshrc +++ b/sample.tclshrc @@ -58,6 +58,10 @@ if {$tcl_interactive} { # # ::tclreadline::readline customcompleter "" + # automatically save the history after every + # command (instead of when cleanly exiting) + set tclreadline::autosave 1 + # go to tclrealdine's main loop. # tclreadline::Loop diff --git a/tclreadlineSetup.tcl.in b/tclreadlineSetup.tcl.in index d418345..3c99413 100644 --- a/tclreadlineSetup.tcl.in +++ b/tclreadlineSetup.tcl.in @@ -289,6 +289,12 @@ namespace eval tclreadline { if {[string length $::tclreadline::LINE] && [history event 0] != $::tclreadline::LINE} { history add $::tclreadline::LINE + if {[info exists ::tclreadline::autosave] && \ + [string is true -strict $::tclreadline::autosave] && \ + [catch {::tclreadline::readline write [::tclreadline::HistoryFileGet]} \ + ::tclreadline::errorMsg]} { + puts stderr $::tclreadline::errorMsg + } } if {[catch {