[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shrinking side-by-side windows

From: Stefan Monnier
Subject: Re: Shrinking side-by-side windows
Date: 07 Feb 2004 18:32:48 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> With the CVS Emacs, shrink-window-if-larger-than-buffer (C-x -)
> shrinks a window when there is a window to its right and a single
> window across the frame above it (or across the bottom of the frame if
> it is the top-left window).

It should also do it when "there is a window to its left, ...".

> It seems that for a non-top-left window window-safely-shrinkable-p
> only checks the previous window.

How is that?  The second arm of the `or' checks the next window in all
cases, doesn't it?

> And when called without an argument
> (as by shrink-window-if-larger-than-buffer) window-safely-shrinkable-p
> treats the top-left window as any other window (checking the previous
> window instead of only the next).

Good point.
[ BTW:  Too bad I can't remember why I added the special case for the first
  window.  It should either be removed or a comment should be added. ]

I suggest the patch below,


@@ -188,82 +188,206 @@
 (defun window-safely-shrinkable-p (&optional window)
   "Non-nil if the WINDOW can be shrunk without shrinking other windows.
 If WINDOW is nil or omitted, it defaults to the currently selected window."
-  (save-selected-window
-    (when window (select-window window))
+  (unless window (setq window (selected-window)))
+  (with-selected-window window
     (or (and (not (eq window (frame-first-window)))
             (= (car (window-edges))
                (car (window-edges (previous-window)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]