From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25523 invoked by alias); 25 Apr 2015 19:51:55 -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: 34966 Received: (qmail 14386 invoked from network); 25 Apr 2015 19:51:54 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-type; bh=mXyK4QIS7EO0oCE505gVyyO5uBtxSOrdSVUguRZkW/s=; b=Se2JROZ1h2LgCchYBu1F8osVBYy1LE7TLPZXUocSjfX2pQ7jBDoImNPWJEtzYBVkzh Xb4Mvsg4DGLtwKLnR16u5IBcQZ0odj2fTYJGug9zEvDBedUhtRgwx/K1vEhOa8VEN749 zCOw7AGcMWGOHrFQGLqoph4Yuw83wBiAPDjkZhSUPNjCpNTray6cXLQbVnZafl+nWIYu RT1UjsUyxiaZtqn2whLG33Jo5Z8UMkfm/euJjASMg/lIFGXIWEmVLf29W7ocg9T58c+K RMAzOcymVP65Bv1e5hfhExG9b+91fQ9OSSygInURCBivj10nRjkU89nP5zV/NZj78eFv HDCA== X-Gm-Message-State: ALoCoQmPaI1iU6H1brIQCNn4HfNnVLNiN4tipOuB10FiNOMrU1+97kJbcV3CGEFvKniBL3+cSoQ2 X-Received: by 10.60.35.42 with SMTP id e10mr3810845oej.26.1429991512481; Sat, 25 Apr 2015 12:51:52 -0700 (PDT) From: Bart Schaefer Message-Id: <150425125149.ZM1489@torch.brasslantern.com> Date: Sat, 25 Apr 2015 12:51:49 -0700 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: "whence -v" and function file names MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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; }