emacs-devel
[Top][All Lists]
Advanced

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

Re: call1(Vrun_hooks, Qmy_hook) vs. Frun_hook(1, &Qmy_hook)


From: Juanma Barranquero
Subject: Re: call1(Vrun_hooks, Qmy_hook) vs. Frun_hook(1, &Qmy_hook)
Date: Tue, 20 Nov 2001 13:46:22 +0100

On Tue, 20 Nov 2001 03:56:59 -0700 (MST), Richard Stallman <address@hidden> 
wrote:

> The comment is correct.  So these places can be changed.

Related questions.


1.- Would be ok to change things like

>   /* If buffer is unmodified, run a special hook for that case.  */
>   if (SAVE_MODIFF >= MODIFF
>       && !NILP (Vfirst_change_hook)
>       && !NILP (Vrun_hooks))
>     {
>       PRESERVE_VALUE;
>       PRESERVE_START_END;
>       call1 (Vrun_hooks, Qfirst_change_hook);
>     }

(from insdel.c) to

>   /* If buffer is unmodified, run a special hook for that case.  */
>   if (SAVE_MODIFF >= MODIFF
>       && !NILP (Vfirst_change_hook))
>     {
>       PRESERVE_VALUE;
>       PRESERVE_START_END;
>       Frun_hooks (1, &Qfirst_change_hook);
>     }

or

>   if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound)
>       && !NILP (Vrun_hooks))
>     call1 (Vrun_hooks, Qminibuffer_setup_hook);

to

>   if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, 
> Qunbound))
>     Frun_hooks (1, &Qminibuffer_setup_hook);


2.- run_hook_with_args already tests whether the hook variable is
unbound or nil. Could the "!NILP (Vmy_hook)" and "!EQ (Vmy_hook,
Qunbound)" tests that frequently precede running a hook be skipped?
(With this posible exception from minibuf.c)

>   /* Run our hook, but not if it is empty.
>      (run-hooks would do nothing if it is empty,
>      but it's important to save time here in the usual case).  */
>   if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound)
>       && !NILP (Vrun_hooks))
>     call1 (Vrun_hooks, Qminibuffer_setup_hook);


3.- Can simple cases like

> call1 (Vrun_hooks, Qtemp_buffer_show_hook);

(with no tests) be changed to calls to Frun_hooks? The only reason
against would be performance, I believe.


4.- In that code from keyboard.c:

> /* Subroutine for safe_run_hooks: run the hook HOOK.  */
> 
> static Lisp_Object
> safe_run_hooks_1 (hook)
>      Lisp_Object hook;
> {
>   return call1 (Vrun_hooks, Vinhibit_quit);
> }
> 

safe_run_hooks_1 is trying to run Vinhibit_quit as a hook, which it is
not?

Thanks,


                                                           /L/e/k/t/u




reply via email to

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