]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bugs in window resizing code
authorMartin Rudalics <rudalics@gmx.at>
Thu, 18 Feb 2016 10:25:07 +0000 (11:25 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Thu, 18 Feb 2016 10:25:07 +0000 (11:25 +0100)
* lisp/window.el (adjust-window-trailing-edge): Fix mismatched
parenthesis.
(shrink-window, enlarge-window): Fix bug#22723 where windows
with preserved size would not get resized.  Also now signal an
error when the window cannot be shrunk or enlarged as requested.

lisp/window.el

index e4669c1f6e787aa0c293faf7c60d5ae03392624f..c45e60e6204177054cc299f853edc200ae82dd04 100644 (file)
@@ -3241,9 +3241,9 @@ move it as far as possible in the desired direction."
        (setq ignore 'preserved)
        (setq right first-right)
        (while (and right
-                   (or (window-size-fixed-p right horizontal 'preserved))
-                   (<= (window-size right horizontal t)
-                       (window-min-size right horizontal 'preserved t)))
+                   (or (window-size-fixed-p right horizontal 'preserved)
+                        (<= (window-size right horizontal t)
+                            (window-min-size right horizontal 'preserved t))))
          (setq right
                (or (window-right right)
                    (progn
@@ -3352,12 +3352,12 @@ negative, shrink selected window by -DELTA lines or columns."
       (window--resize-mini-window minibuffer-window (- delta)))
      ((window--resizable-p nil delta horizontal)
       (window-resize nil delta horizontal))
+     ((window--resizable-p nil delta horizontal 'preserved)
+      (window-resize nil delta horizontal 'preserved))
+     ((eq this-command 'enlarge-window)
+      (user-error "Cannot enlarge selected window"))
      (t
-      (window-resize
-       nil (if (> delta 0)
-              (window-max-delta nil horizontal)
-            (- (window-min-delta nil horizontal)))
-       horizontal)))))
+      (error "Cannot enlarge selected window")))))
 
 (defun shrink-window (delta &optional horizontal)
   "Make the selected window DELTA lines smaller.
@@ -3387,12 +3387,12 @@ Also see the `window-min-height' variable."
       (window--resize-mini-window minibuffer-window delta))
      ((window--resizable-p nil (- delta) horizontal)
       (window-resize nil (- delta) horizontal))
+     ((window--resizable-p nil (- delta) horizontal 'preserved)
+      (window-resize nil (- delta) horizontal 'preserved))
+     ((eq this-command 'shrink-window)
+      (user-error "Cannot shrink selected window"))
      (t
-      (window-resize
-       nil (if (> delta 0)
-              (- (window-min-delta nil horizontal))
-            (window-max-delta nil horizontal))
-       horizontal)))))
+      (error "Cannot shrink selected window")))))
 
 (defun maximize-window (&optional window)
   "Maximize WINDOW.