From: Greg Klanderman <gak@klanderman.net>
To: zsh-workers@zsh.org
Subject: Re: bug in 'rm' completion
Date: Mon, 09 Nov 2009 16:20:50 -0500 [thread overview]
Message-ID: <m3iqdjmm31.fsf@klanderman.net> (raw)
In-Reply-To: <m3639j4mcl.fsf@klanderman.net> (Greg Klanderman's message of "Mon, 09 Nov 2009 12:52:26 -0500")
>>>>> On November 9, 2009 Greg Klanderman <gak@klanderman.net> wrote:
> What I think is needed is to
> generally remove the current word from incorporation into the ignore
> pattern, but I don't know how to do that. If I knew how to relate
> $CURRENT to an element of $line that would do it.
I think the patch below is the correct fix. I'm still not sure
whether it should be using $line or $words and I'm not certain on the
difference between two and three colons in the _arguments definition
('*::files:->file' vs '*:::files:->file') but in both cases I suspect
it doesn't actually matter.
Let me know what you think..
Greg
Index: Completion/Unix/Command/_rm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_rm,v
retrieving revision 1.2
diff -u -r1.2 _rm
--- Completion/Unix/Command/_rm 23 Nov 2008 18:23:29 -0000 1.2
+++ Completion/Unix/Command/_rm 9 Nov 2009 21:07:52 -0000
@@ -5,7 +5,7 @@
'(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]'
'(-I --interactive)-i[prompt before every removal]'
'(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]'
- '*:files:->file'
+ '*::files:->file'
)
if _pick_variant gnu=gnu unix --help; then
opts+=(-S)
@@ -33,7 +33,8 @@
case $state in
(file)
declare -a ignored
- ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+ ignored=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+ ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
_files -F ignored && ret=0
;;
esac
next prev parent reply other threads:[~2009-11-09 21:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 5:29 Greg Klanderman
2009-11-09 16:17 ` Greg Klanderman
2009-11-09 17:29 ` Bart Schaefer
2009-11-09 17:52 ` Greg Klanderman
2009-11-09 21:20 ` Greg Klanderman [this message]
2009-11-10 15:52 ` Bart Schaefer
2009-11-12 2:48 ` Greg Klanderman
2009-11-12 4:21 ` Bart Schaefer
2009-11-12 17:22 ` Greg Klanderman
2009-11-09 16:29 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3iqdjmm31.fsf@klanderman.net \
--to=gak@klanderman.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).