Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Auto-correct and newly-added commands

On Nov 18, 10:50am, Daniel Serodio wrote:
} Subject: Re: Auto-correct and newly-added commands
} Bart Schaefer wrote:
} > On Nov 14,  4:31pm, Daniel Serodio (lists) wrote:
} > }
} > } It it possible to have zsh automatically run "rehash" after I reply no
} > } to an auto-correct prompt, so it "learns" this new command?
} >
} > That would certainly seem logical.  Also it seems strange to load up
} > the command tables and check them for proper spellings when the word
} > that is being checked is not in the command position to begin with.
} Hmm, maybe my explanation wasn't clear (or I don't understand your 
} reply), but I only have problem with real commands (in the beginning of 
} the line), not with their arguments. Or did you mention "words not in 
} the command position" from reviewing the code and not my explanation?

The latter (that's the first hunk of the patch).

} > What this patch does is reset the incremental path search in the event
} > the correction is rejected.  That allows whatever hashing options the
} > user has specified to kick in at the time the path is searched during
} > command execution, rather than having to test them all here.
} This sounds like what I need, but when I tried to apply this patch, it 
} failed (both on zsh 4.3.12 and on a fresh git clone).

I'm not sure why it would have failed on 4.3.12, but it's already been
committed to sourceforge CVS so a fresh git of the very latest probably
won't need to have it applied.

What was the failure message from patch?  Did you use "patch -p0" ?
} Where should I apply this patch?

For your purposes you only need the second hunk with two lines added.
Try manually deleting the first hunk and then applying the second:

} > @@ -2621,6 +2623,8 @@
} >   		fflush(shout);
} >   		zbeep();
} >   		x = getquery("nyae \t", 0);
} > +		if (cmd&&  x == 'n')
} > +		    pathchecked = path;
} >   	    } else
} >   		x = 'n';
} >   	} else

Messages sorted by: Reverse Date, Date, Thread, Author