Skip to content

Instantly share code, notes, and snippets.

@mjwall
Last active October 4, 2016 03:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjwall/3fe935a8becb60dd3c4c to your computer and use it in GitHub Desktop.
Save mjwall/3fe935a8becb60dd3c4c to your computer and use it in GitHub Desktop.
Installing Emacs 24.3 on MacOSX Lion
# be sure to install xcode 4.3 and command line tools first
git clone git://github.com/emacsmirror/emacs.git
git co -b emacs-24.3-local emacs-24.2
#apply patch for fullscreen, yes!
curl https://raw.github.com/renard/emacs-build-macosx/master/patches/00_lion-fullscreen.patch | patch -p1
# could also manually apply the srbg patch from homebrew
if build.include? "srgb"
inreplace "src/nsterm.m",
"*col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];",
"*col = [NSColor colorWithDeviceRed: r green: g blue: b alpha: 1.0];"
end
# see https://github.com/mxcl/homebrew/blob/master/Library/Formula/emacs.rb#L68
./autogen.sh
env CC=gcc ./configure --host=x86_64-apple-darwin --build=i686-apple-darwin --with-ns
make
make bootstrap
make
make install
sudo mv /usr/bin/emacs /usr/bin/emacs-23.4 #or whatever version
sudo mv /usr/bin/emacsclient /usr/bin/emacsclient-23.4 #or whatever version
sudo mv /usr/bin/ctags /usr/bin/ctags.orig
sudo mv /usr/bin/etags /usr/bin/etags.orig
sudo mv /Applications/Emacs.app /Applications/Emacs-23.4.app/ #or whatever version
cd nextstep/
sudo cp -R Emacs.app /Applications/.
cd /Applications/Emacs.app/Contents/MacOS
cd bin
for f in *; do sudo ln -s /Application/Emacs.app/Contents/MacOS/bin/$f /usr/bin/$f; done
now make /usr/bin/emacs the following, so it operates properly
------------
#!/bin/bash
EMACS_PATH=/Applications/Emacs.app/Contents/MacOS/Emacs
if [ $(id -u) = "0" ]; then
sudo $EMACS_PATH $*
else
$EMACS_PATH $*
fi
------------
sudo chown -R root:staff /Applications/Emacs.app
sudo chown root:wheel /usr/bin/emacs
sudo chmod 755 /usr/bin/emacs
- Get configs from https://github.com/mjwall/dotfiles
- Code
------------------------------------------------------
# raw patch below incase it goes away
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index b8baaa0..9d25ff3 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -940,6 +940,10 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
(add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
+ (interactive)
+ (ns-toggle-fullscreen-internal))
(provide 'ns-win)
diff --git a/src/nsfns.m b/src/nsfns.m
index fac61d2..9dbbc47 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2580,6 +2580,21 @@ Value is t if tooltip was open, nil otherwise. */)
return Qt;
}
+DEFUN ("ns-toggle-fullscreen-internal", Fns_toggle_fullscreen_internal, Sns_toggle_fullscreen_internal,
+ 0, 0, 0,
+ doc: /* Toggle fulscreen mode */)
+()
+{
+ struct frame *f = SELECTED_FRAME();
+ EmacsWindow *window = ns_get_window(f);
+
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ [window toggleFullScreen:nil];
+#endif
+
+ return Qnil;
+}
+
/* ==========================================================================
@@ -2736,6 +2751,8 @@ be used as the image of the icon representing the frame. */);
defsubr (&Sx_show_tip);
defsubr (&Sx_hide_tip);
+ defsubr (&Sns_toggle_fullscreen_internal);
+
/* used only in fontset.c */
check_window_system_func = check_ns;
@too
Copy link

too commented Aug 15, 2016

line 32
for f in *; do sudo ln -s /Application/Emacs.app/Contents/MacOS/bin/$f /usr/bin/$f; done

Application should be Applications?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment