# HG changeset patch # User Sam Steingold <sds@gnu.org> # Date 1210018344 0 # Node ID 0280cb8774cc78d2a779fbf8d45603609da557d3 # Parent 4ee3432d1e099b0c712855ee507d94a069e2cd32 (delete-other-windows-vertically): New function. diff -r 4ee3432d1e09 -r 0280cb8774cc lisp/ChangeLog --- a/lisp/ChangeLog Mon May 05 19:27:54 2008 +0000 +++ b/lisp/ChangeLog Mon May 05 20:12:24 2008 +0000 @@ -1,3 +1,7 @@ +2008-05-05 Sam Steingold <sds@gnu.org> + + * window.el (delete-other-windows-vertically): New function. + 2008-05-05 Stefan Monnier <monnier@iro.umontreal.ca> * dired.el (dired-read-dir-and-switches): diff -r 4ee3432d1e09 -r 0280cb8774cc lisp/window.el --- a/lisp/window.el Mon May 05 19:27:54 2008 +0000 +++ b/lisp/window.el Mon May 05 20:12:24 2008 +0000 @@ -1095,6 +1095,21 @@ (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)