From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3143 invoked by alias); 24 Jan 2010 09:21:52 -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: 27634 Received: (qmail 26315 invoked from network); 24 Jan 2010 09:21:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at mycircuit.org does not designate permitted sender hosts) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=xNx9s4ikNNyBxTUwpIRkeQ==:17 a=VhN7IiW4HiXJTkFKAd8A:9 a=0dzw2T6glnb3dBrXsikA:7 a=3MGrj084s-9xca6S21IcYqvbekUA:4 Received-SPF: none receiver=mailfe03.swip.net; client-ip=188.155.188.182; envelope-from=vmail@mycircuit.org Message-ID: <4B5C111D.7010401@mycircuit.org> Date: Sun, 24 Jan 2010 10:21:33 +0100 From: Peter User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Re: PATCH: Add `sourcetrace' option References: <4B58AB3A.7050300@mycircuit.org> <1264241882-29700-1-git-send-email-ft@bewatermyfriend.org> In-Reply-To: <1264241882-29700-1-git-send-email-ft@bewatermyfriend.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 01/23/2010 11:18 AM, Frank Terbeck wrote: > Peter wrote: > >> Is there a way to list the files that the shell has read on startup? >> > With this patch, you can invoke zsh like this: > % zsh -o sourcetrace > > to make zsh tell you which files it sources right before it does. That > would catch all the files, that are read upon startup, too. > > I don't know how much sense it would make to make this part of zsh in > this or another form; but this was easy enough, so no time wasted. > > Regards, Frank > > --- > Doc/Zsh/options.yo | 8 ++++++++ > Src/init.c | 5 +++++ > Src/options.c | 1 + > Src/zsh.h | 1 + > 4 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo > index 8c11c82..e19a58a 100644 > --- a/Doc/Zsh/options.yo > +++ b/Doc/Zsh/options.yo > @@ -1584,6 +1584,14 @@ Sequences of digits indicating a numeric base such as the `tt(08)' > component in `tt(08#77)' are always interpreted as decimal, regardless > of leading zeroes. > ) > +pindex(SOURCE_TRACE) > +pindex(NO_SOURCE_TRACE) > +pindex(SOURCETRACE) > +pindex(NOSOURCETRACE) > +item(tt(SOURCE_TRACE))( > +If set, when sourcing a file zsh will print a message about which file > +it is about to source. > +) > pindex(TYPESET_SILENT) > pindex(NO_TYPESET_SILENT) > pindex(TYPESETSILENT) > diff --git a/Src/init.c b/Src/init.c > index 123e20e..c59d632 100644 > --- a/Src/init.c > +++ b/Src/init.c > @@ -1102,6 +1102,11 @@ source(char *s) > return SOURCE_NOT_FOUND; > } > > + if (isset(SOURCETRACE)) { > + fprintf(stderr, "sourcetrace> \"%s\"\n", s); > + fflush(stderr); > + } > + > /* save the current shell state */ > fd = SHIN; /* store the shell input fd */ > obshin = bshin; /* store file handle for buffered shell input */ > diff --git a/Src/options.c b/Src/options.c > index a5f299e..7055466 100644 > --- a/Src/options.c > +++ b/Src/options.c > @@ -233,6 +233,7 @@ static struct optname optns[] = { > {{NULL, "shwordsplit", OPT_EMULATE|OPT_BOURNE}, SHWORDSPLIT}, > {{NULL, "singlecommand", OPT_SPECIAL}, SINGLECOMMAND}, > {{NULL, "singlelinezle", OPT_KSH}, SINGLELINEZLE}, > +{{NULL, "sourcetrace", 0}, SOURCETRACE}, > {{NULL, "sunkeyboardhack", 0}, SUNKEYBOARDHACK}, > {{NULL, "transientrprompt", 0}, TRANSIENTRPROMPT}, > {{NULL, "trapsasync", 0}, TRAPSASYNC}, > diff --git a/Src/zsh.h b/Src/zsh.h > index 060f8a6..f2bab06 100644 > --- a/Src/zsh.h > +++ b/Src/zsh.h > @@ -1999,6 +1999,7 @@ enum { > SHWORDSPLIT, > SINGLECOMMAND, > SINGLELINEZLE, > + SOURCETRACE, > SUNKEYBOARDHACK, > TRANSIENTRPROMPT, > TRAPSASYNC, > Thanks a lot for the patch, this is exactly what I was looking for ... Peter