From: William Deakin
Subject: How to use hooks
Date: 
Message-ID: <37AEBB30.35F34F46@pindar.com>
This posting is about the use of hooks in CL.

On the weekend I was working my way through Bob Glickstein's 'Writing
GNU Emacs Extensions.' In this there is much store put on hook
variables. And I see this as a pretty neat way get functions to be
evaluated under certain conditions.

Cltl2 (pp. 490-4) says hooks are 'provided for user-supplied debugging
routines to obtain control during the execution of an interperative
evaluator'. This I see as being used more for debugging of eval (based
on the examples given in Cltl2). The Hyperspec (which on all other
occasions I have found  most excellent) did not add anything to this.

Is there a reason why hooks are restricted in CL? Does anybody write
code using hooks? Is hook use restricted because CLOS gives you really
good before, around and after methods to call with objects? Or are there
any other reasons that in my inexperience I am not aware?

Thank you in advance for any help you can give me,

Best Regards,

:-) will

From: Kent M Pitman
Subject: Re: How to use hooks
Date: 
Message-ID: <sfw1zdc69io.fsf@world.std.com>
William Deakin <·····@pindar.com> writes:

> Cltl2 (pp. 490-4) says hooks are 'provided for user-supplied debugging
> routines to obtain control during the execution of an interperative
> evaluator'.

it took me a long time to understand what you were talking about. You
mean evalhook.  It's one word, and it's only veery vaguely related to
the concept of a hook (a hook being classically a user-supplied
variable that is set to a possibly empty list of of forms to evaluate
or functions to call in a certain non-fatal, synchronous situation,
such as occurs with entry to a "mode" in emacs; evalhook being about
a variable you can use to replace the normal action of the evaluator).

cltl2 is not a language standard.  look for prior posts by me in deja
news on that topic if you want an explanation.

cltl did have evalhook and we removed it for ansi cl.  the reason is
that implementations are not even required to have an interpreter.
some, like mcl, are compiled-only.  the meaning of evalhook in such a
context was not clear.  further, we have generally felt this was an
environment issue and environment issues are generally left to
vendors, who have the best interest of their users at heart.  some
implementations do have evalhook.  if this is what makes or breaks
your feeling about a good lisp, you should support such vendors with
your dollars.  if you end up using another lisp that odesn't have
them, then you are basically agreeing with those vendors that there
were more important fish to fry.

> This I see as being used more for debugging of eval (based
> on the examples given in Cltl2).

i'm not sure what this means.  eval doesn't require debugging in 
any competent implementation.  TRACE provides considerable power.
so does STEP.  but evalhook was mostly not about debugging anything; it
was about allowing the user to take  hold and take over eval for their
own purposes.  Sometimes, indeed, that was used to implement debuggers.
But sometimes not.  And implemenotrs mostly implement their own
debuggers, so you could always just send bug reports or feature
requests about vendor debuggers.

> The Hyperspec (which on all other
> occasions I have found  most excellent) did not add anything to this.

That's because there was nothing to say.  It was 1150 hardcopy pages
or 16MB long just describing what the language does.  The set of things
the language does not do is much longer, and was beyond budget. ;-)
 
> Is there a reason why hooks are restricted in CL?

They are not restricted.  They are omitted. It is up to vendors.
Vendors are free to add whatever they like in this regard.

> Does anybody write
> code using hooks?

Not a huge number of people did, and it was a major burden for implementors,
diverting from other things they needed to do in order to survive.
I personally think it is safe to say that this is the kind of infrastructure
detail that is sure not to attract any statistically interesting number of
people to lisp use, since it's mostly a detail you'd only learn after
you were into lisp.  by contrast, the requirement to implement it to
a certain level of standard steals resources from things that could make
a material difference to vendors sustained existence.

> Is hook use restricted because CLOS gives you really
> good before, around and after methods to call with objects?

I don't think this really relates.  This isn't "hooking" the same set
of functionality.  However, you're right that if you're just generally
looking to construct systems that have places where users can
attach stuff, these facilities give you some opportunity to do that
if you design it in early enough.

You should also look at the condition system, which is a more
modern way of dealing with hooking certain kinds of situations, and
which is not dependent on changing the eval model, nor is it dependent
on whether you are running interpreted or compiled.

> Or are there
> any other reasons that in my inexperience I am not aware?

I don't know if it's inexperience or what, but here's what I recommend
in this regard:  Problems are rarely correctly described in terms of
"feature foo is missing" with a helpful suggestino being "add feature foo".
Think about what problem you are REALLY trying to solve and describe
that and then ask people what they suggest you use.  That's something
that will generally get you a lot farther, and not just on this
one situation.
 
> Thank you in advance for any help you can give me,

Hope this was helpful.
From: Kent M Pitman
Subject: Re: How to use hooks
Date: 
Message-ID: <sfw1zdc1vp7.fsf@world.std.com>
Kent M Pitman <······@world.std.com> writes:

> it took me a long time to understand what you were talking about. You
> mean evalhook.  It's one word, and it's only veery vaguely related to
> the concept of a hook (a hook being classically a user-supplied
> variable that is set to a possibly empty list of of forms to evaluate
> or functions to call in a certain non-fatal, synchronous situation,
> such as occurs with entry to a "mode" in emacs; evalhook being about
> a variable you can use to replace the normal action of the evaluator).

I should have qualified this sentence to say "generally in my
experience".  It's not like there is a dictionary of what these words
do and don't mean or I or anyone is the authority on what these words
mean.  This paragraph was intended mostly to offer an explanation of
why I found the term confusing; the unqualified term "hook" didn't
spark anything at all in my mind--it wasn't until I thought of
"evalhook" that I realized what this was about.  I realized after the
fact, too, that *debugger-hook* has a different protocol than what I
said, so it's something of a practical gray area.  Anyway, hope this
after-the-fact correction puts my remarks in context in time that I
don't get a lot of mail form people thinking I said more than it I
meant to here. I was just in a hurry and being sloppier than I should have.
From: William Deakin
Subject: Re: How to use hooks
Date: 
Message-ID: <37AFE1E5.53DCBAA2@pindar.com>
Kent M Pitman wrote:

> William Deakin <·····@pindar.com> writes:
> it took me a long time to understand what you were talking about.

I'm not sure that I was too clear either. Sorry for that :-|

> You mean evalhook.  It's one word, and it's only veery vaguely related to the
> concept of a hook...

I didn't know that is what I meant. But having read your description, this is
indeed the sort of thing that I was thinking of.

As an aside: I have a problems when I read cltl2, after several reading of a
section, I often find myself not a great deal closer to understanding than I was
when I started. But this is my problem and I must try harder :-)

>  cltl2 is not a language standard.

I think I was aware of that. I'm sorry if I was using cltl2 as a language
standard, but as I do not have easy access to the ansi standard and could not
find any reference in the Hyperspec. Again this is through my cack handed
attempts and not intendend as a critism of your hard work and thoroughly
worthwhile project. :-)

> cltl did have evalhook and we removed it for ansi cl..

[ elided a clear explanation of why evalhook was removed from ANSI cl ]

> > This I see as being used more for debugging of eval (based on the examples
> given in Cltl2).
> ...but evalhook was mostly not about debugging anything; it was about allowing
> the user to take  hold and take over eval for their own purposes...

I was unclear here. When I said debugging of eval I was thinking of somebody
using the hook mechanism to control evaluation when something strange was going
on with code. To debug from a user perspective. Not from a compiler/interpreter
angle. Any other use had escaped me.

> > The Hyperspec (which on all other occasions I have found  most excellent)
> did not add anything to this.
> That's because there was nothing to say...The set of things the language does
> not do is much longer, and was beyond budget. ;-)

Please don't include an online copy of a book on fixing the Ford Escort Mk II.
This would describe the set of things the language has never done. ;-)

> > Is there a reason why hooks are restricted in CL?
> They are not restricted.  They are omitted.

Again my mistake. I had not considered this possibility. :-(

> I personally think it is safe to say that this is the kind of infrastructure
> detail that is sure not to attract any statistically interesting number of
> people to lisp use...by contrast, the requirement to implement it to a certain
> level of standard steals resources from things that could make a material
> difference to vendors sustained existence.

I agree wholeheartedly.

> You should also look at the condition system...

This sounds like the kind of thing that I am after. By this I take it to refer
to the work contained in chapter 29 of cltl2 entitled 'Conditions' and written
by your good self ;-)

> ...Problems are rarely correctly described in terms of "feature foo is
> missing" with a helpful suggestino being "add feature foo".

I am sorry if this is how you read my posting. I do not wish hooks to be added
to cl.

What happened is: I came across hooks in emacs lisp, (yes, this very different
from cl), and thought they look interesting. Particularly for solving certain
type of problems.

I then found some stuff talking about hooks in cltl2. But this confused me.
Through my ineptness I could find no references in the Hyperspec. Through my
stupidity I did not consider that hooks were out of the standard. Through my
hubris I posted to cll to ask about them.

> > Thank you in advance for any help you can give me,
> Hope this was helpful.

Yes it was. Thank you for helping me with the muzzy haas that is my confusion.

Best Regards,

:-) will
From: Kent M Pitman
Subject: Re: How to use hooks
Date: 
Message-ID: <sfw3dxsroda.fsf@world.std.com>
Also on this topic, of some historical interest is my 1980 paper on FEXPRs,
another fallen language feature which offered control of evaluation
but at some cost that ultimately was too high for the community.
You can find it at my web site
 Special Forms in Lisp
 http://world.std.com/~pitman/Papers/Special-Forms.html
There is some overlap in causality between these two issues because
Lisp  has over the years tried to move toward a language that is very
much not just an interpreted scripting language.  CL (and Scheme)
was the break-off for this , trying to leave behind the interpreter/compiler
separation in semantics that had characterized earlier languages
like Maclisp and Interlisp.  Evalhook is a show-through from an older
time, and fought against this separation.  FEXPRs survived briefly 
into the modern era on the Lisp Machine (as &quote) but fell quickly
(and fortunately) into disuse.  There is more interesting expressional
stuff you can do without compilation than with--but it came at  
too high a price for what Lisp was needing to do.

Regarding Chap 29 of CLTL2, you should know that's really just a
document I wrote for X3J13 (and one that was subsequently amended in
various ways as we moved toward ANSI CL) which Steele asked if he
could include in the book.  It will contain some inaccuracies 
but is mostly conceptually right and probably a better introduction
because of its style than ANSI CL has.  You can get some additional
conceptual bsackground (more abstract than CLTL2) from my web site
in my 1990 paper on conditions (a revision of a 1985 working paper,
dusted off for more serious publication):
 Exceptional Situations in Lisp
 http://world.std.com/~pitman/Papers/Exceptional-Situations-1990.html

Happy reading.
From: Vassil Nikolov
Subject: Re: How to use hooks
Date: 
Message-ID: <l03130303b3d48565d526@195.138.129.96>
William Deakin wrote:                [1999-08-09 12:27 +0100]

  [...]
  > Cltl2 (pp. 490-4) says hooks are 'provided for user-supplied debugging
  > routines to obtain control during the execution of an interperative
  > evaluator'. This I see as being used more for debugging of eval (based

The original intended use was to develop things like STEP in a portable way.

  > on the examples given in Cltl2). The Hyperspec (which on all other
  > occasions I have found  most excellent) did not add anything to this.

*EVAL-HOOK* and *APPLY-HOOK*, while still present in CLtL2, eventually
disappeared from ANSI Common Lisp as they are not really very useful
in implementations that don't have a true interpreter (i.e. where (EVAL
expr) is really something like (FUNCALL (COMPILE NIL '(LAMBDA () expr))).
See the EVALHOOK-STEP-CONFUSION issue in CLHS (Issues).

  > Is there a reason why hooks are restricted in CL? Does anybody write
  > code using hooks? Is hook use restricted because CLOS gives you really
  > good before, around and after methods to call with objects? Or are there
  > any other reasons that in my inexperience I am not aware?

Hooks are in no way restricted in Common Lisp; it is just that there are
few hooks defined by the language standard itself.  (Using CLHS's
Permuted Symbol Index, one easily finds *DEBUGGER-HOOK* and
*MACROEXPAND-HOOK*.)  But there are no obstacles before the
programmer to design code which uses hooks (which is, as you say,
a powerful means to increase flexibility and usefulness of code),
and many people do.  (Comparing things to Emacs Lisp, in Common Lisp
one has to proclaim the hook variable special, the most natural way
of doing this being DEFVAR, while in Emacs Lisp all variables are
special.  It is true that Common Lisp does not provide any specific
support for hooks (e.g. such as Emacs Lisp's ADDHOOK).)

Hooks as called via FUNCALL/APPLY of special variables are not the
same, and not interchangeable with, hooks as called via before/after/around
methods.  In particular, one cannot bind dynamically the applicable
before/after/around methods.  Also, with hook variables it is easier
to avoid interference with other programs (with a generic function,
two different programs might interfere with one another if they
both define a method for the same classes of arguments, while such
interference does not occur if each program binds the hook variable
for itself).

An example of a hook that is not part of Common Lisp but (IMO) would
be useful would be a function called by READ after an extended token
is collected from the input stream and before it is turned into a
number or a symbol.


Vassil Nikolov
Permanent forwarding e-mail: ········@poboxes.com
For more: http://www.poboxes.com/vnikolov
  Abaci lignei --- programmatici ferrei.





 Sent via Deja.com http://www.deja.com/
 Share what you know. Learn what you don't.
From: Vassil Nikolov
Subject: Re: How to use hooks
Date: 
Message-ID: <l03130303b3d4c6e6f516@195.138.129.104>
William Deakin wrote:                [1999-08-09 16:13 +0100]

  > Vassil Nikolov wrote:
  [...]
  > > But there are no obstacles before the programmer to design code which uses
  > > hooks ... and many people do.
  > 
  > I know this a dumb question. But I alway like a nice example. Do you know if
  > this type of thing is covered in any book or references? or is there code in
  > somewhere like CMU AI repositories?

I am afraid I can't give you an example right away, and can't do a search
right now.  But anyway the examples in CLtL regarding
*EVAL-HOOK*/EVALHOOK and *APPLY-HOOK*/APPLYHOOK still have
instructive value, nevermind that these are no longer in the language.
(These examples are a little hairy, not because of their `hookness'
as such, but because in this particular case the hook functions are
invoked recursively.)

There is also an example in CLHS for *DEBUGGER-HOOK*.

  [...]
  > From the examples in Glickstein, the hook variable binding seems to be the way
  > that you can avoid a variable from different buffers (say) from being
  > overwritten. Is there a way of doing this in CL? (This again is probably just
  > another dumb question.)

(Do you mean hook variables or per-buffer variables?)

As Barry Margolin wrote, there isn't a direct counterpart to that
in Common Lisp. There is an analogy, however, between Emacs
buffers and per-buffer variables, on one hand, and threads and
bound special variables, on the other hand. I mean the case of
deep binding when, if one thread binds a special variable, this
binding is not accessible to any other thread (i.e. each thread
has its own dynamic environment with regards to bound special
variables). This behaviour is implementation-specific; ANSI
Common Lisp (as of now) does not provide anything with respect to
threads (though a future revision of the standard may), and it is
up to implementations to do so if they so choose; many do.

Also, using PROGV one can establish one's own dynamic variable
environments (e.g. a `dynamic closure'^1 can be implemented on top
of PROGV).  For example, if Emacs were implemented in Common
Lisp (well, that *is* a can of worms), PROGV might^2 be used to
implement per-bufferness of variables, and activating a buffer
would mean executing PROGV on the list of per-buffer variables
for that buffer.
__________
^1 a function which, when applied, establishes dynamic bindings
   for a set of variables for the (dynamic) extent of the call
   such that the next invocation sees the same values of the
   variables as they were when the function returned the
   previous time
^2 this is a weak `might'---I keep the right to admit later that
   this is not actually the proper way to implement Emacs in CL.
   In other words, I probably shouldn't even mention this in the
   presence of experts on this particular issue.

  [...]
  > Thank you for your help.

No sweat.

(Apart from the fact that it is rather hot in this part of the world
now...)


Vassil Nikolov
Permanent forwarding e-mail: ········@poboxes.com
For more: http://www.poboxes.com/vnikolov
  Abaci lignei --- programmatici ferrei.





 Sent via Deja.com http://www.deja.com/
 Share what you know. Learn what you don't.
From: William Deakin
Subject: Re: How to use hooks
Date: 
Message-ID: <37AEF023.F602C76E@pindar.com>
Vassil Nikolov wrote:

> William Deakin wrote:
>
>   [...]
>   > Cltl2 (pp. 490-4) says hooks are 'provided for user-supplied debugging
>   > routines to obtain control during the execution of an interperative
>   > evaluator'. This I see as being used more for debugging of eval (based
>
> The original intended use was to develop things like STEP in a portable way.

Pardon my ignorance, what is/was STEP?

>   > on the examples given in Cltl2). The Hyperspec (which on all other
>   > occasions I have found  most excellent) did not add anything to this.
>
> ...See the EVALHOOK-STEP-CONFUSION issue in CLHS (Issues).

Thank you for the reference.

> (Using CLHS's Permuted Symbol Index, one easily finds *DEBUGGER-HOOK* and
> *MACROEXPAND-HOOK*.

Oops. Thank you again. I take back the things I said about CLHS :-|

> But there are no obstacles before the programmer to design code which uses
> hooks ... and many people do.

I know this a dumb question. But I alway like a nice example. Do you know if
this type of thing is covered in any book or references? or is there code in
somewhere like CMU AI repositories?

> ...while in Emacs Lisp all variables are special.

I didn't know that. But I find if an ... interesting way of doing things.

> Hooks as called via FUNCALL/APPLY of special variables are not the same, and
> not interchangeable with, hooks as called via before/after/around methods.

> ... Also, with hook variables it is easier to avoid interference with other
> programs (with a generic function, two different programs might interfere with
> one another if they both define a method for the same classes of arguments,
> while such interference does not occur if each program binds the hook variable
> for itself).

From the examples in Glickstein, the hook variable binding seems to be the way
that you can avoid a variable from different buffers (say) from being
overwritten. Is there a way of doing this in CL? (This again is probably just
another dumb question.)

> An example of a hook that is not part of Common Lisp but (IMO) would be useful
> would be a function called by READ after an extended token is collected from
> the input stream and before it is turned into a number or a symbol.

I remember reading something about extended token conversion and READ last month
in cll. ;-)

Thank you for your help.

Best Regards,

:-) will

-- 'Fast and bulbuous. Fast and bulbous the mascara snake.' 'That's right. And
with a tin tear drop.' --
From: Rudi Schlatte
Subject: Re: How to use hooks
Date: 
Message-ID: <874si81z9x.fsf@semmel.berg>
William Deakin <·····@pindar.com> writes:

> Vassil Nikolov wrote:
> 
> > But there are no obstacles before the programmer to design code which uses
> > hooks ... and many people do.
> 
> I know this a dumb question. But I alway like a nice example. Do you know if
> this type of thing is covered in any book or references? or is there code in
> somewhere like CMU AI repositories?
> 

  This is probably a dumb example, but the whole thing doesn't seem
much more complicated than this to me:


(defparameter *calc-hooks* '()
  "List of functions to be (funcall)ed before (complex-calculation)
does its thing")

(push (lambda () (print "Hi! I'm a hook!")) *calc-hooks*)

(defun complex-calculation ()
  "Turns the switches, then lets out the tiger.
Customize via *calc-hooks*."
  (mapc (lambda(x)
          (when (functionp x) (funcall x)))
        *calc-hooks*)
  (ok-now-calculate-away))


  That's about it.  As you already mentioned earlier in the thread,
it's comparable to having :before methods.

Rudi
From: Barry Margolin
Subject: Re: How to use hooks
Date: 
Message-ID: <0rCr3.105$34.5017@burlma1-snr2>
In article <·················@pindar.com>,
William Deakin  <········@pindar.com> wrote:
>Vassil Nikolov wrote:
>
>> William Deakin wrote:
>>
>>   [...]
>>   > Cltl2 (pp. 490-4) says hooks are 'provided for user-supplied debugging
>>   > routines to obtain control during the execution of an interperative
>>   > evaluator'. This I see as being used more for debugging of eval (based
>>
>> The original intended use was to develop things like STEP in a portable way.
>
>Pardon my ignorance, what is/was STEP?

It's the Lisp interpreter's single-stepper.  Look it up in CLTL or CLHS.

>> But there are no obstacles before the programmer to design code which uses
>> hooks ... and many people do.
>
>I know this a dumb question. But I alway like a nice example. Do you know if
>this type of thing is covered in any book or references? or is there code in
>somewhere like CMU AI repositories?

Hooks have not tended to be common in Lisp programming.  Emacs is somewhat
unique in this regard, since it's intended for end users to customize, and
hooks are a convenient way to allow such customizations.

>From the examples in Glickstein, the hook variable binding seems to be the way
>that you can avoid a variable from different buffers (say) from being
>overwritten. Is there a way of doing this in CL? (This again is probably just
>another dumb question.)

Since CL doesn't have buffers, nor anything that sets up contexts like
them, it's not clear how to answer this.  The above behavior isn't really
specific to hooks, either; it has to do with the fact that Emacs Lisp has
buffer-local variables and some hooks that are executed upon entry into a
buffer.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Vassil Nikolov
Subject: Re: How to use hooks
Date: 
Message-ID: <l03130304b3d4cf07dde6@195.138.129.104>
William Deakin wrote:                [1999-08-09 17:01 +0100]

  [...]
  > So having spent at least five minutes thinking: is there a way of registering a
  > function that gets called under a set of circumstances?

Yes---provided that the designer of the program has set up a hook
in the appropriate place.

Yet another example: a Lisp implementation usually has a function
(usually called EXIT or QUIT) to end working with it.  If the
implementor provides an *EXIT-HOOK* variable such that EXIT,
before actually exiting, does (FUNCALL *EXIT-HOOK*) (possibly
passing some arguments), then users themselves can for example
implement something analogous to C's atexit() (if they `find it
advisable').


Vassil Nikolov
Permanent forwarding e-mail: ········@poboxes.com
For more: http://www.poboxes.com/vnikolov
  Abaci lignei --- programmatici ferrei.





 Sent via Deja.com http://www.deja.com/
 Share what you know. Learn what you don't.
From: William Deakin
Subject: Re: How to use hooks
Date: 
Message-ID: <37AFE2B6.61B1CCAB@pindar.com>
Thank you again.

Vassil Nikolov wrote:

>   Abaci lignei --- programmatici ferrei.

 As an aside (since I don't have language skills) what does 'Abaci lignei ---
programmatici ferrei' mean.

Cheers,

:-) will
From: Vassil Nikolov
Subject: Re: How to use hooks
Date: 
Message-ID: <l03130301b3d59943523b@195.138.129.88>
William Deakin wrote:                [1999-08-10 09:28 +0100]

  > Thank you again.

Not at all.

  > Vassil Nikolov wrote:
  > 
  > >   Abaci lignei --- programmatici ferrei.
  > 
  >  As an aside (since I don't have language skills) what does 'Abaci lignei ---
  > programmatici ferrei' mean.

(I am less fluent in Latin than I pretend to be.)

I took the (well-known, I believe) proverb `Wooden ships---iron sailors,'
did the obvious analogy into `Wooden abaci---iron programmers,'
translated that into Latin (well, Latin never had a word for `programmer,'
so I partially invented it), and put it in my signature.


Vassil Nikolov
Permanent forwarding e-mail: ········@poboxes.com
For more: http://www.poboxes.com/vnikolov
  Abaci lignei --- programmatici ferrei.





 Sent via Deja.com http://www.deja.com/
 Share what you know. Learn what you don't.
From: William Deakin
Subject: Re: How to use hooks
Date: 
Message-ID: <37AEFB5C.5A3FE2D3@pindar.com>
Barry Margolin wrote:

> William Deakin  wrote:
> >Pardon my ignorance, what is/was STEP?
>
> It's the Lisp interpreter's single-stepper...

An unfortunate misunderstanding on my part. I read this as some tool or project
called S.T.E.P. :-(

> >From the examples in Glickstein, the hook variable binding seems to be the way
> >that you can avoid a variable from different buffers (say) from being
> >overwritten. Is there a way of doing this in CL? (This again is probably just
> >another dumb question.)
>
> Since CL doesn't have buffers, nor anything that sets up contexts like them, it's
> not clear how to answer this.

I did say it was a dumb question. Although I would now call it ill-considered ;-)

> The above behavior isn't really specific to hooks, either; it has to do with the
> fact that Emacs Lisp has buffer-local variables and some hooks that are executed
> upon entry into a buffer.

What I like about the hooks is that you can put a load of functions that get
executed when a particular 'thing' occurs. You get this kind of thing in some UI's
that have call-back functions. You bind a function to a change of state (e.g. a key
press) and when that key press occurs. Bingo. The function gets called with the
state information passed to it.

So having spent at least five minutes thinking: is there a way of registering a
function that gets called under a set of circumstances?

Thank you for your help.

Best Regards.

:-) will
From: Barry Margolin
Subject: Re: How to use hooks
Date: 
Message-ID: <RfFr3.117$34.4945@burlma1-snr2>
In article <·················@pindar.com>,
William Deakin  <········@pindar.com> wrote:
>So having spent at least five minutes thinking: is there a way of registering a
>function that gets called under a set of circumstances?

Nothing built-in.  Emacs doesn't, either; all the hooks are there because
the programmer for that facility put an explicit call to run-hooks in his
program at the appropriate place.  There's no way to make a hook run under
an arbitrary set of circumstances -- the circumstance has to be predefined.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.