Commit 67222e1d authored by Martin Rudalics's avatar Martin Rudalics

Have enlarge-/shrink-window not report errors in most cases (bug#8862).

* window.el (enlarge-window, shrink-window): Don't report an error
when the window can't be resized as requested (Bug#8862).
parent 52724a05
......@@ -11,6 +11,8 @@
display-buffer-pop-up-frame.
(display-buffer-pop-up-frame): Never pop up a frame in
noninteractive mode (Bug#8857).
(enlarge-window, shrink-window): Don't report an error when the
window can't be resized as requested (Bug#8862).
2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
......
......@@ -2044,7 +2044,18 @@ make selected window wider by DELTA columns. If DELTA is
negative, shrink selected window by -DELTA lines or columns.
Return nil."
(interactive "p")
(resize-window (selected-window) delta horizontal))
(cond
((zerop delta))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
((window-resizable-p nil delta horizontal)
(resize-window nil delta horizontal))
(t
(resize-window
nil (if (> delta 0)
(window-max-delta nil horizontal)
(- (window-min-delta nil horizontal)))
horizontal))))
(defun shrink-window (delta &optional horizontal)
"Make selected window DELTA lines smaller.
......@@ -2054,7 +2065,18 @@ make selected window narrower by DELTA columns. If DELTA is
negative, enlarge selected window by -DELTA lines or columns.
Return nil."
(interactive "p")
(resize-window (selected-window) (- delta) horizontal))
(cond
((zerop delta))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
((window-resizable-p nil (- delta) horizontal)
(resize-window nil (- delta) horizontal))
(t
(resize-window
nil (if (> delta 0)
(- (window-min-delta nil horizontal))
(window-max-delta nil horizontal))
horizontal))))
(defun maximize-window (&optional window)
"Maximize WINDOW.
......@@ -4932,7 +4954,7 @@ SPECIFIERS is the SPECIFIERS argument of `display-buffer'."
(setq entry (assq specifiers display-buffer-macro-specifiers)))
;; A macro specifier.
(cdr entry))
((memq pop-up-frames '(nil unset))
((with-no-warnings (memq pop-up-frames '(nil unset)))
;; Pop up a new window.
(cdr (assq 'other-window display-buffer-macro-specifiers)))
(t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment