From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: [PATCH] _redirect: add missing 'context' arg to _dispatch
Date: Fri, 22 Jul 2022 18:16:41 +0900 [thread overview]
Message-ID: <D3D2864A-79CD-49D2-AC01-6D6000F67FB4@kba.biglobe.ne.jp> (raw)
In zshcompsys(1), in the description of the special context
-redirect-,
zstyle ':completion:*:*:-redirect-,2>,*:*' file-patterns '*.log'
is another way to make completion after `2> <TAB>' complete files
matching `*.log'.
This works fine. But if I try the following to restrict this
to a specific command, say make,
zstyle ':completion:*:*:-redirect-,2>,make:*' file-patterns '*.log'
it does not work; 'make 2> <TAB>' offers all the files.
'make 2> ^Xh' shows:
tags in context :completion::complete:-redirect-,2>,/usr/bin/make::
globbed-files (_files _redirect)
so the context includes not 'make' but '/usr/bin/make'.
I think the problem is in the last line of _redirect:
_dispatch -redirect-,{${compstate[redirect]},-default-},${^strs}
The 'context' argument to _dispatch is missing, so the 1st
word of the results of the brace expansion (with RC_EXPAND_PARAM)
is used as the 'context'.
_value has a similar use of _dispatch with explicit 'context' arg.
diff --git a/Completion/Zsh/Context/_redirect b/Completion/Zsh/Context/_redirect
index e6da5d115..520a7666e 100644
--- a/Completion/Zsh/Context/_redirect
+++ b/Completion/Zsh/Context/_redirect
@@ -15,4 +15,5 @@ if [[ "$CURRENT" != "1" ]]; then
fi
fi
-_dispatch -redirect-,{${compstate[redirect]},-default-},${^strs}
+_dispatch -redirect-,${compstate[redirect]},$_comp_command \
+ -redirect-,{${compstate[redirect]},-default-},${^strs}
reply other threads:[~2022-07-22 9:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=D3D2864A-79CD-49D2-AC01-6D6000F67FB4@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--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).