From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22311 invoked by alias); 9 Nov 2009 16:26:03 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27372 Received: (qmail 21445 invoked from network); 9 Nov 2009 16:25:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at klanderman.net does not designate permitted sender hosts) From: Greg Klanderman To: zsh-workers@zsh.org Subject: Re: bug in 'rm' completion Reply-To: gak@klanderman.net Date: Mon, 09 Nov 2009 11:17:31 -0500 In-Reply-To: <19191.43212.832827.724369@gargle.gargle.HOWL> (Greg Klanderman's message of "Mon, 9 Nov 2009 00:29:48 -0500") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (linux) References: <19191.43212.832827.724369@gargle.gargle.HOWL> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>>>> On November 9, 2009 Greg Klanderman wrote: > | lwm% mkdir temp2 > | lwm% cd temp2 > | lwm% touch foo foo-bar > At this point, if you type "rm f" and hit it correctly completes > to "rm foo". If you then hit again, it incorrectly completes to > "rm foo-bar". It looks like the code in _rm is trying to ignore completing other files already listed to be removed on the command line, but brokenly including the current word being completed in the ignore pattern. The patch below seems to fix the problem, provided you are completing the last word on the line. So for example, % mkdir temp % cd temp % touch bar foo foo-bar % rm f bar if you hit with the cursor in the location indicated, the problem still exists with my patch, so I don't really think this is the right fix.. I guess I should use $CURRENT to exclude the current word? Can someone explain where $line is coming from in _rm? I don't see it listed in the 'Completion Special Parameters' or 'Parameters Set By The Shell' sections of the manual, and the name is too generic to effectively search for. Is it the same as $words, which I do see documented in 'Completion Special Parameters'? Hmm, not exactly, as $line does not contain the command.. can I assume line=$words[2,-1] and adjust $CURRENT appropriately? BTW, what's the deal with _files vs _path_files? I see that revision 1.2 of _rm switched from using _path_files to _files: | revision 1.2 | date: 2008/11/23 18:23:29; author: barts; state: Exp; lines: +1 -1 | users/13477: call _files instead of _path_files to correctly handle | cycling through choices. but there are plenty of completion functions using each. thanks, Greg