Fullscreen Emacs in OSX
Solution 1:
This feature is present in Emacs 24.4. From the NEWS file:
Changes in Emacs 24.4 on Non-Free Operating Systems
...
Improved fullscreen support on Mac OS X.
Both native (>= OSX 10.7) and "old style" fullscreen are supported. Customize `ns-use-native-fullscreen' to change style. For >= 10.7 native is the default.
And:
New commands
toggle-frame-fullscreen
andtoggle-frame-maximized
, bound to<f11>
andM-<f10>
, respectively.
Solution 2:
The build of Emacs distributed via http://emacsforosx.com doesn't include the fullscreen option.
If you use the Homebrew package manager, you can install Emacs with fullscreen support via
brew install emacs --cocoa
You'll then want to link Homebrew's Emacs.app
to one in your /Applications
directory:
ln -s `brew --prefix`/Cellar/emacs/23.2/Emacs.app /Applications/Emacs.app
Now you'll be able to use fullscreen mode via ns-toggle-fullscreen.
Solution 3:
If you want to keep your version of GNU Emacs, here are two possible tested approaches.
From Amit's Thoughts: Emacs: full screen on Mac OS X for GNU (Cocoa/Nextstep) Emacs 23 :
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.
Another article recommends :
If you want to make GNU Emacs fullscreen, there are three things you should do:
- Disable tool bar
This can be accomplished executing (inside Emacs)(tool-bar-mode -1)
- Disable menu bar
This can be done executing(menu-bar-mode -1)
- Go to full screen mode
You have to execute(set-frame-parameter nil 'fullscreen 'fullboth)
If you want to disable always tool bar and menu bar, like me, and you want to be able to go to full screen with a keystroke (F11, for example), add this to your .emacs:
;; F11 = Full Screen (defun toggle-fullscreen (&optional f) (interactive) (let ((current-value (frame-parameter nil 'fullscreen))) (set-frame-parameter nil 'fullscreen (if (equal 'fullboth current-value) (if (boundp 'old-fullscreen) old-fullscreen nil) (progn (setq old-fullscreen current-value) 'fullboth))))) (global-set-key [f11] 'toggle-fullscreen) ;; Disable tool-bar (tool-bar-mode -1) ;; Disable Menu Bar (menu-bar-mode -1)