Wrote a quick Emacs Lisp function in the past half hour that centralises
the current buffer on display and adds large left and right margins in
the form of empty buffers; I find it easier to write and read when the
content is in the middle of the screen (indeed I’m using it right now to
write this post). I have it bound to C-c c
.
;; centralise window for easier viewing
(defun swhitton/centralise-current-window ()
"Make editing window 95 cols wide and centre it in the frame
for easier reading and writing"
(interactive)
(delete-other-windows)
(split-window-horizontally)
(split-window-horizontally)
(shrink-window-horizontally (- (window-width) (/ (- (frame-width) 97) 2)))
(switch-to-buffer "*blank*")
(toggle-read-only 1)
(setq mode-line-format nil)
(other-window 1)
(shrink-window-horizontally (- (window-width) 95))
(other-window 1)
(switch-to-buffer "*blank*")
(other-window -1))
(global-set-key (kbd "C-c c") 'swhitton/centralise-current-window)
Here’s a live action shot:
?centralisewindow.png
Back to work.
Edit 31/v/2011: Updated to improved version.