zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint@zdharma.org>
To: zsh-users@zsh.org
Subject: Hooking up to function definition via module
Date: Tue, 18 Apr 2017 10:23:46 +0200	[thread overview]
Message-ID: <etPan.58f5cd12.2eb141f2.15fbc@MacMini.local> (raw)

Hello,
I would like to receive a callback or something else, when a function is defined. For example, I can detect setopt by wrapping bin_setopt(), like this:

    Builtin bn = (Builtin) builtintab->getnode2(builtintab, "setopt");
    bn->handlerfunc = bin_setopt2;

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

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?

-- 
Sebastian Gniazdowski
psprint /at/ zdharma.org


             reply	other threads:[~2017-04-18  8:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18  8:23 Sebastian Gniazdowski [this message]
2017-04-19 20:57 ` 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=etPan.58f5cd12.2eb141f2.15fbc@MacMini.local \
    --to=psprint@zdharma.org \
    --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).