On Jan 13, 2008 2:31 PM, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> On Jan 13, 2008 12:05 PM, Isaac Dupree <[EMAIL PROTECTED]> wrote:
> >
> > How can I not be misinterpreted? I know it's inefficient and risky, so
> > I want the users who try it out of old habits to be directed to the
> > fish-way of doing it, not to get a puzzling error message with no idea
> > what happened! I'm saying that even if "This is about as complicated as
> > fully implementing "!!".", it's better for us to give a message than to
> > "fully implement !!", (if it's worth doing either -- which sounds nearly
> > impossible to do without unduly messing up cases where it was intended
> > as a normal string. In other words, I think it's harder to implement
> > the message ideally than to implement bash-style !!)
>
> I agree with you that giving a nice error message to guide you toward
> the fish way of doing things would be nice. In this case, the only way
> to do that is to make '!' into a special magical character that has to
> be escaped, though, and I don't think that it's worth making yet
> another character magical just to give better error messages.
>
How about a "newbie mode": recognize certain constructs that would
otherwise be legal, but do it only once, or only until the user
acknowledges that he has learnt the lesson (this is easy - just set a
universal var).
Drawback: It's against fish's "no modes" guideline. Also, given the
statistic below, it's almost unneeded.
Another idea: "message area": automatically display the helpful
messages while editing, below the edited command:
[EMAIL PROTECTED] ~> sudo !!
HINT: fish doesn't support history substitution.
Use <Up> and <Alt+Up> to recall commands and words interactively;
type 'help editor' to learn more more.
You can also use the $history array if you really need.
The offending "!!" and/or the message should be in some new color to
make it more obvious.
When you press Enter, the message silently disappears, and real errors
are reported (if any).
This allows warnings and tips for constructs that are legal.
It also allows hints like "Use 'end' to end the loop" which can't be
done in any other way because the multi-line editor doesn't accept
your command for execution if you don't know how to close it :-).
BTW, if we grow a mechanism to display lines and then clear them, we
can use it for completions too!
"pyrepl" does this for python and it's a nice experience. fish
completions are more informative, so clearing them is a pity => they
should stay visible until the users presses TAB in another place or
something like that.
The messages themselves can be loaded from a simple file with
pattern-message pairs, reacting to the first matching pattern. This
should cover 98% of the needs.
I went over the index of info bash. Here is an (incompolete) list of
bash constructs that sould have a helpful "did you mean" message:
[Classification: "-" = silently accepted, "+" = unhelpful error, "*" =
helpful error]
+ all bash builtins (if not found in PATH)
+ let, ((arithmetic)), $((arithmetic expr))
+ [[ ... ]]
+ $(foo)
- `foo`
+ $'\t', $"gettext" - prints wrong message (appropriate for $(foo))
* foo && bar || baz
* foo=bar - but should also mention "env"
+ foo=(bar baz)
- !!, ^foo^bar and similar history expansions
+ done, fi, etc - currently can't even press enter if you don't know
the magic "end"
+ {foo; bar}
+ (foo; bar)
+ {1..10}
+ foo[XYZW] globbing
+ ${foo}, ${foo-bar}, etc
+ foo () {
- $0, $1, $2...
+ $*, $@, $#, $?, $-, $$, $!
+ cp <(foo) >(bar)
+ foo >| noclobber-file
+ echo <<END
+ foo <>read_and_write_file
- Ctrl-R should hint at Up / Alt+Up. Other important bindings?
There might more more. And of course, constructs from zsh, tcsh, etc.
should also be treated.
P.S. unrelated: I just used "help" which tried to launch firefox but
firefox failed for whatever reason.
I'm left without ability to see help. This is bad. Not everybody
knows about BROWSER.
Proposed solution: help should have "--browser=foo" and "--stdout"
options, which must also appear in help completion.
--
Beni Cherniavsky <[EMAIL PROTECTED]> (I read email only on weekends)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users