[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 09:27:30 -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?
Could you use jit-lock instead?
> I currently do this by (defvar counter 0) and adding a fun to
> post-command-hook that increases the counter.
That sounds like the standard hack, yes.
> Is there a cleverer way?
In general, not that I know.
You can also use wall-time instead of a counter incremented in
post-command-hook.
Stefan