Re: Project idea on "Big one hook"
- From: Jeremy Hankins <nowan nowan org>
- To: General discussion about sawfish wm <sawfish-list gnome org>
- Subject: Re: Project idea on "Big one hook"
- Date: Sat, 26 Sep 2009 12:13:50 -0500
Teika Kazura <teika lavabit com> writes:
> Currently, each module independently puts their functions on hooks.
> So, it is quite obscure both for users and developers what is
> processed, e.g., when a window is mapped.
I seem to recall you mentioning this issue before, and problems that it
caused, but I don't remember the message. Could you refresh our memory?
Because I'm not certain what problem you're trying to solve.
> So, if "big one hook" like (add-hook 'before-add-window-hook
> system-before-add-window) replaces all system hooked functions in
> before-add-window-hook, and `system-add-window' is coded somewhere
> with comments like "before changing focus, prepare xxx", then birds
> eye view is there. Those who want a hack can tell what should be
> done. When you want to put something on a hook, you can easily choose
> whether it goes at the head or the tail of the hook.
If you need to, you can see what's being done in a hook by evaluating
the hook in sawfish-client or something. And order isn't supposed to
matter in a hook; if we get in the habit of letting our code depend on a
particular order my worry is that it would become more fragile. If
there's some reason that order does matter in a particular case it may
be that we need to separate a particular hook into two (or more?) hooks:
one a before-x-hook and one an after-x-hook.
> There's nicety in Sawfish initialization; some open/require can break
> Sawfish, and it's difficult to tell when it happens. This project may
> be challenging, but I think it's possible, at least for some hooks.
Can you give an example of this? Some of this may indicate bugs that
should be fixed.
> What do you think?
Personally, I like hooks. Hooks make the code much more extensible by
the end user, and ideally more modular as well. I can add to a hook in
the module that needs that hook, so if the module isn't loaded that code
never gets run. Or I could add a hook in my .sawfishrc file if it's
just a quick hack. On your method it sounds like that wouldn't be
possible.
--
Jeremy Hankins <nowan nowan org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]