From 3722a694fa094f88f7dfe54ccce7ea7cbaab214a Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Thu, 18 Feb 2016 11:25:07 +0100 Subject: [PATCH] Fix bugs in window resizing code * 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 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index e4669c1f6e7..c45e60e6204 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -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. -- 2.39.2