home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!karl
- From: karl@NeoSoft.com (Karl Lehenbauer)
- Subject: Re: wish -- command line editing
- Organization: NeoSoft Communications Services -- (713) 684-5900
- Date: Mon, 07 Sep 1992 17:28:53 GMT
- Message-ID: <1992Sep07.172853.19830@NeoSoft.com>
- References: <55220005@hpfcbig.SDE.HP.COM> <189ipjINNd1b@agate.berkeley.edu> <1992Sep5.073337.9071@cs.ubc.ca>
- Lines: 33
-
- I've thought about adding some tcsh-like command line editing to Extended
- Tcl, and will outline my ideas below. Mark Diekhans has pretty much talked
- me out of doing it by convincing me that Tcl is a programming language and
- not a shell, but hey, that's not to say that it wouldn't be a worthwhile
- project.
-
- I added a new Tcl command, written in C, called "getkey" which lets you
- read single keys from the user's keyboard.
-
- The idea is that when some magic key is hit, you would try to do command
- or filename completion.
-
- To do command completion, let's say we're building up the word the user
- is typing by repeatedly appending characters to a variable called "command".
-
- When the user hits the meta key, a possibly incomplete command name is
- in "command", so we do a "info commands $command*" and look at what is
- returned. If no elements are returned, you have an invalid command name.
- If only one element is returned, you have a unique command
- name. If more than one is returned, you still have multiple matches, and
- may offer them to the user a la command completion in the cmushell under
- EMACS.
-
- Note that with the autoloading capability of Tcl, a valid command name may
- not be present but would be loaded once you tried to execute it, so you'll
- have to look at the Tcl code that handles autoloading and peek into its
- arrays to see if the command exists.
-
- For filename completion, play the same tricks with "glob" instead.
- --
- -- Email info@NeoSoft.com for info on getting interactive Internet access.
- You will now awaken feeling relaxed and refreshed, remembering everything
- you've read except the details of the Omega contingency plan.
-