about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Doc/Zsh/options.yo18
-rw-r--r--Src/init.c5
-rw-r--r--Src/options.c1
-rw-r--r--Src/zsh.h1
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  <p.w.stephenson@ntlworld.com>
+
+	* 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  <clint@zsh.org>
 
 	* 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(<sourcetrace>).
+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, "<sourcetrace>\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,