X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/blobdiff_plain/47d0a830f2805e02b3e28e662b915f0084afe86b..22e1b8c34780d0ada1387977f00a68b7befd8343:/el/dot-emacs.el diff --git a/el/dot-emacs.el b/el/dot-emacs.el index d99134d..24d076d 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -200,13 +200,16 @@ (defun mdw-split-window-horizontally (&optional width) ((>= width 0) (+ width (mdw-horizontal-window-overhead))) ((< width 0) width)))) +(defun mdw-preferred-column-width () + "Return the preferred column width." + (if (and window-system (mdw-emacs-version-p 22)) mdw-column-width + (1+ mdw-column-width))) + (defun mdw-divvy-window (&optional width) "Split a wide window into appropriate widths." (interactive "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)))) + (setq width (if width (prefix-numeric-value width) + (mdw-preferred-column-width))) (let* ((win (selected-window)) (sb-width (mdw-horizontal-window-overhead)) (c (/ (+ (window-width) sb-width) @@ -220,10 +223,8 @@ (defun mdw-divvy-window (&optional width) (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)))) + (setq width (if width (prefix-numeric-value width) + (mdw-preferred-column-width))) (let ((sb-width (mdw-horizontal-window-overhead))) (set-frame-width (selected-frame) (- (* columns (+ width sb-width))