Subject: bug#27645: closed (Re: bug#27645: MacOS: run GUI Emacs without 'make install')

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 23 Jul 2017 15:04:02 +0000

Your bug report

#27645: MacOS: run GUI Emacs without 'make install'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
27645: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27645
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#27645: MacOS: run GUI Emacs without 'make install'
From: "Charles A. Roelli" <[email-masked]>
To: Alan Third <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sun, 23 Jul 2017 17:02:54 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Great!  Pushed as:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2c87aab57946b95d67b664259f30e64468d08544

On 20/07/2017 22:34, Alan Third wrote:
> On Thu, Jul 20, 2017 at 08:58:06PM +0200, Charles A. Roelli wrote:
>> I'll push this in a few days if there's no further changes to make.
> Looks good to me. Thanks.

Subject: MacOS: run GUI Emacs without 'make install'
From: "Charles A. Roelli" <[email-masked]>
To: [email-masked]
Date: Mon, 10 Jul 2017 21:06:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Currently, when building Emacs for MacOS, you have to run 'make
install' before you can run the GUI version, which needs to be running
inside an Apple "bundle" (which includes a configuration file,
"Info.plist").  If you try to run 'src/emacs -q' directly after
'make', you get an Emacs frame with no menu or dock icon, and the
frame does not take any keyboard input.  This is fixed by changing the
"activation policy" of Emacs at runtime.

The following snippet from

/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSRunningApplication.h:

has more details:

/* The following activation policies control whether and how an 
application may be activated.  They are determined by the Info.plist. */
enum {
     /* The application is an ordinary app that appears in the Dock and 
may have a user interface.  This is the default for bundled apps, unless 
overridden in the Info.plist. */
     NSApplicationActivationPolicyRegular,

     /* The application does not appear in the Dock and does not have a 
menu bar, but it may be activated programmatically or by clicking on one 
of its windows.  This corresponds to LSUIElement=1 in the Info.plist. */
     NSApplicationActivationPolicyAccessory,

     /* The application does not appear in the Dock and may not create 
windows or be activated.  This corresponds to LSBackgroundOnly=1 in the 
Info.plist.  This is also the default for unbundled executables that do 
not have Info.plists. */
     NSApplicationActivationPolicyProhibited
};
typedef NSInteger NSApplicationActivationPolicy;

So when we call 'src/emacs -q' directly, Emacs should change
activation policy to NSApplicationActivationPolicyRegular.  The
patch in the next message implements this.

Normally the Info.plist file inside the application's bundle takes
care of setting this policy, but when we run Emacs outside of the
bundle, that won't happen.

This change also makes it easier to run Emacs inside GDB in MacOS,
since there's no need to run 'make install' and give GDB the bundled
executable's name -- it's now done as on GNU/Linux.

Some things still to consider:
- Is this necessary/feasible on GNUstep?
- Does this work on the X11 port in macOS?  (I don't have a build ATM.)