[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: table.el

From: Stefan Monnier
Subject: Re: table.el
Date: Sun, 02 Dec 2001 01:11:36 -0500

> The reason why I needed wrapper mechanism was that I was advised by
> you not to use advice in table.el, and that was because
> `describe-function' of those advised functions mislead novice users to
> table.el where there is no real information about the original
> functions.  I personally dislike this shortcoming of
> `describe-function'.

I still think that if a wrapper-hook is specific to a function,
then you might as well use

        (defun kill-region (blabla)
          (if kill-region-function
              (funcall kill-region-function blabla)
            ..do the usual thing..))

Now if you want to allow to put more than one function on a wrapper-hook,
then you can use something like

        (defun kill-region (blabla)
          (if kill-region-functions
              (let ((kill-region-functions kill-region-functions))
                (funcall (pop kill-region-function) blabla))
            ..do the usual thing..))

You might want to define this idiom as a macro `with-wrapper-hook'
and you might even want to extend it to handle the local/global
behavior of normal hooks (i.e. if you encounter a `t' in a buffer-local
hook, it stands for its global value).

But I'd still advocate for passing not just the arguments but the
function itself so that the same wrapper-hook can be used for
several functions.  This is obviously a bit more difficult to do
since the macro doesn't know from where it's being called.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]