HOWTO: Start and Toggle Emacs Fullscreen

Posted on by on May 24th, 2012 | 0 Comments ยป
Most of the time, when I'm using Emacs, I don't have any need to use any other programs or windows. In particular, the use of multiple desktops encourages me to keep Emacs open as a full screen and switch desktops if another program is necessary. This subroutine allows you to have Emacs take up your entire display, and gives you the ability to toggle between full-screen mode and a regular windowed mode.  

Installation Steps

  1. Create a file nmg-subroutine.el in your ~/.emacs.d directory, and add this code:
  2. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    ;; -----------------------------------------------
    ;; -- Full Screen
    ;; Make new frames fullscreen by default.
    ;; -----------------------------------------------
    (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)
                               ))))
  3. require the file, by adding this code to your .emacs
  4. (load-file "~/.emacs.d/nmg-subroutines.el")
  5. Add Hotkey to make F11 toggle and windowed mode
  6. (global-set-key [f11] 'toggle-fullscreen)
  7. IF you want emacs to start in full screen (and on top) add these lines to your .emacs
  8. (toggle-fullscreen)
    (auto-raise-mode 1) ;;EmacsManual P.191

Results

You can now start emacs in full screen, and toggle using F11 (or you can always hit C-z)
getchar VS scanf
Othello’s Green I’d Monster

Categorized Under

Emacs

About Nick Guthrie

» has written 38 posts

Leave a Reply

You must be logged in to post a comment.

History