From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: Should timers run in the initial frame? Date: Mon, 11 Jun 2018 08:40:57 -0500 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1528728889 20593 195.159.176.226 (11 Jun 2018 14:54:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 14:54:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 11 16:54:45 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 1fSODO-0005Ay-ST for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 16:54:39 +0200 Original-Received: from localhost ([::1]:49347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSOFV-0002Ug-Sk for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 10:56:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSN48-00084F-E8 for emacs-devel@gnu.org; Mon, 11 Jun 2018 09:41:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSN47-0006TO-Gc for emacs-devel@gnu.org; Mon, 11 Jun 2018 09:41:00 -0400 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:39019) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSN47-0006T5-8w for emacs-devel@gnu.org; Mon, 11 Jun 2018 09:40:59 -0400 Original-Received: by mail-wm0-x233.google.com with SMTP id p11-v6so16605406wmc.4 for ; Mon, 11 Jun 2018 06:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=cNRH+c7lBZxOxFde2QTpiiyQroEqcgRMuY2IvOJn/eo=; b=N0v5QKSOzca838Gb4oJGamokYZnZbJEdaW2sT0q3gkBfz89epLvtEQU5y5V+9tCNnq WuytDpS8s/1GAtbobnhZA+mojEFXRNU3WtV3/mIXARgMSvdAyHJaEqPjgN6kGjmsCEST J+pWVy4kYiCT2RkL5mMztdOEoNW+cPiuunyGOJoJJrhfMIVKd2+6hAJ821iTJ0cuFjEy 1WX3jqvs0yALiV/UclAvpN9fqxuy/PFo72yQtXM+gvPOlviv81iA/uA7PbxZbfSmVfY8 4PchafDTCUWB8QVlCxi9sEvq1UaWbZ+21t1Xhal8nn+nYDgCQ73BW/F/evhC8XjHthOb qi7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=cNRH+c7lBZxOxFde2QTpiiyQroEqcgRMuY2IvOJn/eo=; b=HUrMnYGSuErnObQW/cgCEGS0mYFHkTixSvJAj2qRg/J41XW0WA/SMjuNh6PGDEVmhI 6nIi5hlY89fDaxpPg6j7obXHvQquhBoLwbXXrnJpTyZbpW6iCNnjtoqKA5+ZUUPah4s7 nQoI0Lg4+3OMll1AHn61+XOPJrfqSi6TMmFz2fPwSuVqRK6uX0jg48KEb5xE8Zkt8BJ0 75wstgnoZ62pNgPlmB3p36V+kl7HswnRxhqfQvQcUOSQd9+N3qbTCI6K6gPj80GfCdXw uN3Nm4kKJztfozllRSBRiERmqGpINZAkuIWZxBQDEEoKB/kdK32ANsr1N84WIllf5uaG Sx4Q== X-Gm-Message-State: APt69E3tXY6Hsed3HZshcr969juH8mT9LNyPPuiqTar/fP2tJMi8XdZz r/BOSrXS744nacratGlJkVOEsOO6BkJVDsQGHusExQ== X-Google-Smtp-Source: ADUXVKJv1rjw8so58N2YJFHbOSV6b0uF9xs+FkXRk0TFr5YIG7Iur5QKI+EalLTXSWelPfj773JrFH4wJno6kxDOXBo= X-Received: by 2002:aa7:c250:: with SMTP id y16-v6mr14076314edo.87.1528724457779; Mon, 11 Jun 2018 06:40:57 -0700 (PDT) Original-Received: by 2002:aa7:d283:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 06:40:57 -0700 (PDT) X-Google-Sender-Auth: H8lUMbqjNy_Bu2roisXh7Rv8Uo8 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::233 X-Mailman-Approved-At: Mon, 11 Jun 2018 10:52:04 -0400 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:226213 Archived-At: 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