From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15705 invoked by alias); 21 Feb 2013 16:05:10 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31060 Received: (qmail 8544 invoked from network); 21 Feb 2013 16:05:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f5-b7fd76d000007247-ae-512643508a79 Date: Thu, 21 Feb 2013 15:54:55 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Re: "functions +t" etc. output Message-id: <20130221155455.0c4c071b@pwslap01u.europe.root.pri> In-reply-to: <20130221123343.692abdec@pwslap01u.europe.root.pri> References: <20130221123343.692abdec@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmluLIzCtJLcpLzFFi42I5/e/4Fd0AZ7VAg+0/JSwONj9kcmD0WHXw A1MAYxSXTUpqTmZZapG+XQJXxosrt5kKXohWHF5wkbGB8ZVAFyMHh4SAicS7WSVdjJxAppjE hXvr2boYuTiEBJYyStzasYEdwlnOJDF/wTc2kCoWAVWJhxvvsILYbAKGElM3zWYEGSQioC3R /lEMJCwsoC7R2zCdCcTmFbCXODjzFSOIzSngILG0cxFYqxBQ/MLpv8wgNr+AvsTVv5+YII6w l5h55QwjRK+gxI/J91hAbGagmZPmLWKGsLUlnry7wDqBUWAWkrJZSMpmISlbwMi8ilE0tTS5 oDgpPddIrzgxt7g0L10vOT93EyMkAL/uYFx6zOoQowAHoxIP74KXKoFCrIllxZW5hxglOJiV RHhtmNQChXhTEiurUovy44tKc1KLDzEycXBKNTCe//lb8LGZB6/WPovZyaF/mdwf+0zxu6qZ uW11lF52eijDl4dB00x5ju+6muSys2PJlJjr7wt+asWu9pvoJqQ6/bja8yrDIyKLux06/s46 W1Yi8su/IyaMsXb9FRmpeP70Ll1JRhGblKh3WqcZlr9/IRqQyvzNUWnzG0Nxkw9KheZP06Vr lJVYijMSDbWYi4oTAZ1h53keAgAA On Thu, 21 Feb 2013 12:33:43 +0000 Peter Stephenson wrote: > For "typeset" etc., with flags but no arguments, >=20 > using =E2=80=98+=E2=80=99 rather than =E2=80=98-=E2=80=99 to intro= duce the flag > suppresses printing of the values of parameters when there is no > parameter name. >=20 > It would seem to me this ought to apply to "functions", in fact it's > even more useful if you want to see the functions with a particular flag > to suppress the body of the function, which might be huge. But it > doesn't work --- you get the body of the function. >=20 > It does work if you add an extra and otherwise redundant "+", which you > don't need in the typeset case, leading me to suppose this is just a > bug. Same feacha with autoload. Remembering that the option +/-f is only tested for in the caller, if that's bin_typeset(), and that implicitly turned off flags shouldn't be included, you get something like this... diff --git a/Src/builtin.c b/Src/builtin.c index f13167f..d91c2d9 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2680,7 +2680,7 @@ bin_functions(char *name, char **argv, Options ops, i= nt func) Patprog pprog; Shfunc shf; int i, returnval =3D 0; - int on =3D 0, off =3D 0, pflags =3D 0; + int on =3D 0, off =3D 0, pflags =3D 0, roff; =20 /* Do we have any flags defined? */ if (OPT_PLUS(ops,'u')) @@ -2699,16 +2699,21 @@ bin_functions(char *name, char **argv, Options ops,= int func) on |=3D PM_TAGGED_LOCAL; else if (OPT_PLUS(ops,'T')) off |=3D PM_TAGGED_LOCAL; + roff =3D off; if (OPT_MINUS(ops,'z')) { on |=3D PM_ZSHSTORED; off |=3D PM_KSHSTORED; - } else if (OPT_PLUS(ops,'z')) + } else if (OPT_PLUS(ops,'z')) { off |=3D PM_ZSHSTORED; + roff |=3D PM_ZSHSTORED; + } if (OPT_MINUS(ops,'k')) { on |=3D PM_KSHSTORED; off |=3D PM_ZSHSTORED; - } else if (OPT_PLUS(ops,'k')) + } else if (OPT_PLUS(ops,'k')) { off |=3D PM_KSHSTORED; + roff |=3D PM_KSHSTORED; + } =20 if ((off & PM_UNDEFINED) || (OPT_ISSET(ops,'k') && OPT_ISSET(ops,'z'))= || (OPT_MINUS(ops,'X') && (OPT_ISSET(ops,'m') || *argv || !scriptname))) { @@ -2716,7 +2721,7 @@ bin_functions(char *name, char **argv, Options ops, i= nt func) return 1; } =20 - if (OPT_PLUS(ops,'f') || OPT_ISSET(ops,'+')) + if (OPT_PLUS(ops,'f') || roff || OPT_ISSET(ops,'+')) pflags |=3D PRINT_NAMEONLY; =20 if (OPT_MINUS(ops,'M') || OPT_PLUS(ops,'M')) { --=20 Peter Stephenson Consultant, Software Tel: +44 (0)1223 434724 Samsung Cambridge Solution Centre St John's House, St John's Innovation Park, Cowley Road, Cambridge, CB4 0DS, UK