Zsh Mailing List Archive
Messages sorted by:
Re: Hooking up to function definition via module
- X-seq: zsh-users 22681
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Hooking up to function definition via module
- Date: Wed, 19 Apr 2017 13:57:55 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=k8MvGpg995N1WJ4x1NovG9eOcT96Mklgtegi4WIbJzk=; b=TBsw3ARZHUHamz9HN+KVA1gsLfYzQ5KhJfITXC5pDUahWIMQ9yfefih6nt1Ui3Dwg1 J2keM6yt9oBuBbzheAypnue8z8ePZMeaPAZlLWO8l/8muNobl6B5yJnhmBV3JCXjFyix USR2Z856etlYcybf+XeUE4FwPJlQ9FFBBz4QzalUcp7E10Xa3h5buuD59QdB5Tqw04Go yJWTF8Nxw8z4zE8GNc8iQUfFyb7u4HEKK266jzDkhAoJEGos9u95A4sL0pfNbWCfHrS3 d4WGsmDdziyRGpu5gOwp8vjmx5r05Ge4Qqv+vmyEM497aHDxNc4qslZPUvqt5daAOpJ1 k0dw==
- In-reply-to: <etPan.58f5cd12.2eb141f2.15fbc@MacMini.local>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <etPan.58f5cd12.2eb141f2.15fbc@MacMini.local>
On Apr 18, 10:23am, Sebastian Gniazdowski wrote:
} So in theory I can analyze setopt arguments in bin_setopt2(), record
} which option is being set, even if it is already set to requested
} state, then call original bin_setopt().
Yes, but -- options can also be changed as a consequence of "emulate",
even long after the the emulate command has come and gone, because of
"sticky emulation" (emulate zsh -c 'myfunc() ...'); and there is a
moderate list of options that either can't be changed by setopt, or
that can't be unwound by localoptions.
} I think I cannot do something similar with function
} redefinition/definition, because there isn't a builtin dedicated to
} this, so I cannot wrap that builtin. But maybe I'm wrong?
You are correct -- function definitions are handled entirely by the
parser, there is no table-driven lookup that you can subvert.
Depending upon exactly what your goal is -- I'm guessing it's to make
a module for your plugin manager -- you might be able to do a lot of
the work with a function call wrapper. See zprof.c for an example.
This is getting into zsh-workers territory rather than -users.
Messages sorted by: