From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Johan Andersson Newsgroups: gmane.emacs.bugs Subject: bug#24849: Is Emacs put in idle mode when window is not focused? Date: Tue, 1 Nov 2016 20:48:59 +0100 Message-ID: References: <83oa1znpah.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114c8692c6e63c0540429e98 X-Trace: blaine.gmane.org 1478029829 30497 195.159.176.226 (1 Nov 2016 19:50:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 Nov 2016 19:50:29 +0000 (UTC) Cc: 24849@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 01 20:50:24 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1c1f4V-0005i6-Cq for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Nov 2016 20:50:11 +0100 Original-Received: from localhost ([::1]:50836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1f4Y-0007Qh-0x for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Nov 2016 15:50:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1f4Q-0007NW-9S for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2016 15:50:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1f4N-0003bF-11 for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2016 15:50:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52221) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1f4M-0003b9-TJ for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2016 15:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c1f4M-00023l-H3 for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2016 15:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Johan Andersson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Nov 2016 19:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24849 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24849-submit@debbugs.gnu.org id=B24849.14780297767881 (code B ref 24849); Tue, 01 Nov 2016 19:50:02 +0000 Original-Received: (at 24849) by debbugs.gnu.org; 1 Nov 2016 19:49:36 +0000 Original-Received: from localhost ([127.0.0.1]:39387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1f3n-00022t-TT for submit@debbugs.gnu.org; Tue, 01 Nov 2016 15:49:35 -0400 Original-Received: from mail-qk0-f178.google.com ([209.85.220.178]:34442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1f3k-00022g-SO for 24849@debbugs.gnu.org; Tue, 01 Nov 2016 15:49:25 -0400 Original-Received: by mail-qk0-f178.google.com with SMTP id q130so92864263qke.1 for <24849@debbugs.gnu.org>; Tue, 01 Nov 2016 12:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burtcorp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2iNmk0vpl7vaH8jWxs2oh4SaP+NF1zN7u6gblHXZiVs=; b=2A4aowesY8P/roA+YOEu3ATOGtOJPm2xLsNkEy0jjbHpbC+Qpni2kpR9HlBT+ZGnv9 skE7BeFRDE8ERf9qAiNzUS/MjmHfUxJfDOoBqD2VTk3CiY5LvrM1biemirpPEScRhRu9 wOpE7Vg78I6polqzVo3EbcgMkQXc8j6WblGCh+BLJikRJEeDpcG+KEHZ2Jimg5xwXdO/ 95AQ9WBely1wVGLzUSqL2ekbYq7cA7DNj28vze1aaV5wjtIB3Qh/wvLoe6XBM/KCHhMs WGoP+JPbajR1+MdKcMe0C1F/r72So0kDlQpwdlQiBGkXknZuhIqW/8LyuU50tMGnVQhi Io/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2iNmk0vpl7vaH8jWxs2oh4SaP+NF1zN7u6gblHXZiVs=; b=EJAO5lnNuuuJrpAwfmqYWlfyZSuZRh7hqQN1ZIwjTC9Q1M2R4mKCgH3AR5wa4Oew6d FHJyjO9l5XEMZd3p1LEzxas+dpeCDHUlyQ3OK4GX1dIQ8zA0CmzqG8dgrfC1vj3mq5vz pOkt8HDxEojV1zRS92JuZwLZ5thO3IZ5pqm/BfkYI9kuWTuH67GsCGDFoBtbFQgDYBfP 4ENqOFoJC9+ihmlEJrbFw47V8/OhtlvEoMHFjkqLLd9FTdkv2v6owyQqLYYCEKPdAUBd 3TjQTiEQyRkHZdbCT7DAwepR/KzoQ3T0Ls0Pl6k35CSUTZtHRzAtgi+7rHYBRRQwF5Yx lt7g== X-Gm-Message-State: ABUngvdPavkvIPiO9z1+RKUp9vrapPhs3uC0PxHLiMdx/KaxB8WFZ7D2UZSIpI7lZAhf1+PUL9yK90Le9aUbBw== X-Received: by 10.55.6.141 with SMTP id 135mr31748363qkg.79.1478029759396; Tue, 01 Nov 2016 12:49:19 -0700 (PDT) Original-Received: by 10.237.38.33 with HTTP; Tue, 1 Nov 2016 12:48:59 -0700 (PDT) In-Reply-To: <83oa1znpah.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125231 Archived-At: --001a114c8692c6e63c0540429e98 Content-Type: text/plain; charset=UTF-8 Sorry for not being clear enough. With Prodigy, you define a service. Usually that is a path, command and arguments to the command. You can then via the Prodigy GUI manage (start/stop/restart/etc...) these services. To put it very simple, what happens in Prodigy when a service is started is basically this: (let* ((default-directory "/tmp") (process (start-process "server" nil "python" "-m" "SimpleHTTPServer" "8000"))) (set-process-filter process (lambda (_ output) ;; ... ))) What happens in practice is that, when I get to work, I select the services I need and start them (unless Emacs was killed, they are already started). Sometimes I use Emacs quite frequently and then this is not so much of an issue because Emacs does not have time to idle. But when I don't use Emacs for a while, it will hang waiting for the response from the service (because Emacs is idle). Hope you understand my issue better! On Tue, Nov 1, 2016 at 5:22 PM, Eli Zaretskii wrote: > > From: Johan Andersson > > Date: Tue, 1 Nov 2016 09:44:20 +0100 > > > > I have written an Emacs package called Prodigy ( > https://github.com/rejeep/prodigy.el/). The package is used > > to manage external services from within Emacs. A service is some kind of > running process, usually a web > > server or database. > > > > There has always been an issue that I have not investigated further. It > seems that after a while, if Emacs is > > not focused, it ends up in some idle mode. The effect is that requests > are very slow, almost hangs for a few > > seconds. If I focus the Emacs window, the request goes through > immediately. > > > > The reason I'm asking about it now is that this has gotten even worse in > Emacs 25. > > > > My question is if anyone knows what this is about and if it's possible > to solve? > > Please describe in more detail what you package does and how it is > related to "non-idle" Emacs. IOW, why does your package care whether > Emacs is idle or not. > > My suspicion is that your package somehow assumes that the Emacs main > loop is always running at the same fast speed, which is not true. In > particular, when the frame doesn't have the focus, Emacs 25 stops the > blinking cursor timer, and if that is the only high-frequency activity > in Emacs (i.e. there's no other timers or external events that drive > the event loop), then yes, Emacs will only crank the event loop at > very low frequency. > > But I'm not sure this is related to your problem, because I don't know > what does your package expect from Emacs. > -- Johan Andersson System Developer, Burt www.burtcorp.com Cell: +46 761 041607 https:// github.com/rejeep | http://twitter.com/rejeep | http://twitter.com/burtcorp --001a114c8692c6e63c0540429e98 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Sorry for not being clear enough.

With Prodigy, you define a service. Usually that is a path, command a= nd arguments to the command. You can then via the Prodigy GUI manage (start= /stop/restart/etc...) these services.

To put it ve= ry simple, what happens in Prodigy when a service is started is basically t= his:

(let* ((d= efault-directory "/tmp")
=C2=A0 =C2=A0 =C2=A0 =C2=A0(process (start-process "serve= r" nil "python" "-m" "SimpleHTTPServer" = "8000")))
= =C2=A0 (set-process-filter
=C2=A0 =C2=A0process
=C2=A0 =C2=A0(lambda (_ output)
=C2=A0 =C2=A0 =C2=A0;; ...
=C2=A0 =C2=A0 =C2=A0)))

= What happens in practice is that, when I get to work, I select the services= I need and start them (unless Emacs was killed, they are already started).= Sometimes I use Emacs quite frequently and then this is not so much of an = issue because Emacs does not have time to idle. But when I don't use Em= acs for a while, it will hang waiting for the response from the service (be= cause Emacs is idle).

Hope you understand my issue= better!

On Tue, Nov 1, 2016 at 5:22 PM, Eli Zaretskii <= eliz@gnu.org> wrote:
> From: Johan Andersson <= johan.andersson@burtcorp.co= m>
> Date: Tue, 1 Nov 2016 09:44:20 +0100
>
> I have written an Emacs package called Prodigy (https://gi= thub.com/rejeep/prodigy.el/). The package is used
> to manage external services from within Emacs. A service is some kind = of running process, usually a web
> server or database.
>
> There has always been an issue that I have not investigated further. I= t seems that after a while, if Emacs is
> not focused, it ends up in some idle mode. The effect is that requests= are very slow, almost hangs for a few
> seconds. If I focus the Emacs window, the request goes through immedia= tely.
>
> The reason I'm asking about it now is that this has gotten even wo= rse in Emacs 25.
>
> My question is if anyone knows what this is about and if it's poss= ible to solve?

Please describe in more detail what you package does and how it is
related to "non-idle" Emacs.=C2=A0 IOW, why does your package car= e whether
Emacs is idle or not.

My suspicion is that your package somehow assumes that the Emacs main
loop is always running at the same fast speed, which is not true.=C2=A0 In<= br> particular, when the frame doesn't have the focus, Emacs 25 stops the blinking cursor timer, and if that is the only high-frequency activity
in Emacs (i.e. there's no other timers or external events that drive the event loop), then yes, Emacs will only crank the event loop at
very low frequency.

But I'm not sure this is related to your problem, because I don't k= now
what does your package expect from Emacs.



--
Johan Andersson
System Developer, Burt
=
Cell: +46 761 041607
--001a114c8692c6e63c0540429e98--