From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4533 invoked by alias); 17 May 2015 20:52:28 -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: 35167 Received: (qmail 1317 invoked from network); 17 May 2015 20:52:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-transfer-encoding:content-type:content-type:in-reply-to :references:subject:subject:mime-version:user-agent:from:from :date:date:message-id:received:received; s=postfix2; t= 1431895941; bh=l9inpdTPIilsgajjsq4J7slIwy3P9762jRPqKMloXxs=; b=a jFth7UJXbX5ovTTYtaLtNVZcGUxAehjYBKHMdatEUdcP3/mSFDWd5KVw8FHArSpn 0aDpKdbamKt7ud3Jy/4+4Uz0UbZCYnDTH+V9eSQ9Knh48YiU2eHOKUJWooK8pE5S DhNhr3GA5wJ6dJPAcBwi+oRAAJiNvg/1OpaApXUFI8= Message-ID: <5558FF85.1060400@thequod.de> Date: Sun, 17 May 2015 22:52:21 +0200 From: Daniel Hahler User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Re: "whence -v" and function file names References: <150425125149.ZM1489@torch.brasslantern.com> In-Reply-To: <150425125149.ZM1489@torch.brasslantern.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 25.04.2015 21:51, Bart Schaefer wrote: > In workers/34903 I posted a patch to append the function filename (when > useful) to the "whence -v" output for functions. I temporized: > >> I'm undecided about whether the file name should be output using >> nicezputs(). > > I settled on using quotedzputs(), which will make the filename both human > readable and copy-paste-able. > > > diff --git a/Src/hashtable.c b/Src/hashtable.c > index 7a43062..ab381cc 100644 > --- a/Src/hashtable.c > +++ b/Src/hashtable.c > @@ -910,7 +910,7 @@ printshfuncnode(HashNode hn, int printflags) > { > Shfunc f = (Shfunc) hn; > char *t = 0; > - > + > if ((printflags & PRINT_NAMEONLY) || > ((printflags & PRINT_WHENCE_SIMPLE) && > !(printflags & PRINT_WHENCE_FUNCDEF))) { > @@ -922,8 +922,16 @@ printshfuncnode(HashNode hn, int printflags) > if ((printflags & (PRINT_WHENCE_VERBOSE|PRINT_WHENCE_WORD)) && > !(printflags & PRINT_WHENCE_FUNCDEF)) { > nicezputs(f->node.nam, stdout); > - printf((printflags & PRINT_WHENCE_WORD) ? ": function\n" : > - " is a shell function\n"); > + printf((printflags & PRINT_WHENCE_WORD) ? ": function" : > + (f->node.flags & PM_UNDEFINED) ? > + " is an autoload shell function" : > + " is a shell function"); > + if (f->filename && (printflags & PRINT_WHENCE_VERBOSE) && > + strcmp(f->filename, f->node.nam) != 0) { > + printf(" from "); > + quotedzputs(f->filename, stdout); > + } > + putchar('\n'); > return; > } This is a nice addition, but it does not seem to work with compdef functions: % whence -v _git _git is an autoload shell function % git % whence -v _git _git is a shell function It would be nice if it could provide the path, at least with the second call. Regards, Daniel. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iD8DBQFVWP+FfAK/hT/mPgARAkdFAJ0TOGJ94lvSqB8ZzjfLsEugtqqXVACg/D2d XZXu7fvUteUHBjp9sjxtl6o= =AWLV -----END PGP SIGNATURE-----