Created
September 24, 2014 19:35
-
-
Save jordonbiondo/aa6d68b680abdb1a5f70 to your computer and use it in GitHub Desktop.
toggle 80 columns edittable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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