[Top][All Lists]

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

Re: request: make-frame-visible hook

From: Kim F. Storm
Subject: Re: request: make-frame-visible hook
Date: Sat, 21 Feb 2009 03:11:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Miles Bader <address@hidden> writes:

> Lynbech Christian <address@hidden> writes:
>> Alternatively you can consider using post-command-hook, this is run all
>> the time and this particular problem should not pose a performance
>> problem.
> Using post-command-hook _will_ pose a performance problem if everybody
> and their dog gets in the habit of using it... 

I know people are repeating this claim again and again as "gospel truth".

However, I strongly doubt this is really true in practice.
The amount of lisp code executed in the post-command-hook is not nearly
comparable to the amount of work done in redisplay for every (non-trivial)

E.g. just hitting RET performs - I would guess - 1000 times the code anybody
has every put into the post-command-hook...

IMO, the real problem using post-command-hook is that there is no way to
control the sequence of things that is done via that hook - so if you have
two packages putting stuff on the hook - and they both do something which
modifies either buffer contents or visual appearence - then users may see
different results depending on which package is loaded first.

So I agree that using post-command-hook is not a good thing
.. unfortunately there are not many hooks in Emacs which can do global
things - and there seem to be a reluctance to adding "necessary" hooks
(in the sense that the alternative is to use post-commmand-hook).

E.g. where is:
 before-modify-buffer-hook  (run before changing buffer)
 after-modify-buffer-hook  (run after changing buffer)
etc. etc. etc.

I'm not going to discuss semantics of those hooks here, but these things
are typically used for stuff that would currently involve pre-command-hook and
post-command-hook code to notice and react to specific state changes.

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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