From: Sven Wischnowsky <wischnow@berkom.de>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: _file_systems & Re: zstyle for _arguments feature request
Date: Mon, 7 Jan 2002 15:45:16 +0100 [thread overview]
Message-ID: <15417.46204.627434.169119@wischnow.berkom.de> (raw)
In-Reply-To: <20011211152415.85017.qmail@web9303.mail.yahoo.com>
Oliver Kiddle wrote:
> ...
>
> > About the general fake style: I'm not sure where the compadd for it
> > could be put. Probably in _setup or _description (where we have all
> > the information about groups and so on), but there might be cases
> > where the matches are then added more than once or into a group which
> > isn't really used for matches (if the user doesn't give near enogh
> > context). Doing it with help texts further complicates this, of
> > course. Especially if we want to have nice consistent listings
> > because only the completion function decides if the normal matches
> > get descriptions. We would just have to try it, I think.
>
> I suggest we just try something and see how it goes. Locating it in
> _description might work, assuming that the tag is in the context when
> the style is looked up. It might be a bit strange where more than one
> compadd is used to add matches.
Here is something to play with. It adds the `fake' style, tested in
_description. Still very basic, but matches with descriptions can be
added. I'm not going to commit this until I get positive replies.
Bye
Sven
diff -ur ../oz/Completion/Base/Core/_description ./Completion/Base/Core/_description
--- ../oz/Completion/Base/Core/_description Sun Dec 23 17:20:30 2001
+++ ./Completion/Base/Core/_description Sun Dec 23 17:46:28 2001
@@ -1,6 +1,6 @@
#autoload
-local name gropt=-J format gname hidden hide match opts
+local name gropt=-J format gname hidden hide match opts tag
opts=()
@@ -51,6 +51,8 @@
_comp_ignore=()
fi
+tag="$1"
+
shift 2
if [[ -z "$1" && $# -eq 1 ]]; then
format=
@@ -70,6 +72,17 @@
else
set -A "$name" "$opts[@]" "$gropt" -default-
fi
+fi
+
+if ! (( ${funcstack[2,-1][(I)_description]} )) &&
+ zstyle -a ":completion:${curcontext}:$tag" fake match; then
+
+ local descr
+
+ descr=( "${(@M)match:#*[^\\]:*}" )
+
+ compadd "${(@P)name}" - "${(@)${(@)match:#*[^\\]:*}:s/\\:/:/}"
+ (( $#descr )) && _describe -t "$tag" '' descr "${(@P)name}"
fi
return 0
diff -ur ../oz/Doc/Zsh/compsys.yo ./Doc/Zsh/compsys.yo
--- ../oz/Doc/Zsh/compsys.yo Sun Dec 23 17:20:30 2001
+++ ./Doc/Zsh/compsys.yo Sun Dec 23 17:51:18 2001
@@ -1082,6 +1082,22 @@
this will also cycle through the names of the files in pathname
components after the first ambiguous one.
)
+kindex(fake, completion style)
+item(tt(fake))(
+This style may be set for every completion context and is used to
+specify additional strings to complete in that context. It's values
+are either the strings to complete with every colon quoted by a
+preceding backslash or strings of the form
+`var(string)tt(:)var(description)'. In the latter case the var(string)s
+will be shown together with the var(description)s in completion
+listings.
+
+Note that you only really want to use this style for a narrow
+enough context, so that the additional string won't show up in other
+contexts. Also note the styles tt(fake-files) and tt(fake-parameters)
+which give more control over additional strings to add when completing
+files or parameters.
+)
kindex(fake-files, completion style)
item(tt(fake-files))(
This style is used when completing files and looked up
--
Sven Wischnowsky wischnow@berkom.de
next prev parent reply other threads:[~2002-01-07 14:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-11 15:24 Oliver Kiddle
2002-01-07 14:45 ` Sven Wischnowsky [this message]
2002-01-07 14:47 ` Sven Wischnowsky
2002-01-07 16:06 ` Oliver Kiddle
2002-01-21 16:09 ` Sven Wischnowsky
2001-12-11 15:38 Wischnowsky, Sven
2002-01-08 6:26 Felix Rosencrantz
2002-01-08 8:26 ` Sven Wischnowsky
2002-01-09 7:19 Felix Rosencrantz
2002-01-10 13:46 ` Sven Wischnowsky
2002-01-14 12:34 ` Oliver Kiddle
2002-01-18 8:47 ` Sven Wischnowsky
2002-01-22 2:35 Felix Rosencrantz
2002-01-28 16:37 ` Sven Wischnowsky
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=15417.46204.627434.169119@wischnow.berkom.de \
--to=wischnow@berkom.de \
--cc=zsh-workers@sunsite.dk \
/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).