emacs-devel
[Top][All Lists]
Advanced

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

Re: How to test whether any code runs after same command invocation?


From: Stefan Monnier
Subject: Re: How to test whether any code runs after same command invocation?
Date: Fri, 14 Feb 2014 12:15:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> > Example: I use some code that propertizes any dired buffer in a way that
>> > the mouse tooltip over any directory shows the directory contents.
>> > Since that can take a long time for huge directory hierarchies, I want
>> > to use a timeout.  But if you have marked files you operate on, the code
>> > is run multiple times when refreshing the files' lines, so the timeout
>> Not sure I understand.  Do you use after-change-functions, by any
>> chance?
> I after-advice dired-insert-set-properties.

Then why is the code run multiple times?

> I didn't want to cope with that.  Also, this was just an example, I have
> other, quite different use cases of the raised issue.

The general idea might still apply: try and make it lazier.  E.g. change
your code so that rather than doing the job right away, it just writes
down somewhere what jobs needs to be done, and then later (e.g. in
post-command-hook, jit-lock, timer, you name it) look at what was
written down (if anything) and do it then, once.
Of course, it can't always be done.

> What's that?

"Wall clock" is this thing that you can get from your watch, your phone,
or the `current-time' function ;-)


        Stefan



reply via email to

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