Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: PATCH: Add `sourcetrace' option
- X-seq: zsh-workers 27624
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: PATCH: Add `sourcetrace' option
- Date: Sat, 23 Jan 2010 22:53:21 +0100
- Cc: richih.mailinglist@xxxxxxxxx, ft@xxxxxxxxxxxxxxxxxxx
- In-reply-to: <2d460de71001231216x76bd0320y2bd29c31c685ca26@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <2d460de71001231216x76bd0320y2bd29c31c685ca26@xxxxxxxxxxxxxx>
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.
Richard Hartmann <richih.mailinglist@xxxxxxxxx> wrote:
> Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
>> +If set, when sourcing a file zsh will print a message about which file
>> +it is about to source.
>
> Suggestion for alternative wording:
>
> If set, zsh will print a debug message for each file it is about to source.
I agree. My initial wording wasn't well thought out. But I'm not
entirely happy with this suggestion either. For one thing, the messages
are not strictly for `debugging' (although that may be a valid use
case), they are merely informational.
Here's an updated patch. I'm happy with the way the documentation reads
now.
Regards, Frank
---
Doc/Zsh/options.yo | 10 ++++++++++
Src/init.c | 5 +++++
Src/options.c | 1 +
Src/zsh.h | 1 +
4 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 8c11c82..4f57e23 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1584,6 +1584,16 @@ 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, zsh will print an informational message announcing the name of
+each file loads. A file may be loaded by the shell itself when it
+starts up and shuts down (tt(Startup/Shutdown Files)) or by the use of
+the `tt(source)' and `tt(dot)' builtin commands.
+)
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,
--
1.6.6.rc1.31.g1a56b
Messages sorted by:
Reverse Date,
Date,
Thread,
Author