zsh-workers
 help / color / mirror / code / Atom feed
* Re: nocorrect deduced from completion list?
@ 2000-01-04  9:32 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-01-04  9:32 UTC (permalink / raw)
  To: zsh-workers


Adam Spiers wrote:

> This may be a totally unrealistic idea, but in principle it works
> nicely (I think):
> 
> How about an option which intercepts command-line processing just
> before spelling correction is invoked, and checks whether the word
> under suspicion of incorrect spelling belongs to the list of
> completions for that context?  E.g.
> 
> % perldoc -f pos
> zsh: correct 'pos' to 'os' [nyae]? n
> 
> would never happen, because `pos' is in the list of completions in the
> :complete::perldoc::-f-1 context.  It might slow things down too much
> for some people's tastes, but would it be worth implementing anyway?

I've been thinking about this too. A bit. I haven't really looked at
the code, but maybe something like this could be allowed via the
preexec function -- changing the command liine, which would then
require re-parsing.

Or maybe it's better to do something like this with a shell function
for accept-line (which should almost be possible already, the only
problem is that $BUFFERLINES is read-only).

But the main problem is to find out the right places where to call
completion (i.e. set $CURSOR, try completion, look at the result,
place the cursor at the next interesting position, etc.). A good
starting point may be try it at every white space after a word. But I
think we would really need a way to split a string into command line
words with full shell parsing to find the places where to set the
cursor. We currently only have this in the completion code. Hm. That
would mean to split the line at every command separator, call the
completion code only to get the $words (i.e. without any completers),
look at those words to find out which should be checked, call the
completion code for them and continue with the next command. Sounds
terribly expensive...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* nocorrect deduced from completion list?
@ 1999-12-17 17:47 Adam Spiers
  0 siblings, 0 replies; 2+ messages in thread
From: Adam Spiers @ 1999-12-17 17:47 UTC (permalink / raw)
  To: zsh workers mailing list

This may be a totally unrealistic idea, but in principle it works
nicely (I think):

How about an option which intercepts command-line processing just
before spelling correction is invoked, and checks whether the word
under suspicion of incorrect spelling belongs to the list of
completions for that context?  E.g.

% perldoc -f pos
zsh: correct 'pos' to 'os' [nyae]? n

would never happen, because `pos' is in the list of completions in the
:complete::perldoc::-f-1 context.  It might slow things down too much
for some people's tastes, but would it be worth implementing anyway?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-01-04  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-04  9:32 nocorrect deduced from completion list? Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-12-17 17:47 Adam Spiers

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).