From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: completion files sensitive to user options like RC_QUOTES
Date: Tue, 6 Dec 2016 21:15:21 -0800 [thread overview]
Message-ID: <161206211521.ZM30878@torch.brasslantern.com> (raw)
In-Reply-To: <93888.1481082302@hydra.kiddle.eu>
On Dec 7, 4:45am, Oliver Kiddle wrote:
} Subject: Re: completion files sensitive to user options like RC_QUOTES
}
} Bart wrote:
} > There would be a case for wrapping the "eval" expressions in _expand
}
} To restore $_comp_caller_options it is still best to limit the range of
} options. Is there a simple way to restore it for that matter
Just assign to $options?
() {
options=( "${(kv)_comp_caller_options[@]}" )
setopt localoptions
eval ...
}
(But possibly even better below.)
} Internally to the C code it needn't really use the sticky emulation
} feature.
True; I just meant that we have working code for a similar situation,
which can be cannibalized.
} > On a side note, maybe we need a special keyword for "emulate" that
} > means "make sticky whatever the current options are"
}
} How about some way to create a custom emulation.
Now that you suggest it, I realize you can do that already, because of
the way sticky emulations propagate. To borrow your example:
emulate sh -o kshglob +o shglob -o braceexpand -c \
'emulate_bash() { eval "$*" }'
emulate_bash 'show_bash_opts() { set -o }'
show_bash_opts
You can prove this works by doing e.g.
emulate zsh -c show_bash_opts
and noting that in spite of forcing zsh emulation outside, set -o prints
the bash options inside.
The missing bit is being able to snapshot the current state. Which of
course you can also do with gymnastics on $options.
emulate zsh -${(k)^options[(R)on]} +${(k)^options[(R)off]} -c \
'emulate_useropts() { eval "$*" }'
And now Ray can shake his head some more at the emergent behavior ...
prev parent reply other threads:[~2016-12-07 5:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-06 14:27 Vincent Lefevre
2016-12-06 16:57 ` Bart Schaefer
2016-12-06 17:29 ` Oliver Kiddle
2016-12-06 21:21 ` Bart Schaefer
2016-12-07 3:45 ` Oliver Kiddle
2016-12-07 5:15 ` 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=161206211521.ZM30878@torch.brasslantern.com \
--to=schaefer@brasslantern.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).