home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / tcl / 1314 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.1 KB  |  44 lines

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