From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18268 invoked by alias); 15 Nov 2011 04:16:46 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16581 Received: (qmail 8346 invoked from network); 15 Nov 2011 04:16:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <111114201608.ZM11290@torch.brasslantern.com> Date: Mon, 14 Nov 2011 20:16:08 -0800 In-reply-to: <4EC15E90.6020703@mandic.com.br> Comments: In reply to "Daniel Serodio (lists)" "Auto-correct and newly-added commands" (Nov 14, 4:31pm) References: <4EC15E90.6020703@mandic.com.br> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Auto-correct and newly-added commands MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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? Hrm. The direct answer is "no" but: 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. 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. Index: Src/utils.c --- ../zsh-forge/current/Src/utils.c 2011-09-25 15:52:55.000000000 -0700 +++ Src/utils.c 2011-11-14 19:58:34.000000000 -0800 @@ -2498,16 +2498,18 @@ return; if (!(*s)[0] || !(*s)[1]) return; - if (shfunctab->getnode(shfunctab, *s) || - builtintab->getnode(builtintab, *s) || - cmdnamtab->getnode(cmdnamtab, *s) || - aliastab->getnode(aliastab, *s) || - reswdtab->getnode(reswdtab, *s)) - return; - else if (isset(HASHLISTALL)) { - cmdnamtab->filltable(cmdnamtab); - if (cmdnamtab->getnode(cmdnamtab, *s)) + if (cmd) { + if (shfunctab->getnode(shfunctab, *s) || + builtintab->getnode(builtintab, *s) || + cmdnamtab->getnode(cmdnamtab, *s) || + aliastab->getnode(aliastab, *s) || + reswdtab->getnode(reswdtab, *s)) return; + else if (isset(HASHLISTALL)) { + cmdnamtab->filltable(cmdnamtab); + if (cmdnamtab->getnode(cmdnamtab, *s)) + return; + } } t = *s; if (*t == Tilde || *t == Equals || *t == String) @@ -2621,6 +2623,8 @@ fflush(shout); zbeep(); x = getquery("nyae \t", 0); + if (cmd && x == 'n') + pathchecked = path; } else x = 'n'; } else