Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -1,8 +1,8 @@ # -*- make -*- -# FILE: "/diska/home/joze/src/tclreadline/Makefile.in" -# LAST MODIFICATION: "Fri Aug 20 17:22:45 1999 (joze)" +# FILE: "/home/joze/src/tclreadline/Makefile.in" +# LAST MODIFICATION: "Sat Aug 21 00:21:27 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -178,18 +178,19 @@ aux/install-sh \ aux/mkinstalldirs \ aux/vimtags MAN = tclreadline.n +HTML = tclreadline.n.html CIFLAGS = -f -t-"gnu readline for tcl" -m"before initial relase" .PHONY: clean distclean ctags tcltags vimtags tags ci co .SUFFIXES: .c .o .so .sl .tcl -all: $(TCLREADLINE_LIB_FILE) pkgIndex.tcl +all: $(TCLREADLINE_LIB_FILE) @TCLREADLINE_LIB_FILE@: ${OBJS} rm -f $(TCLREADLINE_LIB_FILE) @MAKE_LIB@ $(TERMCAP_LIB) $(READLINE_LIB) @@ -218,12 +219,12 @@ FORCE: $(MANN_INSTALL_DIR)/$(MAN): FORCE - $(INSTALL_DATA) $(srcdir)/$(MAN) $@ && chmod 644 $@ -pkgIndex.tcl: - @echo "eval pkg_mkIndex $(TOP_DIR) tclreadline*.tcl" | tclsh +tclreadline.n.html: tclreadline.n + rman -f html $^ > $@ Makefile: $(TOP_DIR)/Makefile.in $(SHELL) config.status clean: @@ -264,13 +265,13 @@ ci -u $(CIFLAGS) $^ co: $(SOURCES) co -l $^ -distribution: $(SOURCES) configure $(AUXILIARY) +distribution: $(SOURCES) configure $(AUXILIARY) tclreadline.n.html - mkdir -p dist/tclreadline-$(VERSION)/aux - - cp $(SOURCES) configure dist/tclreadline-$(VERSION) + - cp $(SOURCES) configure tclreadline.n.html dist/tclreadline-$(VERSION) - cp $(AUXILIARY) dist/tclreadline-$(VERSION)/aux (cd dist; tar zcvf tclreadline-$(VERSION).tar.gz tclreadline-$(VERSION); rm -rf tclreadline-$(VERSION)) # DO NOT DELETE THIS LINE -- make depend depends on it. Index: configure.in ================================================================== --- configure.in +++ configure.in @@ -1,8 +1,8 @@ # -*- autoconf -*- -# FILE: "/diska/home/joze/src/tclreadline/configure.in" -# LAST MODIFICATION: "Fri Aug 20 15:52:19 1999 (joze)" +# FILE: "/home/joze/src/tclreadline/configure.in" +# LAST MODIFICATION: "Fri Aug 20 23:57:02 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -110,10 +110,11 @@ # ----------------------------------------------------------------------- # Set up a new default --prefix. # ----------------------------------------------------------------------- +# this is the default anyway: # AC_PREFIX_DEFAULT(/usr/local) if test "${prefix}" = "NONE"; then prefix=$TCL_PREFIX fi @@ -121,11 +122,11 @@ exec_prefix=$TCL_EXEC_PREFIX else TCLREADLINE_PACKAGE_PATH=${exec_prefix}/lib fi -TCLREADLINE_LIBRARY=$TCLREADLINE_PACKAGE_PATH/tclreadline$TCLREADLINE_VERSION +TCLREADLINE_LIBRARY=${exec_prefix}/lib/tclreadline$TCLREADLINE_VERSION # ----------------------------------------------------------------------- # Check for some programs here. # ----------------------------------------------------------------------- Index: tclreadline.c ================================================================== --- tclreadline.c +++ tclreadline.c @@ -1,10 +1,10 @@ /* ================================================================== - FILE: "/diska/home/joze/src/tclreadline/tclreadline.c" - LAST MODIFICATION: "Fri Aug 20 18:14:57 1999 (joze)" + FILE: "/home/joze/src/tclreadline/tclreadline.c" + LAST MODIFICATION: "Fri Aug 20 23:41:24 1999 (joze)" (C) 1998, 1999 by Johannes Zellner, $Id$ --- tclreadline -- gnu readline for tcl @@ -214,11 +214,11 @@ } void TclReadlineDataAvailableHandler (ClientData clientData, int mask) { -#if 1 +#if 0 fprintf (stderr, "(TclReadlineDataAvailableHandler) mask = %d\n", mask); #endif if (mask & TCL_READABLE) { rl_callback_read_char (); rl_redisplay (); Index: tclreadline.n.in ================================================================== --- tclreadline.n.in +++ tclreadline.n.in @@ -1,10 +1,10 @@ .TH tclreadline n "@TCLREADLINE_VERSION@" "Johannes Zellner" .\" (C) 1999 by Johannes Zellner -.\" FILE: "/diska/home/joze/src/tclreadline/tclreadline.n.in" -.\" LAST MODIFICATION: "Fri Aug 20 15:01:22 1999 (joze)" +.\" FILE: "/home/joze/src/tclreadline/tclreadline.n.in" +.\" LAST MODIFICATION: "Sat Aug 21 00:33:01 1999 (joze)" .\" (C) 1998, 1999 by Johannes Zellner, .\" $Id$ .\" --- .\" .\" tclreadline -- gnu readline for the tcl scripting language @@ -129,10 +129,35 @@ .TP 5 \fB::tclreadline::Loop\fP enter the tclreadline main loop. This command is typically called from the startup resource file (something .tclshrc, depending on the interpreter you use). \fB::tclreadline::Loop\fP will normally not return. + +.TP 5 +\fB::tclreadline::prompt1\fP +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, +if it is not already defined. So: If you define your own proc +::tclreadline::prompt1 before entering ::tclreadline::Loop, this +proc is called each time the prompt is to be displayed. +Example: +.EQ + package require tclreadline + namespace eval tclreadline { + proc prompt1 {} { + return "[clock format [clock seconds]]> " + } + } + ::tclreadline::Loop +.EN +Note that non-printable control characters as color control characters +must be enclosed in literal ctrl-a / ctrl-b to tell readline the length +of the printable prompt. See for example the variable `prompt_string' +in the file tclreadlineSetup.tcl in your tclreadline installation directory. + .\".SH "EXAMPLES" .\".SH "ENVIRONMENT VARIABLES" @@ -173,21 +198,21 @@ settings for the implementation name \fBtclreadline\fP. Example of some lines in your .inputrc: .EQ $if tclreadline - "\C-xp": "puts $env(PATH)" + "\\C-xp": "puts $env(PATH)" $endif .EN For further documentation please refer to the gnu readline documentation. .SH BUGS probably. -.SH "SEE ALSO" +.SH SEE ALSO .PP The official \fBtclreadline\fP web site at: @@ -203,11 +228,12 @@ .SH CONTRIBUTIONS, SUGGESTIONS AND PATCHES Magnus Eriksson , Les Johnson , Harald Kirsch , Christian Krone , -Larry W. Virden +Larry W. Virden , +David Engel , .SH DEBIAN PACKAGE David Engel , .SH HISTORY Index: tclreadlineSetup.tcl.in ================================================================== --- tclreadlineSetup.tcl.in +++ tclreadlineSetup.tcl.in @@ -1,8 +1,8 @@ #!/usr/local/bin/tclsh -# FILE: "/diska/home/joze/src/tclreadline/tclreadlineSetup.tcl.in" -# LAST MODIFICATION: "Fri Aug 20 15:23:15 1999 (joze)" +# FILE: "/home/joze/src/tclreadline/tclreadlineSetup.tcl.in" +# LAST MODIFICATION: "Sat Aug 21 00:19:39 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -44,15 +44,15 @@ if ![info exists auto_noload] { # # Make sure we're not trying to load the same proc twice. # if [info exists unknown_pending($name)] { - return -code error "self-referential recursion in \"unknown\" for command \"$name\""; + return -code error "self-referential recursion in \"unknown\" for command \"$name\"" } - set unknown_pending($name) pending; + set unknown_pending($name) pending set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg] - unset unknown_pending($name); + unset unknown_pending($name) if {$ret != 0} { return -code $ret -errorcode $errorCode \ "error while autoloading \"$name\": $msg" } if ![array size unknown_pending] { @@ -164,21 +164,23 @@ set prompt_string "\[0;91m$base\[0m" } } - proc ::tclreadline::prompt1 {} { - variable prompt_string - global env - if {[catch {set pwd [pwd]} tmp]} { - set pwd "unable to get pwd" - } - - if [info exists env(HOME)] { - regsub $env(HOME) $pwd "~" pwd - } - return "$prompt_string \[$pwd\]" + if {"" == [info procs ::tclreadline::prompt1]} { + proc ::tclreadline::prompt1 {} { + variable prompt_string + global env + if {[catch {set pwd [pwd]} tmp]} { + set pwd "unable to get pwd" + } + + if [info exists env(HOME)] { + regsub $env(HOME) $pwd "~" pwd + } + return "$prompt_string \[$pwd\]" + } } } proc ls {args} { if {[exec uname -s] == "Linux"} { @@ -291,11 +293,11 @@ } else { set ::tclreadline::LINE [::tclreadline::readline read %] } while {![::tclreadline::readline complete $::tclreadline::LINE]} { - append ::tclreadline::LINE ";" + append ::tclreadline::LINE "\n" append ::tclreadline::LINE [::tclreadline::readline read \ ${::tclreadline::prompt2}] } # Magnus Eriksson proposed