bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22993: Potential fix/workaround for 22993


From: Alan Third
Subject: bug#22993: Potential fix/workaround for 22993
Date: Sun, 10 Jul 2016 17:11:12 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]