unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: 22993@debbugs.gnu.org
Subject: bug#22993: Potential fix/workaround for 22993
Date: Sun, 10 Jul 2016 17:11:12 +0100	[thread overview]
Message-ID: <20160710161112.GA51429@breton.holly.idiocy.org> (raw)
In-Reply-To: <CAHyO48ze=NuNWKf-AE4FfxHso7iOsMc5H3s7fgVbRHXmrW+UFw@mail.gmail.com>

On Sun, Jul 10, 2016 at 03:38:57PM +0000, Aaron Jensen wrote:
> The code referenced is getting the main bundle, then getting its Info.plist
> and writing `NSAppSleepDisabled` to be true. I’m sure you can tell that.
> What I don’t know is if it actually modifies the Info.plist, or if it has
> the same effect as the “defaults write” work around below.
> 
> It also appears to not be the “correct”[1] way to disable appnap, which,
> afaict, requires objective c[2]?
> 
> [1]: http://lists.apple.com/archives/java-dev/2014/Feb/msg00051.html
> [2]: https://github.com/bitcoin/bitcoin/pull/5804/files

Yeah, I expect we'd have to convert it to Objective C since almost all
the NS port specific code is written in it.

I've seen the suggestion in your second link elsewhere too, and it's
generally described as being for long-running processes that shouldn't
be interrupted, not for a process sitting waiting for input. (Just
using the code as provided will actually, as I understand it, prevent
the PC from sleeping too, there's some other command that doesn't do
that, but I don't have it to hand right now.)

Apparently App Nap also doesn't affect any code that occurs within an
event handler, which perhaps explains why I can type this email within
an emacsclient -t session with no problems, but you're seeing trouble
with other, possibly more complex, situations.

> > For future reference, here are the known work-arounds for this problem:
> >
> > 1. At the command prompt: defaults write org.gnu.Emacs NSAppSleepDisabled
> > -bool YES
> >
> > 2. Right-click on the Emacs icon and select 'get info' and tick the
> >    'Disable App Nap' checkbox. (Although I don't get that tick box...)
> >
> 
> Nor do I, it’d be nice if we knew why this was.

I get it for an Emacs 24.5 that I downloaded from Emacsformacosx.com,
which made me wonder if it was because I compiled it myself or
something... :/

> > 3. Run in daemon mode: Emacs as a daemon has no GUI so app nap
> >    is disabled automatically.
> >
> >
> I wonder if it would be worth posting to an apple mailing list about this?
> It seems to be an edge case—an app that is sometimes a gui+daemon.

Yes, it appears that Apple haven't provided a way for apps to both have a
GUI and act as a server. Perhaps we should raise it directly with
them.

It would also be nice if we could attract some people with
Objective C and Cocoa experience to Emacs development, right now we
seem to have none. I'm trying to pick up Objective C, Cocoa, GNUStep
and Emacs's internals all at the same time.

> I’ve also been unable to find Cocoa equivalents to the APIs
> mentioned as the proper way to disable app nap (if we could use
> these, we could begin an activity when a server starts, so app nap
> would only be disabled in that case). If there were an easy way to
> detect a tty frame coming into and leaving existence it could even
> be done around that.

Yes, I'd wondered about something like that, but I don't know how the
server bit works. Anyone out there know about the practicalities of
implementing this? Is there a hook that executes when a connection is
made from emacsclient? Apparently there's server-visit-hook, but that
only works if you load a file, and we need to be able to disable app
nap even if no file is loaded.
-- 
Alan Third





  reply	other threads:[~2016-07-10 16:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12  6:07 bug#22993: 25.0.92; OS X app nap slows down tty emacsclient Aaron Jensen
2016-03-12  8:03 ` bug#22993: Potential fix/workaround for 22993 Aaron Jensen
2016-06-10 18:40   ` Alan Third
2016-06-11 15:51     ` Aaron Jensen
2016-06-11 16:19       ` Alan Third
2016-06-11 16:23         ` Aaron Jensen
2016-06-15 20:35   ` Alan Third
2016-06-16 13:47     ` Aaron Jensen
     [not found]     ` <57629b7f841b1a0000aa4164@polymail.io>
2016-07-03  9:19       ` Alan Third
2016-07-03 17:23         ` Aaron Jensen
2016-07-07 18:55           ` Alan Third
2016-07-07 19:08             ` Aaron Jensen
2016-07-07 19:09               ` Aaron Jensen
2016-07-07 19:57               ` Alan Third
2016-07-08  5:29                 ` Aaron Jensen
2016-07-10  9:53                   ` Alan Third
2016-07-10 15:38                     ` Aaron Jensen
2016-07-10 16:11                       ` Alan Third [this message]
2021-07-01 20:47     ` Alan Third
2021-07-02 17:43       ` Aaron Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160710161112.GA51429@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=22993@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).