unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Charles A. Roelli" <charles@aurox.ch>
To: 27645@debbugs.gnu.org
Subject: bug#27645: MacOS: run GUI Emacs without 'make install'
Date: Mon, 10 Jul 2017 21:12:14 +0200	[thread overview]
Message-ID: <7c02464a-7569-40a8-5746-7a6883dc251e@aurox.ch> (raw)
In-Reply-To: <ok0j7c$nnq$1@blaine.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 130 bytes --]

The patch is attached.

Also, maybe there is a better way to find the file name of the icon to
use (without hardcoding the name).

[-- Attachment #2: 0001-Enable-GUI-Emacs-without-make-install-on-macOS-Bug-2.patch --]
[-- Type: text/x-patch, Size: 2449 bytes --]

From 3cc9491d301be0030b9a4c85bb2cfa0507f7e243 Mon Sep 17 00:00:00 2001
From: Charles A. Roelli <charles@aurox.ch>
Date: Mon, 10 Jul 2017 21:08:14 +0200
Subject: [PATCH] Enable GUI Emacs without 'make install' on macOS (Bug
 #27645)

* nextstep/INSTALL: Correct it, and mention that Emacs can be run
from 'src/emacs'.

* src/nsterm.m (applicationDidFinishLaunching:): When Emacs is
launched outside of a macOS application bundle, change its
activation policy from the default 'prohibited' to 'regular'.

; * etc/NEWS: Mention the change on macOS.
---
 etc/NEWS         |    3 +++
 nextstep/INSTALL |   11 ++++++-----
 src/nsterm.m     |   11 +++++++++++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index a00760c..e1e6e15 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1516,6 +1516,9 @@ debugger has been attached to it.
 ** 'set-mouse-position' and 'set-mouse-absolute-pixel-position' work
 on macOS.
 
+** Emacs can now be run as a GUI application from the command line on
+macOS.
+
 \f
 ----------------------------------------------------------------------
 This file is part of GNU Emacs.
diff --git a/nextstep/INSTALL b/nextstep/INSTALL
index 799cd4d..9579987 100644
--- a/nextstep/INSTALL
+++ b/nextstep/INSTALL
@@ -17,14 +17,15 @@ Compilation
 
 In the top-level directory, use:
 
-  ./configure --with-ns
+  make
 
-(On macOS, --with-ns is enabled by default.)
+This will compile all the files.
 
-This will compile all the files, but emacs will not be able to be run except
-in -nw (terminal) mode.
+In order to run Emacs, you must run:
 
-In order to run Emacs.app, you must run:
+  src/emacs
+
+In order to install Emacs, you must run:
 
   make install
 
diff --git a/src/nsterm.m b/src/nsterm.m
index bf83550..c965e25 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5479,6 +5479,17 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
 	 object:nil];
 #endif
 
+  if ([NSApp activationPolicy] == NSApplicationActivationPolicyProhibited) {
+    /* Set the app's activation policy to regular when we run outside
+       of a bundle.  This is already done for us by Info.plist when we
+       run inside a bundle. */
+    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+    [NSApp setApplicationIconImage:
+	     [EmacsImage
+	       allocInitFromFile:
+		 build_string("icons/hicolor/128x128/apps/emacs.png")]];
+  }
+
   ns_send_appdefined (-2);
 }
 
-- 
1.7.4.4


  reply	other threads:[~2017-07-10 19:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 19:06 bug#27645: MacOS: run GUI Emacs without 'make install' Charles A. Roelli
2017-07-10 19:12 ` Charles A. Roelli [this message]
2017-07-12 18:52   ` Alan Third
2017-07-12 22:24     ` Jean-Christophe Helary
2017-07-15 14:58     ` Charles A. Roelli
2017-07-20 18:58       ` Charles A. Roelli
2017-07-20 20:34         ` Alan Third
2017-07-23 15:02           ` Charles A. Roelli
2017-07-24 18:24             ` Charles A. Roelli

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=7c02464a-7569-40a8-5746-7a6883dc251e@aurox.ch \
    --to=charles@aurox.ch \
    --cc=27645@debbugs.gnu.org \
    /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).