[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Es and autocompleting
Noah Friedman writes:
Completion is context-sensitive and requires knowledge of grammar
and syntax, which vary from shell to shell.
If you have to teach the window system how to do context-sensitive
completion and history for csh, sh, rc, scsh, etc. you've now moved
a lot of application-specific knowledge...
The claim has been made that the shell is the best place to do
command-line editing because of application-specific knowledge.
You could reasonably also claim:
* The debugger is the best place to do command-line editing
because of application-specific knowledge (such as grammar and
syntax, variables in the debuggee, ...).
* The mail client is the best place to do command-line editing
(grammar and syntax, email addresses, ...).
* The ftp client is the best place to do command-line editing
(grammar and syntax, remote filename completion, ...).
As you start adding completion to every program, you get complexity and
code bloat in every program -- except, of course, the ones you haven't spent the
time adding command-line editing to. If the command-line editor is at a level
above the shell (I hesitate to say "window system"), then you get that
editing with *every* program -- even trivial ones like "cat".
Furthermore, if you have the command-line editing above the shell level,
and this level sports some sort of completion mechanism (like rk), then
you can actually have completion mechanisms that can be helpful *across*
the exec barrier.
For example, when I run the command "telnet foo.com smtp", rk might
suggest that the next line I want to type is "ehlo cloud.rain.com",
and then "mail from:". On the other hand, if I type "telnet foo.com
http", rk can suggest "GET /" as the next thing to type. (Yes, these
are realistic examples -- I was doing some tiger-team work a few months
back).
Zsh hackers aside, I hope no one suggests that telnet should include
command-line editors for every port you might want to type at, but with
a good higher-level command-line editor, you get this all for free.