zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Hooking up to function definition via module
Date: Wed, 19 Apr 2017 13:57:55 -0700	[thread overview]
Message-ID: <170419135755.ZM32067@torch.brasslantern.com> (raw)
In-Reply-To: <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.


      reply	other threads:[~2017-04-19 20:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18  8:23 Sebastian Gniazdowski
2017-04-19 20:57 ` 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=170419135755.ZM32067@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).