Emacs: full screen on Mac OS X #
The methods for toggling full screen on Emacs/Mac vary by version. I've reorganized this post to document what I've used for various versions of Emacs. As of 2012-11-01 I was using the Yamamoto Mitsuharu version of Emacs, which has a very nice full screen mode; as of 2014-01-01 I switched to the Emacs 24.4 nightlies from EmacsForMacOSX.com, but I also suggest looking at the railwaycat emacs build, which is also available on Homebrew.
- Carbon Emacs 22.2
-
You can run M-x mac-toggle-max-window to toggle full screen mode, with no menubar. This is handy enough that I've bound it to ⌘ Cmd+Return, which is similar to what some Linux and Windows apps use to toggle full screen mode.
(define-key global-map [(alt return)] 'mac-toggle-max-window)
- Carbon Emacs 22.5
-
They seem to have removed the function from 22.2, but you can get it back with this code from Vebjorn Lsoja:
(defun mac-toggle-max-window () (interactive) (set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen) nil 'fullboth)))
- Yamamoto Mitsuharu's Emacs Port
-
Use the
mac-toggle-max-window
function definition above. - GNU (Cocoa/Nextstep) Emacs 23
-
Neither approach above works with this version. Instead I'm using a patched version of maxframe.el, and this function from the EmacsWiki page:
(defvar maxframe-maximized-p nil "maxframe is in fullscreen mode") (defun toggle-maxframe () "Toggle maximized frame" (interactive) (setq maxframe-maximized-p (not maxframe-maximized-p)) (cond (maxframe-maximized-p (maximize-frame)) (t (restore-frame)))) (define-key global-map [(alt return)] 'toggle-maxframe)
Unfortunately this doesn't hide the menubar or titlebar.
For other versions, check the EmacsWiki page to see if there's a method that works on the version you run, or check this page for Aquamacs.