From 06b7029aa8c06310135734c646ba795772f973bb Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 27 Jan 2010 19:24:22 +0000 Subject: 27638, based on Frank Terbeck, 27633: SOURCETRACE option --- ChangeLog | 8 +++++++- Doc/Zsh/options.yo | 18 +++++++++++++++++- Src/init.c | 5 +++++ Src/options.c | 1 + Src/zsh.h | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15a0432b7..3f47b9426 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-01-27 Peter Stephenson + + * 27638, based on Frank Terbeck, 27633: Doc/Zsh/options.yo, + init.c, options.c, zsh.h: add SOURCE_TRACE option with output + similar to XTRACE for tracing sourced files. + 2010-01-23 Clint Adams * 27617: Completion/Unix/Command/_graphicsmagick: graphicsmagick @@ -12633,5 +12639,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.4872 $ +* $Revision: 1.4873 $ ***************************************************** diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index 8c11c828d..254c35d02 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -1584,6 +1584,18 @@ 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 it loads. The format of the output is similar to that +for the tt(XTRACE) option, with the message tt(). +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) @@ -1610,7 +1622,11 @@ pindex(NOXTRACE) cindex(tracing, of commands) cindex(commands, tracing) item(tt(XTRACE) (tt(-x), ksh: tt(-x)))( -Print commands and their arguments as they are executed. +Print commands and their arguments as they are executed. The +output is proceded by the value of tt($PS4), formatted as described +in +ifzman(the section EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\ +ifnzman(noderef(Prompt Expansion)). ) enditem() diff --git a/Src/init.c b/Src/init.c index 123e20e85..812cd8409 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1126,6 +1126,11 @@ source(char *s) scriptname = s; scriptfilename = s; + if (isset(SOURCETRACE)) { + printprompt4(); + fprintf(xtrerr ? xtrerr : stderr, "\n"); + } + /* * The special return behaviour of traps shouldn't * trigger in files sourced from traps; the return diff --git a/Src/options.c b/Src/options.c index a5f299e49..705546699 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 060f8a6d4..f2bab06fd 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1999,6 +1999,7 @@ enum { SHWORDSPLIT, SINGLECOMMAND, SINGLELINEZLE, + SOURCETRACE, SUNKEYBOARDHACK, TRANSIENTRPROMPT, TRAPSASYNC, -- cgit 1.4.1