chiark
/
gitweb
/
~mdw
/
profile
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
el/dot-emacs.el: Abstract out the frame column-width logic.
[profile]
/
el
/
dot-emacs.el
diff --git
a/el/dot-emacs.el
b/el/dot-emacs.el
index d99134d7a9868e03128706d83c9af1a485c7f423..24d076d2e05477c4c1fb5ccd08e9eaf33fa20a6e 100644
(file)
--- 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))))
((>= 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")
(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)
(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")
(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))
(let ((sb-width (mdw-horizontal-window-overhead)))
(set-frame-width (selected-frame)
(- (* columns (+ width sb-width))