]> git.eshelyaron.com Git - emacs.git/commitdiff
(delete-other-windows-vertically): New function.
authorSam Steingold <sds@gnu.org>
Mon, 5 May 2008 20:12:24 +0000 (20:12 +0000)
committerSam Steingold <sds@gnu.org>
Mon, 5 May 2008 20:12:24 +0000 (20:12 +0000)
lisp/ChangeLog
lisp/window.el

index be022bee3cfbce43c5618be44c2a92e34a2c5824..415981c8e13f0a94fdc674b099911033b363a698 100644 (file)
@@ -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):
index eab0f2b27fccd510cda389594d7fd4c2fee93b08..056ce84085ada8c1a67a923e63d1d131aaec0b71 100644 (file)
@@ -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)