diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 2 | ||||
| -rw-r--r-- | lisp/help.el | 2 | ||||
| -rw-r--r-- | lisp/window.el | 55 |
4 files changed, 41 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7047bd47c7b..88af47fa2f7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2011-10-30 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.el (window-iso-combination-p, window-iso-combined-p) | ||
| 4 | (window-iso-combinations): Remove "iso-" infix. Suggested by | ||
| 5 | Chong Yidong. | ||
| 6 | (window-min-size-1, window-size-fixed-1, window-min-delta-1) | ||
| 7 | (window-max-delta-1, window-resize, window--resize-siblings) | ||
| 8 | (window--resize-this-window, adjust-window-trailing-edge) | ||
| 9 | (split-window, balance-windows-1) | ||
| 10 | (shrink-window-if-larger-than-buffer): | ||
| 11 | * calendar/calendar.el (calendar-generate-window): | ||
| 12 | * help.el (resize-temp-buffer-window): Adjust callers | ||
| 13 | accordingly. | ||
| 14 | |||
| 1 | 2011-10-30 Stefan Monnier <monnier@iro.umontreal.ca> | 15 | 2011-10-30 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 16 | ||
| 3 | * eshell/esh-cmd.el (eshell-rewrite-for-command): Don't modify the list | 17 | * eshell/esh-cmd.el (eshell-rewrite-for-command): Don't modify the list |
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 6fa924dd788..a59e28811d3 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -1373,7 +1373,7 @@ Optional integers MON and YR are used instead of today's date." | |||
| 1373 | ;; Don't do any window-related stuff if we weren't called from a | 1373 | ;; Don't do any window-related stuff if we weren't called from a |
| 1374 | ;; window displaying the calendar. | 1374 | ;; window displaying the calendar. |
| 1375 | (when in-calendar-window | 1375 | (when in-calendar-window |
| 1376 | (if (window-iso-combined-p) | 1376 | (if (window-combined-p) |
| 1377 | ;; Adjust the window to exactly fit the displayed calendar. | 1377 | ;; Adjust the window to exactly fit the displayed calendar. |
| 1378 | (fit-window-to-buffer nil nil calendar-minimum-window-height) | 1378 | (fit-window-to-buffer nil nil calendar-minimum-window-height) |
| 1379 | ;; For a full height window or a window that is horizontally | 1379 | ;; For a full height window or a window that is horizontally |
diff --git a/lisp/help.el b/lisp/help.el index 508a4e3262c..bc3d863f357 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1003,7 +1003,7 @@ than `window-min-height'. Do nothing if the selected window is | |||
| 1003 | not vertically combined or some of its contents are scrolled out | 1003 | not vertically combined or some of its contents are scrolled out |
| 1004 | of view." | 1004 | of view." |
| 1005 | (when (and (pos-visible-in-window-p (point-min)) | 1005 | (when (and (pos-visible-in-window-p (point-min)) |
| 1006 | (window-iso-combined-p)) | 1006 | (window-combined-p)) |
| 1007 | (fit-window-to-buffer | 1007 | (fit-window-to-buffer |
| 1008 | nil | 1008 | nil |
| 1009 | (if (functionp temp-buffer-max-height) | 1009 | (if (functionp temp-buffer-max-height) |
diff --git a/lisp/window.el b/lisp/window.el index e9f3a779785..d254248c2c7 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -196,7 +196,7 @@ narrower, explictly specify the SIZE argument of that function." | |||
| 196 | :version "24.1" | 196 | :version "24.1" |
| 197 | :group 'windows) | 197 | :group 'windows) |
| 198 | 198 | ||
| 199 | (defun window-iso-combination-p (&optional window horizontal) | 199 | (defun window-combination-p (&optional window horizontal) |
| 200 | "If WINDOW is a vertical combination return WINDOW's first child. | 200 | "If WINDOW is a vertical combination return WINDOW's first child. |
| 201 | WINDOW can be any window and defaults to the selected one. | 201 | WINDOW can be any window and defaults to the selected one. |
| 202 | Optional argument HORIZONTAL non-nil means return WINDOW's first | 202 | Optional argument HORIZONTAL non-nil means return WINDOW's first |
| @@ -206,16 +206,16 @@ child if WINDOW is a horizontal combination." | |||
| 206 | (window-left-child window) | 206 | (window-left-child window) |
| 207 | (window-top-child window))) | 207 | (window-top-child window))) |
| 208 | 208 | ||
| 209 | (defsubst window-iso-combined-p (&optional window horizontal) | 209 | (defsubst window-combined-p (&optional window horizontal) |
| 210 | "Return non-nil if and only if WINDOW is vertically combined. | 210 | "Return non-nil if and only if WINDOW is vertically combined. |
| 211 | WINDOW can be any window and defaults to the selected one. | 211 | WINDOW can be any window and defaults to the selected one. |
| 212 | Optional argument HORIZONTAL non-nil means return non-nil if and | 212 | Optional argument HORIZONTAL non-nil means return non-nil if and |
| 213 | only if WINDOW is horizontally combined." | 213 | only if WINDOW is horizontally combined." |
| 214 | (setq window (window-normalize-any-window window)) | 214 | (setq window (window-normalize-any-window window)) |
| 215 | (let ((parent (window-parent window))) | 215 | (let ((parent (window-parent window))) |
| 216 | (and parent (window-iso-combination-p parent horizontal)))) | 216 | (and parent (window-combination-p parent horizontal)))) |
| 217 | 217 | ||
| 218 | (defun window-iso-combinations (&optional window horizontal) | 218 | (defun window-combinations (&optional window horizontal) |
| 219 | "Return largest number of vertically arranged subwindows of WINDOW. | 219 | "Return largest number of vertically arranged subwindows of WINDOW. |
| 220 | WINDOW can be any window and defaults to the selected one. | 220 | WINDOW can be any window and defaults to the selected one. |
| 221 | Optional argument HORIZONTAL non-nil means to return the largest | 221 | Optional argument HORIZONTAL non-nil means to return the largest |
| @@ -225,14 +225,14 @@ number of horizontally arranged subwindows of WINDOW." | |||
| 225 | ((window-live-p window) | 225 | ((window-live-p window) |
| 226 | ;; If WINDOW is live, return 1. | 226 | ;; If WINDOW is live, return 1. |
| 227 | 1) | 227 | 1) |
| 228 | ((window-iso-combination-p window horizontal) | 228 | ((window-combination-p window horizontal) |
| 229 | ;; If WINDOW is iso-combined, return the sum of the values for all | 229 | ;; If WINDOW is iso-combined, return the sum of the values for all |
| 230 | ;; subwindows of WINDOW. | 230 | ;; subwindows of WINDOW. |
| 231 | (let ((child (window-child window)) | 231 | (let ((child (window-child window)) |
| 232 | (count 0)) | 232 | (count 0)) |
| 233 | (while child | 233 | (while child |
| 234 | (setq count | 234 | (setq count |
| 235 | (+ (window-iso-combinations child horizontal) | 235 | (+ (window-combinations child horizontal) |
| 236 | count)) | 236 | count)) |
| 237 | (setq child (window-right child))) | 237 | (setq child (window-right child))) |
| 238 | count)) | 238 | count)) |
| @@ -243,7 +243,7 @@ number of horizontally arranged subwindows of WINDOW." | |||
| 243 | (count 1)) | 243 | (count 1)) |
| 244 | (while child | 244 | (while child |
| 245 | (setq count | 245 | (setq count |
| 246 | (max (window-iso-combinations child horizontal) | 246 | (max (window-combinations child horizontal) |
| 247 | count)) | 247 | count)) |
| 248 | (setq child (window-right child))) | 248 | (setq child (window-right child))) |
| 249 | count)))) | 249 | count)))) |
| @@ -555,7 +555,7 @@ restrictions for that window only." | |||
| 555 | (if sub | 555 | (if sub |
| 556 | (let ((value 0)) | 556 | (let ((value 0)) |
| 557 | ;; WINDOW is an internal window. | 557 | ;; WINDOW is an internal window. |
| 558 | (if (window-iso-combined-p sub horizontal) | 558 | (if (window-combined-p sub horizontal) |
| 559 | ;; The minimum size of an iso-combination is the sum of | 559 | ;; The minimum size of an iso-combination is the sum of |
| 560 | ;; the minimum sizes of its subwindows. | 560 | ;; the minimum sizes of its subwindows. |
| 561 | (while sub | 561 | (while sub |
| @@ -669,7 +669,7 @@ doc-string of `window-sizable'." | |||
| 669 | (catch 'fixed | 669 | (catch 'fixed |
| 670 | (if sub | 670 | (if sub |
| 671 | ;; WINDOW is an internal window. | 671 | ;; WINDOW is an internal window. |
| 672 | (if (window-iso-combined-p sub horizontal) | 672 | (if (window-combined-p sub horizontal) |
| 673 | ;; An iso-combination is fixed size if all its subwindows | 673 | ;; An iso-combination is fixed size if all its subwindows |
| 674 | ;; are fixed-size. | 674 | ;; are fixed-size. |
| 675 | (progn | 675 | (progn |
| @@ -717,7 +717,7 @@ WINDOW can be resized in the desired direction. The functions | |||
| 717 | (let* ((parent (window-parent window)) | 717 | (let* ((parent (window-parent window)) |
| 718 | (sub (window-child parent))) | 718 | (sub (window-child parent))) |
| 719 | (catch 'done | 719 | (catch 'done |
| 720 | (if (window-iso-combined-p sub horizontal) | 720 | (if (window-combined-p sub horizontal) |
| 721 | ;; In an iso-combination throw DELTA if we find at least one | 721 | ;; In an iso-combination throw DELTA if we find at least one |
| 722 | ;; subwindow and that subwindow is either not of fixed-size | 722 | ;; subwindow and that subwindow is either not of fixed-size |
| 723 | ;; or we can ignore fixed-sizeness. | 723 | ;; or we can ignore fixed-sizeness. |
| @@ -797,7 +797,7 @@ least one other windows can be enlarged appropriately." | |||
| 797 | (let* ((parent (window-parent window)) | 797 | (let* ((parent (window-parent window)) |
| 798 | (sub (window-child parent))) | 798 | (sub (window-child parent))) |
| 799 | (catch 'fixed | 799 | (catch 'fixed |
| 800 | (if (window-iso-combined-p sub horizontal) | 800 | (if (window-combined-p sub horizontal) |
| 801 | ;; For an iso-combination calculate how much we can get from | 801 | ;; For an iso-combination calculate how much we can get from |
| 802 | ;; other subwindows. | 802 | ;; other subwindows. |
| 803 | (let ((skip (eq trail 'after))) | 803 | (let ((skip (eq trail 'after))) |
| @@ -1498,7 +1498,7 @@ instead." | |||
| 1498 | (window--resize-reset frame horizontal) | 1498 | (window--resize-reset frame horizontal) |
| 1499 | (window--resize-this-window window delta horizontal ignore t) | 1499 | (window--resize-this-window window delta horizontal ignore t) |
| 1500 | (if (and (not (window-splits window)) | 1500 | (if (and (not (window-splits window)) |
| 1501 | (window-iso-combined-p window horizontal) | 1501 | (window-combined-p window horizontal) |
| 1502 | (setq sibling (or (window-right window) (window-left window))) | 1502 | (setq sibling (or (window-right window) (window-left window))) |
| 1503 | (window-sizable-p sibling (- delta) horizontal ignore)) | 1503 | (window-sizable-p sibling (- delta) horizontal ignore)) |
| 1504 | ;; If window-splits returns nil for WINDOW, WINDOW is part of | 1504 | ;; If window-splits returns nil for WINDOW, WINDOW is part of |
| @@ -1819,7 +1819,7 @@ preferably only resize windows adjacent to EDGE." | |||
| 1819 | (when (window-parent window) | 1819 | (when (window-parent window) |
| 1820 | (let* ((parent (window-parent window)) | 1820 | (let* ((parent (window-parent window)) |
| 1821 | (sub (window-child parent))) | 1821 | (sub (window-child parent))) |
| 1822 | (if (window-iso-combined-p sub horizontal) | 1822 | (if (window-combined-p sub horizontal) |
| 1823 | ;; In an iso-combination try to extract DELTA from WINDOW's | 1823 | ;; In an iso-combination try to extract DELTA from WINDOW's |
| 1824 | ;; siblings. | 1824 | ;; siblings. |
| 1825 | (let ((first sub) | 1825 | (let ((first sub) |
| @@ -1935,7 +1935,7 @@ actually take effect." | |||
| 1935 | (let ((sub (window-child window))) | 1935 | (let ((sub (window-child window))) |
| 1936 | (cond | 1936 | (cond |
| 1937 | ((not sub)) | 1937 | ((not sub)) |
| 1938 | ((window-iso-combined-p sub horizontal) | 1938 | ((window-combined-p sub horizontal) |
| 1939 | ;; In an iso-combination resize subwindows according to their | 1939 | ;; In an iso-combination resize subwindows according to their |
| 1940 | ;; normal sizes. | 1940 | ;; normal sizes. |
| 1941 | (window--resize-subwindows | 1941 | (window--resize-subwindows |
| @@ -2010,7 +2010,7 @@ move it as far as possible in the desired direction." | |||
| 2010 | (right window) | 2010 | (right window) |
| 2011 | left this-delta min-delta max-delta failed) | 2011 | left this-delta min-delta max-delta failed) |
| 2012 | ;; Find the edge we want to move. | 2012 | ;; Find the edge we want to move. |
| 2013 | (while (and (or (not (window-iso-combined-p right horizontal)) | 2013 | (while (and (or (not (window-combined-p right horizontal)) |
| 2014 | (not (window-right right))) | 2014 | (not (window-right right))) |
| 2015 | (setq right (window-parent right)))) | 2015 | (setq right (window-parent right)))) |
| 2016 | (cond | 2016 | (cond |
| @@ -2029,7 +2029,7 @@ move it as far as possible in the desired direction." | |||
| 2029 | (or (window-left left) | 2029 | (or (window-left left) |
| 2030 | (progn | 2030 | (progn |
| 2031 | (while (and (setq left (window-parent left)) | 2031 | (while (and (setq left (window-parent left)) |
| 2032 | (not (window-iso-combined-p left horizontal)))) | 2032 | (not (window-combined-p left horizontal)))) |
| 2033 | (window-left left))))) | 2033 | (window-left left))))) |
| 2034 | (unless left | 2034 | (unless left |
| 2035 | (if horizontal | 2035 | (if horizontal |
| @@ -2043,7 +2043,7 @@ move it as far as possible in the desired direction." | |||
| 2043 | (or (window-right right) | 2043 | (or (window-right right) |
| 2044 | (progn | 2044 | (progn |
| 2045 | (while (and (setq right (window-parent right)) | 2045 | (while (and (setq right (window-parent right)) |
| 2046 | (not (window-iso-combined-p right horizontal)))) | 2046 | (not (window-combined-p right horizontal)))) |
| 2047 | (window-right right))))) | 2047 | (window-right right))))) |
| 2048 | (unless right | 2048 | (unless right |
| 2049 | (if horizontal | 2049 | (if horizontal |
| @@ -3142,7 +3142,7 @@ frame. The selected window is not changed by this function." | |||
| 3142 | (resize | 3142 | (resize |
| 3143 | (and window-splits (not window-nest) | 3143 | (and window-splits (not window-nest) |
| 3144 | ;; Resize makes sense in iso-combinations only. | 3144 | ;; Resize makes sense in iso-combinations only. |
| 3145 | (window-iso-combined-p window horizontal))) | 3145 | (window-combined-p window horizontal))) |
| 3146 | ;; `old-size' is the current size of WINDOW. | 3146 | ;; `old-size' is the current size of WINDOW. |
| 3147 | (old-size (window-total-size window horizontal)) | 3147 | (old-size (window-total-size window horizontal)) |
| 3148 | ;; `new-size' is the specified or calculated size of the | 3148 | ;; `new-size' is the specified or calculated size of the |
| @@ -3157,7 +3157,7 @@ frame. The selected window is not changed by this function." | |||
| 3157 | (min (- parent-size | 3157 | (min (- parent-size |
| 3158 | (window-min-size parent horizontal)) | 3158 | (window-min-size parent horizontal)) |
| 3159 | (/ parent-size | 3159 | (/ parent-size |
| 3160 | (1+ (window-iso-combinations | 3160 | (1+ (window-combinations |
| 3161 | parent horizontal)))) | 3161 | parent horizontal)))) |
| 3162 | ;; Else try to give the new window half the size | 3162 | ;; Else try to give the new window half the size |
| 3163 | ;; of WINDOW (plus an eventual odd line). | 3163 | ;; of WINDOW (plus an eventual odd line). |
| @@ -3220,13 +3220,13 @@ frame. The selected window is not changed by this function." | |||
| 3220 | ;; Make new-parent non-nil if we need a new parent window; | 3220 | ;; Make new-parent non-nil if we need a new parent window; |
| 3221 | ;; either because we want to nest or because WINDOW is not | 3221 | ;; either because we want to nest or because WINDOW is not |
| 3222 | ;; iso-combined. | 3222 | ;; iso-combined. |
| 3223 | (or window-nest (not (window-iso-combined-p window horizontal)))) | 3223 | (or window-nest (not (window-combined-p window horizontal)))) |
| 3224 | (setq new-normal | 3224 | (setq new-normal |
| 3225 | ;; Make new-normal the normal size of the new window. | 3225 | ;; Make new-normal the normal size of the new window. |
| 3226 | (cond | 3226 | (cond |
| 3227 | (size (/ (float new-size) (if new-parent old-size parent-size))) | 3227 | (size (/ (float new-size) (if new-parent old-size parent-size))) |
| 3228 | (new-parent 0.5) | 3228 | (new-parent 0.5) |
| 3229 | (resize (/ 1.0 (1+ (window-iso-combinations parent horizontal)))) | 3229 | (resize (/ 1.0 (1+ (window-combinations parent horizontal)))) |
| 3230 | (t (/ (window-normal-size window horizontal) 2.0)))) | 3230 | (t (/ (window-normal-size window horizontal) 2.0)))) |
| 3231 | 3231 | ||
| 3232 | (if resize | 3232 | (if resize |
| @@ -3359,7 +3359,8 @@ right, if any." | |||
| 3359 | ;; the smallest window). | 3359 | ;; the smallest window). |
| 3360 | (defun balance-windows-2 (window horizontal) | 3360 | (defun balance-windows-2 (window horizontal) |
| 3361 | "Subroutine of `balance-windows-1'. | 3361 | "Subroutine of `balance-windows-1'. |
| 3362 | WINDOW must be an iso-combination." | 3362 | WINDOW must be a vertical combination (horizontal if HORIZONTAL |
| 3363 | is non-nil." | ||
| 3363 | (let* ((first (window-child window)) | 3364 | (let* ((first (window-child window)) |
| 3364 | (sub first) | 3365 | (sub first) |
| 3365 | (number-of-children 0) | 3366 | (number-of-children 0) |
| @@ -3432,7 +3433,7 @@ WINDOW must be an iso-combination." | |||
| 3432 | "Subroutine of `balance-windows'." | 3433 | "Subroutine of `balance-windows'." |
| 3433 | (if (window-child window) | 3434 | (if (window-child window) |
| 3434 | (let ((sub (window-child window))) | 3435 | (let ((sub (window-child window))) |
| 3435 | (if (window-iso-combined-p sub horizontal) | 3436 | (if (window-combined-p sub horizontal) |
| 3436 | (balance-windows-2 window horizontal) | 3437 | (balance-windows-2 window horizontal) |
| 3437 | (let ((size (window-new-total window))) | 3438 | (let ((size (window-new-total window))) |
| 3438 | (while sub | 3439 | (while sub |
| @@ -5281,14 +5282,8 @@ WINDOW was scrolled." | |||
| 5281 | WINDOW defaults to the selected window." | 5282 | WINDOW defaults to the selected window." |
| 5282 | (with-selected-window (or window (selected-window)) | 5283 | (with-selected-window (or window (selected-window)) |
| 5283 | (let ((edges (window-edges))) | 5284 | (let ((edges (window-edges))) |
| 5284 | ;; The following doesn't satisfy the doc-string's claim when | ||
| 5285 | ;; window and previous-/next-window are not part of the same | ||
| 5286 | ;; combination but still share a common edge. Using | ||
| 5287 | ;; `window-iso-combined-p' instead should handle that. | ||
| 5288 | (or (= (nth 2 edges) (nth 2 (window-edges (previous-window)))) | 5285 | (or (= (nth 2 edges) (nth 2 (window-edges (previous-window)))) |
| 5289 | (= (nth 0 edges) (nth 0 (window-edges (next-window)))))))) | 5286 | (= (nth 0 edges) (nth 0 (window-edges (next-window)))))))) |
| 5290 | ;; (make-obsolete | ||
| 5291 | ;; 'window-safely-shrinkable-p "use `window-iso-combined-p' instead." "24.1") | ||
| 5292 | 5287 | ||
| 5293 | (defun shrink-window-if-larger-than-buffer (&optional window) | 5288 | (defun shrink-window-if-larger-than-buffer (&optional window) |
| 5294 | "Shrink height of WINDOW if its buffer doesn't need so many lines. | 5289 | "Shrink height of WINDOW if its buffer doesn't need so many lines. |
| @@ -5308,7 +5303,7 @@ Return non-nil if the window was shrunk, nil otherwise." | |||
| 5308 | ;; Make sure that WINDOW is vertically combined and `point-min' is | 5303 | ;; Make sure that WINDOW is vertically combined and `point-min' is |
| 5309 | ;; visible (for whatever reason that's needed). The remaining issues | 5304 | ;; visible (for whatever reason that's needed). The remaining issues |
| 5310 | ;; should be taken care of by `fit-window-to-buffer'. | 5305 | ;; should be taken care of by `fit-window-to-buffer'. |
| 5311 | (when (and (window-iso-combined-p window) | 5306 | (when (and (window-combined-p window) |
| 5312 | (pos-visible-in-window-p (point-min) window)) | 5307 | (pos-visible-in-window-p (point-min) window)) |
| 5313 | (fit-window-to-buffer window (window-total-size window)))) | 5308 | (fit-window-to-buffer window (window-total-size window)))) |
| 5314 | 5309 | ||