Skip to content

Instantly share code, notes, and snippets.

@vaaas
Created November 29, 2017 16:27
Show Gist options
  • Save vaaas/ac745ee4074e8bf46a3b8e48cd166cd6 to your computer and use it in GitHub Desktop.
Save vaaas/ac745ee4074e8bf46a3b8e48cd166cd6 to your computer and use it in GitHub Desktop.
ghetto writeroom in emacs
(defvar-local writing-mode nil)
(defvar-local cached-mode-line nil)
(define-minor-mode writing-mode
"Minor mode for writing"
:variable writing-mode
:init-value nil
:group 'editing-basics
(if (not writing-mode)
(progn
(toggle-frame-fullscreen)
(fringe-mode nil)
(set-window-margins nil 0 0)
(setq mode-line-format cached-mode-line cached-mode-line nil))
(progn
(toggle-frame-fullscreen)
(fringe-mode 0)
(defconst x (/ (- (frame-width) 80) 2))
(set-window-margins nil x x)
(setq cached-mode-line mode-line-format mode-line-format nil))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment