zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: set - $foo resets set -x
Date: Tue, 19 Sep 2006 17:54:08 +0100	[thread overview]
Message-ID: <200609191654.k8JGs8Jd002640@news01.csr.com> (raw)
In-Reply-To: <200609192023.06736.arvidjaar@newmail.ru>

Andrey Borzenkov wrote:
>     /* Obsolescent sh compatibility: set - is the same as set +xv *
>      * and set - args is the same as set +xv -- args              */
>     if (*args && **args == '-' && !args[0][1]) {
>         dosetopt(VERBOSE, 0, 0);
>         dosetopt(XTRACE, 0, 0);
>         if (!args[1])
>             return 0;
>     }
> 
> Anyone remembers the reasons for that? May be we can at least relax it if 
> running in emulate zsh mode?

I'm inclined to agree, since zsh's native emulation tends to remove the
worst idiocies from prehistory, and currently it doesn't even seem to be
documented...

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.86
diff -u -r1.86 builtins.yo
--- Doc/Zsh/builtins.yo	24 Jul 2006 22:00:20 -0000	1.86
+++ Doc/Zsh/builtins.yo	19 Sep 2006 16:51:40 -0000
@@ -1160,6 +1160,10 @@
 If no arguments and no `tt(-)tt(-)' are given, then the names and values of
 all parameters are printed on the standard output.  If the only argument is
 `tt(PLUS())', the names of all parameters are printed.
+
+For historical reasons, `tt(set -)' is treated as `tt(set +xv)'
+and `tt(set -) var(args)' as `tt(set +xv --) var(args)' when in
+any other emulation mode than zsh's native mode.
 )
 module(setcap)(zsh/cap)
 findex(setopt)
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.162
diff -u -r1.162 builtin.c
--- Src/builtin.c	10 Sep 2006 19:11:54 -0000	1.162
+++ Src/builtin.c	19 Sep 2006 16:51:41 -0000
@@ -535,7 +535,7 @@
 
     /* Obsolescent sh compatibility: set - is the same as set +xv *
      * and set - args is the same as set +xv -- args              */
-    if (*args && **args == '-' && !args[0][1]) {
+    if (emulation != EMULATE_ZSH && *args && **args == '-' && !args[0][1]) {
 	dosetopt(VERBOSE, 0, 0);
 	dosetopt(XTRACE, 0, 0);
 	if (!args[1])

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


  reply	other threads:[~2006-09-19 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-19 16:23 Andrey Borzenkov
2006-09-19 16:54 ` Peter Stephenson [this message]
2006-09-20  4:52   ` Bart Schaefer
2006-09-20 15:40     ` Andrey Borzenkov
2006-09-20 16:04       ` Bart Schaefer

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=200609191654.k8JGs8Jd002640@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /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).