* Don't suggest completion functions when 'correcting' on non-existant commands @ 2008-12-31 17:48 Richard Hartmann 2008-12-31 18:12 ` Frank Terbeck 0 siblings, 1 reply; 7+ messages in thread From: Richard Hartmann @ 2008-12-31 17:48 UTC (permalink / raw) To: Zsh Workers, 257336-forwarded Hi all, bug 257336[1] made me think of something that has annoyed me for ages, but never enough to actually send email to the list: richih@roadwarrior ~ % figlet zsh: correct 'figlet' to '_figlet'? [N/y/a/e] I don't know enough about zsh internas to guesstimate if this is an easy fix or not. Two possible solutions which come to mind: 1) Make zsh aware of what functions came in through $FPATH and which came in through $PATH so the correction function does not even see them when looking for other executable commands. 2) Make the completion function do the filtering outlined in 1) Richard [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257336 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't suggest completion functions when 'correcting' on non-existant commands 2008-12-31 17:48 Don't suggest completion functions when 'correcting' on non-existant commands Richard Hartmann @ 2008-12-31 18:12 ` Frank Terbeck 2008-12-31 18:46 ` Bart Schaefer 0 siblings, 1 reply; 7+ messages in thread From: Frank Terbeck @ 2008-12-31 18:12 UTC (permalink / raw) To: Zsh Workers Richard Hartmann <richih.mailinglist@gmail.com>: > bug 257336[1] made me think of something that has annoyed me > for ages, but never enough to actually send email to the list: > > richih@roadwarrior ~ % figlet > zsh: correct 'figlet' to '_figlet'? [N/y/a/e] Here's a possible solution for this: <http://bewatermyfriend.org/posts/2007/12-26.11-50-38-tooltime.html> I've thought about submitting this for inclusion... And I'd look into it the next days, if there's interest in it. Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't suggest completion functions when 'correcting' on non-existant commands 2008-12-31 18:12 ` Frank Terbeck @ 2008-12-31 18:46 ` Bart Schaefer 2009-01-02 22:54 ` Frank Terbeck 0 siblings, 1 reply; 7+ messages in thread From: Bart Schaefer @ 2008-12-31 18:46 UTC (permalink / raw) To: Zsh Workers [Removed debian bugs from recipients] On Dec 31, 6:48pm, Richard Hartmann wrote: } } richih@roadwarrior ~ % figlet } zsh: correct 'figlet' to '_figlet'? [N/y/a/e] } } I don't know enough about zsh internas to guesstimate if this is } an easy fix or not. Two possible solutions which come to mind: } } 1) Make zsh aware of what functions came in through $FPATH } and which came in through $PATH No, that doesn't make sense. Functions never "come in" through $PATH, only external commands do; and of functions only autoloaded ones are affected by $FPATH. A closer approximation to what you want would be for correction to filter out names that are bound to widgets, but even that doesn't go far enough; it'd also have to filter out names that begin with an underscore. The reason for the leading-underscore convention is so that things like that would be possible, but of course it is only a convention. Filtering out widgets is problematic because correction is a part of the base shell and ZLE is added as a module. } 2) Make the completion function do the filtering outlined in 1) That doesn't work either because correction and completion have almost nothing to do with one another, internally. Completion is long since over before correction kicks in. What you really want is something like $fignore applied to correction. On Dec 31, 7:12pm, Frank Terbeck wrote: } } Here's a possible solution for this: } <http://bewatermyfriend.org/posts/2007/12-26.11-50-38-tooltime.html> That's not really a solution; it just replaces the correction prompt with a different prompt. It might be interesting for other reasons. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't suggest completion functions when 'correcting' on non-existant commands 2008-12-31 18:46 ` Bart Schaefer @ 2009-01-02 22:54 ` Frank Terbeck 2009-01-03 2:48 ` Bart Schaefer 0 siblings, 1 reply; 7+ messages in thread From: Frank Terbeck @ 2009-01-02 22:54 UTC (permalink / raw) To: Zsh Workers Bart Schaefer <schaefer@brasslantern.com>: [...] > On Dec 31, 7:12pm, Frank Terbeck wrote: > } > } Here's a possible solution for this: > } <http://bewatermyfriend.org/posts/2007/12-26.11-50-38-tooltime.html> > > That's not really a solution; it just replaces the correction prompt > with a different prompt. Well, to me it's not really another prompt, because you're not actually prompted for anything. It's merely a warning message, that gets displayed below the prompt. If you hit enter again, the command line is processed normally (probably with command correction kicking in). So, it does prevent a prompt the first time you hit enter. E.g.: If it's due to a not-yet-installed piece of software you can push-input the current cmdline, aptitude-install (or whatever way your OS does it) and then just hit enter to have the pushed command executed - with the missing program installed. > It might be interesting for other reasons. What would those reasons be? ...maybe you see use-cases I didn't see, yet. :-) Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't suggest completion functions when 'correcting' on non-existant commands 2009-01-02 22:54 ` Frank Terbeck @ 2009-01-03 2:48 ` Bart Schaefer 2009-01-03 11:42 ` Frank Terbeck 0 siblings, 1 reply; 7+ messages in thread From: Bart Schaefer @ 2009-01-03 2:48 UTC (permalink / raw) To: Zsh Workers On Jan 2, 11:54pm, Frank Terbeck wrote: } } > On Dec 31, 7:12pm, Frank Terbeck wrote: } > } } > } <http://bewatermyfriend.org/posts/2007/12-26.11-50-38-tooltime.html> } > } > That's not really a solution; it just replaces the correction prompt } > with a different prompt. } } Well, to me it's not really another prompt, because you're not } actually prompted for anything. It nevertheless stops whatever is going on and makes you hit enter, which is not that much better than answering "N" to a request to correct the command name. } E.g.: If it's due to a not-yet-installed piece of software you can } push-input the current cmdline, aptitude-install (or whatever way your } OS does it) and then just hit enter to have the pushed command } executed - with the missing program installed. } } > It might be interesting for other reasons. } } What would those reasons be? ...maybe you see use-cases I didn't see, } yet. :-) Well, on Ubuntu under bash when a command is not found you get told what to do to install it (e.g. what package to apt-get install). This could be the basis for something like that for zsh. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't suggest completion functions when 'correcting' on non-existant commands 2009-01-03 2:48 ` Bart Schaefer @ 2009-01-03 11:42 ` Frank Terbeck 2009-01-21 17:08 ` Richard Hartmann 0 siblings, 1 reply; 7+ messages in thread From: Frank Terbeck @ 2009-01-03 11:42 UTC (permalink / raw) To: Zsh Workers Bart Schaefer <schaefer@brasslantern.com>: > On Jan 2, 11:54pm, Frank Terbeck wrote: > } > On Dec 31, 7:12pm, Frank Terbeck wrote: > } > } > } > } <http://bewatermyfriend.org/posts/2007/12-26.11-50-38-tooltime.html> > } > > } > That's not really a solution; it just replaces the correction prompt > } > with a different prompt. > } > } Well, to me it's not really another prompt, because you're not > } actually prompted for anything. > > It nevertheless stops whatever is going on and makes you hit enter, which > is not that much better than answering "N" to a request to correct the > command name. Since the problem only occurs as soon as you hit enter, I don't see the problem, that this workaround (yeah, let's call it that way) only kicks in as soon as you hit enter. If it detects the problem, it displays a warning below the prompt and ignores the first enter completely. Nothing changes. So, at least for me (and some other folks who I know use this, too) that's a lot less annoying than the correction question. Of course, a solution within zle would be way cleaner. I tried that, before I wrote that accept-line wrapper back then. Obviously, I failed - who would have guessed. :-) > } E.g.: If it's due to a not-yet-installed piece of software you can > } push-input the current cmdline, aptitude-install (or whatever way your > } OS does it) and then just hit enter to have the pushed command > } executed - with the missing program installed. > } > } > It might be interesting for other reasons. > } > } What would those reasons be? ...maybe you see use-cases I didn't see, > } yet. :-) > > Well, on Ubuntu under bash when a command is not found you get told what > to do to install it (e.g. what package to apt-get install). This could > be the basis for something like that for zsh. Yeah, that could probably be done. I'll take a look at it as soon as I can find the time. :) Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't suggest completion functions when 'correcting' on non-existant commands 2009-01-03 11:42 ` Frank Terbeck @ 2009-01-21 17:08 ` Richard Hartmann 0 siblings, 0 replies; 7+ messages in thread From: Richard Hartmann @ 2009-01-21 17:08 UTC (permalink / raw) To: Zsh Workers On Sat, Jan 3, 2009 at 12:42, Frank Terbeck <ft@bewatermyfriend.org> wrote: > Yeah, that could probably be done. I'll take a look at it as soon as I > can find the time. :) Not exactly mine any more but bump nonetheless :) Richard ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-01-21 17:08 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-12-31 17:48 Don't suggest completion functions when 'correcting' on non-existant commands Richard Hartmann 2008-12-31 18:12 ` Frank Terbeck 2008-12-31 18:46 ` Bart Schaefer 2009-01-02 22:54 ` Frank Terbeck 2009-01-03 2:48 ` Bart Schaefer 2009-01-03 11:42 ` Frank Terbeck 2009-01-21 17:08 ` Richard Hartmann
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).