Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Created September 24, 2014 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordonbiondo/aa6d68b680abdb1a5f70 to your computer and use it in GitHub Desktop.
Save jordonbiondo/aa6d68b680abdb1a5f70 to your computer and use it in GitHub Desktop.
toggle 80 columns edittable
(defun toggle-80-editting-columns ()
"Set the right window margin so the edittable space is only 80 columns."
(interactive)
(let ((margins (window-margins)))
(if (or (car margins) (cdr margins))
(set-window-margins nil 0 0)
(set-window-margins nil 0 (max (- (window-width) 80) 0)))))
(defun toggle-80-editting-columns-balanced ()
"Set both window margins so the edittable space is only 80 columns."
(interactive)
(let ((margins (window-margins)))
(if (or (car margins) (cdr margins))
(set-window-margins nil 0 0)
(let* ((change (max (- (window-width) 80) 0))
(left (/ change 2))
(right (- change left)))
(set-window-margins nil left right)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment