zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Cc: zsh@benizi.com, schaefer@brasslantern.com, richih.mailinglist@gmail.com
Subject: Re: PATCH: Add `sourcetrace' option
Date: Sun, 24 Jan 2010 21:12:40 +0000	[thread overview]
Message-ID: <20100124211240.3d84f802@pws-pc> (raw)
In-Reply-To: <1264292296-5459-1-git-send-email-ft@bewatermyfriend.org>

On Sun, 24 Jan 2010 01:18:16 +0100
Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Here's an updated patch. Thanks to everyone who reviewed the previous
> attempts.

I'm just toying with this variant...  the difference is this moves the
output down until after the script name etc. is set up, and uses PS4
(like the xtrace option), so the output is more configurable.  For
example, I get:

+/etc/zshenv:1> <sourcetrace>
+/home/pws/.zshenv:1> <sourcetrace>
+/home/pws/.profile:1> <sourcetrace>
+/home/pws/.zshrc:1> <sourcetrace>
/home/pws/.aliasrc:1:> <sourcetrace>
/home/pws/.compinstall:1:> <sourcetrace>
/home/pws/.zcompdump_4.3.10-dev-1_pws:1:> <sourcetrace>

(the change in the middle is because I tweak PS4 to remove the "+" in
.zshrc, for no good reason I can now think of, as well as adding %_, and
there's only one global file because .zshenv sets NO_GLOBAL_RCS.)

I'm not particularly set on this but it seems more powerful without
losing anything obvious.  The documentation would need tweaking.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.88
diff -u -r1.88 options.yo
--- Doc/Zsh/options.yo	13 Jan 2010 12:05:48 -0000	1.88
+++ Doc/Zsh/options.yo	24 Jan 2010 21:10:31 -0000
@@ -1584,6 +1584,16 @@
 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.  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)
Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.108
diff -u -r1.108 init.c
--- Src/init.c	16 Dec 2009 18:39:07 -0000	1.108
+++ Src/init.c	24 Jan 2010 21:10:31 -0000
@@ -1126,6 +1126,11 @@
     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
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.52
diff -u -r1.52 options.c
--- Src/options.c	13 Jan 2010 12:05:49 -0000	1.52
+++ Src/options.c	24 Jan 2010 21:10:31 -0000
@@ -233,6 +233,7 @@
 {{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},
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.161
diff -u -r1.161 zsh.h
--- Src/zsh.h	19 Jul 2009 19:08:54 -0000	1.161
+++ Src/zsh.h	24 Jan 2010 21:10:32 -0000
@@ -1999,6 +1999,7 @@
     SHWORDSPLIT,
     SINGLECOMMAND,
     SINGLELINEZLE,
+    SOURCETRACE,
     SUNKEYBOARDHACK,
     TRANSIENTRPROMPT,
     TRAPSASYNC,

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2010-01-24 21:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B582F3C.2010709@mycircuit.org>
     [not found] ` <100121080540.ZM21444@torch.brasslantern.com>
     [not found]   ` <4B58AB3A.7050300@mycircuit.org>
2010-01-23 10:18     ` Frank Terbeck
2010-01-23 15:46       ` Baptiste Daroussin
2010-01-23 20:16       ` Richard Hartmann
2010-01-23 21:53         ` PATCH: " Frank Terbeck
2010-01-23 22:07           ` Benjamin R. Haskell
2010-01-23 22:23             ` Frank Terbeck
2010-01-23 23:46               ` Bart Schaefer
2010-01-24  0:10                 ` Frank Terbeck
2010-01-24  0:18                   ` Frank Terbeck
2010-01-24 21:12                     ` Peter Stephenson [this message]
2010-01-24 22:27                       ` Frank Terbeck
2010-01-23 22:14           ` PATCH: " Frank Terbeck
2010-01-23 23:44             ` Bart Schaefer
2010-01-24  0:05               ` Frank Terbeck
2010-01-24  9:21       ` Peter
     [not found]     ` <m3fx5y2le2.fsf@klanderman.net>
     [not found]       ` <87hbqdu9xs.fsf@ft.bewatermyfriend.org>
     [not found]         ` <4B5A26BA.5080307@mycircuit.org>
     [not found]           ` <87fx5x6918.fsf@ft.bewatermyfriend.org>
     [not found]             ` <4B5ABB0D.9010504@mycircuit.org>
     [not found]               ` <14989d6e1001230228k22e32200s10db146bd8596dc2@mail.gmail.com>
2010-01-23 12:03                 ` what is the effect of a percentage sign (%) as last character on the command line Peter
     [not found]     ` <2d3b879b1001211336m5b78982au96f267ea472af43d@mail.gmail.com>
     [not found]       ` <4B58D35D.1050208@mycircuit.org>
     [not found]         ` <100121182713.ZM21821@torch.brasslantern.com>
     [not found]           ` <4B597061.10701@mycircuit.org>
     [not found]             ` <100123155239.ZM27228@torch.brasslantern.com>
2010-01-24  9:51               ` Peter
2010-01-24 10:58                 ` Frank Terbeck
2010-01-24 14:50                   ` Peter
2010-01-26  7:52                   ` Peter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100124211240.3d84f802@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=richih.mailinglist@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    --cc=zsh@benizi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).