From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Should timers run in the initial frame? Date: Mon, 11 Jun 2018 11:42:28 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528731690 29658 195.159.176.226 (11 Jun 2018 15:41:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 15:41:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 11 17:41:26 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSOwg-0007ch-JD for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 17:41:26 +0200 Original-Received: from localhost ([::1]:49658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSOym-000380-5g for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 11:43:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSOxu-00036a-CE for emacs-devel@gnu.org; Mon, 11 Jun 2018 11:42:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSOxr-0003Rv-AG for emacs-devel@gnu.org; Mon, 11 Jun 2018 11:42:42 -0400 Original-Received: from [195.159.176.226] (port=54509 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSOxr-0003RN-2B for emacs-devel@gnu.org; Mon, 11 Jun 2018 11:42:39 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fSOvh-0006SR-BW for emacs-devel@gnu.org; Mon, 11 Jun 2018 17:40:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 25 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:kMWZNqY9gJdUVF6d/nRijtrdz4A= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226218 Archived-At: > 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). Stefan