* Re: PATCH: 3.1.6-bart-7: Self-loading auto-functions
@ 1999-10-25 9:53 Sven Wischnowsky
1999-10-25 10:27 ` Zefram
1999-10-25 22:15 ` Parameters, disable, modules (Re: Self-loading auto-functions) Bart Schaefer
0 siblings, 2 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-10-25 9:53 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> One change that may be controversial is the output of "functions". As was
> mentioned in the exchange I had with Zefram, it no longer puts "undefined"
> in front of an autoloaded function name. In the course of changing that,
> I found that it might also output "traced" in that position, which for the
> purposes of making `eval $(functions)' work was equally annoying. Further,
> it might be useful to differentiate an actual autoloaded function from one
> that merely calls "autoload -X".
>
> So it now outputs comments like this:
>
> foo() {
> # undefined
> # traced
> builtin autoload -X
> }
>
> The comments use the user's $histchars[2], and you can tell a defined
> function from an undefined one because of course defined functions always
> have their comments stripped. If anyone has a better idea for this, I'd
> be glad to see it changed.
I've fiddled with `parameter.c' a lot over the weekend, adding
parameters for the `compgen'-replacement. There I made `functions'
prepend a `<disabled>' prefix to report disabled shell functions (and
the same string in other parameters). I was thinking about using
comments, too, and I still think they are ok for functions, but in my
case I needed something that also worked for aliases -- and I hope
`<disabled>' is uncommen enough to be usable there.
> ...
>
> There's one partial bug fix in the paramter.c diff below: Unloading the
> module would dump core when trying to unset the $dirstack parameter. The
> remaining badness after the patch is that the dirstack gets erased as a
> side-effect of unloading the module, but at 2:15 AM I didn't feel like
> tackling that part.
There were some other problems. E.g. the strings stored in the pparam
struct should all be dupstring()ed (because the new pattern matching
code may try to store the trailing '\0' again). Also, they shouldn't
be tricat()ed, because that uses zalloc()ed memory which isn't freed
anywhere.
Since my code is currently far too different from anyone else's, I
don't send a patch for it now, it'll come together with the completion
code stuff.
While I'm at it: does anyone have an idea how we can make the
parameter module report stuff about zle widgets and keymaps? I don't
see a solution (other than making parameter depend on zle which I
don't want to do). So in the first implementation at least, parameters
for them will be in the zle module. Sigh.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: 3.1.6-bart-7: Self-loading auto-functions
1999-10-25 9:53 PATCH: 3.1.6-bart-7: Self-loading auto-functions Sven Wischnowsky
@ 1999-10-25 10:27 ` Zefram
1999-10-25 22:15 ` Parameters, disable, modules (Re: Self-loading auto-functions) Bart Schaefer
1 sibling, 0 replies; 3+ messages in thread
From: Zefram @ 1999-10-25 10:27 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers
Sven Wischnowsky wrote:
>While I'm at it: does anyone have an idea how we can make the
>parameter module report stuff about zle widgets and keymaps? I don't
>see a solution (other than making parameter depend on zle which I
>don't want to do). So in the first implementation at least, parameters
>for them will be in the zle module. Sigh.
Logically, there should be a separate module for ZLE-related parameters,
dependent on the ZLE module.
-zefram
^ permalink raw reply [flat|nested] 3+ messages in thread
* Parameters, disable, modules (Re: Self-loading auto-functions)
1999-10-25 9:53 PATCH: 3.1.6-bart-7: Self-loading auto-functions Sven Wischnowsky
1999-10-25 10:27 ` Zefram
@ 1999-10-25 22:15 ` Bart Schaefer
1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-10-25 22:15 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers
On Mon, 25 Oct 1999, Sven Wischnowsky wrote:
> I've fiddled with `parameter.c' a lot over the weekend, adding
> parameters for the `compgen'-replacement. There I made `functions'
> prepend a `<disabled>' prefix to report disabled shell functions (and
> the same string in other parameters).
Waitaminute. "functions" doesn't output ANYTHING for disabled functions;
it acts as if they don't exist, and you can't get to them via $functions.
Did you really change that?
Same goes for aliases, etc.
Disable doesn't work very well on functions anyway; all you have to do
is redefine one to re-enable it:
zagzig[27] fnord() { echo foo }
zagzig[28] disable -f fnord
zagzig[29] fnord
zsh: command not found: fnord
zagzig[30] fnord() { echo foo }
zagzig[31] fnord
foo
zagzig[32]
Oh, by the way: autoload +X will happily (re)load the definition for a
disabled function, causing it to become enabled again. That was not an
intended side-effect, and I rather suspect that both the example above
and this +X side-effect are doing bad things to the hash table internals.
> While I'm at it: does anyone have an idea how we can make the
> parameter module report stuff about zle widgets and keymaps?
Introduce a registry: A hash table mapping strings with a well-defined
syntax to function pointers with a corresponding call signature. The zle
module registers its function pointers and the parameters module looks
them up, and vice-versa. A fallback of some sort is used by each when it
doesn't find the other.
There are some obscure architectures where you can't cast a function
pointer to (void *) and back and so this wouldn't work, but they probably
can't deal with dynamic loading anyway.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-10-25 22:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-25 9:53 PATCH: 3.1.6-bart-7: Self-loading auto-functions Sven Wischnowsky
1999-10-25 10:27 ` Zefram
1999-10-25 22:15 ` Parameters, disable, modules (Re: Self-loading auto-functions) Bart Schaefer
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).