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: Michael Heerdegen
Subject: Re: How to test whether any code runs after same command invocation?
Date: Fri, 14 Feb 2014 18:42:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> > I after-advice dired-insert-set-properties.
>
> Then why is the code run multiple times?

If you operate on several (marked) files, each file's line is refreshed
individually.  Then the code is called several times (contrary to
e.g. just hitting g) after one command invocation.

> > 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.

Indeed, that would be a much better approach, although this requires
some more effort.

> "Wall clock" is this thing that you can get from your watch, your
> phone,

I'm not so accustomed to such physical things...

> or the `current-time' function ;-)

Oh, that's what you meant, ok, I understand.


Many thanks, Stefan!

Michael.




reply via email to

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