summaryrefslogtreecommitdiff
path: root/lisp/window.el
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2008-05-05 20:12:24 +0000
committerSam Steingold <sds@gnu.org>2008-05-05 20:12:24 +0000
commit4ecc0b678728d3affd3f376dfefa19e2e70c30c4 (patch)
tree9ea01bd84304ad2e6a092b1279001e25d7aba1d6 /lisp/window.el
parentd0c66c5b2abdbaad24fa694f477a98a57f06e32a (diff)
downloademacs-4ecc0b678728d3affd3f376dfefa19e2e70c30c4.tar.gz
(delete-other-windows-vertically): New function.
Diffstat (limited to 'lisp/window.el')
-rw-r--r--lisp/window.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/window.el b/lisp/window.el
index eab0f2b27fc..056ce84085a 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1095,6 +1095,21 @@ active. This function is run by `mouse-autoselect-window-timer'."
(run-hooks 'mouse-leave-buffer-hook))
(select-window window))))
+(defun delete-other-windows-vertically (&optional window)
+ "Delete the windows in the same column with WINDOW, but not WINDOW itself.
+This may be a useful alternative binding for \\[delete-other-windows]
+ if you often split windows horizontally."
+ (interactive)
+ (let* ((window (or window (selected-window)))
+ (edges (window-edges window))
+ (w window) delenda)
+ (while (not (eq (setq w (next-window w 1)) window))
+ (let ((e (window-edges w)))
+ (when (and (= (car e) (car edges))
+ (= (caddr e) (caddr edges)))
+ (push w delenda))))
+ (mapc 'delete-window delenda)))
+
(define-key ctl-x-map "2" 'split-window-vertically)
(define-key ctl-x-map "3" 'split-window-horizontally)
(define-key ctl-x-map "}" 'enlarge-window-horizontally)