zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: SH_GLOB influence on a script and on an autoload function
Date: Sat, 11 Jun 2016 10:14:12 -0700	[thread overview]
Message-ID: <160611101412.ZM12850@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVBSCgG4Y87L_PzCEWDk=-cQLFmLxwps_rfvUUuhA-Np+w@mail.gmail.com>

On Jun 11,  7:11am, Sebastian Gniazdowski wrote:
}
} Below is a simple script (save to file rtest1) that works well despite
} SH_GLOB should or could stop the pattern from parsing. The same
} doesn't work for autoload.

A script is executed line by line as it is parsed.  An autoloaded function
is fully parsed first, then executed.  Hence in the script, the "emulate"
command resets the parsing rules before the expression is encountered.

This is one of the drawbacks to attempting to accurately emulate parsing
rules that are inherently contradictory.

} setopt shglob
} FPATH=$FPATH:`pwd`
} autoload rtest1
} rtest1
} 
} Probably no workaround for this?

In "recent" zsh (since roughly 2009) you can do this:

    emulate zsh -c 'autoload rtest1'

but of course you have to know a priori what emulation mode the function
is going to want.


  reply	other threads:[~2016-06-11 17:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11  5:11 Sebastian Gniazdowski
2016-06-11 17:14 ` Bart Schaefer [this message]
2016-09-07 10:39   ` Sebastian Gniazdowski
2016-09-07 18:28     ` Bart Schaefer
2016-09-07 19:01       ` Sebastian Gniazdowski
2016-09-07 23:48         ` 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=160611101412.ZM12850@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).