zsh-workers
 help / color / mirror / code / Atom feed
* Regarding emulate: a thought, and refresh my memory?
@ 2012-03-04  1:25 Bart Schaefer
  2012-03-06  8:27 ` PATCH " Bart Schaefer
  2012-03-06 20:06 ` Peter Stephenson
  0 siblings, 2 replies; 9+ messages in thread
From: Bart Schaefer @ 2012-03-04  1:25 UTC (permalink / raw)
  To: zsh-workers

First the memory bump:

The code in bin_emulate dating all the way back to Andrej's patch in
zsh-workers/26425 rejects the combination of -L and -c.  The stated
reason for this is "do not confuse user who reads manuals."  However,
the -c option always restores everything at the end, and anyway one
can always run
    emulate zsh -c 'setopt localoptions; ...'
so I'm hoping someone can remind me why we bother throwing an error
on that combination.

The reason I ask is because it suddenly popped into my head that the
emulate command might just as well parse other startup-time options
besides just -c.  Primarily this means that instead of e.g.

    emulate zsh -c 'setopt xtrace; blah blah blah ...'

one could simply do

    emulate zsh -x -c 'blah blah blah ...'

Simlarly there are all sorts of functions that begin with stuff like

    emulate -R zsh
    setopt extendedglob

which could become

    emulate -R zsh -o extendedglob

and off you go.

I've got this 98% working by factoring a loop out of init.c:parseargs()
but it seems silly that
    emulate -L zsh -c '...'
throws an error when
    emulate zsh --localoptions -c '...'
does not.  (Of course -L means a bit more than --localoptions, but you
see my point, I hope.)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-08 15:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-04  1:25 Regarding emulate: a thought, and refresh my memory? Bart Schaefer
2012-03-06  8:27 ` PATCH " Bart Schaefer
2012-03-06 20:06 ` Peter Stephenson
2012-03-06 20:22   ` Stephane Chazelas
2012-03-07  6:38     ` Bart Schaefer
2012-03-07 11:34       ` Stephane Chazelas
2012-03-07 17:45         ` Bart Schaefer
2012-03-08  8:38           ` Stephane Chazelas
2012-03-08 15:08             ` Bart Schaefer

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).