From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2515 invoked from network); 8 Sep 2004 16:56:31 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Sep 2004 16:56:31 -0000 Received: (qmail 54406 invoked from network); 8 Sep 2004 16:56:25 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Sep 2004 16:56:25 -0000 Received: (qmail 3514 invoked by alias); 8 Sep 2004 16:56:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20332 Received: (qmail 3505 invoked from network); 8 Sep 2004 16:56:12 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 8 Sep 2004 16:56:12 -0000 Received: (qmail 54069 invoked from network); 8 Sep 2004 16:56:12 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 8 Sep 2004 16:56:10 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i88Gu9v22124 for ; Wed, 8 Sep 2004 16:56:09 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 8 Sep 2004 17:55:16 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Sep 2004 17:57:07 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i88Gu8hZ011752 for ; Wed, 8 Sep 2004 17:56:08 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i88Gu7dA011749 for ; Wed, 8 Sep 2004 17:56:08 +0100 Message-Id: <200409081656.i88Gu7dA011749@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: Difficulties with _oldlist In-reply-to: References: Date: Wed, 08 Sep 2004 17:56:07 +0100 From: Peter Stephenson X-OriginalArrivalTime: 08 Sep 2004 16:57:07.0103 (UTC) FILETIME=[DF9E2AF0:01C495C4] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=UPPERCASE_25_50 autolearn=no version=2.63 X-Spam-Hits: 0.0 Bart Schaefer wrote: > A better solution would be > if $WIDGET could be replaced by a different variable, say $WIDGETSTYLE for > example, which is set corresponding to the second argument of "zle -C". > I.e. if the widget were defined with > > zle -C blather list-choices blather > > then at time of call $WIDGETSTYLE would be "list-choices", and _oldlist > could examine that instead of $WIDGET. This is the internal implementation. For a "zle -N" widget $WIDGETSTYLE gives the name of the function that implements the widget. Altering the completion system is left as an exercise to the reader. Index: Src/Zle/zle_params.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_params.c,v retrieving revision 1.16 diff -u -r1.16 zle_params.c --- Src/Zle/zle_params.c 29 Jul 2004 14:22:22 -0000 1.16 +++ Src/Zle/zle_params.c 8 Sep 2004 16:52:53 -0000 @@ -55,43 +55,45 @@ } zleparams[] = { { "BUFFER", PM_SCALAR, FN(set_buffer), FN(get_buffer), zleunsetfn, NULL }, - { "CURSOR", PM_INTEGER, FN(set_cursor), FN(get_cursor), - zleunsetfn, NULL }, - { "MARK", PM_INTEGER, FN(set_mark), FN(get_mark), - zleunsetfn, NULL }, - { "LBUFFER", PM_SCALAR, FN(set_lbuffer), FN(get_lbuffer), - zleunsetfn, NULL }, - { "RBUFFER", PM_SCALAR, FN(set_rbuffer), FN(get_rbuffer), + { "BUFFERLINES", PM_INTEGER | PM_READONLY, NULL, FN(get_bufferlines), + zleunsetfn, NULL }, + { "CONTEXT", PM_SCALAR | PM_READONLY, NULL, FN(get_context), zleunsetfn, NULL }, - { "PREBUFFER", PM_SCALAR | PM_READONLY, NULL, FN(get_prebuffer), + { "CURSOR", PM_INTEGER, FN(set_cursor), FN(get_cursor), zleunsetfn, NULL }, - { "WIDGET", PM_SCALAR | PM_READONLY, NULL, FN(get_widget), - zleunsetfn, NULL }, - { "LASTWIDGET", PM_SCALAR | PM_READONLY, NULL, FN(get_lwidget), + { "CUTBUFFER", PM_SCALAR, FN(set_cutbuffer), FN(get_cutbuffer), + unset_cutbuffer, NULL }, + { "HISTNO", PM_INTEGER, FN(set_histno), FN(get_histno), zleunsetfn, NULL }, { "KEYMAP", PM_SCALAR | PM_READONLY, NULL, FN(get_keymap), zleunsetfn, NULL }, { "KEYS", PM_SCALAR | PM_READONLY, NULL, FN(get_keys), zleunsetfn, NULL }, - { "NUMERIC", PM_INTEGER | PM_UNSET, FN(set_numeric), FN(get_numeric), - unset_numeric, NULL }, - { "HISTNO", PM_INTEGER, FN(set_histno), FN(get_histno), + { "killring", PM_ARRAY, FN(set_killring), FN(get_killring), + unset_killring, NULL }, + { "LASTSEARCH", PM_SCALAR | PM_READONLY, NULL, FN(get_lsearch), zleunsetfn, NULL }, - { "BUFFERLINES", PM_INTEGER | PM_READONLY, NULL, FN(get_bufferlines), + { "LASTWIDGET", PM_SCALAR | PM_READONLY, NULL, FN(get_lwidget), zleunsetfn, NULL }, + { "LBUFFER", PM_SCALAR, FN(set_lbuffer), FN(get_lbuffer), + zleunsetfn, NULL }, + { "MARK", PM_INTEGER, FN(set_mark), FN(get_mark), + zleunsetfn, NULL }, + { "NUMERIC", PM_INTEGER | PM_UNSET, FN(set_numeric), FN(get_numeric), + unset_numeric, NULL }, { "PENDING", PM_INTEGER | PM_READONLY, NULL, FN(get_pending), zleunsetfn, NULL }, - { "CUTBUFFER", PM_SCALAR, FN(set_cutbuffer), FN(get_cutbuffer), - unset_cutbuffer, NULL }, - { "killring", PM_ARRAY, FN(set_killring), FN(get_killring), - unset_killring, NULL }, + { "POSTDISPLAY", PM_SCALAR, FN(set_postdisplay), FN(get_postdisplay), + zleunsetfn, NULL }, + { "PREBUFFER", PM_SCALAR | PM_READONLY, NULL, FN(get_prebuffer), + zleunsetfn, NULL }, { "PREDISPLAY", PM_SCALAR, FN(set_predisplay), FN(get_predisplay), zleunsetfn, NULL }, - { "POSTDISPLAY", PM_SCALAR, FN(set_postdisplay), FN(get_postdisplay), + { "RBUFFER", PM_SCALAR, FN(set_rbuffer), FN(get_rbuffer), zleunsetfn, NULL }, - { "LASTSEARCH", PM_SCALAR | PM_READONLY, NULL, FN(get_lsearch), + { "WIDGET", PM_SCALAR | PM_READONLY, NULL, FN(get_widget), zleunsetfn, NULL }, - { "CONTEXT", PM_SCALAR | PM_READONLY, NULL, FN(get_context), + { "WIDGETSTYLE", PM_SCALAR | PM_READONLY, NULL, FN(get_widgetstyle), zleunsetfn, NULL }, { NULL, 0, NULL, NULL, NULL, NULL } }; @@ -280,6 +282,21 @@ /**/ static char * +get_widgetstyle(UNUSED(Param pm)) +{ + Widget widget = bindk->widget; + int flags = widget->flags; + + if (flags & WIDGET_INT) + return ".internal"; /* Don't see how this can ever be returned... */ + else if (flags & WIDGET_NCOMP) + return widget->u.comp.wid; + else + return widget->u.fnnam; +} + +/**/ +static char * get_lwidget(UNUSED(Param pm)) { return (lbindk ? lbindk->nam : ""); Index: Doc/Zsh/zle.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v retrieving revision 1.41 diff -u -r1.41 zle.yo --- Doc/Zsh/zle.yo 8 Sep 2004 15:24:08 -0000 1.41 +++ Doc/Zsh/zle.yo 8 Sep 2004 16:52:55 -0000 @@ -732,6 +732,16 @@ item(tt(WIDGET) (scalar))( The name of the widget currently being executed; read-only. ) +vindex(WIDGETSTYLE) +item(tt(WIDGET) (scalar))( +Describes the implementation behind the widget currently being executed; +the second argument that followed tt(zle -C) or tt(zle -N) when the widget +was defined, if any. If the widget was defined with tt(zle -N) and there was +no second argument this is the same as the first argument. Hence for +tt(zle -N) this gives the name of the function that implements the widget, +and for tt(zle -C) this gives the internal completion widget that defines +the type of completion. Read-only. +) enditem() subsect(Special Widget) -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************