all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Should timers run in the initial frame?
@ 2018-06-11 13:40 Adam Porter
  2018-06-11 15:42 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Porter @ 2018-06-11 13:40 UTC (permalink / raw)
  To: emacs-devel

Hi,

I've learned that Emacs timers run in the context of whichever frame
was most recently active.  This is typically fine, but I've found a
situation in which this may cause problems.

In my new frame-purpose.el package, the buffer-list function is
overridden to only return buffers in the current frame (when
frame-purpose-mode is active, and the frame has a predicate defined in
its parameter list).  This makes it easy to have "purposeful" frames,
because in so-configured frames, commands like ibuffer will only
display buffers matching the configured predicate.

This seems to work fine, but I have noticed that buffer-list gets
called quite often in timers (at least, in my config).  Some of those
timers may do important work, like automatically saving buffers,
network-related tasks that depend on buffers, etc.

So when frame-purpose-mode is active, and the current Emacs frame is a
"purposeful" frame (i.e. not the frame Emacs initially opened, which
has no predicate configured), any timers that fire which iterate over
the result of buffer-list will not see all buffers in the Emacs
process, but only ones matching the frame's predicate.  Thankfully,
real-auto-save-mode (which I use) keeps its own internal list of
buffers, rather than calling buffer-list each time its timer fires.
But I would guess that there are a variety of packages which do
iterate over buffer-list on a timer.

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?

Of course, this is likely not a problem for anyone who's not using
frame-purpose.el, i.e. nearly all Emacs users.  However, this might
make Emacs a bit more robust and allow packages like frame-purpose.el
to customize behavior more safely.

Thanks,
Adam



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-16 21:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-11 13:40 Should timers run in the initial frame? Adam Porter
2018-06-11 15:42 ` Stefan Monnier
2018-06-16 21:07   ` Daniel Colascione

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.