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 use the Yamamoto Mitsuharu version of Emacs, which has a very nice full screen mode.
- 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
mac-toggle-max-windowfunction 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.