chiark / gitweb /
el/dot-emacs.el: New function to make Emacs frames a sensible width.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 2 Sep 2017 14:17:42 +0000 (15:17 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 2 Sep 2017 14:17:42 +0000 (15:17 +0100)
el/dot-emacs.el

index 5314fd90cbdd5e0f761814bd1cfb010e3dd52a8b..c6c038c7bcd14b2c70698c1b6fb3e2271ba84877 100644 (file)
@@ -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