Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: wrapper functions in modules



Bart Schaefer wrote:

> 
> On Dec 15,  1:03pm, Sven Wischnowsky wrote:
> } Subject: Re: wrapper functions in modules
> }
> } Bart Schaefer wrote:
> } > Is the new first parameter of doshfunc() needed any longer?
> } 
> } [For those who don't want to look at the code: the argument is the
> } name of the function to be executed.]
> } 
> } I added the argument since modules may be interested in it
> 
> Hm.  I'm not sure that modules *ought* to be interested in it, but...

It's just that wrappers can't get at this information. But I wouldn't
resist to remove this or to use a global variable for it.
Apropos variables: we could use two static variables for the other
arguments a wrapper function gets and which are only passed to
runshfunc()... hm, I might produce a patch for this some time.

> 
> One thing a wrapper function might legitimately be interested in is the
> context in which it was called.  By that I mean, the wrapper might want
> to do something different if the function is being run by the completion
> widget code (the call to doshfunc() in zle_main.c), the compctl -K code
> or -Y code (zle_tricky.c), or the signal traps (signals.c).  The signal
> handlers can sort of be determined by examination of the name, but that's
> not what I'd call the best way to do it (e.g. it's possible to invoke the
> trap functions manually without a signal having been received), and that
> doesn't work for the other cases.

Yes, that would be good to have. Using a global integer variable or an 
argument and a couple of constants?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author