zsh-workers
 help / color / mirror / code / Atom feed
* Bug in spell correction of directories for cd
@ 2008-05-07 23:32 Vincent Lefevre
  2008-05-08  8:53 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Lefevre @ 2008-05-07 23:32 UTC (permalink / raw)
  To: zsh-workers

Hi,

This has annoyed me from some time, but spell corrections of directories
doesn't work correctly. I think it doesn't take the cdpath into account
or something like that. For instance:

prunille:~tmp> cd wd/db
zsh: correct 'wd/db' to 'wc/b' [nyae]? y
cd: not a directory: wc/b
zsh: exit 1
prunille:~tmp[1]> cd wd/db
zsh: correct 'wd/db' to 'wc/b' [nyae]? n
~/wd/db
prunille:~/wd/db> 

Note that in ~tmp, there is a directory wc and a file b (which is not
a directory) in wc.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


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

* Re: Bug in spell correction of directories for cd
  2008-05-07 23:32 Bug in spell correction of directories for cd Vincent Lefevre
@ 2008-05-08  8:53 ` Peter Stephenson
  2008-05-08 14:59   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2008-05-08  8:53 UTC (permalink / raw)
  To: zsh-workers

On Thu, 8 May 2008 01:32:34 +0200
Vincent Lefevre <vincent@vinc17.org> wrote:
> This has annoyed me from some time, but spell corrections of directories
> doesn't work correctly. I think it doesn't take the cdpath into account
> or something like that.

As far as I can see the only place where directories are handled specially
during spell-checking is in command position with AUTO_CD set.

Spell checking is very much simpler than completion and has virtually no
knowledge of context beyond whether or not the word is in command position.
It's in the main shell, which makes it hard to use all the pre-existing
correction code in completion.  Probably the only sensible way to improve
it would be to run something when the line editor exited.  Even that's
quite hard to set up since it would have to scan every word as if it were
being completed, or something such.

You can, of course, set up correction so that you can invoke it directly
from the line editor, but it's not the same as having it checked as you go
along.

Hmm...  I wonder if there's scope for an even-more-magic-space command that
sees if a shell argument has just been completed and if it should spell
check it?  You'd need a long list either of exceptions or inclusions, which
might have to be narrowed down by argument position.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: Bug in spell correction of directories for cd
  2008-05-08  8:53 ` Peter Stephenson
@ 2008-05-08 14:59   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2008-05-08 14:59 UTC (permalink / raw)
  To: zsh-workers

On May 8,  9:53am, Peter Stephenson wrote:
}
} Hmm... I wonder if there's scope for an even-more-magic-space command
} that sees if a shell argument has just been completed and if it
} should spell check it?

The trouble with that is that completion usually adds the trailing space,
so when would one ever type the space that invokes even-more-magic-space?

} You'd need a long list either of exceptions or inclusions, which might
} have to be narrowed down by argument position.

Here's a nutty idea.  In the same way that highlighting regions are
maintained for the buffer, maintain a list of regions that label how
that particular part of the buffer was filled: by ordinary self-insert,
by completion, by yanking from the kill ring, etc.  Then when global
correction makes its pass over the words, it could use those region
labels for context.

Of course one reason this is nutty is because of the ability for user-
defined widgets to manipulate BUFFER and friends directly.  The other
is that correction is in the main shell and doesn't necessarily have
anything to do with ZLE.


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

end of thread, other threads:[~2008-05-08 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-07 23:32 Bug in spell correction of directories for cd Vincent Lefevre
2008-05-08  8:53 ` Peter Stephenson
2008-05-08 14:59   ` Bart Schaefer

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).