diff options
-rw-r--r-- | lisp/ChangeLog | 8 | ||||
-rw-r--r-- | lisp/mail/rmail.el | 18 | ||||
-rw-r--r-- | lisp/window.el | 30 |
3 files changed, 41 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 06a5bd7bff4..88200a27133 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2012-12-31 Martin Rudalics <rudalics@gmx.at> + + * window.el (window-resizable--p): Rename to window-resizable-p. + (window-resize-no-error): New function. + + * mail/rmail.el (rmail-maybe-display-summary): Restore behavior + broken in fix from 2012-12-28. + 2012-12-31 Stefan Monnier <monnier@iro.umontreal.ca> * subr.el (special-form-p): Don't signal errors on undef aliases. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 096b53c6cab..947d8e2cb4c 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4224,15 +4224,25 @@ This has an effect only if a summary buffer exists." ;; Put the summary buffer back on the screen, if user wants that. (defun rmail-maybe-display-summary () - ;; If requested, make sure the summary is displayed. - (when (and rmail-summary-buffer (buffer-name rmail-summary-buffer) - rmail-redisplay-summary) + (cond + ((or (not rmail-summary-buffer) + (not (buffer-name rmail-summary-buffer)))) + (rmail-redisplay-summary + ;; If `rmail-redisplay-summary' is non-nil, make sure the summary + ;; buffer is displayed. (display-buffer rmail-summary-buffer `(nil (reusable-frames . 0) ,(when rmail-summary-window-size - `(window-height . ,rmail-summary-window-size)))))) + `(window-height . ,rmail-summary-window-size))))) + (rmail-summary-window-size + ;; If `rmail-summary-window-size' is non-nil and the summary buffer + ;; is displayed, make sure it gets resized. + (let ((window (get-buffer-window rmail-summary-buffer 0))) + (when window + (window-resize-no-error + window (- rmail-summary-window-size (window-height window)))))))) ;;;; *** Rmail Local Fontification *** diff --git a/lisp/window.el b/lisp/window.el index 52909fa9e5f..250978d0053 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -1340,7 +1340,7 @@ violate size restrictions of WINDOW or its child windows." delta)) (t 0))) -(defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown) +(defun window-resizable-p (window delta &optional horizontal ignore trail noup nodown) "Return t if WINDOW can be resized vertically by DELTA lines. WINDOW must be a valid window and defaults to the selected one. For the meaning of the arguments of this function see the @@ -1943,7 +1943,7 @@ instead." ;; nil or the minibuffer window is active, resize the minibuffer ;; window. (window--resize-mini-window minibuffer-window (- delta))) - ((window--resizable-p window delta horizontal ignore) + ((window-resizable-p window delta horizontal ignore) (window--resize-reset frame horizontal) (window--resize-this-window window delta horizontal ignore t) (if (and (not window-combination-resize) @@ -1969,6 +1969,14 @@ instead." (t (error "Cannot resize window %s" window))))) +(defun window-resize-no-error (window delta &optional horizontal ignore) + "Resize WINDOW vertically if it is resizable by DELTA lines. +This function is like `window-resize' but does not signal an +error when WINDOW cannot be resized. For the meaning of the +optional arguments see the documentation of `window-resize'." + (when (window-resizable-p window delta horizontal ignore) + (window-resize window delta horizontal ignore))) + (defun window--resize-child-windows-skip-p (window) "Return non-nil if WINDOW shall be skipped by resizing routines." (memq (window-new-normal window) '(ignore stuck skip))) @@ -2594,7 +2602,7 @@ negative, shrink selected window by -DELTA lines or columns." ;; If the selected window is full height and `resize-mini-windows' ;; is nil, resize the minibuffer window. (window--resize-mini-window minibuffer-window (- delta))) - ((window--resizable-p nil delta horizontal) + ((window-resizable-p nil delta horizontal) (window-resize nil delta horizontal)) (t (window-resize @@ -2627,7 +2635,7 @@ Also see the `window-min-height' variable." ;; If the selected window is full height and `resize-mini-windows' ;; is nil, resize the minibuffer window. (window--resize-mini-window minibuffer-window delta)) - ((window--resizable-p nil (- delta) horizontal) + ((window-resizable-p nil (- delta) horizontal) (window-resize nil (- delta) horizontal)) (t (window-resize @@ -2901,7 +2909,7 @@ that is its frame's root window." (set-window-new-normal sibling (+ (window-normal-size sibling horizontal) (window-normal-size window horizontal)))) - ((window--resizable-p window (- size) horizontal nil nil nil t) + ((window-resizable-p window (- size) horizontal nil nil nil t) ;; Can do without resizing fixed-size windows. (window--resize-siblings window (- size) horizontal)) (t @@ -4440,13 +4448,13 @@ value can be also stored on disk and read back in a new session." (let ((delta (- (cdr (assq 'total-height item)) (window-total-height window))) window-size-fixed) - (when (window--resizable-p window delta) + (when (window-resizable-p window delta) (window-resize window delta))) ;; Else check whether the window is not high enough. (let* ((min-size (window-min-size window nil ignore)) (delta (- min-size (window-total-size window)))) (when (and (> delta 0) - (window--resizable-p window delta nil ignore)) + (window-resizable-p window delta nil ignore)) (window-resize window delta nil ignore)))) ;; Adjust horizontally. (if (memq window-size-fixed '(t width)) @@ -4454,13 +4462,13 @@ value can be also stored on disk and read back in a new session." (let ((delta (- (cdr (assq 'total-width item)) (window-total-width window))) window-size-fixed) - (when (window--resizable-p window delta) + (when (window-resizable-p window delta) (window-resize window delta))) ;; Else check whether the window is not wide enough. (let* ((min-size (window-min-size window t ignore)) (delta (- min-size (window-total-size window t)))) (when (and (> delta 0) - (window--resizable-p window delta t ignore)) + (window-resizable-p window delta t ignore)) (window-resize window delta t ignore)))) ;; Set dedicated status. (set-window-dedicated-p window (cdr (assq 'dedicated state))) @@ -5211,7 +5219,7 @@ live." (* (window-total-size (frame-root-window window)) height)))) (delta (- new-height (window-total-size window)))) - (when (and (window--resizable-p window delta nil 'safe) + (when (and (window-resizable-p window delta nil 'safe) (window-combined-p window)) (window-resize window delta nil 'safe)))) ((functionp height) @@ -5227,7 +5235,7 @@ live." (* (window-total-size (frame-root-window window) t) width)))) (delta (- new-width (window-total-size window t)))) - (when (and (window--resizable-p window delta t 'safe) + (when (and (window-resizable-p window delta t 'safe) (window-combined-p window t)) (window-resize window delta t 'safe)))) ((functionp width) |