Subject: Re: bug#22993: Potential fix/workaround for 22993

From: Aaron Jensen <[email-masked]>
Date: Sun, 10 Jul 2016 15:38:57 +0000

On Sun, Jul 10, 2016 at 2:53 AM Alan Third <[email-masked]> wrote:

> I've reverted the change, but I'm not keen to make the above changes
> because they're not trivial, I don't understand them, and I would
> basically be copying and pasting code. I suspect we could have license
> issues with that. If anyone knows different feel free to chime in.
>

I have also tried adding:

<key>NSAppSleepDisabled</key>
<true/>

To the plist and it still napped.

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

> 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.

>
> 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. 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.

-- 
Aaron