Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.