zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Dave Yost <Dave@yost.com>, "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: setopt temporarily?
Date: Thu, 20 Feb 2014 18:45:09 -0800	[thread overview]
Message-ID: <CAH+w=7a93s4G7sGcOEw83jXOX3PY7uv1iLCD_rqd+4AVENCN4w@mail.gmail.com> (raw)
In-Reply-To: <20140220233340.GA25786@redoubt.spodhuis.org>

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On Thursday, February 20, 2014, Phil Pennock <
zsh-workers+phil.pennock@spodhuis.org> wrote:

> On 2014-02-20 at 13:06 -0800, Dave Yost wrote:
> > It would be nice to be able similarly to temporarily set an option.
>
> Anonymous function.
>
> (){ setopt localoptions xtrace; ls }
>

Also the emulate command:  emulate zsh -o pushdSilent -c 'pushd Desktop'

But in most cases a function with localoptions is what you want.

Incidentally, note that the behavior of
 var=value command
depends on what the command is.  If it's an external command, the variable
is not just temporarily set, it's temporarily exported into the
environment.  For certain builtins the variable becomes permanently set.

      reply	other threads:[~2014-02-21  2:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 21:06 Dave Yost
2014-02-20 23:33 ` Phil Pennock
2014-02-21  2:45   ` Bart Schaefer [this message]

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='CAH+w=7a93s4G7sGcOEw83jXOX3PY7uv1iLCD_rqd+4AVENCN4w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=Dave@yost.com \
    --cc=zsh-workers@zsh.org \
    /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).