bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#21747: 25.0.50; while-no-input breaks kbd event handling when called


From: Artur Malabarba
Subject: bug#21747: 25.0.50; while-no-input breaks kbd event handling when called from post-command-hook
Date: Sun, 25 Oct 2015 14:43:06 +0000

2015-10-24 11:52 GMT+01:00 Eli Zaretskii <eliz@gnu.org>:
>> Date: Sat, 24 Oct 2015 11:30:42 +0100
>> From: Artur Malabarba <bruce.connor.am@gmail.com>
>> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Kim Storm <storm@cua.dk>, 
>> 21747@debbugs.gnu.org,
>>       Eli Zaretskii <eliz@gnu.org>
>>
>> So maybe the docstring for post-command-hook should point out this detail and
>> recommend that functions added to this hook call sit-for if they're going to 
>> do
>> potentially expensive processing.
>
> Just being potentially expensive is not enough to trigger the problem.
> You need to actually hog Emacs (or close to that) to prevent redisplay
> from eventually happening.
>
> I agree that expensive processing in post-command-hook is not a good
> idea (and said so several times in the past), but people are still
> doing that, so I guess just advertising the problem is not enough.  (I
> don't object to adding this to documentation, of course.)

I've extended the docstring.
I used redisplay instead of (sit-for 0), because inside a call to
while-no-input it has the exact same effect and is more expressive.

Suggestions welcome.

-otherwise the error might happen repeatedly and make Emacs nonfunctional.  */);
+otherwise the error might happen repeatedly and make Emacs nonfunctional.
+
+It is usually a bad idea to use this hook for expensive processing.
+If unavoidable, `while-no-input' can be used avoid making Emacs
+unresponsive while the user types.  Furthermore, this hook is run
+before redisplay, so the effect of the executed command won't be
+displayed on the buffer until after the hook has finished (giving the
+impression that Emacs is hanging).  You can call `redisplay' inside
+`while-no-input' to avoid this.
+





reply via email to

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