zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: emulate zsh *except* pushd related options
Date: Tue, 22 Dec 2015 20:57:47 -0800	[thread overview]
Message-ID: <151222205747.ZM29374@torch.brasslantern.com> (raw)
In-Reply-To: <20151222083043.GA6457@linux.vnet.ibm.com>

On Dec 22,  9:30am, Dominik Vogt wrote:
}
} Is there a (safe!) way to say "emulate zsh but don't touch certain options"?

The "emulate" command accepts the same "-o optionn_name" (or "+o") as
shell startup, so you can do

    emulate -L zsh -o shwordsplit ...

For your specific use case, the current state of the pushd and cd options
can be enumerated this way:

    ${(Oa)${${(kv)options[(I)*pushd*|cd*|*cd]/off/+o}/on/-o}}

That won't work in general because some options have "on" as a substring
of the option name.

So if your autoloaded function begins with:

    emulate -L zsh -o shwordsplit \
      ${(Oa)${${(kv)options[(I)*pushd*|cd*|*cd]/off/+o}/on/-o}}

you should get what you want.


  reply	other threads:[~2015-12-23  4:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  8:30 Dominik Vogt
2015-12-23  4:57 ` Bart Schaefer [this message]
2015-12-23 14:19   ` Dominik Vogt
2015-12-23 16:31     ` 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=151222205747.ZM29374@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).