diff options
| author | Martin Rudalics | 2014-12-18 18:12:24 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-12-18 18:12:24 +0100 |
| commit | 47f730e3b6a36d6b3e22b91caac576ec2ac4bd7c (patch) | |
| tree | a516327425c0cd36f4cc1fe56376fc0860e7ab54 | |
| parent | 36c43e95de5e067b7d6a06db479765b4e4a22986 (diff) | |
| download | emacs-47f730e3b6a36d6b3e22b91caac576ec2ac4bd7c.tar.gz emacs-47f730e3b6a36d6b3e22b91caac576ec2ac4bd7c.zip | |
Add code for "preserving" window sizes.
* frame.c (frame_windows_min_size): New argument IGNORE.
(adjust_frame_size): When called from change_frame_size call
frame_windows_min_size with IGNORE Qt so we can ignore size
restrictions.
* dired.el (dired-pop-to-buffer): Call fit-window-to-buffer with
`preserve-size' t.
(dired-mark-pop-up): Preserve size of window showing marked
files.
* electric.el (Electric-pop-up-window):
* help.el (resize-temp-buffer-window): Call fit-window-to-buffer
with `preserve-size' t.
* minibuffer.el (minibuffer-completion-help): Use
`resize-temp-buffer-window' instead of `fit-window-to-buffer'
(Bug#19355). Preserve size of completions window.
* register.el (register-preview): Preserve size of register
preview window.
* tmm.el (tmm-add-prompt): Call fit-window-to-buffer
with `preserve-size' t (Bug#1291).
* window.el (with-displayed-buffer-window): Add calls to
`window-preserve-size'.
(window-min-pixel-size, window--preservable-size)
(window-preserve-size, window-preserved-size)
(window--preserve-size, window--min-size-ignore-p): New
functions.
(window-min-size, window-min-delta, window--resizable)
(window--resize-this-window, split-window-below)
(split-window-right): Amend doc-string.
(adjust-window-trailing-edge): Handle preserving window
sizes. Signal user-error instead of an error when there's no
window above or below.
(window--min-size-1, window-sizable, window--size-fixed-1)
(window-size-fixed-p, window--min-delta-1)
(frame-windows-min-size, window--max-delta-1, window-resize)
(window--resize-child-windows, window--resize-siblings)
(enlarge-window, shrink-window, split-window): Handle preserving
window sizes.
(window--state-put-2): Handle horizontal scroll bars.
(window--display-buffer): Call `preserve-size' if asked for.
(display-buffer): Mention `preserve-size' alist member in
doc-string.
(fit-window-to-buffer): New argument PRESERVE-SIZE.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/ChangeLog | 41 | ||||
| -rw-r--r-- | lisp/dired.el | 5 | ||||
| -rw-r--r-- | lisp/electric.el | 5 | ||||
| -rw-r--r-- | lisp/help.el | 7 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 5 | ||||
| -rw-r--r-- | lisp/register.el | 3 | ||||
| -rw-r--r-- | lisp/tmm.el | 11 | ||||
| -rw-r--r-- | lisp/window.el | 509 | ||||
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/frame.c | 10 | ||||
| -rw-r--r-- | src/window.c | 6 |
12 files changed, 393 insertions, 220 deletions
| @@ -575,6 +575,10 @@ fullwidth frames, the behavior may depend on the toolkit used. | |||
| 575 | specific frame does not resize that frame in order to preserve the | 575 | specific frame does not resize that frame in order to preserve the |
| 576 | number of columns or lines it displays. | 576 | number of columns or lines it displays. |
| 577 | 577 | ||
| 578 | ** New function `window-preserve-size' allows to preserve the size of | ||
| 579 | windows without "fixing" it. It's supported by `fit-window-to-buffer', | ||
| 580 | `temp-buffer-resize-mode' and `display-buffer'. | ||
| 581 | |||
| 578 | ** Tearoff menus and detachable toolbars for Gtk+ has been removed. | 582 | ** Tearoff menus and detachable toolbars for Gtk+ has been removed. |
| 579 | Those features have been deprecated in Gtk+ for a long time. | 583 | Those features have been deprecated in Gtk+ for a long time. |
| 580 | 584 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 16590271ec4..46c87180411 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,44 @@ | |||
| 1 | 2014-12-18 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | Add code for "preserving" window sizes. | ||
| 4 | * dired.el (dired-pop-to-buffer): Call fit-window-to-buffer with | ||
| 5 | `preserve-size' t. | ||
| 6 | (dired-mark-pop-up): Preserve size of window showing marked | ||
| 7 | files. | ||
| 8 | * electric.el (Electric-pop-up-window): | ||
| 9 | * help.el (resize-temp-buffer-window): Call fit-window-to-buffer | ||
| 10 | with `preserve-size' t. | ||
| 11 | * minibuffer.el (minibuffer-completion-help): Use | ||
| 12 | `resize-temp-buffer-window' instead of `fit-window-to-buffer' | ||
| 13 | (Bug#19355). Preserve size of completions window. | ||
| 14 | * register.el (register-preview): Preserve size of register | ||
| 15 | preview window. | ||
| 16 | * tmm.el (tmm-add-prompt): Call fit-window-to-buffer | ||
| 17 | with `preserve-size' t (Bug#1291). | ||
| 18 | * window.el (with-displayed-buffer-window): Add calls to | ||
| 19 | `window-preserve-size'. | ||
| 20 | (window-min-pixel-size, window--preservable-size) | ||
| 21 | (window-preserve-size, window-preserved-size) | ||
| 22 | (window--preserve-size, window--min-size-ignore-p): New | ||
| 23 | functions. | ||
| 24 | (window-min-size, window-min-delta, window--resizable) | ||
| 25 | (window--resize-this-window, split-window-below) | ||
| 26 | (split-window-right): Amend doc-string. | ||
| 27 | (window--min-size-1, window-sizable, window--size-fixed-1) | ||
| 28 | (window-size-fixed-p, window--min-delta-1) | ||
| 29 | (frame-windows-min-size, window--max-delta-1, window-resize) | ||
| 30 | (window--resize-child-windows, window--resize-siblings) | ||
| 31 | (enlarge-window, shrink-window, split-window): Handle preserving | ||
| 32 | window sizes. | ||
| 33 | (adjust-window-trailing-edge): Handle preserving window | ||
| 34 | sizes. Signal user-error instead of an error when there's no | ||
| 35 | window above or below. | ||
| 36 | (window--state-put-2): Handle horizontal scroll bars. | ||
| 37 | (window--display-buffer): Call `preserve-size' if asked for. | ||
| 38 | (display-buffer): Mention `preserve-size' alist member in | ||
| 39 | doc-string. | ||
| 40 | (fit-window-to-buffer): New argument PRESERVE-SIZE. | ||
| 41 | |||
| 1 | 2014-12-18 Dmitry Gutov <dgutov@yandex.ru> | 42 | 2014-12-18 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 43 | ||
| 3 | * emacs-lisp/package.el (package-activate): Do not re-activate or | 44 | * emacs-lisp/package.el (package-activate): Do not re-activate or |
diff --git a/lisp/dired.el b/lisp/dired.el index 4cc252c7492..909ba22985a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -3059,7 +3059,7 @@ or \"* [3 files]\"." | |||
| 3059 | (when dired-shrink-to-fit | 3059 | (when dired-shrink-to-fit |
| 3060 | ;; Try to not delete window when we want to display less than | 3060 | ;; Try to not delete window when we want to display less than |
| 3061 | ;; `window-min-height' lines. | 3061 | ;; `window-min-height' lines. |
| 3062 | (fit-window-to-buffer (get-buffer-window buf) nil 1))) | 3062 | (fit-window-to-buffer (get-buffer-window buf) nil 1 nil nil t))) |
| 3063 | 3063 | ||
| 3064 | (defcustom dired-no-confirm nil | 3064 | (defcustom dired-no-confirm nil |
| 3065 | "A list of symbols for commands Dired should not confirm, or t. | 3065 | "A list of symbols for commands Dired should not confirm, or t. |
| @@ -3106,7 +3106,8 @@ argument or confirmation)." | |||
| 3106 | (with-displayed-buffer-window | 3106 | (with-displayed-buffer-window |
| 3107 | buffer | 3107 | buffer |
| 3108 | (cons 'display-buffer-below-selected | 3108 | (cons 'display-buffer-below-selected |
| 3109 | '((window-height . fit-window-to-buffer))) | 3109 | '((window-height . fit-window-to-buffer) |
| 3110 | (preserve-size . (nil . t)))) | ||
| 3110 | #'(lambda (window _value) | 3111 | #'(lambda (window _value) |
| 3111 | (with-selected-window window | 3112 | (with-selected-window window |
| 3112 | (unwind-protect | 3113 | (unwind-protect |
diff --git a/lisp/electric.el b/lisp/electric.el index 4bf5963e175..fa9666d8560 100644 --- a/lisp/electric.el +++ b/lisp/electric.el | |||
| @@ -164,7 +164,10 @@ | |||
| 164 | ;; Don't shrink the window, but expand it if necessary. | 164 | ;; Don't shrink the window, but expand it if necessary. |
| 165 | (goto-char (point-min)) | 165 | (goto-char (point-min)) |
| 166 | (unless (= (point-max) (window-end win t)) | 166 | (unless (= (point-max) (window-end win t)) |
| 167 | (fit-window-to-buffer win max-height)) | 167 | ;; This call is executed even if the window existed before, was |
| 168 | ;; reused, ... contradicting a claim in the comment before this | ||
| 169 | ;; function. | ||
| 170 | (fit-window-to-buffer win max-height nil nil nil t)) | ||
| 168 | win))) | 171 | win))) |
| 169 | 172 | ||
| 170 | ;;; Electric keys. | 173 | ;;; Electric keys. |
diff --git a/lisp/help.el b/lisp/help.el index 44716a5d0a8..07b9627e3db 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1133,7 +1133,10 @@ of a horizontal combination, restrain its new size by | |||
| 1133 | `fit-window-to-buffer-horizontally' can inhibit resizing. | 1133 | `fit-window-to-buffer-horizontally' can inhibit resizing. |
| 1134 | 1134 | ||
| 1135 | If WINDOW is the root window of its frame, resize the frame | 1135 | If WINDOW is the root window of its frame, resize the frame |
| 1136 | provided `fit-frame-to-buffer' is non-nil." | 1136 | provided `fit-frame-to-buffer' is non-nil. |
| 1137 | |||
| 1138 | This function may call `preserve-window-size' to preserve the | ||
| 1139 | size of WINDOW." | ||
| 1137 | (setq window (window-normalize-window window t)) | 1140 | (setq window (window-normalize-window window t)) |
| 1138 | (let ((height (if (functionp temp-buffer-max-height) | 1141 | (let ((height (if (functionp temp-buffer-max-height) |
| 1139 | (with-selected-window window | 1142 | (with-selected-window window |
| @@ -1155,7 +1158,7 @@ provided `fit-frame-to-buffer' is non-nil." | |||
| 1155 | (and (eq quit-cadr 'frame) | 1158 | (and (eq quit-cadr 'frame) |
| 1156 | fit-frame-to-buffer | 1159 | fit-frame-to-buffer |
| 1157 | (eq window (frame-root-window window)))) | 1160 | (eq window (frame-root-window window)))) |
| 1158 | (fit-window-to-buffer window height nil width)))) | 1161 | (fit-window-to-buffer window height nil width nil t)))) |
| 1159 | 1162 | ||
| 1160 | ;;; Help windows. | 1163 | ;;; Help windows. |
| 1161 | (defcustom help-window-select nil | 1164 | (defcustom help-window-select nil |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ee97174b0b2..e1e6b0ee907 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -1818,7 +1818,10 @@ variables.") | |||
| 1818 | ,(if (eq (selected-window) (minibuffer-window)) | 1818 | ,(if (eq (selected-window) (minibuffer-window)) |
| 1819 | 'display-buffer-at-bottom | 1819 | 'display-buffer-at-bottom |
| 1820 | 'display-buffer-below-selected)) | 1820 | 'display-buffer-below-selected)) |
| 1821 | (window-height . fit-window-to-buffer)) | 1821 | ,(when temp-buffer-resize-mode |
| 1822 | '(window-height . resize-temp-buffer-window)) | ||
| 1823 | ,(when temp-buffer-resize-mode | ||
| 1824 | '(preserve-size . (nil . t)))) | ||
| 1822 | nil | 1825 | nil |
| 1823 | ;; Remove the base-size tail because `sort' requires a properly | 1826 | ;; Remove the base-size tail because `sort' requires a properly |
| 1824 | ;; nil-terminated list. | 1827 | ;; nil-terminated list. |
diff --git a/lisp/register.el b/lisp/register.el index 24146065384..aacd5d093fd 100644 --- a/lisp/register.el +++ b/lisp/register.el | |||
| @@ -135,7 +135,8 @@ Format of each entry is controlled by the variable `register-preview-function'." | |||
| 135 | (with-current-buffer-window | 135 | (with-current-buffer-window |
| 136 | buffer | 136 | buffer |
| 137 | (cons 'display-buffer-below-selected | 137 | (cons 'display-buffer-below-selected |
| 138 | '((window-height . fit-window-to-buffer))) | 138 | '((window-height . fit-window-to-buffer) |
| 139 | (preserve-size . (nil . t)))) | ||
| 139 | nil | 140 | nil |
| 140 | (with-current-buffer standard-output | 141 | (with-current-buffer standard-output |
| 141 | (setq cursor-in-non-selected-windows nil) | 142 | (setq cursor-in-non-selected-windows nil) |
diff --git a/lisp/tmm.el b/lisp/tmm.el index 09729755c14..8aedb780925 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el | |||
| @@ -371,7 +371,6 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." | |||
| 371 | (unless tmm-c-prompt | 371 | (unless tmm-c-prompt |
| 372 | (error "No active menu entries")) | 372 | (error "No active menu entries")) |
| 373 | (setq tmm-old-mb-map (tmm-define-keys t)) | 373 | (setq tmm-old-mb-map (tmm-define-keys t)) |
| 374 | ;; Get window and hide it for electric mode to get correct size | ||
| 375 | (or tmm-completion-prompt | 374 | (or tmm-completion-prompt |
| 376 | (add-hook 'completion-setup-hook | 375 | (add-hook 'completion-setup-hook |
| 377 | 'tmm-completion-delete-prompt 'append)) | 376 | 'tmm-completion-delete-prompt 'append)) |
| @@ -381,9 +380,15 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." | |||
| 381 | (with-current-buffer "*Completions*" | 380 | (with-current-buffer "*Completions*" |
| 382 | (tmm-remove-inactive-mouse-face) | 381 | (tmm-remove-inactive-mouse-face) |
| 383 | (when tmm-completion-prompt | 382 | (when tmm-completion-prompt |
| 384 | (let ((inhibit-read-only t)) | 383 | (let ((inhibit-read-only t) |
| 384 | (window (get-buffer-window "*Completions*"))) | ||
| 385 | (goto-char (point-min)) | 385 | (goto-char (point-min)) |
| 386 | (insert tmm-completion-prompt)))) | 386 | (insert tmm-completion-prompt) |
| 387 | (when window | ||
| 388 | ;; Try to show everything just inserted and preserve height of | ||
| 389 | ;; *Completions* window. This should fix a behavior described | ||
| 390 | ;; in Bug#1291. | ||
| 391 | (fit-window-to-buffer window nil nil nil nil t))))) | ||
| 387 | (insert tmm-c-prompt)) | 392 | (insert tmm-c-prompt)) |
| 388 | 393 | ||
| 389 | (defun tmm-shortcut () | 394 | (defun tmm-shortcut () |
diff --git a/lisp/window.el b/lisp/window.el index b1acd93926c..c95b0d6d418 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -249,6 +249,12 @@ displays the buffer specified by BUFFER-OR-NAME before running BODY." | |||
| 249 | (ignore-errors | 249 | (ignore-errors |
| 250 | (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window))) | 250 | (funcall (cdr (assq 'window-height (cdr ,vaction))) ,window))) |
| 251 | 251 | ||
| 252 | (when (consp (cdr (assq 'preserve-size (cdr ,vaction)))) | ||
| 253 | (window-preserve-size | ||
| 254 | ,window t (cadr (assq 'preserve-size (cdr ,vaction)))) | ||
| 255 | (window-preserve-size | ||
| 256 | ,window nil (cddr (assq 'preserve-size (cdr ,vaction))))) | ||
| 257 | |||
| 252 | (if (functionp ,vquit-function) | 258 | (if (functionp ,vquit-function) |
| 253 | (funcall ,vquit-function ,window ,value) | 259 | (funcall ,vquit-function ,window ,value) |
| 254 | ,value))))) | 260 | ,value))))) |
| @@ -435,6 +441,14 @@ minimum pixel width of WINDOW." | |||
| 435 | (window-safe-min-pixel-width window) | 441 | (window-safe-min-pixel-width window) |
| 436 | (window-safe-min-pixel-height window))) | 442 | (window-safe-min-pixel-height window))) |
| 437 | 443 | ||
| 444 | (defun window-min-pixel-size (&optional window horizontal) | ||
| 445 | "Return the minimum pixel height of WINDOW. | ||
| 446 | Optional argument HORIZONTAL non-nil means return the minimum | ||
| 447 | pixel width of WINDOW." | ||
| 448 | (if horizontal | ||
| 449 | (window-min-pixel-width window) | ||
| 450 | (window-min-pixel-height window))) | ||
| 451 | |||
| 438 | (defun window-combined-p (&optional window horizontal) | 452 | (defun window-combined-p (&optional window horizontal) |
| 439 | "Return non-nil if WINDOW has siblings in a given direction. | 453 | "Return non-nil if WINDOW has siblings in a given direction. |
| 440 | WINDOW must be a valid window and defaults to the selected one. | 454 | WINDOW must be a valid window and defaults to the selected one. |
| @@ -1215,9 +1229,73 @@ unless it has no other choice (like when deleting a neighboring | |||
| 1215 | window).") | 1229 | window).") |
| 1216 | (make-variable-buffer-local 'window-size-fixed) | 1230 | (make-variable-buffer-local 'window-size-fixed) |
| 1217 | 1231 | ||
| 1218 | (defun window--size-ignore-p (window ignore) | 1232 | (defun window--preservable-size (window &optional horizontal) |
| 1219 | "Return non-nil if IGNORE says to ignore size restrictions for WINDOW." | 1233 | "Return height of WINDOW as `window-preserve-size' would preserve it. |
| 1220 | (if (window-valid-p ignore) (eq window ignore) ignore)) | 1234 | Optional argument HORIZONTAL non-nil means to return the width of |
| 1235 | WINDOW as `window-preserve-size' would preserve it." | ||
| 1236 | (if horizontal | ||
| 1237 | (window-body-width window t) | ||
| 1238 | (+ (window-body-height window t) | ||
| 1239 | (window-header-line-height window) | ||
| 1240 | (window-mode-line-height window)))) | ||
| 1241 | |||
| 1242 | (defun window-preserve-size (&optional window horizontal preserve) | ||
| 1243 | "Preserve height of window WINDOW. | ||
| 1244 | WINDOW must be a live window and defaults to the selected one. | ||
| 1245 | Optional argument HORIZONTAL non-nil means preserve the width of | ||
| 1246 | WINDOW. | ||
| 1247 | |||
| 1248 | PRESERVE t means to preserve the current height/width of WINDOW's | ||
| 1249 | body in frame and window resizing operations whenever possible. | ||
| 1250 | The height/width of WINDOW will change only if Emacs has no other | ||
| 1251 | choice. Resizing a window whose height/width is preserved never | ||
| 1252 | throws an error. | ||
| 1253 | |||
| 1254 | PRESERVE nil means to stop preserving the height/width of WINDOW, | ||
| 1255 | lifting the respective restraint induced by a previous call of | ||
| 1256 | `window-preserve-size' for WINDOW. Calling `enlarge-window', | ||
| 1257 | `shrink-window', `split-window' or `fit-window-to-buffer' with | ||
| 1258 | WINDOW as argument also removes the respective restraint. | ||
| 1259 | |||
| 1260 | Other values of PRESERVE are reserved for future use." | ||
| 1261 | (setq window (window-normalize-window window t)) | ||
| 1262 | (let* ((parameter (window-parameter window 'window-preserved-size)) | ||
| 1263 | (width (nth 1 parameter)) | ||
| 1264 | (height (nth 2 parameter))) | ||
| 1265 | (if horizontal | ||
| 1266 | (set-window-parameter | ||
| 1267 | window 'window-preserved-size | ||
| 1268 | (list | ||
| 1269 | (window-buffer window) | ||
| 1270 | (and preserve (window--preservable-size window t)) | ||
| 1271 | height)) | ||
| 1272 | (set-window-parameter | ||
| 1273 | window 'window-preserved-size | ||
| 1274 | (list | ||
| 1275 | (window-buffer window) | ||
| 1276 | width | ||
| 1277 | (and preserve (window--preservable-size window))))))) | ||
| 1278 | |||
| 1279 | (defun window-preserved-size (&optional window horizontal) | ||
| 1280 | "Return preserved height of window WINDOW. | ||
| 1281 | WINDOW must be a live window and defaults to the selected one. | ||
| 1282 | Optional argument HORIZONTAL non-nil means to return preserved | ||
| 1283 | width of WINDOW." | ||
| 1284 | (setq window (window-normalize-window window t)) | ||
| 1285 | (let* ((parameter (window-parameter window 'window-preserved-size)) | ||
| 1286 | (buffer (nth 0 parameter)) | ||
| 1287 | (width (nth 1 parameter)) | ||
| 1288 | (height (nth 2 parameter))) | ||
| 1289 | (when (eq buffer (window-buffer window)) | ||
| 1290 | (if horizontal width height)))) | ||
| 1291 | |||
| 1292 | (defun window--preserve-size (window horizontal) | ||
| 1293 | "Return non-nil when the height of WINDOW shall be preserved. | ||
| 1294 | Optional argument HORIZONTAL non-nil means to return non-nil when | ||
| 1295 | the width of WINDOW shall be preserved." | ||
| 1296 | (let ((size (window-preserved-size window horizontal))) | ||
| 1297 | (and (numberp size) | ||
| 1298 | (= size (window--preservable-size window horizontal))))) | ||
| 1221 | 1299 | ||
| 1222 | (defun window-safe-min-size (&optional window horizontal pixelwise) | 1300 | (defun window-safe-min-size (&optional window horizontal pixelwise) |
| 1223 | "Return safe minimum size of WINDOW. | 1301 | "Return safe minimum size of WINDOW. |
| @@ -1244,19 +1322,20 @@ Optional argument HORIZONTAL non-nil means return the minimum | |||
| 1244 | number of columns of WINDOW; otherwise return the minimum number | 1322 | number of columns of WINDOW; otherwise return the minimum number |
| 1245 | of WINDOW's lines. | 1323 | of WINDOW's lines. |
| 1246 | 1324 | ||
| 1247 | Optional argument IGNORE, if non-nil, means ignore restrictions | 1325 | The optional argument IGNORE has the same meaning as for |
| 1248 | imposed by fixed size windows, `window-min-height' or | 1326 | `window-resizable'. Optional argument PIXELWISE non-nil means |
| 1249 | `window-min-width' settings. If IGNORE equals `safe', live | 1327 | return the minimum pixel-size of WINDOW." |
| 1250 | windows may get as small as `window-safe-min-height' lines and | ||
| 1251 | `window-safe-min-width' columns. If IGNORE is a window, ignore | ||
| 1252 | restrictions for that window only. Any other non-nil value | ||
| 1253 | means ignore all of the above restrictions for all windows. | ||
| 1254 | |||
| 1255 | Optional argument PIXELWISE non-nil means return the minimum pixel-size | ||
| 1256 | of WINDOW." | ||
| 1257 | (window--min-size-1 | 1328 | (window--min-size-1 |
| 1258 | (window-normalize-window window) horizontal ignore pixelwise)) | 1329 | (window-normalize-window window) horizontal ignore pixelwise)) |
| 1259 | 1330 | ||
| 1331 | (defun window--min-size-ignore-p (window horizontal ignore) | ||
| 1332 | "Return non-nil if IGNORE says to ignore height restrictions for WINDOW. | ||
| 1333 | HORIZONTAL non-nil means to return non-nil if IGNORE says to | ||
| 1334 | ignore width restrictions for WINDOW." | ||
| 1335 | (if (window-valid-p ignore) | ||
| 1336 | (eq window ignore) | ||
| 1337 | (not (memq ignore '(nil preserved))))) | ||
| 1338 | |||
| 1260 | (defun window--min-size-1 (window horizontal ignore pixelwise) | 1339 | (defun window--min-size-1 (window horizontal ignore pixelwise) |
| 1261 | "Internal function of `window-min-size'." | 1340 | "Internal function of `window-min-size'." |
| 1262 | (let ((sub (window-child window))) | 1341 | (let ((sub (window-child window))) |
| @@ -1283,8 +1362,7 @@ of WINDOW." | |||
| 1283 | (cond | 1362 | (cond |
| 1284 | ((window-minibuffer-p window) | 1363 | ((window-minibuffer-p window) |
| 1285 | (if pixelwise (frame-char-height (window-frame window)) 1)) | 1364 | (if pixelwise (frame-char-height (window-frame window)) 1)) |
| 1286 | ((and (not (window--size-ignore-p window ignore)) | 1365 | ((window-size-fixed-p window horizontal ignore) |
| 1287 | (window-size-fixed-p window horizontal)) | ||
| 1288 | ;; The minimum size of a fixed size window is its size. | 1366 | ;; The minimum size of a fixed size window is its size. |
| 1289 | (window-size window horizontal pixelwise)) | 1367 | (window-size window horizontal pixelwise)) |
| 1290 | ((eq ignore 'safe) | 1368 | ((eq ignore 'safe) |
| @@ -1313,12 +1391,12 @@ of WINDOW." | |||
| 1313 | pixel-width | 1391 | pixel-width |
| 1314 | ;; Round up to next integral of columns. | 1392 | ;; Round up to next integral of columns. |
| 1315 | (* (ceiling pixel-width char-size) char-size)) | 1393 | (* (ceiling pixel-width char-size) char-size)) |
| 1316 | (if (window--size-ignore-p window ignore) | 1394 | (if (window--min-size-ignore-p window horizontal ignore) |
| 1317 | 0 | 1395 | 0 |
| 1318 | (window-min-pixel-width window))) | 1396 | (window-min-pixel-width window))) |
| 1319 | (max | 1397 | (max |
| 1320 | (ceiling pixel-width char-size) | 1398 | (ceiling pixel-width char-size) |
| 1321 | (if (window--size-ignore-p window ignore) | 1399 | (if (window--min-size-ignore-p window horizontal ignore) |
| 1322 | 0 | 1400 | 0 |
| 1323 | window-min-width))))) | 1401 | window-min-width))))) |
| 1324 | ((let ((char-size (frame-char-size window)) | 1402 | ((let ((char-size (frame-char-size window)) |
| @@ -1334,11 +1412,11 @@ of WINDOW." | |||
| 1334 | pixel-height | 1412 | pixel-height |
| 1335 | ;; Round up to next integral of lines. | 1413 | ;; Round up to next integral of lines. |
| 1336 | (* (ceiling pixel-height char-size) char-size)) | 1414 | (* (ceiling pixel-height char-size) char-size)) |
| 1337 | (if (window--size-ignore-p window ignore) | 1415 | (if (window--min-size-ignore-p window horizontal ignore) |
| 1338 | 0 | 1416 | 0 |
| 1339 | (window-min-pixel-height window))) | 1417 | (window-min-pixel-height window))) |
| 1340 | (max (ceiling pixel-height char-size) | 1418 | (max (ceiling pixel-height char-size) |
| 1341 | (if (window--size-ignore-p window ignore) | 1419 | (if (window--min-size-ignore-p window horizontal ignore) |
| 1342 | 0 | 1420 | 0 |
| 1343 | window-min-height)))))))))) | 1421 | window-min-height)))))))))) |
| 1344 | 1422 | ||
| @@ -1363,26 +1441,17 @@ columns. If WINDOW cannot be shrunk by -DELTA lines or columns, | |||
| 1363 | return the minimum value in the range DELTA..0 by which WINDOW | 1441 | return the minimum value in the range DELTA..0 by which WINDOW |
| 1364 | can be shrunk. | 1442 | can be shrunk. |
| 1365 | 1443 | ||
| 1366 | Optional argument IGNORE non-nil means ignore restrictions | 1444 | The optional argument IGNORE has the same meaning as for |
| 1367 | imposed by fixed size windows, `window-min-height' or | 1445 | `window-resizable'. Optional argument PIXELWISE non-nil means |
| 1368 | `window-min-width' settings. If IGNORE equals `safe', live | 1446 | interpret DELTA as pixels." |
| 1369 | windows may get as small as `window-safe-min-height' lines and | ||
| 1370 | `window-safe-min-width' columns. If IGNORE is a window, ignore | ||
| 1371 | restrictions for that window only. Any other non-nil value means | ||
| 1372 | ignore all of the above restrictions for all windows. | ||
| 1373 | |||
| 1374 | Optional argument PIXELWISE non-nil means interpret DELTA as | ||
| 1375 | pixels." | ||
| 1376 | (setq window (window-normalize-window window)) | 1447 | (setq window (window-normalize-window window)) |
| 1377 | (cond | 1448 | (cond |
| 1378 | ((< delta 0) | 1449 | ((< delta 0) |
| 1379 | (max (- (window-min-size window horizontal ignore pixelwise) | 1450 | (max (- (window-min-size window horizontal ignore pixelwise) |
| 1380 | (window-size window horizontal pixelwise)) | 1451 | (window-size window horizontal pixelwise)) |
| 1381 | delta)) | 1452 | delta)) |
| 1382 | ((window--size-ignore-p window ignore) | ||
| 1383 | delta) | ||
| 1384 | ((> delta 0) | 1453 | ((> delta 0) |
| 1385 | (if (window-size-fixed-p window horizontal) | 1454 | (if (window-size-fixed-p window horizontal ignore) |
| 1386 | 0 | 1455 | 0 |
| 1387 | delta)) | 1456 | delta)) |
| 1388 | (t 0))) | 1457 | (t 0))) |
| @@ -1399,7 +1468,7 @@ doc-string of `window-sizable'." | |||
| 1399 | (<= (window-sizable window delta horizontal ignore pixelwise) | 1468 | (<= (window-sizable window delta horizontal ignore pixelwise) |
| 1400 | delta))) | 1469 | delta))) |
| 1401 | 1470 | ||
| 1402 | (defun window--size-fixed-1 (window horizontal) | 1471 | (defun window--size-fixed-1 (window horizontal ignore) |
| 1403 | "Internal function for `window-size-fixed-p'." | 1472 | "Internal function for `window-size-fixed-p'." |
| 1404 | (let ((sub (window-child window))) | 1473 | (let ((sub (window-child window))) |
| 1405 | (catch 'fixed | 1474 | (catch 'fixed |
| @@ -1410,7 +1479,7 @@ doc-string of `window-sizable'." | |||
| 1410 | ;; windows are fixed-size. | 1479 | ;; windows are fixed-size. |
| 1411 | (progn | 1480 | (progn |
| 1412 | (while sub | 1481 | (while sub |
| 1413 | (unless (window--size-fixed-1 sub horizontal) | 1482 | (unless (window--size-fixed-1 sub horizontal ignore) |
| 1414 | ;; We found a non-fixed-size child window, so | 1483 | ;; We found a non-fixed-size child window, so |
| 1415 | ;; WINDOW's size is not fixed. | 1484 | ;; WINDOW's size is not fixed. |
| 1416 | (throw 'fixed nil)) | 1485 | (throw 'fixed nil)) |
| @@ -1421,28 +1490,33 @@ doc-string of `window-sizable'." | |||
| 1421 | ;; An ortho-combination is fixed-size if at least one of its | 1490 | ;; An ortho-combination is fixed-size if at least one of its |
| 1422 | ;; child windows is fixed-size. | 1491 | ;; child windows is fixed-size. |
| 1423 | (while sub | 1492 | (while sub |
| 1424 | (when (window--size-fixed-1 sub horizontal) | 1493 | (when (window--size-fixed-1 sub horizontal ignore) |
| 1425 | ;; We found a fixed-size child window, so WINDOW's size | 1494 | ;; We found a fixed-size child window, so WINDOW's size |
| 1426 | ;; is fixed. | 1495 | ;; is fixed. |
| 1427 | (throw 'fixed t)) | 1496 | (throw 'fixed t)) |
| 1428 | (setq sub (window-right sub)))) | 1497 | (setq sub (window-right sub)))) |
| 1429 | ;; WINDOW is a live window. | 1498 | ;; WINDOW is a live window. |
| 1430 | (with-current-buffer (window-buffer window) | 1499 | (and (or (not (windowp ignore)) (not (eq window ignore))) |
| 1431 | (if horizontal | 1500 | (or (and (not (eq ignore 'preserved)) |
| 1432 | (memq window-size-fixed '(width t)) | 1501 | (window--preserve-size window horizontal)) |
| 1433 | (memq window-size-fixed '(height t)))))))) | 1502 | (with-current-buffer (window-buffer window) |
| 1434 | 1503 | (if horizontal | |
| 1435 | (defun window-size-fixed-p (&optional window horizontal) | 1504 | (memq window-size-fixed '(width t)) |
| 1505 | (memq window-size-fixed '(height t)))))))))) | ||
| 1506 | |||
| 1507 | (defun window-size-fixed-p (&optional window horizontal ignore) | ||
| 1436 | "Return non-nil if WINDOW's height is fixed. | 1508 | "Return non-nil if WINDOW's height is fixed. |
| 1437 | WINDOW must be a valid window and defaults to the selected one. | 1509 | WINDOW must be a valid window and defaults to the selected one. |
| 1438 | Optional argument HORIZONTAL non-nil means return non-nil if | 1510 | Optional argument HORIZONTAL non-nil means return non-nil if |
| 1439 | WINDOW's width is fixed. | 1511 | WINDOW's width is fixed. The optional argument IGNORE has the |
| 1512 | same meaning as for `window-resizable'. | ||
| 1440 | 1513 | ||
| 1441 | If this function returns nil, this does not necessarily mean that | 1514 | If this function returns nil, this does not necessarily mean that |
| 1442 | WINDOW can be resized in the desired direction. The function | 1515 | WINDOW can be resized in the desired direction. The function |
| 1443 | `window-resizable' can tell that." | 1516 | `window-resizable' can tell that." |
| 1444 | (window--size-fixed-1 | 1517 | (when (or (windowp ignore) (memq ignore '(nil preserved))) |
| 1445 | (window-normalize-window window) horizontal)) | 1518 | (window--size-fixed-1 |
| 1519 | (window-normalize-window window) horizontal ignore))) | ||
| 1446 | 1520 | ||
| 1447 | (defun window--min-delta-1 (window delta &optional horizontal ignore trail noup pixelwise) | 1521 | (defun window--min-delta-1 (window delta &optional horizontal ignore trail noup pixelwise) |
| 1448 | "Internal function for `window-min-delta'." | 1522 | "Internal function for `window-min-delta'." |
| @@ -1463,8 +1537,7 @@ WINDOW can be resized in the desired direction. The function | |||
| 1463 | ((eq sub window) | 1537 | ((eq sub window) |
| 1464 | (setq skip (eq trail 'before))) | 1538 | (setq skip (eq trail 'before))) |
| 1465 | (skip) | 1539 | (skip) |
| 1466 | ((and (not (window--size-ignore-p window ignore)) | 1540 | ((window-size-fixed-p sub horizontal ignore)) |
| 1467 | (window-size-fixed-p sub horizontal))) | ||
| 1468 | (t | 1541 | (t |
| 1469 | ;; We found a non-fixed-size child window. | 1542 | ;; We found a non-fixed-size child window. |
| 1470 | (throw 'done delta))) | 1543 | (throw 'done delta))) |
| @@ -1493,25 +1566,18 @@ Return zero if WINDOW cannot be shrunk. | |||
| 1493 | Optional argument HORIZONTAL non-nil means return number of | 1566 | Optional argument HORIZONTAL non-nil means return number of |
| 1494 | columns by which WINDOW can be shrunk. | 1567 | columns by which WINDOW can be shrunk. |
| 1495 | 1568 | ||
| 1496 | Optional argument IGNORE non-nil means ignore restrictions | 1569 | The optional argument IGNORE has the same meaning as for |
| 1497 | imposed by fixed size windows, `window-min-height' or | 1570 | `window-resizable'. Optional argument TRAIL restricts the |
| 1498 | `window-min-width' settings. If IGNORE is a window, ignore | 1571 | windows that can be enlarged. If its value is `before', only |
| 1499 | restrictions for that window only. If IGNORE equals `safe', | 1572 | windows to the left of or above WINDOW can be enlarged. If it is |
| 1500 | live windows may get as small as `window-safe-min-height' lines | 1573 | `after', only windows to the right of or below WINDOW can be |
| 1501 | and `window-safe-min-width' columns. Any other non-nil value | 1574 | enlarged. |
| 1502 | means ignore all of the above restrictions for all windows. | ||
| 1503 | |||
| 1504 | Optional argument TRAIL restricts the windows that can be enlarged. | ||
| 1505 | If its value is `before', only windows to the left of or above WINDOW | ||
| 1506 | can be enlarged. If it is `after', only windows to the right of or | ||
| 1507 | below WINDOW can be enlarged. | ||
| 1508 | 1575 | ||
| 1509 | Optional argument NOUP non-nil means don't go up in the window | 1576 | Optional argument NOUP non-nil means don't go up in the window |
| 1510 | tree, but try to enlarge windows within WINDOW's combination only. | 1577 | tree, but try to enlarge windows within WINDOW's combination |
| 1511 | 1578 | only. Optional argument NODOWN non-nil means don't check whether | |
| 1512 | Optional argument NODOWN non-nil means don't check whether WINDOW | 1579 | WINDOW itself (and its child windows) can be shrunk; check only |
| 1513 | itself (and its child windows) can be shrunk; check only whether | 1580 | whether at least one other window can be enlarged appropriately. |
| 1514 | at least one other window can be enlarged appropriately. | ||
| 1515 | 1581 | ||
| 1516 | Optional argument PIXELWISE non-nil means return number of pixels | 1582 | Optional argument PIXELWISE non-nil means return number of pixels |
| 1517 | by which WINDOW can be shrunk." | 1583 | by which WINDOW can be shrunk." |
| @@ -1533,14 +1599,16 @@ by which WINDOW can be shrunk." | |||
| 1533 | (window--min-delta-1 | 1599 | (window--min-delta-1 |
| 1534 | window (- size minimum) horizontal ignore trail noup pixelwise))))) | 1600 | window (- size minimum) horizontal ignore trail noup pixelwise))))) |
| 1535 | 1601 | ||
| 1536 | (defun frame-windows-min-size (&optional frame horizontal pixelwise) | 1602 | (defun frame-windows-min-size (&optional frame horizontal ignore pixelwise) |
| 1537 | "Return minimum number of lines of FRAME's windows. | 1603 | "Return minimum number of lines of FRAME's windows. |
| 1538 | HORIZONTAL non-nil means return number of columns of FRAME's | 1604 | HORIZONTAL non-nil means return number of columns of FRAME's |
| 1539 | windows. PIXELWISE non-nil means return sizes in pixels." | 1605 | windows. The optional argument IGNORE has the same meaning as |
| 1606 | for `window-resizable'. PIXELWISE non-nil means return sizes in | ||
| 1607 | pixels." | ||
| 1540 | (setq frame (window-normalize-frame frame)) | 1608 | (setq frame (window-normalize-frame frame)) |
| 1541 | (let* ((root (frame-root-window frame)) | 1609 | (let* ((root (frame-root-window frame)) |
| 1542 | (mini (window-next-sibling root))) | 1610 | (mini (window-next-sibling root))) |
| 1543 | (+ (window-min-size root horizontal nil pixelwise) | 1611 | (+ (window-min-size root horizontal ignore pixelwise) |
| 1544 | (if (and mini (not horizontal)) | 1612 | (if (and mini (not horizontal)) |
| 1545 | (window-min-size mini horizontal nil pixelwise) | 1613 | (window-min-size mini horizontal nil pixelwise) |
| 1546 | 0)))) | 1614 | 0)))) |
| @@ -1575,8 +1643,7 @@ windows. PIXELWISE non-nil means return sizes in pixels." | |||
| 1575 | ;; child window is fixed-size. | 1643 | ;; child window is fixed-size. |
| 1576 | (while sub | 1644 | (while sub |
| 1577 | (when (and (not (eq sub window)) | 1645 | (when (and (not (eq sub window)) |
| 1578 | (not (window--size-ignore-p sub ignore)) | 1646 | (window-size-fixed-p sub horizontal ignore)) |
| 1579 | (window-size-fixed-p sub horizontal)) | ||
| 1580 | (throw 'fixed delta)) | 1647 | (throw 'fixed delta)) |
| 1581 | (setq sub (window-right sub)))) | 1648 | (setq sub (window-right sub)))) |
| 1582 | (if noup | 1649 | (if noup |
| @@ -1595,32 +1662,24 @@ The return value is zero if WINDOW cannot be enlarged. | |||
| 1595 | Optional argument HORIZONTAL non-nil means return maximum number | 1662 | Optional argument HORIZONTAL non-nil means return maximum number |
| 1596 | of columns by which WINDOW can be enlarged. | 1663 | of columns by which WINDOW can be enlarged. |
| 1597 | 1664 | ||
| 1598 | Optional argument IGNORE non-nil means ignore restrictions | 1665 | The optional argument IGNORE has the same meaning as for |
| 1599 | imposed by fixed size windows, `window-min-height' or | 1666 | `window-resizable'. Optional argument TRAIL restricts the |
| 1600 | `window-min-width' settings. If IGNORE is a window, ignore | 1667 | windows that can be enlarged. If its value is `before', only |
| 1601 | restrictions for that window only. If IGNORE equals `safe', | 1668 | windows to the left of or above WINDOW can be enlarged. If it is |
| 1602 | live windows may get as small as `window-safe-min-height' lines | 1669 | `after', only windows to the right of or below WINDOW can be |
| 1603 | and `window-safe-min-width' columns. Any other non-nil value means | 1670 | enlarged. |
| 1604 | ignore all of the above restrictions for all windows. | ||
| 1605 | |||
| 1606 | Optional argument TRAIL restricts the windows that can be enlarged. | ||
| 1607 | If its value is `before', only windows to the left of or above WINDOW | ||
| 1608 | can be enlarged. If it is `after', only windows to the right of or | ||
| 1609 | below WINDOW can be enlarged. | ||
| 1610 | 1671 | ||
| 1611 | Optional argument NOUP non-nil means don't go up in the window | 1672 | Optional argument NOUP non-nil means don't go up in the window |
| 1612 | tree but try to obtain the entire space from windows within | 1673 | tree but try to obtain the entire space from windows within |
| 1613 | WINDOW's combination. | 1674 | WINDOW's combination. Optional argument NODOWN non-nil means do |
| 1614 | 1675 | not check whether WINDOW itself (and its child windows) can be | |
| 1615 | Optional argument NODOWN non-nil means do not check whether | 1676 | enlarged; check only whether other windows can be shrunk |
| 1616 | WINDOW itself (and its child windows) can be enlarged; check | 1677 | appropriately. |
| 1617 | only whether other windows can be shrunk appropriately. | ||
| 1618 | 1678 | ||
| 1619 | Optional argument PIXELWISE non-nil means return number of | 1679 | Optional argument PIXELWISE non-nil means return number of |
| 1620 | pixels by which WINDOW can be enlarged." | 1680 | pixels by which WINDOW can be enlarged." |
| 1621 | (setq window (window-normalize-window window)) | 1681 | (setq window (window-normalize-window window)) |
| 1622 | (if (and (not (window--size-ignore-p window ignore)) | 1682 | (if (and (not nodown) (window-size-fixed-p window horizontal ignore)) |
| 1623 | (not nodown) (window-size-fixed-p window horizontal)) | ||
| 1624 | ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed | 1683 | ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed |
| 1625 | ;; size. | 1684 | ;; size. |
| 1626 | 0 | 1685 | 0 |
| @@ -1645,26 +1704,18 @@ columns. If WINDOW cannot be shrunk by -DELTA lines or columns, | |||
| 1645 | return the minimum value in the range DELTA..0 that can be used | 1704 | return the minimum value in the range DELTA..0 that can be used |
| 1646 | for shrinking WINDOW. | 1705 | for shrinking WINDOW. |
| 1647 | 1706 | ||
| 1648 | Optional argument IGNORE non-nil means ignore restrictions | 1707 | The optional argument IGNORE has the same meaning as for |
| 1649 | imposed by fixed size windows, `window-min-height' or | 1708 | `window-resizable'. Optional argument TRAIL `before' means only |
| 1650 | `window-min-width' settings. If IGNORE is a window, ignore | 1709 | windows to the left of or below WINDOW can be shrunk. Optional |
| 1651 | restrictions for that window only. If IGNORE equals `safe', | 1710 | argument TRAIL `after' means only windows to the right of or |
| 1652 | live windows may get as small as `window-safe-min-height' lines | 1711 | above WINDOW can be shrunk. |
| 1653 | and `window-safe-min-width' columns. Any other non-nil value | ||
| 1654 | means ignore all of the above restrictions for all windows. | ||
| 1655 | |||
| 1656 | Optional argument TRAIL `before' means only windows to the left | ||
| 1657 | of or below WINDOW can be shrunk. Optional argument TRAIL | ||
| 1658 | `after' means only windows to the right of or above WINDOW can be | ||
| 1659 | shrunk. | ||
| 1660 | 1712 | ||
| 1661 | Optional argument NOUP non-nil means don't go up in the window | 1713 | Optional argument NOUP non-nil means don't go up in the window |
| 1662 | tree but check only whether space can be obtained from (or given | 1714 | tree but check only whether space can be obtained from (or given |
| 1663 | to) WINDOW's siblings. | 1715 | to) WINDOW's siblings. Optional argument NODOWN non-nil means |
| 1664 | 1716 | don't go down in the window tree. This means do not check | |
| 1665 | Optional argument NODOWN non-nil means don't go down in the | 1717 | whether resizing would violate size restrictions of WINDOW or its |
| 1666 | window tree. This means do not check whether resizing would | 1718 | child windows. |
| 1667 | violate size restrictions of WINDOW or its child windows. | ||
| 1668 | 1719 | ||
| 1669 | Optional argument PIXELWISE non-nil means interpret DELTA as | 1720 | Optional argument PIXELWISE non-nil means interpret DELTA as |
| 1670 | number of pixels." | 1721 | number of pixels." |
| @@ -1714,13 +1765,14 @@ columns. If WINDOW cannot be shrunk by -DELTA lines or columns, | |||
| 1714 | return the minimum value in the range DELTA..0 that can be used | 1765 | return the minimum value in the range DELTA..0 that can be used |
| 1715 | for shrinking WINDOW. | 1766 | for shrinking WINDOW. |
| 1716 | 1767 | ||
| 1717 | Optional argument IGNORE non-nil means ignore restrictions | 1768 | Optional argument IGNORE, if non-nil, means to ignore restraints |
| 1718 | imposed by fixed size windows, `window-min-height' or | 1769 | induced by fixed size windows or the values of the variables |
| 1719 | `window-min-width' settings. If IGNORE is a window, ignore | 1770 | `window-min-height' and `window-min-width'. The following values |
| 1720 | restrictions for that window only. If IGNORE equals `safe', | 1771 | have special meanings: `safe' means that in addition live windows |
| 1721 | live windows may get as small as `window-safe-min-height' lines | 1772 | are allowed to get as small as `window-safe-min-height' lines and |
| 1722 | and `window-safe-min-width' columns. Any other non-nil value | 1773 | `window-safe-min-width' columns. `preserved' means to ignore |
| 1723 | means ignore all of the above restrictions for all windows. | 1774 | only restrictions induced by `window-preserve-size'. If IGNORE |
| 1775 | is a window, then ignore restrictions for that window only. | ||
| 1724 | 1776 | ||
| 1725 | Optional argument PIXELWISE non-nil means interpret DELTA as | 1777 | Optional argument PIXELWISE non-nil means interpret DELTA as |
| 1726 | pixels." | 1778 | pixels." |
| @@ -2419,13 +2471,14 @@ horizontally by DELTA columns. In this case a positive DELTA | |||
| 2419 | means enlarge WINDOW by DELTA columns. DELTA negative means | 2471 | means enlarge WINDOW by DELTA columns. DELTA negative means |
| 2420 | WINDOW shall be shrunk by -DELTA columns. | 2472 | WINDOW shall be shrunk by -DELTA columns. |
| 2421 | 2473 | ||
| 2422 | Optional argument IGNORE non-nil means ignore restrictions | 2474 | Optional argument IGNORE, if non-nil, means to ignore restraints |
| 2423 | imposed by fixed size windows, `window-min-height' or | 2475 | induced by fixed size windows or the values of the variables |
| 2424 | `window-min-width' settings. If IGNORE is a window, ignore | 2476 | `window-min-height' and `window-min-width'. The following values |
| 2425 | restrictions for that window only. If IGNORE equals `safe', | 2477 | have special meanings: `safe' means that in addition live windows |
| 2426 | live windows may get as small as `window-safe-min-height' lines | 2478 | are allowed to get as small as `window-safe-min-height' lines and |
| 2427 | and `window-safe-min-width' columns. Any other non-nil value | 2479 | `window-safe-min-width' columns. `preserved' means to ignore |
| 2428 | means ignore all of the above restrictions for all windows. | 2480 | only restrictions induced by `window-preserve-size'. If IGNORE |
| 2481 | is a window, then ignore restrictions for that window only. | ||
| 2429 | 2482 | ||
| 2430 | Optional argument PIXELWISE non-nil means resize WINDOW by DELTA | 2483 | Optional argument PIXELWISE non-nil means resize WINDOW by DELTA |
| 2431 | pixels. | 2484 | pixels. |
| @@ -2456,8 +2509,12 @@ instead." | |||
| 2456 | ;; nil or the minibuffer window is active, resize the minibuffer | 2509 | ;; nil or the minibuffer window is active, resize the minibuffer |
| 2457 | ;; window. | 2510 | ;; window. |
| 2458 | (window--resize-mini-window minibuffer-window (- delta))) | 2511 | (window--resize-mini-window minibuffer-window (- delta))) |
| 2459 | ((window--resizable-p | 2512 | ((or (window--resizable-p |
| 2460 | window delta horizontal ignore nil nil nil t) | 2513 | window delta horizontal ignore nil nil nil t) |
| 2514 | (and (not ignore) | ||
| 2515 | (setq ignore 'preserved) | ||
| 2516 | (window--resizable-p | ||
| 2517 | window delta horizontal ignore nil nil nil t))) | ||
| 2461 | (window--resize-reset frame horizontal) | 2518 | (window--resize-reset frame horizontal) |
| 2462 | (window--resize-this-window window delta horizontal ignore t) | 2519 | (window--resize-this-window window delta horizontal ignore t) |
| 2463 | (if (and (not window-combination-resize) | 2520 | (if (and (not window-combination-resize) |
| @@ -2615,13 +2672,8 @@ be a horizontally combined internal window. | |||
| 2615 | WINDOW, if specified, must denote a child window of PARENT that | 2672 | WINDOW, if specified, must denote a child window of PARENT that |
| 2616 | is resized by DELTA pixels. | 2673 | is resized by DELTA pixels. |
| 2617 | 2674 | ||
| 2618 | Optional argument IGNORE non-nil means ignore restrictions | 2675 | The optional argument IGNORE has the same meaning as for |
| 2619 | imposed by fixed size windows, `window-min-height' or | 2676 | `window-resizable'. |
| 2620 | `window-min-width' settings. If IGNORE equals `safe', live | ||
| 2621 | windows may get as small as `window-safe-min-height' lines and | ||
| 2622 | `window-safe-min-width' columns. If IGNORE is a window, ignore | ||
| 2623 | restrictions for that window only. Any other non-nil value means | ||
| 2624 | ignore all of the above restrictions for all windows. | ||
| 2625 | 2677 | ||
| 2626 | Optional arguments TRAIL and EDGE, when non-nil, restrict the set | 2678 | Optional arguments TRAIL and EDGE, when non-nil, restrict the set |
| 2627 | of windows that shall be resized. If TRAIL equals `before', | 2679 | of windows that shall be resized. If TRAIL equals `before', |
| @@ -2692,7 +2744,7 @@ already set by this routine." | |||
| 2692 | ;; Ignore windows to skip and fixed-size child windows - | 2744 | ;; Ignore windows to skip and fixed-size child windows - |
| 2693 | ;; in the latter case make it a window to skip. | 2745 | ;; in the latter case make it a window to skip. |
| 2694 | (and (not ignore) | 2746 | (and (not ignore) |
| 2695 | (window-size-fixed-p sub horizontal) | 2747 | (window-size-fixed-p sub horizontal ignore) |
| 2696 | (set-window-new-normal sub 'ignore)))) | 2748 | (set-window-new-normal sub 'ignore)))) |
| 2697 | ((< delta 0) | 2749 | ((< delta 0) |
| 2698 | ;; When shrinking store the number of lines/cols we can get | 2750 | ;; When shrinking store the number of lines/cols we can get |
| @@ -2798,13 +2850,8 @@ Optional argument HORIZONTAL non-nil means resize other windows | |||
| 2798 | when WINDOW is resized horizontally by DELTA pixels. WINDOW | 2850 | when WINDOW is resized horizontally by DELTA pixels. WINDOW |
| 2799 | itself is not resized by this function. | 2851 | itself is not resized by this function. |
| 2800 | 2852 | ||
| 2801 | Optional argument IGNORE non-nil means ignore restrictions | 2853 | The optional argument IGNORE has the same meaning as for |
| 2802 | imposed by fixed size windows, `window-min-height' or | 2854 | `window-resizable'. |
| 2803 | `window-min-width' settings. If IGNORE equals `safe', live | ||
| 2804 | windows may get as small as `window-safe-min-height' lines and | ||
| 2805 | `window-safe-min-width' columns. If IGNORE is a window, ignore | ||
| 2806 | restrictions for that window only. Any other non-nil value means | ||
| 2807 | ignore all of the above restrictions for all windows. | ||
| 2808 | 2855 | ||
| 2809 | Optional arguments TRAIL and EDGE, when non-nil, refine the set | 2856 | Optional arguments TRAIL and EDGE, when non-nil, refine the set |
| 2810 | of windows that shall be resized. If TRAIL equals `before', | 2857 | of windows that shall be resized. If TRAIL equals `before', |
| @@ -2831,8 +2878,7 @@ preferably only resize windows adjacent to EDGE." | |||
| 2831 | ;; Make sure this sibling is left alone when | 2878 | ;; Make sure this sibling is left alone when |
| 2832 | ;; resizing its siblings. | 2879 | ;; resizing its siblings. |
| 2833 | (set-window-new-normal sub 'ignore)) | 2880 | (set-window-new-normal sub 'ignore)) |
| 2834 | ((or (window--size-ignore-p sub ignore) | 2881 | ((not (window-size-fixed-p sub horizontal ignore)) |
| 2835 | (not (window-size-fixed-p sub horizontal))) | ||
| 2836 | ;; Set this-delta to t to signal that we found a sibling | 2882 | ;; Set this-delta to t to signal that we found a sibling |
| 2837 | ;; of WINDOW whose size is not fixed. | 2883 | ;; of WINDOW whose size is not fixed. |
| 2838 | (setq this-delta t))) | 2884 | (setq this-delta t))) |
| @@ -2902,16 +2948,9 @@ preferably only resize windows adjacent to EDGE." | |||
| 2902 | Optional argument HORIZONTAL non-nil means resize WINDOW | 2948 | Optional argument HORIZONTAL non-nil means resize WINDOW |
| 2903 | horizontally by DELTA pixels. | 2949 | horizontally by DELTA pixels. |
| 2904 | 2950 | ||
| 2905 | Optional argument IGNORE non-nil means ignore restrictions | 2951 | The optional argument IGNORE has the same meaning as for |
| 2906 | imposed by fixed size windows, `window-min-height' or | 2952 | `window-resizable'. Optional argument ADD non-nil means add |
| 2907 | `window-min-width' settings. If IGNORE equals `safe', live | 2953 | DELTA to the new total size of WINDOW. |
| 2908 | windows may get as small as `window-safe-min-height' lines and | ||
| 2909 | `window-safe-min-width' columns. If IGNORE is a window, ignore | ||
| 2910 | restrictions for that window only. Any other non-nil value | ||
| 2911 | means ignore all of the above restrictions for all windows. | ||
| 2912 | |||
| 2913 | Optional argument ADD non-nil means add DELTA to the new total | ||
| 2914 | size of WINDOW. | ||
| 2915 | 2954 | ||
| 2916 | Optional arguments TRAIL and EDGE, when non-nil, refine the set | 2955 | Optional arguments TRAIL and EDGE, when non-nil, refine the set |
| 2917 | of windows that shall be resized. If TRAIL equals `before', | 2956 | of windows that shall be resized. If TRAIL equals `before', |
| @@ -3057,7 +3096,7 @@ move it as far as possible in the desired direction." | |||
| 3057 | (let* ((frame (window-frame window)) | 3096 | (let* ((frame (window-frame window)) |
| 3058 | (minibuffer-window (minibuffer-window frame)) | 3097 | (minibuffer-window (minibuffer-window frame)) |
| 3059 | (right window) | 3098 | (right window) |
| 3060 | left this-delta min-delta max-delta) | 3099 | left this-delta min-delta max-delta ignore) |
| 3061 | 3100 | ||
| 3062 | (unless pixelwise | 3101 | (unless pixelwise |
| 3063 | (setq pixelwise t) | 3102 | (setq pixelwise t) |
| @@ -3080,12 +3119,16 @@ move it as far as possible in the desired direction." | |||
| 3080 | (window--resize-mini-window minibuffer-window (- delta))) | 3119 | (window--resize-mini-window minibuffer-window (- delta))) |
| 3081 | ((or (not (setq left right)) (not (setq right (window-right right)))) | 3120 | ((or (not (setq left right)) (not (setq right (window-right right)))) |
| 3082 | (if horizontal | 3121 | (if horizontal |
| 3083 | (error "No window on the right of this one") | 3122 | (user-error "No window on the right of this one") |
| 3084 | (error "No window below this one"))) | 3123 | (user-error "No window below this one"))) |
| 3085 | (t | 3124 | (t |
| 3086 | ;; Set LEFT to the first resizable window on the left. This step is | 3125 | ;; Set LEFT to the first resizable window on the left. This step is |
| 3087 | ;; needed to handle fixed-size windows. | 3126 | ;; needed to handle fixed-size windows. |
| 3088 | (while (and left (window-size-fixed-p left horizontal)) | 3127 | (while (and left |
| 3128 | (or (window-size-fixed-p left horizontal) | ||
| 3129 | (and (< delta 0) | ||
| 3130 | (<= (window-size left horizontal t) | ||
| 3131 | (window-min-size left horizontal nil t))))) | ||
| 3089 | (setq left | 3132 | (setq left |
| 3090 | (or (window-left left) | 3133 | (or (window-left left) |
| 3091 | (progn | 3134 | (progn |
| @@ -3093,13 +3136,31 @@ move it as far as possible in the desired direction." | |||
| 3093 | (not (window-combined-p left horizontal)))) | 3136 | (not (window-combined-p left horizontal)))) |
| 3094 | (window-left left))))) | 3137 | (window-left left))))) |
| 3095 | (unless left | 3138 | (unless left |
| 3096 | (if horizontal | 3139 | (setq ignore 'preserved) |
| 3097 | (error "No resizable window on the left of this one") | 3140 | (setq left window) |
| 3098 | (error "No resizable window above this one"))) | 3141 | (while (and left |
| 3142 | (or (window-size-fixed-p left horizontal 'preserved) | ||
| 3143 | (<= (window-size left horizontal t) | ||
| 3144 | (window-min-size left horizontal 'preserved t)))) | ||
| 3145 | (setq left | ||
| 3146 | (or (window-left left) | ||
| 3147 | (progn | ||
| 3148 | (while (and (setq left (window-parent left)) | ||
| 3149 | (not (window-combined-p left horizontal)))) | ||
| 3150 | (window-left left))))) | ||
| 3151 | |||
| 3152 | (unless left | ||
| 3153 | (if horizontal | ||
| 3154 | (user-error "No resizable window on the left of this one") | ||
| 3155 | (user-error "No resizable window above this one")))) | ||
| 3099 | 3156 | ||
| 3100 | ;; Set RIGHT to the first resizable window on the right. This step | 3157 | ;; Set RIGHT to the first resizable window on the right. This step |
| 3101 | ;; is needed to handle fixed-size windows. | 3158 | ;; is needed to handle fixed-size windows. |
| 3102 | (while (and right (window-size-fixed-p right horizontal)) | 3159 | (while (and right |
| 3160 | (or (window-size-fixed-p right horizontal) | ||
| 3161 | (and (> delta 0) | ||
| 3162 | (<= (window-size right horizontal t) | ||
| 3163 | (window-min-size right horizontal 'preserved t))))) | ||
| 3103 | (setq right | 3164 | (setq right |
| 3104 | (or (window-right right) | 3165 | (or (window-right right) |
| 3105 | (progn | 3166 | (progn |
| @@ -3107,9 +3168,22 @@ move it as far as possible in the desired direction." | |||
| 3107 | (not (window-combined-p right horizontal)))) | 3168 | (not (window-combined-p right horizontal)))) |
| 3108 | (window-right right))))) | 3169 | (window-right right))))) |
| 3109 | (unless right | 3170 | (unless right |
| 3110 | (if horizontal | 3171 | (setq ignore 'preserved) |
| 3111 | (error "No resizable window on the right of this one") | 3172 | (setq right (window-right window)) |
| 3112 | (error "No resizable window below this one"))) | 3173 | (while (and right |
| 3174 | (or (window-size-fixed-p right horizontal 'preserved)) | ||
| 3175 | (<= (window-size right horizontal t) | ||
| 3176 | (window-min-size right horizontal nil t))) | ||
| 3177 | (setq right | ||
| 3178 | (or (window-right right) | ||
| 3179 | (progn | ||
| 3180 | (while (and (setq right (window-parent right)) | ||
| 3181 | (not (window-combined-p right horizontal)))) | ||
| 3182 | (window-right right))))) | ||
| 3183 | (unless right | ||
| 3184 | (if horizontal | ||
| 3185 | (user-error "No resizable window on the right of this one") | ||
| 3186 | (user-error "No resizable window below this one")))) | ||
| 3113 | 3187 | ||
| 3114 | ;; LEFT and RIGHT (which might be both internal windows) are now the | 3188 | ;; LEFT and RIGHT (which might be both internal windows) are now the |
| 3115 | ;; two windows we want to resize. | 3189 | ;; two windows we want to resize. |
| @@ -3117,10 +3191,10 @@ move it as far as possible in the desired direction." | |||
| 3117 | ((> delta 0) | 3191 | ((> delta 0) |
| 3118 | (setq max-delta | 3192 | (setq max-delta |
| 3119 | (window--max-delta-1 | 3193 | (window--max-delta-1 |
| 3120 | left 0 horizontal nil 'after nil pixelwise)) | 3194 | left 0 horizontal ignore 'after nil pixelwise)) |
| 3121 | (setq min-delta | 3195 | (setq min-delta |
| 3122 | (window--min-delta-1 | 3196 | (window--min-delta-1 |
| 3123 | right (- delta) horizontal nil 'before nil pixelwise)) | 3197 | right (- delta) horizontal ignore 'before nil pixelwise)) |
| 3124 | (when (or (< max-delta delta) (> min-delta (- delta))) | 3198 | (when (or (< max-delta delta) (> min-delta (- delta))) |
| 3125 | ;; We can't get the whole DELTA - move as far as possible. | 3199 | ;; We can't get the whole DELTA - move as far as possible. |
| 3126 | (setq delta (min max-delta (- min-delta)))) | 3200 | (setq delta (min max-delta (- min-delta)))) |
| @@ -3129,26 +3203,26 @@ move it as far as possible in the desired direction." | |||
| 3129 | (window--resize-reset frame horizontal) | 3203 | (window--resize-reset frame horizontal) |
| 3130 | ;; Try to enlarge LEFT first. | 3204 | ;; Try to enlarge LEFT first. |
| 3131 | (setq this-delta (window--resizable | 3205 | (setq this-delta (window--resizable |
| 3132 | left delta horizontal nil 'after nil nil pixelwise)) | 3206 | left delta horizontal ignore 'after nil nil pixelwise)) |
| 3133 | (unless (zerop this-delta) | 3207 | (unless (zerop this-delta) |
| 3134 | (window--resize-this-window | 3208 | (window--resize-this-window |
| 3135 | left this-delta horizontal nil t 'before | 3209 | left this-delta horizontal ignore t 'before |
| 3136 | (if horizontal | 3210 | (if horizontal |
| 3137 | (+ (window-pixel-left left) (window-pixel-width left)) | 3211 | (+ (window-pixel-left left) (window-pixel-width left)) |
| 3138 | (+ (window-pixel-top left) (window-pixel-height left))))) | 3212 | (+ (window-pixel-top left) (window-pixel-height left))))) |
| 3139 | ;; Shrink windows on right of LEFT. | 3213 | ;; Shrink windows on right of LEFT. |
| 3140 | (window--resize-siblings | 3214 | (window--resize-siblings |
| 3141 | left delta horizontal nil 'after | 3215 | left delta horizontal ignore 'after |
| 3142 | (if horizontal | 3216 | (if horizontal |
| 3143 | (window-pixel-left right) | 3217 | (window-pixel-left right) |
| 3144 | (window-pixel-top right))))) | 3218 | (window-pixel-top right))))) |
| 3145 | ((< delta 0) | 3219 | ((< delta 0) |
| 3146 | (setq max-delta | 3220 | (setq max-delta |
| 3147 | (window--max-delta-1 | 3221 | (window--max-delta-1 |
| 3148 | right 0 horizontal nil 'before nil pixelwise)) | 3222 | right 0 horizontal ignore 'before nil pixelwise)) |
| 3149 | (setq min-delta | 3223 | (setq min-delta |
| 3150 | (window--min-delta-1 | 3224 | (window--min-delta-1 |
| 3151 | left delta horizontal nil 'after nil pixelwise)) | 3225 | left delta horizontal ignore 'after nil pixelwise)) |
| 3152 | (when (or (< max-delta (- delta)) (> min-delta delta)) | 3226 | (when (or (< max-delta (- delta)) (> min-delta delta)) |
| 3153 | ;; We can't get the whole DELTA - move as far as possible. | 3227 | ;; We can't get the whole DELTA - move as far as possible. |
| 3154 | (setq delta (max (- max-delta) min-delta))) | 3228 | (setq delta (max (- max-delta) min-delta))) |
| @@ -3158,16 +3232,16 @@ move it as far as possible in the desired direction." | |||
| 3158 | ;; Try to enlarge RIGHT. | 3232 | ;; Try to enlarge RIGHT. |
| 3159 | (setq this-delta | 3233 | (setq this-delta |
| 3160 | (window--resizable | 3234 | (window--resizable |
| 3161 | right (- delta) horizontal nil 'before nil nil pixelwise)) | 3235 | right (- delta) horizontal ignore 'before nil nil pixelwise)) |
| 3162 | (unless (zerop this-delta) | 3236 | (unless (zerop this-delta) |
| 3163 | (window--resize-this-window | 3237 | (window--resize-this-window |
| 3164 | right this-delta horizontal nil t 'after | 3238 | right this-delta horizontal ignore t 'after |
| 3165 | (if horizontal | 3239 | (if horizontal |
| 3166 | (window-pixel-left right) | 3240 | (window-pixel-left right) |
| 3167 | (window-pixel-top right)))) | 3241 | (window-pixel-top right)))) |
| 3168 | ;; Shrink windows on left of RIGHT. | 3242 | ;; Shrink windows on left of RIGHT. |
| 3169 | (window--resize-siblings | 3243 | (window--resize-siblings |
| 3170 | right (- delta) horizontal nil 'before | 3244 | right (- delta) horizontal ignore 'before |
| 3171 | (if horizontal | 3245 | (if horizontal |
| 3172 | (+ (window-pixel-left left) (window-pixel-width left)) | 3246 | (+ (window-pixel-left left) (window-pixel-width left)) |
| 3173 | (+ (window-pixel-top left) (window-pixel-height left))))))) | 3247 | (+ (window-pixel-top left) (window-pixel-height left))))))) |
| @@ -3189,6 +3263,8 @@ make selected window wider by DELTA columns. If DELTA is | |||
| 3189 | negative, shrink selected window by -DELTA lines or columns." | 3263 | negative, shrink selected window by -DELTA lines or columns." |
| 3190 | (interactive "p") | 3264 | (interactive "p") |
| 3191 | (let ((minibuffer-window (minibuffer-window))) | 3265 | (let ((minibuffer-window (minibuffer-window))) |
| 3266 | (when (window-preserved-size nil horizontal) | ||
| 3267 | (window-preserve-size nil horizontal)) | ||
| 3192 | (cond | 3268 | (cond |
| 3193 | ((zerop delta)) | 3269 | ((zerop delta)) |
| 3194 | ((window-size-fixed-p nil horizontal) | 3270 | ((window-size-fixed-p nil horizontal) |
| @@ -3222,6 +3298,8 @@ negative, enlarge selected window by -DELTA lines or columns. | |||
| 3222 | Also see the `window-min-height' variable." | 3298 | Also see the `window-min-height' variable." |
| 3223 | (interactive "p") | 3299 | (interactive "p") |
| 3224 | (let ((minibuffer-window (minibuffer-window))) | 3300 | (let ((minibuffer-window (minibuffer-window))) |
| 3301 | (when (window-preserved-size nil horizontal) | ||
| 3302 | (window-preserve-size nil horizontal)) | ||
| 3225 | (cond | 3303 | (cond |
| 3226 | ((zerop delta)) | 3304 | ((zerop delta)) |
| 3227 | ((window-size-fixed-p nil horizontal) | 3305 | ((window-size-fixed-p nil horizontal) |
| @@ -4363,7 +4441,7 @@ frame. The selected window is not changed by this function." | |||
| 4363 | (divider-width (if horizontal | 4441 | (divider-width (if horizontal |
| 4364 | (frame-right-divider-width frame) | 4442 | (frame-right-divider-width frame) |
| 4365 | (frame-bottom-divider-width frame))) | 4443 | (frame-bottom-divider-width frame))) |
| 4366 | atom-root) | 4444 | atom-root ignore) |
| 4367 | (window--check frame) | 4445 | (window--check frame) |
| 4368 | (catch 'done | 4446 | (catch 'done |
| 4369 | (cond | 4447 | (cond |
| @@ -4427,10 +4505,11 @@ frame. The selected window is not changed by this function." | |||
| 4427 | (if resize | 4505 | (if resize |
| 4428 | ;; When resizing try to give the new window the | 4506 | ;; When resizing try to give the new window the |
| 4429 | ;; average size of a window in its combination. | 4507 | ;; average size of a window in its combination. |
| 4430 | (min (- parent-pixel-size | 4508 | (max (min (- parent-pixel-size |
| 4431 | (window-min-size parent horizontal nil t)) | 4509 | (window-min-size parent horizontal nil t)) |
| 4432 | (/ parent-pixel-size | 4510 | (/ parent-pixel-size |
| 4433 | (1+ (window-combinations parent horizontal)))) | 4511 | (1+ (window-combinations parent horizontal)))) |
| 4512 | (window-min-pixel-size)) | ||
| 4434 | ;; Else try to give the new window half the size | 4513 | ;; Else try to give the new window half the size |
| 4435 | ;; of WINDOW (plus an eventual odd pixel). | 4514 | ;; of WINDOW (plus an eventual odd pixel). |
| 4436 | (/ old-pixel-size 2))) | 4515 | (/ old-pixel-size 2))) |
| @@ -4459,12 +4538,20 @@ frame. The selected window is not changed by this function." | |||
| 4459 | (cond | 4538 | (cond |
| 4460 | (resize | 4539 | (resize |
| 4461 | ;; SIZE unspecified, resizing. | 4540 | ;; SIZE unspecified, resizing. |
| 4462 | (unless (window-sizable-p | 4541 | (unless (or (window-sizable-p |
| 4463 | parent (- new-pixel-size divider-width) horizontal nil t) | 4542 | parent (- (+ new-pixel-size divider-width)) horizontal |
| 4543 | nil t) | ||
| 4544 | (window-sizable-p | ||
| 4545 | parent (- (+ new-pixel-size divider-width)) horizontal | ||
| 4546 | (setq ignore 'preserved) t)) | ||
| 4464 | (error "Window %s too small for splitting (1)" parent))) | 4547 | (error "Window %s too small for splitting (1)" parent))) |
| 4465 | ((> (+ new-pixel-size divider-width | 4548 | ((and (> (+ new-pixel-size divider-width |
| 4466 | (window-min-size window horizontal nil t)) | 4549 | (window-min-size window horizontal nil t)) |
| 4467 | old-pixel-size) | 4550 | old-pixel-size) |
| 4551 | (> (+ new-pixel-size divider-width | ||
| 4552 | (window-min-size | ||
| 4553 | window horizontal (setq ignore 'preserved) t)) | ||
| 4554 | old-pixel-size)) | ||
| 4468 | ;; SIZE unspecified, no resizing. | 4555 | ;; SIZE unspecified, no resizing. |
| 4469 | (error "Window %s too small for splitting (2)" window)))) | 4556 | (error "Window %s too small for splitting (2)" window)))) |
| 4470 | ((and (>= pixel-size 0) | 4557 | ((and (>= pixel-size 0) |
| @@ -4477,8 +4564,12 @@ frame. The selected window is not changed by this function." | |||
| 4477 | (error "Window %s too small for splitting (3)" window)) | 4564 | (error "Window %s too small for splitting (3)" window)) |
| 4478 | (resize | 4565 | (resize |
| 4479 | ;; SIZE specified, resizing. | 4566 | ;; SIZE specified, resizing. |
| 4480 | (unless (window-sizable-p | 4567 | (unless (or (window-sizable-p |
| 4481 | parent (- new-pixel-size divider-width) horizontal nil t) | 4568 | parent (- (+ new-pixel-size divider-width)) horizontal |
| 4569 | nil t) | ||
| 4570 | (window-sizable-p | ||
| 4571 | parent (- (+ new-pixel-size divider-width)) horizontal | ||
| 4572 | (setq ignore 'preserved) t)) | ||
| 4482 | ;; If we cannot resize the parent give up. | 4573 | ;; If we cannot resize the parent give up. |
| 4483 | (error "Window %s too small for splitting (4)" parent))) | 4574 | (error "Window %s too small for splitting (4)" parent))) |
| 4484 | ((or (< new-pixel-size | 4575 | ((or (< new-pixel-size |
| @@ -4512,7 +4603,7 @@ frame. The selected window is not changed by this function." | |||
| 4512 | ;; delete the one we create here. Hence we do not go up. | 4603 | ;; delete the one we create here. Hence we do not go up. |
| 4513 | (progn | 4604 | (progn |
| 4514 | (window--resize-child-windows | 4605 | (window--resize-child-windows |
| 4515 | parent (- new-pixel-size) horizontal) | 4606 | parent (- new-pixel-size) horizontal nil ignore) |
| 4516 | (let* ((normal (- 1.0 new-normal)) | 4607 | (let* ((normal (- 1.0 new-normal)) |
| 4517 | (sub (window-child parent))) | 4608 | (sub (window-child parent))) |
| 4518 | (while sub | 4609 | (while sub |
| @@ -4522,10 +4613,8 @@ frame. The selected window is not changed by this function." | |||
| 4522 | ;; Get entire space from WINDOW. | 4613 | ;; Get entire space from WINDOW. |
| 4523 | (set-window-new-pixel | 4614 | (set-window-new-pixel |
| 4524 | window (- old-pixel-size new-pixel-size)) | 4615 | window (- old-pixel-size new-pixel-size)) |
| 4525 | ;; (set-window-new-pixel window (- old-pixel-size new-pixel-size)) | 4616 | (window--resize-this-window |
| 4526 | ;; (set-window-new-total | 4617 | window (- new-pixel-size) horizontal ignore) |
| 4527 | ;; window (- old-size new-size)) | ||
| 4528 | (window--resize-this-window window (- new-pixel-size) horizontal) | ||
| 4529 | (set-window-new-normal | 4618 | (set-window-new-normal |
| 4530 | window (- (if new-parent 1.0 (window-normal-size window horizontal)) | 4619 | window (- (if new-parent 1.0 (window-normal-size window horizontal)) |
| 4531 | new-normal))) | 4620 | new-normal))) |
| @@ -4579,7 +4668,7 @@ the original point in both windows." | |||
| 4579 | (defun split-window-below (&optional size) | 4668 | (defun split-window-below (&optional size) |
| 4580 | "Split the selected window into two windows, one above the other. | 4669 | "Split the selected window into two windows, one above the other. |
| 4581 | The selected window is above. The newly split-off window is | 4670 | The selected window is above. The newly split-off window is |
| 4582 | below, and displays the same buffer. Return the new window. | 4671 | below and displays the same buffer. Return the new window. |
| 4583 | 4672 | ||
| 4584 | If optional argument SIZE is omitted or nil, both windows get the | 4673 | If optional argument SIZE is omitted or nil, both windows get the |
| 4585 | same height, or close to it. If SIZE is positive, the upper | 4674 | same height, or close to it. If SIZE is positive, the upper |
| @@ -4633,7 +4722,7 @@ amount of redisplay; this is convenient on slow terminals." | |||
| 4633 | (defun split-window-right (&optional size) | 4722 | (defun split-window-right (&optional size) |
| 4634 | "Split the selected window into two side-by-side windows. | 4723 | "Split the selected window into two side-by-side windows. |
| 4635 | The selected window is on the left. The newly split-off window | 4724 | The selected window is on the left. The newly split-off window |
| 4636 | is on the right, and displays the same buffer. Return the new | 4725 | is on the right and displays the same buffer. Return the new |
| 4637 | window. | 4726 | window. |
| 4638 | 4727 | ||
| 4639 | If optional argument SIZE is omitted or nil, both windows get the | 4728 | If optional argument SIZE is omitted or nil, both windows get the |
| @@ -5131,7 +5220,7 @@ value can be also stored on disk and read back in a new session." | |||
| 5131 | (let ((scroll-bars (cdr (assq 'scroll-bars state)))) | 5220 | (let ((scroll-bars (cdr (assq 'scroll-bars state)))) |
| 5132 | (set-window-scroll-bars | 5221 | (set-window-scroll-bars |
| 5133 | window (car scroll-bars) (nth 2 scroll-bars) | 5222 | window (car scroll-bars) (nth 2 scroll-bars) |
| 5134 | (or (nth 3 scroll-bars) 0) (nth 5 scroll-bars))) | 5223 | (nth 3 scroll-bars) (nth 5 scroll-bars))) |
| 5135 | (set-window-vscroll window (cdr (assq 'vscroll state))) | 5224 | (set-window-vscroll window (cdr (assq 'vscroll state))) |
| 5136 | ;; Adjust vertically. | 5225 | ;; Adjust vertically. |
| 5137 | (if (memq window-size-fixed '(t height)) | 5226 | (if (memq window-size-fixed '(t height)) |
| @@ -5967,7 +6056,8 @@ live." | |||
| 5967 | (let ((parameter (window-parameter window 'quit-restore)) | 6056 | (let ((parameter (window-parameter window 'quit-restore)) |
| 5968 | (height (cdr (assq 'window-height alist))) | 6057 | (height (cdr (assq 'window-height alist))) |
| 5969 | (width (cdr (assq 'window-width alist))) | 6058 | (width (cdr (assq 'window-width alist))) |
| 5970 | (size (cdr (assq 'window-size alist)))) | 6059 | (size (cdr (assq 'window-size alist))) |
| 6060 | (preserve-size (cdr (assq 'preserve-size alist)))) | ||
| 5971 | (cond | 6061 | (cond |
| 5972 | ((or (eq type 'frame) | 6062 | ((or (eq type 'frame) |
| 5973 | (and (eq (car parameter) 'same) | 6063 | (and (eq (car parameter) 'same) |
| @@ -6022,7 +6112,11 @@ live." | |||
| 6022 | (window-combined-p window t)) | 6112 | (window-combined-p window t)) |
| 6023 | (window-resize window delta t 'safe)))) | 6113 | (window-resize window delta t 'safe)))) |
| 6024 | ((functionp width) | 6114 | ((functionp width) |
| 6025 | (ignore-errors (funcall width window))))))) | 6115 | (ignore-errors (funcall width window)))) |
| 6116 | ;; Preserve window size if asked for. | ||
| 6117 | (when (consp preserve-size) | ||
| 6118 | (window-preserve-size window t (car preserve-size)) | ||
| 6119 | (window-preserve-size window nil (cdr preserve-size)))))) | ||
| 6026 | 6120 | ||
| 6027 | window)) | 6121 | window)) |
| 6028 | 6122 | ||
| @@ -6241,6 +6335,10 @@ Recognized alist entries include: | |||
| 6241 | of not displaying the buffer and FUNCTION can safely return | 6335 | of not displaying the buffer and FUNCTION can safely return |
| 6242 | a non-window value to suppress displaying. | 6336 | a non-window value to suppress displaying. |
| 6243 | 6337 | ||
| 6338 | `preserve-size' -- Value should be either '(t . nil)' to | ||
| 6339 | preserve the width of the window, '(nil . t)' to preserve its | ||
| 6340 | height or '(t . t)' to preserve both. | ||
| 6341 | |||
| 6244 | The ACTION argument to `display-buffer' can also have a non-nil | 6342 | The ACTION argument to `display-buffer' can also have a non-nil |
| 6245 | and non-list value. This means to display the buffer in a window | 6343 | and non-list value. This means to display the buffer in a window |
| 6246 | other than the selected one, even if it is already displayed in | 6344 | other than the selected one, even if it is already displayed in |
| @@ -7242,7 +7340,7 @@ FRAME." | |||
| 7242 | (frame-text-height)) | 7340 | (frame-text-height)) |
| 7243 | frame-resize-pixelwise))))) | 7341 | frame-resize-pixelwise))))) |
| 7244 | 7342 | ||
| 7245 | (defun fit-window-to-buffer (&optional window max-height min-height max-width min-width) | 7343 | (defun fit-window-to-buffer (&optional window max-height min-height max-width min-width preserve-size) |
| 7246 | "Adjust size of WINDOW to display its buffer's contents exactly. | 7344 | "Adjust size of WINDOW to display its buffer's contents exactly. |
| 7247 | WINDOW must be a live window and defaults to the selected one. | 7345 | WINDOW must be a live window and defaults to the selected one. |
| 7248 | 7346 | ||
| @@ -7266,6 +7364,9 @@ and defaults to `window-min-width'. Both MAX-WIDTH and MIN-WIDTH | |||
| 7266 | are specified in columns and include fringes, margins, a | 7364 | are specified in columns and include fringes, margins, a |
| 7267 | scrollbar and a vertical divider, if any. | 7365 | scrollbar and a vertical divider, if any. |
| 7268 | 7366 | ||
| 7367 | If the optional argument `preserve-size' is non-nil, preserve the | ||
| 7368 | size of WINDOW (see `window-preserve-size'). | ||
| 7369 | |||
| 7269 | Fit pixelwise if the option `window-resize-pixelwise' is non-nil. | 7370 | Fit pixelwise if the option `window-resize-pixelwise' is non-nil. |
| 7270 | If WINDOW is its frame's root window and the option | 7371 | If WINDOW is its frame's root window and the option |
| 7271 | `fit-frame-to-buffer' is non-nil, call `fit-frame-to-buffer' to | 7372 | `fit-frame-to-buffer' is non-nil, call `fit-frame-to-buffer' to |
| @@ -7307,25 +7408,25 @@ accessible position." | |||
| 7307 | (max (if pixelwise | 7408 | (max (if pixelwise |
| 7308 | (* char-height window-min-height) | 7409 | (* char-height window-min-height) |
| 7309 | window-min-height) | 7410 | window-min-height) |
| 7310 | (window-min-size nil nil t pixelwise)))) | 7411 | (window-min-size window nil window pixelwise)))) |
| 7311 | (max-height | 7412 | (max-height |
| 7312 | ;; Sanitize MAX-HEIGHT. | 7413 | ;; Sanitize MAX-HEIGHT. |
| 7313 | (if (numberp max-height) | 7414 | (if (numberp max-height) |
| 7314 | (min | 7415 | (min |
| 7315 | (+ total-height | 7416 | (+ total-height |
| 7316 | (window-max-delta | 7417 | (window-max-delta |
| 7317 | window nil nil nil nil nil pixelwise)) | 7418 | window nil window nil nil nil pixelwise)) |
| 7318 | (if pixelwise | 7419 | (if pixelwise |
| 7319 | (* char-height max-height) | 7420 | (* char-height max-height) |
| 7320 | max-height)) | 7421 | max-height)) |
| 7321 | (+ total-height (window-max-delta | 7422 | (+ total-height (window-max-delta |
| 7322 | window nil nil nil nil nil pixelwise)))) | 7423 | window nil window nil nil nil pixelwise)))) |
| 7323 | height) | 7424 | height) |
| 7324 | (cond | 7425 | (cond |
| 7325 | ;; If WINDOW is vertically combined, try to resize it | 7426 | ;; If WINDOW is vertically combined, try to resize it |
| 7326 | ;; vertically. | 7427 | ;; vertically. |
| 7327 | ((and (not (eq fit-window-to-buffer-horizontally 'only)) | 7428 | ((and (not (eq fit-window-to-buffer-horizontally 'only)) |
| 7328 | (not (window-size-fixed-p window)) | 7429 | (not (window-size-fixed-p window 'preserved)) |
| 7329 | (window-combined-p)) | 7430 | (window-combined-p)) |
| 7330 | ;; Vertically we always want to fit the entire buffer. | 7431 | ;; Vertically we always want to fit the entire buffer. |
| 7331 | ;; WINDOW'S height can't get larger than its frame's pixel | 7432 | ;; WINDOW'S height can't get larger than its frame's pixel |
| @@ -7338,14 +7439,17 @@ accessible position." | |||
| 7338 | (unless pixelwise | 7439 | (unless pixelwise |
| 7339 | (setq height (/ (+ height char-height -1) char-height))) | 7440 | (setq height (/ (+ height char-height -1) char-height))) |
| 7340 | (unless (= height total-height) | 7441 | (unless (= height total-height) |
| 7442 | (window-preserve-size window) | ||
| 7341 | (window-resize-no-error | 7443 | (window-resize-no-error |
| 7342 | window | 7444 | window |
| 7343 | (- (max min-height (min max-height height)) total-height) | 7445 | (- (max min-height (min max-height height)) total-height) |
| 7344 | nil window pixelwise))) | 7446 | nil window pixelwise) |
| 7447 | (when preserve-size | ||
| 7448 | (window-preserve-size window nil t)))) | ||
| 7345 | ;; If WINDOW is horizontally combined, try to resize it | 7449 | ;; If WINDOW is horizontally combined, try to resize it |
| 7346 | ;; horizontally. | 7450 | ;; horizontally. |
| 7347 | ((and fit-window-to-buffer-horizontally | 7451 | ((and fit-window-to-buffer-horizontally |
| 7348 | (not (window-size-fixed-p window t)) | 7452 | (not (window-size-fixed-p window t 'preserved)) |
| 7349 | (window-combined-p nil t)) | 7453 | (window-combined-p nil t)) |
| 7350 | (let* ((total-width (window-size window t pixelwise)) | 7454 | (let* ((total-width (window-size window t pixelwise)) |
| 7351 | (min-width | 7455 | (min-width |
| @@ -7362,18 +7466,18 @@ accessible position." | |||
| 7362 | (max (if pixelwise | 7466 | (max (if pixelwise |
| 7363 | (* char-width window-min-width) | 7467 | (* char-width window-min-width) |
| 7364 | window-min-width) | 7468 | window-min-width) |
| 7365 | (window-min-size nil nil t pixelwise)))) | 7469 | (window-min-size nil nil window pixelwise)))) |
| 7366 | (max-width | 7470 | (max-width |
| 7367 | ;; Sanitize MAX-WIDTH. | 7471 | ;; Sanitize MAX-WIDTH. |
| 7368 | (if (numberp max-width) | 7472 | (if (numberp max-width) |
| 7369 | (min (+ total-width | 7473 | (min (+ total-width |
| 7370 | (window-max-delta | 7474 | (window-max-delta |
| 7371 | nil t nil nil nil nil pixelwise)) | 7475 | window t window nil nil nil pixelwise)) |
| 7372 | (if pixelwise | 7476 | (if pixelwise |
| 7373 | (* char-width max-width) | 7477 | (* char-width max-width) |
| 7374 | max-width)) | 7478 | max-width)) |
| 7375 | (+ total-width (window-max-delta | 7479 | (+ total-width (window-max-delta |
| 7376 | nil t nil nil nil nil pixelwise)))) | 7480 | window t window nil nil nil pixelwise)))) |
| 7377 | ;; When fitting horizontally, assume that WINDOW's | 7481 | ;; When fitting horizontally, assume that WINDOW's |
| 7378 | ;; start position remains unaltered. WINDOW can't get | 7482 | ;; start position remains unaltered. WINDOW can't get |
| 7379 | ;; wider than its frame's pixel width, its height | 7483 | ;; wider than its frame's pixel width, its height |
| @@ -7391,13 +7495,16 @@ accessible position." | |||
| 7391 | (unless pixelwise | 7495 | (unless pixelwise |
| 7392 | (setq width (/ (+ width char-width -1) char-width))) | 7496 | (setq width (/ (+ width char-width -1) char-width))) |
| 7393 | (unless (= width body-width) | 7497 | (unless (= width body-width) |
| 7498 | (window-preserve-size window t) | ||
| 7394 | (window-resize-no-error | 7499 | (window-resize-no-error |
| 7395 | window | 7500 | window |
| 7396 | (- (max min-width | 7501 | (- (max min-width |
| 7397 | (min max-width | 7502 | (min max-width |
| 7398 | (+ total-width (- width body-width)))) | 7503 | (+ total-width (- width body-width)))) |
| 7399 | total-width) | 7504 | total-width) |
| 7400 | t window pixelwise))))))))) | 7505 | t window pixelwise) |
| 7506 | (when preserve-size | ||
| 7507 | (window-preserve-size window t t)))))))))) | ||
| 7401 | 7508 | ||
| 7402 | (defun window-safely-shrinkable-p (&optional window) | 7509 | (defun window-safely-shrinkable-p (&optional window) |
| 7403 | "Return t if WINDOW can be shrunk without shrinking other windows. | 7510 | "Return t if WINDOW can be shrunk without shrinking other windows. |
diff --git a/src/ChangeLog b/src/ChangeLog index 2b125d52723..6fabfb49ea4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-12-18 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * frame.c (frame_windows_min_size): New argument IGNORE. | ||
| 4 | (adjust_frame_size): When called from change_frame_size call | ||
| 5 | frame_windows_min_size with IGNORE Qt so we can ignore size | ||
| 6 | restrictions. | ||
| 7 | |||
| 1 | 2014-12-18 Eli Zaretskii <eliz@gnu.org> | 8 | 2014-12-18 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * font.c (Ffont_info): Add more font information to the vector | 10 | * font.c (Ffont_info): Add more font information to the vector |
diff --git a/src/frame.c b/src/frame.c index eaab63a0ea4..31273665e88 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -335,9 +335,9 @@ predicates which report frame's specific UI-related capabilities. */) | |||
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | static int | 337 | static int |
| 338 | frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal, Lisp_Object pixelwise) | 338 | frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal, Lisp_Object ignore, Lisp_Object pixelwise) |
| 339 | { | 339 | { |
| 340 | return XINT (call3 (Qframe_windows_min_size, frame, horizontal, pixelwise)); | 340 | return XINT (call4 (Qframe_windows_min_size, frame, horizontal, ignore, pixelwise)); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | 343 | ||
| @@ -419,8 +419,10 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, | |||
| 419 | /* The following two values are calculated from the old window body | 419 | /* The following two values are calculated from the old window body |
| 420 | sizes and any "new" settings for scroll bars, dividers, fringes and | 420 | sizes and any "new" settings for scroll bars, dividers, fringes and |
| 421 | margins (though the latter should have been processed already). */ | 421 | margins (though the latter should have been processed already). */ |
| 422 | min_windows_width = frame_windows_min_size (frame, Qt, Qt); | 422 | min_windows_width |
| 423 | min_windows_height = frame_windows_min_size (frame, Qnil, Qt); | 423 | = frame_windows_min_size (frame, Qt, (inhibit == 5) ? Qt : Qnil, Qt); |
| 424 | min_windows_height | ||
| 425 | = frame_windows_min_size (frame, Qnil, (inhibit == 5) ? Qt : Qnil, Qt); | ||
| 424 | 426 | ||
| 425 | if (inhibit >= 2 && inhibit <= 4) | 427 | if (inhibit >= 2 && inhibit <= 4) |
| 426 | /* If INHIBIT is in [2..4] inhibit if the "old" window sizes stay | 428 | /* If INHIBIT is in [2..4] inhibit if the "old" window sizes stay |
diff --git a/src/window.c b/src/window.c index ca2bc74fcf4..2177a1d3966 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4135,11 +4135,7 @@ values. */) | |||
| 4135 | 4135 | ||
| 4136 | /* Resize frame F's windows when number of lines of F is set to SIZE. | 4136 | /* Resize frame F's windows when number of lines of F is set to SIZE. |
| 4137 | HORFLAG 1 means resize windows when number of columns of F is set to | 4137 | HORFLAG 1 means resize windows when number of columns of F is set to |
| 4138 | SIZE. PIXELWISE 1 means to interpret SIZE as pixels. | 4138 | SIZE. PIXELWISE 1 means to interpret SIZE as pixels. */ |
| 4139 | |||
| 4140 | This function can delete all windows but the selected one in order to | ||
| 4141 | satisfy the request. The result will be meaningful if and only if | ||
| 4142 | F's windows have meaningful sizes when you call this. */ | ||
| 4143 | void | 4139 | void |
| 4144 | resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | 4140 | resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) |
| 4145 | { | 4141 | { |