From: Mark Wooding Date: Sat, 2 Sep 2017 14:17:42 +0000 (+0100) Subject: el/dot-emacs.el: New function to make Emacs frames a sensible width. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/cc8708fc32ad33d723fdc35d56f808068ea43e9b el/dot-emacs.el: New function to make Emacs frames a sensible width. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 5314fd9..c6c038c 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -217,6 +217,19 @@ (defun mdw-divvy-window (&optional width) (other-window 1)) (select-window win))) +(defun mdw-set-frame-width (columns &optional width) + (interactive "nColumns: +P") + (setq width (cond (width (prefix-numeric-value width)) + ((and window-system (mdw-emacs-version-p 22)) + mdw-column-width) + (t (1+ mdw-column-width)))) + (let ((sb-width (mdw-horizontal-window-overhead))) + (set-frame-width (selected-frame) + (- (* columns (+ width sb-width)) + sb-width)) + (mdw-divvy-window width))) + ;; Don't raise windows unless I say so. (defvar mdw-inhibit-raise-frame nil