[Top][All Lists]

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

Re: Should timers run in the initial frame?

From: Stefan Monnier
Subject: Re: Should timers run in the initial frame?
Date: Mon, 11 Jun 2018 11:42:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> So, I wonder: would it be good if timers ran in the context of the
> initially opened Emacs frame, rather than in whichever frame was most
> recently active?

Elisp code has a lot of context, and which context needs to be saved
depends on ...hmm... context.

I don't think it can break anything to do what you suggest, but it's
a slippery slope: we could also try and preserve the current buffer,
selected window, ...

The specific problem in your case is that the change your package
imposes on buffer-list is pretty drastic (the original semantics of
buffer-list is to return *all* buffers) and inevitably introduces bugs
(e.g. some buffer-local minor modes use a global timer shared between
all buffers (and relying buffer-list for that), so you'd need to either
restore the original buffer-list for those particular uses, or advise
those minor modes such that use a "frame-purpose-local" variable instead
of a global variable for the timer).

So I think it makes more sense to add this particular workaround in your
package (e.g. by advising timer-set-function).


reply via email to

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