From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25923 invoked from network); 7 Oct 1999 15:11:32 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Oct 1999 15:11:32 -0000 Received: (qmail 18603 invoked by alias); 7 Oct 1999 15:11:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8163 Received: (qmail 18596 invoked from network); 7 Oct 1999 15:11:24 -0000 Subject: Re: PATCH: emulate (Re: Prompt fun) In-Reply-To: <991007145347.ZM27050@candle.brasslantern.com> from Bart Schaefer at "Oct 7, 1999 2:53:47 pm" To: schaefer@candle.brasslantern.com (Bart Schaefer) Date: Thu, 7 Oct 1999 16:11:22 +0100 (BST) Cc: zefram@fysh.org, zsh-workers@sunsite.auc.dk X-Mailer: ELM [version 2.4ME+ PL48 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: From: Zefram Bart Schaefer wrote: >I disagree with a number of these changes, particularly promptbang, >promptpercent, and promptsubst. Most scripts do not alter the values >of PS[1234], and resetting the prompt-expansion options will cause the >user's settings to display as garbage in conjunction with either use >of "select" loops or (as of 3.1.6) "setopt xtrace"/"set -x". I changed them to *not* be set by emulate. They're a user interaction matter, and really can't directly affect the operation of scripts, so should not be set by emulate. >I further think it's unwise to have emulate reset either errexit or >"exec" -- though I don't see how it could possibly make any difference >to the latter, as emulate itself won't be executed if exec isn't set. I was a bit dubious about these, and a few others with that type of meta effect, such as XTRACE. On reflection, I think the criterion that needs to be used is "is it valid to change this option within a script, as a programming technique?". "emulate -L zsh" is really the idiom used to get known standard behaviour in a zsh function, so everything that affects the direct behaviour of the function should be set by it. With ERR_EXIT, I was imagining that a user might set the option in a script (it can be quite convenient in scripts run from make), and then call a function that doesn't want ERR_EXIT set -- the function should decide for itself how to handle errors. Applying the criterion I state above, it is normal to set this option within a script -- it has the effect of suffixing all commands with "|| exit", which is sometimes what one wants. For EXEC, really there's no reason to change it within a script. Its sole purpose is for syntax checking of a script, so I agree that it shouldn't be considered to be emulation-relevant. > Certainly I agree with >some of the changes, e.g. the history options ought *not* to be reset. Right. Again, these are user interaction features, and don't affect scripts. > >} The patch quoted above is still necessary; EXTENDED_GLOB is unset >} by default even in zsh mode. Would changing that break any scripts? > >Yes, it would break some of my scripts. A pity. -zefram