1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-05 20:43:08 +00:00

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).
This commit is contained in:
Martin Rudalics 2011-06-16 16:01:46 +02:00
parent 52724a05ab
commit 67222e1dff
2 changed files with 27 additions and 3 deletions

View File

@ -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>

View File

@ -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