zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: _generic
Date: Tue, 13 Jun 2000 13:54:01 +0200 (MET DST)	[thread overview]
Message-ID: <200006131154.NAA31445@beta.informatik.hu-berlin.de> (raw)


Felix suggested something like this some time ago. I think there were
more suggestions, but I can't find the message anymore.

Anyway, maybe this is an acceptable start... _generic puts $WIDGET in
the function field of the context and calls _main_complete. I.e. it
allows users to (relatively) easily define custom completion widgets
for which different styles can be set.


Bye
 Sven

Index: Completion/Commands/_generic
===================================================================
RCS file: _generic
diff -N _generic
--- /dev/null	Tue May  5 13:32:27 1998
+++ _generic	Tue Jun 13 04:53:24 2000
@@ -0,0 +1,11 @@
+#autoload
+
+local curcontext="$curcontext"
+
+if [[ -z "$curcontext" ]]; then
+  curcontext="${WIDGET}:::"
+else
+  curcontext="${WIDGET}:${curcontext#*:}"
+fi
+
+_main_complete
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.62
diff -u -r1.62 compsys.yo
--- Doc/Zsh/compsys.yo	2000/06/13 11:45:26	1.62
+++ Doc/Zsh/compsys.yo	2000/06/13 11:53:26
@@ -2452,6 +2452,20 @@
 value for the tt(substitute) and tt(glob) styles, so both types of
 expansion will normally be performed.
 )
+findex(_generic)
+item(tt(_generic))(
+This function is not defined as a widget and not bound by
+default. However, it can be used to define a widget and will then
+store the name of the widget in the var(function) field of the context 
+and call the completion system. This allows to easily define custom
+completion widgets with their own sets of style settings. For example, 
+to define a widget that does normal completion and starts
+menu-selection, one could do:
+
+example(zle -C foo complete-word _generic
+bindkey '...' foo
+zstyle ':completion:foo:*' menu yes select=1)
+)
 findex(_history_complete_word) (\e/))
 item(tt(_history_complete_word) (\e/))(
 Complete words from the shell's command history. This uses the

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


                 reply	other threads:[~2000-06-13 12:45 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=200006131154.NAA31445@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.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).