--- Begin Message ---
Subject: |
MacOS: run GUI Emacs without 'make install' |
Date: |
Mon, 10 Jul 2017 21:06:26 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
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.)
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#27645: MacOS: run GUI Emacs without 'make install' |
Date: |
Sun, 23 Jul 2017 17:02:54 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
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.
--- End Message ---