diff options
| author | Kenichi Handa | 2012-08-16 21:25:17 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-08-16 21:25:17 +0900 |
| commit | d75ffb4ed0b2e72a9361a07d16a5c884a9459728 (patch) | |
| tree | 8ac5a6a8ae033fef7fbc7fb7b09a703ef4b0ed5b /src/window.c | |
| parent | 69c41c4070c86baac11a627e9c3d366420aeb7cc (diff) | |
| parent | 250c8ab9b8f6322959fa3122db83944c30c3894b (diff) | |
| download | emacs-d75ffb4ed0b2e72a9361a07d16a5c884a9459728.tar.gz emacs-d75ffb4ed0b2e72a9361a07d16a5c884a9459728.zip | |
merge trunk
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 944 |
1 files changed, 505 insertions, 439 deletions
diff --git a/src/window.c b/src/window.c index 7fd66057ad2..7874105df1e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -51,7 +51,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 51 | #include "nsterm.h" | 51 | #include "nsterm.h" |
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | Lisp_Object Qwindowp, Qwindow_live_p; | 54 | Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p; |
| 55 | static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; | 55 | static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; |
| 56 | static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; | 56 | static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; |
| 57 | static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; | 57 | static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; |
| @@ -61,7 +61,6 @@ static Lisp_Object Qsafe, Qabove, Qbelow; | |||
| 61 | static Lisp_Object Qauto_buffer_name, Qclone_of; | 61 | static Lisp_Object Qauto_buffer_name, Qclone_of; |
| 62 | 62 | ||
| 63 | static int displayed_window_lines (struct window *); | 63 | static int displayed_window_lines (struct window *); |
| 64 | static struct window *decode_window (Lisp_Object); | ||
| 65 | static int count_windows (struct window *); | 64 | static int count_windows (struct window *); |
| 66 | static int get_leaf_windows (struct window *, struct window **, int); | 65 | static int get_leaf_windows (struct window *, struct window **, int); |
| 67 | static void window_scroll (Lisp_Object, EMACS_INT, int, int); | 66 | static void window_scroll (Lisp_Object, EMACS_INT, int, int); |
| @@ -131,8 +130,8 @@ static int window_scroll_pixel_based_preserve_y; | |||
| 131 | static EMACS_INT window_scroll_preserve_hpos; | 130 | static EMACS_INT window_scroll_preserve_hpos; |
| 132 | static EMACS_INT window_scroll_preserve_vpos; | 131 | static EMACS_INT window_scroll_preserve_vpos; |
| 133 | 132 | ||
| 134 | static struct window * | 133 | struct window * |
| 135 | decode_window (register Lisp_Object window) | 134 | decode_live_window (register Lisp_Object window) |
| 136 | { | 135 | { |
| 137 | if (NILP (window)) | 136 | if (NILP (window)) |
| 138 | return XWINDOW (selected_window); | 137 | return XWINDOW (selected_window); |
| @@ -144,11 +143,27 @@ decode_window (register Lisp_Object window) | |||
| 144 | static struct window * | 143 | static struct window * |
| 145 | decode_any_window (register Lisp_Object window) | 144 | decode_any_window (register Lisp_Object window) |
| 146 | { | 145 | { |
| 146 | struct window *w; | ||
| 147 | |||
| 147 | if (NILP (window)) | 148 | if (NILP (window)) |
| 148 | return XWINDOW (selected_window); | 149 | return XWINDOW (selected_window); |
| 149 | 150 | ||
| 150 | CHECK_WINDOW (window); | 151 | CHECK_WINDOW (window); |
| 151 | return XWINDOW (window); | 152 | w = XWINDOW (window); |
| 153 | return w; | ||
| 154 | } | ||
| 155 | |||
| 156 | struct window * | ||
| 157 | decode_valid_window (register Lisp_Object window) | ||
| 158 | { | ||
| 159 | struct window *w; | ||
| 160 | |||
| 161 | if (NILP (window)) | ||
| 162 | return XWINDOW (selected_window); | ||
| 163 | |||
| 164 | CHECK_VALID_WINDOW (window); | ||
| 165 | w = XWINDOW (window); | ||
| 166 | return w; | ||
| 152 | } | 167 | } |
| 153 | 168 | ||
| 154 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | 169 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, |
| @@ -158,6 +173,15 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | |||
| 158 | return WINDOWP (object) ? Qt : Qnil; | 173 | return WINDOWP (object) ? Qt : Qnil; |
| 159 | } | 174 | } |
| 160 | 175 | ||
| 176 | DEFUN ("window-valid-p", Fwindow_valid_p, Swindow_valid_p, 1, 1, 0, | ||
| 177 | doc: /* Return t if OBJECT is a valid window and nil otherwise. | ||
| 178 | A valid window is either a window that displays a buffer or an internal | ||
| 179 | window. Deleted windows are not live. */) | ||
| 180 | (Lisp_Object object) | ||
| 181 | { | ||
| 182 | return WINDOW_VALID_P (object) ? Qt : Qnil; | ||
| 183 | } | ||
| 184 | |||
| 161 | DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, | 185 | DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, |
| 162 | doc: /* Return t if OBJECT is a live window and nil otherwise. | 186 | doc: /* Return t if OBJECT is a live window and nil otherwise. |
| 163 | A live window is a window that displays a buffer. | 187 | A live window is a window that displays a buffer. |
| @@ -170,10 +194,10 @@ Internal windows and deleted windows are not live. */) | |||
| 170 | /* Frames and windows. */ | 194 | /* Frames and windows. */ |
| 171 | DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, | 195 | DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, |
| 172 | doc: /* Return the frame that window WINDOW is on. | 196 | doc: /* Return the frame that window WINDOW is on. |
| 173 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 197 | WINDOW must be a valid window and defaults to the selected one. */) |
| 174 | (Lisp_Object window) | 198 | (Lisp_Object window) |
| 175 | { | 199 | { |
| 176 | return decode_any_window (window)->frame; | 200 | return decode_valid_window (window)->frame; |
| 177 | } | 201 | } |
| 178 | 202 | ||
| 179 | DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, | 203 | DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, |
| @@ -187,8 +211,8 @@ With a window argument, return the root window of that window's frame. */) | |||
| 187 | 211 | ||
| 188 | if (NILP (frame_or_window)) | 212 | if (NILP (frame_or_window)) |
| 189 | window = SELECTED_FRAME ()->root_window; | 213 | window = SELECTED_FRAME ()->root_window; |
| 190 | else if (WINDOWP (frame_or_window)) | 214 | else if (WINDOW_VALID_P (frame_or_window)) |
| 191 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; | 215 | window = XFRAME (XWINDOW (frame_or_window)->frame)->root_window; |
| 192 | else | 216 | else |
| 193 | { | 217 | { |
| 194 | CHECK_LIVE_FRAME (frame_or_window); | 218 | CHECK_LIVE_FRAME (frame_or_window); |
| @@ -212,18 +236,18 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) | |||
| 212 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, | 236 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, |
| 213 | Swindow_minibuffer_p, 0, 1, 0, | 237 | Swindow_minibuffer_p, 0, 1, 0, |
| 214 | doc: /* Return non-nil if WINDOW is a minibuffer window. | 238 | doc: /* Return non-nil if WINDOW is a minibuffer window. |
| 215 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 239 | WINDOW must be a valid window and defaults to the selected one. */) |
| 216 | (Lisp_Object window) | 240 | (Lisp_Object window) |
| 217 | { | 241 | { |
| 218 | return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; | 242 | return MINI_WINDOW_P (decode_valid_window (window)) ? Qt : Qnil; |
| 219 | } | 243 | } |
| 220 | 244 | ||
| 221 | /* Don't move this to window.el - this must be a safe routine. */ | 245 | /* Don't move this to window.el - this must be a safe routine. */ |
| 222 | DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, | 246 | DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, |
| 223 | doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW. | 247 | doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW. |
| 224 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. | 248 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. |
| 225 | Else if FRAME-OR-WINDOW denotes any window, return the first window of | 249 | Else if FRAME-OR-WINDOW denotes a valid window, return the first window |
| 226 | that window's frame. If FRAME-OR-WINDOW denotes a live frame, return | 250 | of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return |
| 227 | the first window of that frame. */) | 251 | the first window of that frame. */) |
| 228 | (Lisp_Object frame_or_window) | 252 | (Lisp_Object frame_or_window) |
| 229 | { | 253 | { |
| @@ -231,7 +255,7 @@ the first window of that frame. */) | |||
| 231 | 255 | ||
| 232 | if (NILP (frame_or_window)) | 256 | if (NILP (frame_or_window)) |
| 233 | window = SELECTED_FRAME ()->root_window; | 257 | window = SELECTED_FRAME ()->root_window; |
| 234 | else if (WINDOWP (frame_or_window)) | 258 | else if (WINDOW_VALID_P (frame_or_window)) |
| 235 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; | 259 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; |
| 236 | else | 260 | else |
| 237 | { | 261 | { |
| @@ -256,16 +280,16 @@ DEFUN ("frame-selected-window", Fframe_selected_window, | |||
| 256 | Sframe_selected_window, 0, 1, 0, | 280 | Sframe_selected_window, 0, 1, 0, |
| 257 | doc: /* Return the selected window of FRAME-OR-WINDOW. | 281 | doc: /* Return the selected window of FRAME-OR-WINDOW. |
| 258 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. | 282 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. |
| 259 | Else if FRAME-OR-WINDOW denotes any window, return the selected window | 283 | Else if FRAME-OR-WINDOW denotes a valid window, return the selected |
| 260 | of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return | 284 | window of that window's frame. If FRAME-OR-WINDOW denotes a live frame, |
| 261 | the selected window of that frame. */) | 285 | return the selected window of that frame. */) |
| 262 | (Lisp_Object frame_or_window) | 286 | (Lisp_Object frame_or_window) |
| 263 | { | 287 | { |
| 264 | Lisp_Object window; | 288 | Lisp_Object window; |
| 265 | 289 | ||
| 266 | if (NILP (frame_or_window)) | 290 | if (NILP (frame_or_window)) |
| 267 | window = SELECTED_FRAME ()->selected_window; | 291 | window = SELECTED_FRAME ()->selected_window; |
| 268 | else if (WINDOWP (frame_or_window)) | 292 | else if (WINDOW_VALID_P (frame_or_window)) |
| 269 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; | 293 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; |
| 270 | else | 294 | else |
| 271 | { | 295 | { |
| @@ -298,7 +322,7 @@ Return WINDOW. */) | |||
| 298 | if (EQ (frame, selected_frame)) | 322 | if (EQ (frame, selected_frame)) |
| 299 | return Fselect_window (window, norecord); | 323 | return Fselect_window (window, norecord); |
| 300 | else | 324 | else |
| 301 | return XFRAME (frame)->selected_window = window; | 325 | return FSET (XFRAME (frame), selected_window, window); |
| 302 | } | 326 | } |
| 303 | 327 | ||
| 304 | DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, | 328 | DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, |
| @@ -341,7 +365,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 341 | sf = SELECTED_FRAME (); | 365 | sf = SELECTED_FRAME (); |
| 342 | if (XFRAME (WINDOW_FRAME (w)) != sf) | 366 | if (XFRAME (WINDOW_FRAME (w)) != sf) |
| 343 | { | 367 | { |
| 344 | XFRAME (WINDOW_FRAME (w))->selected_window = window; | 368 | FSET (XFRAME (WINDOW_FRAME (w)), selected_window, window); |
| 345 | /* Use this rather than Fhandle_switch_frame | 369 | /* Use this rather than Fhandle_switch_frame |
| 346 | so that FRAME_FOCUS_FRAME is moved appropriately as we | 370 | so that FRAME_FOCUS_FRAME is moved appropriately as we |
| 347 | move around in the state where a minibuffer in a separate | 371 | move around in the state where a minibuffer in a separate |
| @@ -352,7 +376,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 352 | return window; | 376 | return window; |
| 353 | } | 377 | } |
| 354 | else | 378 | else |
| 355 | sf->selected_window = window; | 379 | FSET (sf, selected_window, window); |
| 356 | 380 | ||
| 357 | /* Store the current buffer's actual point into the | 381 | /* Store the current buffer's actual point into the |
| 358 | old selected window. It belongs to that window, | 382 | old selected window. It belongs to that window, |
| @@ -370,7 +394,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 370 | 394 | ||
| 371 | Fset_buffer (w->buffer); | 395 | Fset_buffer (w->buffer); |
| 372 | 396 | ||
| 373 | BVAR (XBUFFER (w->buffer), last_selected_window) = window; | 397 | BSET (XBUFFER (w->buffer), last_selected_window, window); |
| 374 | 398 | ||
| 375 | /* Go to the point recorded in the window. | 399 | /* Go to the point recorded in the window. |
| 376 | This is important when the buffer is in more | 400 | This is important when the buffer is in more |
| @@ -418,92 +442,92 @@ Return nil for an internal window or a deleted window. */) | |||
| 418 | 442 | ||
| 419 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, | 443 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, |
| 420 | doc: /* Return the parent window of window WINDOW. | 444 | doc: /* Return the parent window of window WINDOW. |
| 421 | If WINDOW is omitted or nil, it defaults to the selected window. | 445 | WINDOW must be a valid window and defaults to the selected one. |
| 422 | Return nil for a window with no parent (e.g. a root window). */) | 446 | Return nil for a window with no parent (e.g. a root window). */) |
| 423 | (Lisp_Object window) | 447 | (Lisp_Object window) |
| 424 | { | 448 | { |
| 425 | return decode_any_window (window)->parent; | 449 | return decode_valid_window (window)->parent; |
| 426 | } | 450 | } |
| 427 | 451 | ||
| 428 | DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, | 452 | DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, |
| 429 | doc: /* Return the topmost child window of window WINDOW. | 453 | doc: /* Return the topmost child window of window WINDOW. |
| 454 | WINDOW must be a valid window and defaults to the selected one. | ||
| 430 | Return nil if WINDOW is a live window (live windows have no children). | 455 | Return nil if WINDOW is a live window (live windows have no children). |
| 431 | Return nil if WINDOW is an internal window whose children form a | 456 | Return nil if WINDOW is an internal window whose children form a |
| 432 | horizontal combination. */) | 457 | horizontal combination. */) |
| 433 | (Lisp_Object window) | 458 | (Lisp_Object window) |
| 434 | { | 459 | { |
| 435 | CHECK_WINDOW (window); | 460 | CHECK_WINDOW (window); |
| 436 | return decode_any_window (window)->vchild; | 461 | return decode_valid_window (window)->vchild; |
| 437 | } | 462 | } |
| 438 | 463 | ||
| 439 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, | 464 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, |
| 440 | doc: /* Return the leftmost child window of window WINDOW. | 465 | doc: /* Return the leftmost child window of window WINDOW. |
| 466 | WINDOW must be a valid window and defaults to the selected one. | ||
| 441 | Return nil if WINDOW is a live window (live windows have no children). | 467 | Return nil if WINDOW is a live window (live windows have no children). |
| 442 | Return nil if WINDOW is an internal window whose children form a | 468 | Return nil if WINDOW is an internal window whose children form a |
| 443 | vertical combination. */) | 469 | vertical combination. */) |
| 444 | (Lisp_Object window) | 470 | (Lisp_Object window) |
| 445 | { | 471 | { |
| 446 | CHECK_WINDOW (window); | 472 | CHECK_WINDOW (window); |
| 447 | return decode_any_window (window)->hchild; | 473 | return decode_valid_window (window)->hchild; |
| 448 | } | 474 | } |
| 449 | 475 | ||
| 450 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, | 476 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, |
| 451 | doc: /* Return the next sibling window of window WINDOW. | 477 | doc: /* Return the next sibling window of window WINDOW. |
| 452 | If WINDOW is omitted or nil, it defaults to the selected window. | 478 | WINDOW must be a valid window and defaults to the selected one. |
| 453 | Return nil if WINDOW has no next sibling. */) | 479 | Return nil if WINDOW has no next sibling. */) |
| 454 | (Lisp_Object window) | 480 | (Lisp_Object window) |
| 455 | { | 481 | { |
| 456 | return decode_any_window (window)->next; | 482 | return decode_valid_window (window)->next; |
| 457 | } | 483 | } |
| 458 | 484 | ||
| 459 | DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, | 485 | DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, |
| 460 | doc: /* Return the previous sibling window of window WINDOW. | 486 | doc: /* Return the previous sibling window of window WINDOW. |
| 461 | If WINDOW is omitted or nil, it defaults to the selected window. | 487 | WINDOW must be a valid window and defaults to the selected one. |
| 462 | Return nil if WINDOW has no previous sibling. */) | 488 | Return nil if WINDOW has no previous sibling. */) |
| 463 | (Lisp_Object window) | 489 | (Lisp_Object window) |
| 464 | { | 490 | { |
| 465 | return decode_any_window (window)->prev; | 491 | return decode_valid_window (window)->prev; |
| 466 | } | 492 | } |
| 467 | 493 | ||
| 468 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, | 494 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, |
| 469 | doc: /* Return combination limit of window WINDOW. | 495 | doc: /* Return combination limit of window WINDOW. |
| 496 | WINDOW must be a valid window and defaults to the selected one. | ||
| 470 | If the return value is nil, child windows of WINDOW can be recombined with | 497 | If the return value is nil, child windows of WINDOW can be recombined with |
| 471 | WINDOW's siblings. A return value of t means that child windows of | 498 | WINDOW's siblings. A return value of t means that child windows of |
| 472 | WINDOW are never \(re-)combined with WINDOW's siblings. */) | 499 | WINDOW are never \(re-)combined with WINDOW's siblings. */) |
| 473 | (Lisp_Object window) | 500 | (Lisp_Object window) |
| 474 | { | 501 | { |
| 475 | return decode_any_window (window)->combination_limit; | 502 | return decode_valid_window (window)->combination_limit; |
| 476 | } | 503 | } |
| 477 | 504 | ||
| 478 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, | 505 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, |
| 479 | doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. | 506 | doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. |
| 507 | WINDOW must be a valid window and defaults to the selected one. | ||
| 480 | If LIMIT is nil, child windows of WINDOW can be recombined with | 508 | If LIMIT is nil, child windows of WINDOW can be recombined with |
| 481 | WINDOW's siblings. LIMIT t means that child windows of WINDOW are | 509 | WINDOW's siblings. LIMIT t means that child windows of WINDOW are |
| 482 | never \(re-)combined with WINDOW's siblings. Other values are reserved | 510 | never \(re-)combined with WINDOW's siblings. Other values are reserved |
| 483 | for future use. */) | 511 | for future use. */) |
| 484 | (Lisp_Object window, Lisp_Object limit) | 512 | (Lisp_Object window, Lisp_Object limit) |
| 485 | { | 513 | { |
| 486 | register struct window *w = decode_any_window (window); | 514 | return WSET (decode_valid_window (window), combination_limit, limit); |
| 487 | |||
| 488 | w->combination_limit = limit; | ||
| 489 | |||
| 490 | return w->combination_limit; | ||
| 491 | } | 515 | } |
| 492 | 516 | ||
| 493 | DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, | 517 | DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, |
| 494 | doc: /* Return the use time of window WINDOW. | 518 | doc: /* Return the use time of window WINDOW. |
| 495 | If WINDOW is omitted or nil, it defaults to the selected window. | 519 | WINDOW must be a live window and defaults to the selected one. |
| 496 | The window with the highest use time is the most recently selected | 520 | The window with the highest use time is the most recently selected |
| 497 | one. The window with the lowest use time is the least recently | 521 | one. The window with the lowest use time is the least recently |
| 498 | selected one. */) | 522 | selected one. */) |
| 499 | (Lisp_Object window) | 523 | (Lisp_Object window) |
| 500 | { | 524 | { |
| 501 | return make_number (decode_window (window)->use_time); | 525 | return make_number (decode_live_window (window)->use_time); |
| 502 | } | 526 | } |
| 503 | 527 | ||
| 504 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, | 528 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, |
| 505 | doc: /* Return the total height, in lines, of window WINDOW. | 529 | doc: /* Return the total height, in lines, of window WINDOW. |
| 506 | If WINDOW is omitted or nil, it defaults to the selected window. | 530 | WINDOW must be a valid window and defaults to the selected one. |
| 507 | 531 | ||
| 508 | The return value includes the mode line and header line, if any. | 532 | The return value includes the mode line and header line, if any. |
| 509 | If WINDOW is an internal window, the total height is the height | 533 | If WINDOW is an internal window, the total height is the height |
| @@ -513,12 +537,12 @@ On a graphical display, this total height is reported as an | |||
| 513 | integer multiple of the default character height. */) | 537 | integer multiple of the default character height. */) |
| 514 | (Lisp_Object window) | 538 | (Lisp_Object window) |
| 515 | { | 539 | { |
| 516 | return decode_any_window (window)->total_lines; | 540 | return decode_valid_window (window)->total_lines; |
| 517 | } | 541 | } |
| 518 | 542 | ||
| 519 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, | 543 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, |
| 520 | doc: /* Return the total width, in columns, of window WINDOW. | 544 | doc: /* Return the total width, in columns, of window WINDOW. |
| 521 | If WINDOW is omitted or nil, it defaults to the selected window. | 545 | WINDOW must be a valid window and defaults to the selected one. |
| 522 | 546 | ||
| 523 | The return value includes any vertical dividers or scroll bars | 547 | The return value includes any vertical dividers or scroll bars |
| 524 | belonging to WINDOW. If WINDOW is an internal window, the total width | 548 | belonging to WINDOW. If WINDOW is an internal window, the total width |
| @@ -528,35 +552,34 @@ On a graphical display, this total width is reported as an | |||
| 528 | integer multiple of the default character width. */) | 552 | integer multiple of the default character width. */) |
| 529 | (Lisp_Object window) | 553 | (Lisp_Object window) |
| 530 | { | 554 | { |
| 531 | return decode_any_window (window)->total_cols; | 555 | return decode_valid_window (window)->total_cols; |
| 532 | } | 556 | } |
| 533 | 557 | ||
| 534 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, | 558 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, |
| 535 | doc: /* Return the new total size of window WINDOW. | 559 | doc: /* Return the new total size of window WINDOW. |
| 536 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 560 | WINDOW must be a valid window and defaults to the selected one. */) |
| 537 | (Lisp_Object window) | 561 | (Lisp_Object window) |
| 538 | { | 562 | { |
| 539 | return decode_any_window (window)->new_total; | 563 | return decode_valid_window (window)->new_total; |
| 540 | } | 564 | } |
| 541 | 565 | ||
| 542 | DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, | 566 | DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, |
| 543 | doc: /* Return the normal height of window WINDOW. | 567 | doc: /* Return the normal height of window WINDOW. |
| 544 | If WINDOW is omitted or nil, it defaults to the selected window. | 568 | WINDOW must be a valid window and defaults to the selected one. |
| 545 | If HORIZONTAL is non-nil, return the normal width of WINDOW. */) | 569 | If HORIZONTAL is non-nil, return the normal width of WINDOW. */) |
| 546 | (Lisp_Object window, Lisp_Object horizontal) | 570 | (Lisp_Object window, Lisp_Object horizontal) |
| 547 | { | 571 | { |
| 548 | if (NILP (horizontal)) | 572 | struct window *w = decode_valid_window (window); |
| 549 | return decode_any_window (window)->normal_lines; | 573 | |
| 550 | else | 574 | return NILP (horizontal) ? w->normal_lines : w->normal_cols; |
| 551 | return decode_any_window (window)->normal_cols; | ||
| 552 | } | 575 | } |
| 553 | 576 | ||
| 554 | DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, | 577 | DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, |
| 555 | doc: /* Return new normal size of window WINDOW. | 578 | doc: /* Return new normal size of window WINDOW. |
| 556 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 579 | WINDOW must be a valid window and defaults to the selected one. */) |
| 557 | (Lisp_Object window) | 580 | (Lisp_Object window) |
| 558 | { | 581 | { |
| 559 | return decode_any_window (window)->new_normal; | 582 | return decode_valid_window (window)->new_normal; |
| 560 | } | 583 | } |
| 561 | 584 | ||
| 562 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, | 585 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, |
| @@ -565,10 +588,10 @@ This is the distance, in columns, between the left edge of WINDOW and | |||
| 565 | the left edge of the frame's window area. For instance, the return | 588 | the left edge of the frame's window area. For instance, the return |
| 566 | value is 0 if there is no window to the left of WINDOW. | 589 | value is 0 if there is no window to the left of WINDOW. |
| 567 | 590 | ||
| 568 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 591 | WINDOW must be a valid window and defaults to the selected one. */) |
| 569 | (Lisp_Object window) | 592 | (Lisp_Object window) |
| 570 | { | 593 | { |
| 571 | return decode_any_window (window)->left_col; | 594 | return decode_valid_window (window)->left_col; |
| 572 | } | 595 | } |
| 573 | 596 | ||
| 574 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, | 597 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, |
| @@ -577,10 +600,10 @@ This is the distance, in lines, between the top of WINDOW and the top | |||
| 577 | of the frame's window area. For instance, the return value is 0 if | 600 | of the frame's window area. For instance, the return value is 0 if |
| 578 | there is no window above WINDOW. | 601 | there is no window above WINDOW. |
| 579 | 602 | ||
| 580 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 603 | WINDOW must be a valid window and defaults to the selected one. */) |
| 581 | (Lisp_Object window) | 604 | (Lisp_Object window) |
| 582 | { | 605 | { |
| 583 | return decode_any_window (window)->top_line; | 606 | return decode_valid_window (window)->top_line; |
| 584 | } | 607 | } |
| 585 | 608 | ||
| 586 | /* Return the number of lines of W's body. Don't count any mode or | 609 | /* Return the number of lines of W's body. Don't count any mode or |
| @@ -634,8 +657,7 @@ window_body_cols (struct window *w) | |||
| 634 | 657 | ||
| 635 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, | 658 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, |
| 636 | doc: /* Return the height, in lines, of WINDOW's text area. | 659 | doc: /* Return the height, in lines, of WINDOW's text area. |
| 637 | If WINDOW is omitted or nil, it defaults to the selected window. | 660 | WINDOW must be a live window and defaults to the selected one. |
| 638 | Signal an error if the window is not live. | ||
| 639 | 661 | ||
| 640 | The returned height does not include the mode line or header line. | 662 | The returned height does not include the mode line or header line. |
| 641 | On a graphical display, the height is expressed as an integer multiple | 663 | On a graphical display, the height is expressed as an integer multiple |
| @@ -644,21 +666,20 @@ area is only partially visible, that counts as a whole line; to | |||
| 644 | exclude partially-visible lines, use `window-text-height'. */) | 666 | exclude partially-visible lines, use `window-text-height'. */) |
| 645 | (Lisp_Object window) | 667 | (Lisp_Object window) |
| 646 | { | 668 | { |
| 647 | struct window *w = decode_window (window); | 669 | struct window *w = decode_live_window (window); |
| 648 | return make_number (window_body_lines (w)); | 670 | return make_number (window_body_lines (w)); |
| 649 | } | 671 | } |
| 650 | 672 | ||
| 651 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, | 673 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, |
| 652 | doc: /* Return the width, in columns, of WINDOW's text area. | 674 | doc: /* Return the width, in columns, of WINDOW's text area. |
| 653 | If WINDOW is omitted or nil, it defaults to the selected window. | 675 | WINDOW must be a live window and defaults to the selected one. |
| 654 | Signal an error if the window is not live. | ||
| 655 | 676 | ||
| 656 | The return value does not include any vertical dividers, fringe or | 677 | The return value does not include any vertical dividers, fringe or |
| 657 | marginal areas, or scroll bars. On a graphical display, the width is | 678 | marginal areas, or scroll bars. On a graphical display, the width is |
| 658 | expressed as an integer multiple of the default character width. */) | 679 | expressed as an integer multiple of the default character width. */) |
| 659 | (Lisp_Object window) | 680 | (Lisp_Object window) |
| 660 | { | 681 | { |
| 661 | struct window *w = decode_window (window); | 682 | struct window *w = decode_live_window (window); |
| 662 | return make_number (window_body_cols (w)); | 683 | return make_number (window_body_cols (w)); |
| 663 | } | 684 | } |
| 664 | 685 | ||
| @@ -667,7 +688,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |||
| 667 | WINDOW must be a live window and defaults to the selected one. */) | 688 | WINDOW must be a live window and defaults to the selected one. */) |
| 668 | (Lisp_Object window) | 689 | (Lisp_Object window) |
| 669 | { | 690 | { |
| 670 | return make_number (decode_window (window)->hscroll); | 691 | return make_number (decode_live_window (window)->hscroll); |
| 671 | } | 692 | } |
| 672 | 693 | ||
| 673 | /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable | 694 | /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable |
| @@ -694,7 +715,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) | |||
| 694 | 715 | ||
| 695 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | 716 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, |
| 696 | doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. | 717 | doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. |
| 697 | If WINDOW is nil, the selected window is used. | 718 | WINDOW must be a live window and defaults to the selected one. |
| 698 | Clip the number to a reasonable value if out of range. | 719 | Clip the number to a reasonable value if out of range. |
| 699 | Return the new number. NCOL should be zero or positive. | 720 | Return the new number. NCOL should be zero or positive. |
| 700 | 721 | ||
| @@ -702,7 +723,7 @@ Note that if `automatic-hscrolling' is non-nil, you cannot scroll the | |||
| 702 | window so that the location of point moves off-window. */) | 723 | window so that the location of point moves off-window. */) |
| 703 | (Lisp_Object window, Lisp_Object ncol) | 724 | (Lisp_Object window, Lisp_Object ncol) |
| 704 | { | 725 | { |
| 705 | struct window *w = decode_window (window); | 726 | struct window *w = decode_live_window (window); |
| 706 | 727 | ||
| 707 | CHECK_NUMBER (ncol); | 728 | CHECK_NUMBER (ncol); |
| 708 | return set_window_hscroll (w, XINT (ncol)); | 729 | return set_window_hscroll (w, XINT (ncol)); |
| @@ -711,44 +732,43 @@ window so that the location of point moves off-window. */) | |||
| 711 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, | 732 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, |
| 712 | Swindow_redisplay_end_trigger, 0, 1, 0, | 733 | Swindow_redisplay_end_trigger, 0, 1, 0, |
| 713 | doc: /* Return WINDOW's redisplay end trigger value. | 734 | doc: /* Return WINDOW's redisplay end trigger value. |
| 714 | WINDOW defaults to the selected window. | 735 | WINDOW must be a live window and defaults to the selected one. |
| 715 | See `set-window-redisplay-end-trigger' for more information. */) | 736 | See `set-window-redisplay-end-trigger' for more information. */) |
| 716 | (Lisp_Object window) | 737 | (Lisp_Object window) |
| 717 | { | 738 | { |
| 718 | return decode_window (window)->redisplay_end_trigger; | 739 | return decode_live_window (window)->redisplay_end_trigger; |
| 719 | } | 740 | } |
| 720 | 741 | ||
| 721 | DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, | 742 | DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, |
| 722 | Sset_window_redisplay_end_trigger, 2, 2, 0, | 743 | Sset_window_redisplay_end_trigger, 2, 2, 0, |
| 723 | doc: /* Set WINDOW's redisplay end trigger value to VALUE. | 744 | doc: /* Set WINDOW's redisplay end trigger value to VALUE. |
| 724 | VALUE should be a buffer position (typically a marker) or nil. | 745 | WINDOW must be a live window and defaults to the selected one. VALUE |
| 725 | If it is a buffer position, then if redisplay in WINDOW reaches a position | 746 | should be a buffer position (typically a marker) or nil. If it is a |
| 726 | beyond VALUE, the functions in `redisplay-end-trigger-functions' are called | 747 | buffer position, then if redisplay in WINDOW reaches a position beyond |
| 727 | with two arguments: WINDOW, and the end trigger value. | 748 | VALUE, the functions in `redisplay-end-trigger-functions' are called |
| 728 | Afterwards the end-trigger value is reset to nil. */) | 749 | with two arguments: WINDOW, and the end trigger value. Afterwards the |
| 750 | end-trigger value is reset to nil. */) | ||
| 729 | (register Lisp_Object window, Lisp_Object value) | 751 | (register Lisp_Object window, Lisp_Object value) |
| 730 | { | 752 | { |
| 731 | register struct window *w; | 753 | return WSET (decode_live_window (window), redisplay_end_trigger, value); |
| 732 | |||
| 733 | w = decode_window (window); | ||
| 734 | w->redisplay_end_trigger = value; | ||
| 735 | return value; | ||
| 736 | } | 754 | } |
| 737 | 755 | ||
| 738 | DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, | 756 | DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
| 739 | doc: /* Return a list of the edge coordinates of WINDOW. | 757 | doc: /* Return a list of the edge coordinates of WINDOW. |
| 740 | The list has the form (LEFT TOP RIGHT BOTTOM). | 758 | WINDOW must be a valid window and defaults to the selected one. |
| 741 | TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, | 759 | |
| 742 | all relative to 0, 0 at top left corner of frame. | 760 | The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM |
| 743 | 761 | count by lines, and LEFT and RIGHT count by columns, all relative to 0, | |
| 744 | RIGHT is one more than the rightmost column occupied by WINDOW. | 762 | 0 at top left corner of frame. |
| 745 | BOTTOM is one more than the bottommost row occupied by WINDOW. | 763 | |
| 746 | The edges include the space used by WINDOW's scroll bar, display | 764 | RIGHT is one more than the rightmost column occupied by WINDOW. BOTTOM |
| 747 | margins, fringes, header line, and/or mode line. For the edges of | 765 | is one more than the bottommost row occupied by WINDOW. The edges |
| 748 | just the text area, use `window-inside-edges'. */) | 766 | include the space used by WINDOW's scroll bar, display margins, fringes, |
| 767 | header line, and/or mode line. For the edges of just the text area, use | ||
| 768 | `window-inside-edges'. */) | ||
| 749 | (Lisp_Object window) | 769 | (Lisp_Object window) |
| 750 | { | 770 | { |
| 751 | register struct window *w = decode_any_window (window); | 771 | register struct window *w = decode_valid_window (window); |
| 752 | 772 | ||
| 753 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), | 773 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), |
| 754 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), | 774 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), |
| @@ -759,8 +779,10 @@ just the text area, use `window-inside-edges'. */) | |||
| 759 | 779 | ||
| 760 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, | 780 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, |
| 761 | doc: /* Return a list of the edge pixel coordinates of WINDOW. | 781 | doc: /* Return a list of the edge pixel coordinates of WINDOW. |
| 762 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at | 782 | WINDOW must be a valid window and defaults to the selected one. |
| 763 | the top left corner of the frame. | 783 | |
| 784 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 785 | 0, 0 at the top left corner of the frame. | ||
| 764 | 786 | ||
| 765 | RIGHT is one more than the rightmost x position occupied by WINDOW. | 787 | RIGHT is one more than the rightmost x position occupied by WINDOW. |
| 766 | BOTTOM is one more than the bottommost y position occupied by WINDOW. | 788 | BOTTOM is one more than the bottommost y position occupied by WINDOW. |
| @@ -769,7 +791,7 @@ margins, fringes, header line, and/or mode line. For the pixel edges | |||
| 769 | of just the text area, use `window-inside-pixel-edges'. */) | 791 | of just the text area, use `window-inside-pixel-edges'. */) |
| 770 | (Lisp_Object window) | 792 | (Lisp_Object window) |
| 771 | { | 793 | { |
| 772 | register struct window *w = decode_any_window (window); | 794 | register struct window *w = decode_valid_window (window); |
| 773 | 795 | ||
| 774 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), | 796 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), |
| 775 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), | 797 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), |
| @@ -803,8 +825,10 @@ calc_absolute_offset (struct window *w, int *add_x, int *add_y) | |||
| 803 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, | 825 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, |
| 804 | Swindow_absolute_pixel_edges, 0, 1, 0, | 826 | Swindow_absolute_pixel_edges, 0, 1, 0, |
| 805 | doc: /* Return a list of the edge pixel coordinates of WINDOW. | 827 | doc: /* Return a list of the edge pixel coordinates of WINDOW. |
| 806 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at | 828 | WINDOW must be a valid window and defaults to the selected one. |
| 807 | the top left corner of the display. | 829 | |
| 830 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 831 | 0, 0 at the top left corner of the display. | ||
| 808 | 832 | ||
| 809 | RIGHT is one more than the rightmost x position occupied by WINDOW. | 833 | RIGHT is one more than the rightmost x position occupied by WINDOW. |
| 810 | BOTTOM is one more than the bottommost y position occupied by WINDOW. | 834 | BOTTOM is one more than the bottommost y position occupied by WINDOW. |
| @@ -813,7 +837,7 @@ margins, fringes, header line, and/or mode line. For the pixel edges | |||
| 813 | of just the text area, use `window-inside-absolute-pixel-edges'. */) | 837 | of just the text area, use `window-inside-absolute-pixel-edges'. */) |
| 814 | (Lisp_Object window) | 838 | (Lisp_Object window) |
| 815 | { | 839 | { |
| 816 | register struct window *w = decode_any_window (window); | 840 | register struct window *w = decode_valid_window (window); |
| 817 | int add_x, add_y; | 841 | int add_x, add_y; |
| 818 | calc_absolute_offset (w, &add_x, &add_y); | 842 | calc_absolute_offset (w, &add_x, &add_y); |
| 819 | 843 | ||
| @@ -826,17 +850,19 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */) | |||
| 826 | 850 | ||
| 827 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, | 851 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, |
| 828 | doc: /* Return a list of the edge coordinates of WINDOW. | 852 | doc: /* Return a list of the edge coordinates of WINDOW. |
| 829 | The list has the form (LEFT TOP RIGHT BOTTOM). | 853 | WINDOW must be a live window and defaults to the selected one. |
| 830 | TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, | 854 | |
| 831 | all relative to 0, 0 at top left corner of frame. | 855 | The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM |
| 856 | count by lines, and LEFT and RIGHT count by columns, all relative to 0, | ||
| 857 | 0 at top left corner of frame. | ||
| 832 | 858 | ||
| 833 | RIGHT is one more than the rightmost column of WINDOW's text area. | 859 | RIGHT is one more than the rightmost column of WINDOW's text area. |
| 834 | BOTTOM is one more than the bottommost row of WINDOW's text area. | 860 | BOTTOM is one more than the bottommost row of WINDOW's text area. The |
| 835 | The inside edges do not include the space used by the WINDOW's scroll | 861 | inside edges do not include the space used by the WINDOW's scroll bar, |
| 836 | bar, display margins, fringes, header line, and/or mode line. */) | 862 | display margins, fringes, header line, and/or mode line. */) |
| 837 | (Lisp_Object window) | 863 | (Lisp_Object window) |
| 838 | { | 864 | { |
| 839 | register struct window *w = decode_window (window); | 865 | register struct window *w = decode_live_window (window); |
| 840 | 866 | ||
| 841 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) | 867 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) |
| 842 | + WINDOW_LEFT_MARGIN_COLS (w) | 868 | + WINDOW_LEFT_MARGIN_COLS (w) |
| @@ -852,8 +878,10 @@ bar, display margins, fringes, header line, and/or mode line. */) | |||
| 852 | 878 | ||
| 853 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, | 879 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, |
| 854 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. | 880 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. |
| 855 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) | 881 | WINDOW must be a live window and defaults to the selected one. |
| 856 | at the top left corner of the frame's window area. | 882 | |
| 883 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 884 | (0,0) at the top left corner of the frame's window area. | ||
| 857 | 885 | ||
| 858 | RIGHT is one more than the rightmost x position of WINDOW's text area. | 886 | RIGHT is one more than the rightmost x position of WINDOW's text area. |
| 859 | BOTTOM is one more than the bottommost y position of WINDOW's text area. | 887 | BOTTOM is one more than the bottommost y position of WINDOW's text area. |
| @@ -861,7 +889,7 @@ The inside edges do not include the space used by WINDOW's scroll bar, | |||
| 861 | display margins, fringes, header line, and/or mode line. */) | 889 | display margins, fringes, header line, and/or mode line. */) |
| 862 | (Lisp_Object window) | 890 | (Lisp_Object window) |
| 863 | { | 891 | { |
| 864 | register struct window *w = decode_window (window); | 892 | register struct window *w = decode_live_window (window); |
| 865 | 893 | ||
| 866 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) | 894 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) |
| 867 | + WINDOW_LEFT_MARGIN_WIDTH (w) | 895 | + WINDOW_LEFT_MARGIN_WIDTH (w) |
| @@ -879,8 +907,10 @@ DEFUN ("window-inside-absolute-pixel-edges", | |||
| 879 | Fwindow_inside_absolute_pixel_edges, | 907 | Fwindow_inside_absolute_pixel_edges, |
| 880 | Swindow_inside_absolute_pixel_edges, 0, 1, 0, | 908 | Swindow_inside_absolute_pixel_edges, 0, 1, 0, |
| 881 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. | 909 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. |
| 882 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) | 910 | WINDOW must be a live window and defaults to the selected one. |
| 883 | at the top left corner of the frame's window area. | 911 | |
| 912 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 913 | (0,0) at the top left corner of the frame's window area. | ||
| 884 | 914 | ||
| 885 | RIGHT is one more than the rightmost x position of WINDOW's text area. | 915 | RIGHT is one more than the rightmost x position of WINDOW's text area. |
| 886 | BOTTOM is one more than the bottommost y position of WINDOW's text area. | 916 | BOTTOM is one more than the bottommost y position of WINDOW's text area. |
| @@ -888,7 +918,7 @@ The inside edges do not include the space used by WINDOW's scroll bar, | |||
| 888 | display margins, fringes, header line, and/or mode line. */) | 918 | display margins, fringes, header line, and/or mode line. */) |
| 889 | (Lisp_Object window) | 919 | (Lisp_Object window) |
| 890 | { | 920 | { |
| 891 | register struct window *w = decode_window (window); | 921 | register struct window *w = decode_live_window (window); |
| 892 | int add_x, add_y; | 922 | int add_x, add_y; |
| 893 | calc_absolute_offset (w, &add_x, &add_y); | 923 | calc_absolute_offset (w, &add_x, &add_y); |
| 894 | 924 | ||
| @@ -1067,7 +1097,7 @@ window_relative_x_coord (struct window *w, enum window_part part, int x) | |||
| 1067 | DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | 1097 | DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, |
| 1068 | Scoordinates_in_window_p, 2, 2, 0, | 1098 | Scoordinates_in_window_p, 2, 2, 0, |
| 1069 | doc: /* Return non-nil if COORDINATES are in WINDOW. | 1099 | doc: /* Return non-nil if COORDINATES are in WINDOW. |
| 1070 | WINDOW must be a live window. | 1100 | WINDOW must be a live window and defaults to the selected one. |
| 1071 | COORDINATES is a cons of the form (X . Y), X and Y being distances | 1101 | COORDINATES is a cons of the form (X . Y), X and Y being distances |
| 1072 | measured in characters from the upper-left corner of the frame. | 1102 | measured in characters from the upper-left corner of the frame. |
| 1073 | \(0 . 0) denotes the character in the upper left corner of the | 1103 | \(0 . 0) denotes the character in the upper left corner of the |
| @@ -1089,8 +1119,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ | |||
| 1089 | int x, y; | 1119 | int x, y; |
| 1090 | Lisp_Object lx, ly; | 1120 | Lisp_Object lx, ly; |
| 1091 | 1121 | ||
| 1092 | CHECK_LIVE_WINDOW (window); | 1122 | w = decode_live_window (window); |
| 1093 | w = XWINDOW (window); | ||
| 1094 | f = XFRAME (w->frame); | 1123 | f = XFRAME (w->frame); |
| 1095 | CHECK_CONS (coordinates); | 1124 | CHECK_CONS (coordinates); |
| 1096 | lx = Fcar (coordinates); | 1125 | lx = Fcar (coordinates); |
| @@ -1268,7 +1297,7 @@ of point, outside of any save-excursion forms. | |||
| 1268 | But that is hard to define. */) | 1297 | But that is hard to define. */) |
| 1269 | (Lisp_Object window) | 1298 | (Lisp_Object window) |
| 1270 | { | 1299 | { |
| 1271 | register struct window *w = decode_window (window); | 1300 | register struct window *w = decode_live_window (window); |
| 1272 | 1301 | ||
| 1273 | if (w == XWINDOW (selected_window) | 1302 | if (w == XWINDOW (selected_window) |
| 1274 | && current_buffer == XBUFFER (w->buffer)) | 1303 | && current_buffer == XBUFFER (w->buffer)) |
| @@ -1282,7 +1311,7 @@ WINDOW must be a live window and defaults to the selected one. | |||
| 1282 | This is updated by redisplay or by calling `set-window-start'. */) | 1311 | This is updated by redisplay or by calling `set-window-start'. */) |
| 1283 | (Lisp_Object window) | 1312 | (Lisp_Object window) |
| 1284 | { | 1313 | { |
| 1285 | return Fmarker_position (decode_window (window)->start); | 1314 | return Fmarker_position (decode_live_window (window)->start); |
| 1286 | } | 1315 | } |
| 1287 | 1316 | ||
| 1288 | /* This is text temporarily removed from the doc string below. | 1317 | /* This is text temporarily removed from the doc string below. |
| @@ -1309,7 +1338,7 @@ if it isn't already recorded. */) | |||
| 1309 | (Lisp_Object window, Lisp_Object update) | 1338 | (Lisp_Object window, Lisp_Object update) |
| 1310 | { | 1339 | { |
| 1311 | Lisp_Object value; | 1340 | Lisp_Object value; |
| 1312 | struct window *w = decode_window (window); | 1341 | struct window *w = decode_live_window (window); |
| 1313 | Lisp_Object buf; | 1342 | Lisp_Object buf; |
| 1314 | struct buffer *b; | 1343 | struct buffer *b; |
| 1315 | 1344 | ||
| @@ -1376,10 +1405,11 @@ if it isn't already recorded. */) | |||
| 1376 | 1405 | ||
| 1377 | DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, | 1406 | DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, |
| 1378 | doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. | 1407 | doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. |
| 1408 | WINDOW must be a live window and defaults to the selected one. | ||
| 1379 | Return POS. */) | 1409 | Return POS. */) |
| 1380 | (Lisp_Object window, Lisp_Object pos) | 1410 | (Lisp_Object window, Lisp_Object pos) |
| 1381 | { | 1411 | { |
| 1382 | register struct window *w = decode_window (window); | 1412 | register struct window *w = decode_live_window (window); |
| 1383 | 1413 | ||
| 1384 | CHECK_NUMBER_COERCE_MARKER (pos); | 1414 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1385 | if (w == XWINDOW (selected_window) | 1415 | if (w == XWINDOW (selected_window) |
| @@ -1398,12 +1428,12 @@ Return POS. */) | |||
| 1398 | 1428 | ||
| 1399 | DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, | 1429 | DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, |
| 1400 | doc: /* Make display in WINDOW start at position POS in WINDOW's buffer. | 1430 | doc: /* Make display in WINDOW start at position POS in WINDOW's buffer. |
| 1401 | If WINDOW is nil, the selected window is used. Return POS. | 1431 | WINDOW must be a live window and defaults to the selected one. Return |
| 1402 | Optional third arg NOFORCE non-nil inhibits next redisplay from | 1432 | POS. Optional third arg NOFORCE non-nil inhibits next redisplay from |
| 1403 | overriding motion of point in order to display at this exact start. */) | 1433 | overriding motion of point in order to display at this exact start. */) |
| 1404 | (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) | 1434 | (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) |
| 1405 | { | 1435 | { |
| 1406 | register struct window *w = decode_window (window); | 1436 | register struct window *w = decode_live_window (window); |
| 1407 | 1437 | ||
| 1408 | CHECK_NUMBER_COERCE_MARKER (pos); | 1438 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1409 | set_marker_restricted (w->start, pos, w->buffer); | 1439 | set_marker_restricted (w->start, pos, w->buffer); |
| @@ -1423,12 +1453,14 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1423 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | 1453 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, |
| 1424 | Spos_visible_in_window_p, 0, 3, 0, | 1454 | Spos_visible_in_window_p, 0, 3, 0, |
| 1425 | doc: /* Return non-nil if position POS is currently on the frame in WINDOW. | 1455 | doc: /* Return non-nil if position POS is currently on the frame in WINDOW. |
| 1426 | Return nil if that position is scrolled vertically out of view. | 1456 | WINDOW must be a live window and defaults to the selected one. |
| 1427 | If a character is only partially visible, nil is returned, unless the | 1457 | |
| 1428 | optional argument PARTIALLY is non-nil. | 1458 | Return nil if that position is scrolled vertically out of view. If a |
| 1429 | If POS is only out of view because of horizontal scrolling, return non-nil. | 1459 | character is only partially visible, nil is returned, unless the |
| 1430 | If POS is t, it specifies the position of the last visible glyph in WINDOW. | 1460 | optional argument PARTIALLY is non-nil. If POS is only out of view |
| 1431 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. | 1461 | because of horizontal scrolling, return non-nil. If POS is t, it |
| 1462 | specifies the position of the last visible glyph in WINDOW. POS | ||
| 1463 | defaults to point in WINDOW; WINDOW defaults to the selected window. | ||
| 1432 | 1464 | ||
| 1433 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | 1465 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, |
| 1434 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), | 1466 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), |
| @@ -1447,7 +1479,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1447 | int rtop, rbot, rowh, vpos, fully_p = 1; | 1479 | int rtop, rbot, rowh, vpos, fully_p = 1; |
| 1448 | int x, y; | 1480 | int x, y; |
| 1449 | 1481 | ||
| 1450 | w = decode_window (window); | 1482 | w = decode_live_window (window); |
| 1451 | buf = XBUFFER (w->buffer); | 1483 | buf = XBUFFER (w->buffer); |
| 1452 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1484 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1453 | 1485 | ||
| @@ -1489,7 +1521,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1489 | DEFUN ("window-line-height", Fwindow_line_height, | 1521 | DEFUN ("window-line-height", Fwindow_line_height, |
| 1490 | Swindow_line_height, 0, 2, 0, | 1522 | Swindow_line_height, 0, 2, 0, |
| 1491 | doc: /* Return height in pixels of text line LINE in window WINDOW. | 1523 | doc: /* Return height in pixels of text line LINE in window WINDOW. |
| 1492 | WINDOW defaults to the selected window. | 1524 | WINDOW must be a live window and defaults to the selected one. |
| 1493 | 1525 | ||
| 1494 | Return height of current line if LINE is omitted or nil. Return height of | 1526 | Return height of current line if LINE is omitted or nil. Return height of |
| 1495 | header or mode line if LINE is `header-line' or `mode-line'. | 1527 | header or mode line if LINE is `header-line' or `mode-line'. |
| @@ -1513,7 +1545,7 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1513 | int max_y, crop, i; | 1545 | int max_y, crop, i; |
| 1514 | EMACS_INT n; | 1546 | EMACS_INT n; |
| 1515 | 1547 | ||
| 1516 | w = decode_window (window); | 1548 | w = decode_live_window (window); |
| 1517 | 1549 | ||
| 1518 | if (noninteractive || w->pseudo_window_p) | 1550 | if (noninteractive || w->pseudo_window_p) |
| 1519 | return Qnil; | 1551 | return Qnil; |
| @@ -1601,8 +1633,8 @@ DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | |||
| 1601 | More precisely, return the value assigned by the last call of | 1633 | More precisely, return the value assigned by the last call of |
| 1602 | `set-window-dedicated-p' for WINDOW. Return nil if that function was | 1634 | `set-window-dedicated-p' for WINDOW. Return nil if that function was |
| 1603 | never called with WINDOW as its argument, or the value set by that | 1635 | never called with WINDOW as its argument, or the value set by that |
| 1604 | function was internally reset since its last call. WINDOW defaults to | 1636 | function was internally reset since its last call. WINDOW must be a |
| 1605 | the selected window. | 1637 | live window and defaults to the selected one. |
| 1606 | 1638 | ||
| 1607 | When a window is dedicated to its buffer, `display-buffer' will refrain | 1639 | When a window is dedicated to its buffer, `display-buffer' will refrain |
| 1608 | from displaying another buffer in it. `get-lru-window' and | 1640 | from displaying another buffer in it. `get-lru-window' and |
| @@ -1615,7 +1647,7 @@ window, unless that window is "strongly" dedicated to its buffer, that | |||
| 1615 | is the value returned by `window-dedicated-p' is t. */) | 1647 | is the value returned by `window-dedicated-p' is t. */) |
| 1616 | (Lisp_Object window) | 1648 | (Lisp_Object window) |
| 1617 | { | 1649 | { |
| 1618 | return decode_window (window)->dedicated; | 1650 | return decode_live_window (window)->dedicated; |
| 1619 | } | 1651 | } |
| 1620 | 1652 | ||
| 1621 | DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, | 1653 | DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
| @@ -1639,10 +1671,7 @@ buffer. If and when `set-window-buffer' displays another buffer in a | |||
| 1639 | window, it also makes sure that the window is no more dedicated. */) | 1671 | window, it also makes sure that the window is no more dedicated. */) |
| 1640 | (Lisp_Object window, Lisp_Object flag) | 1672 | (Lisp_Object window, Lisp_Object flag) |
| 1641 | { | 1673 | { |
| 1642 | register struct window *w = decode_window (window); | 1674 | return WSET (decode_live_window (window), dedicated, flag); |
| 1643 | |||
| 1644 | w->dedicated = flag; | ||
| 1645 | return w->dedicated; | ||
| 1646 | } | 1675 | } |
| 1647 | 1676 | ||
| 1648 | DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, | 1677 | DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, |
| @@ -1655,7 +1684,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the | |||
| 1655 | window for that buffer, and POS is a window-specific point value. */) | 1684 | window for that buffer, and POS is a window-specific point value. */) |
| 1656 | (Lisp_Object window) | 1685 | (Lisp_Object window) |
| 1657 | { | 1686 | { |
| 1658 | return decode_window (window)->prev_buffers; | 1687 | return decode_live_window (window)->prev_buffers; |
| 1659 | } | 1688 | } |
| 1660 | 1689 | ||
| 1661 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, | 1690 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, |
| @@ -1668,7 +1697,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the | |||
| 1668 | window for that buffer, and POS is a window-specific point value. */) | 1697 | window for that buffer, and POS is a window-specific point value. */) |
| 1669 | (Lisp_Object window, Lisp_Object prev_buffers) | 1698 | (Lisp_Object window, Lisp_Object prev_buffers) |
| 1670 | { | 1699 | { |
| 1671 | return decode_window (window)->prev_buffers = prev_buffers; | 1700 | return WSET (decode_live_window (window), prev_buffers, prev_buffers); |
| 1672 | } | 1701 | } |
| 1673 | 1702 | ||
| 1674 | DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, | 1703 | DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, |
| @@ -1677,7 +1706,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, | |||
| 1677 | WINDOW must be a live window and defaults to the selected one. */) | 1706 | WINDOW must be a live window and defaults to the selected one. */) |
| 1678 | (Lisp_Object window) | 1707 | (Lisp_Object window) |
| 1679 | { | 1708 | { |
| 1680 | return decode_window (window)->next_buffers; | 1709 | return decode_live_window (window)->next_buffers; |
| 1681 | } | 1710 | } |
| 1682 | 1711 | ||
| 1683 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, | 1712 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, |
| @@ -1687,43 +1716,45 @@ WINDOW must be a live window and defaults to the selected one. | |||
| 1687 | NEXT-BUFFERS should be a list of buffers. */) | 1716 | NEXT-BUFFERS should be a list of buffers. */) |
| 1688 | (Lisp_Object window, Lisp_Object next_buffers) | 1717 | (Lisp_Object window, Lisp_Object next_buffers) |
| 1689 | { | 1718 | { |
| 1690 | return decode_window (window)->next_buffers = next_buffers; | 1719 | return WSET (decode_live_window (window), next_buffers, next_buffers); |
| 1691 | } | 1720 | } |
| 1692 | 1721 | ||
| 1693 | DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, | 1722 | DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, |
| 1694 | 0, 1, 0, | 1723 | 0, 1, 0, |
| 1695 | doc: /* Return the parameters of WINDOW and their values. | 1724 | doc: /* Return the parameters of WINDOW and their values. |
| 1696 | WINDOW defaults to the selected window. The return value is a list of | 1725 | WINDOW must be a valid window and defaults to the selected one. The |
| 1697 | elements of the form (PARAMETER . VALUE). */) | 1726 | return value is a list of elements of the form (PARAMETER . VALUE). */) |
| 1698 | (Lisp_Object window) | 1727 | (Lisp_Object window) |
| 1699 | { | 1728 | { |
| 1700 | return Fcopy_alist (decode_any_window (window)->window_parameters); | 1729 | return Fcopy_alist (decode_valid_window (window)->window_parameters); |
| 1701 | } | 1730 | } |
| 1702 | 1731 | ||
| 1703 | DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, | 1732 | DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, |
| 1704 | 2, 2, 0, | 1733 | 2, 2, 0, |
| 1705 | doc: /* Return WINDOW's value for PARAMETER. | 1734 | doc: /* Return WINDOW's value for PARAMETER. |
| 1706 | WINDOW defaults to the selected window. */) | 1735 | WINDOW must be a valid window and defaults to the selected one. */) |
| 1707 | (Lisp_Object window, Lisp_Object parameter) | 1736 | (Lisp_Object window, Lisp_Object parameter) |
| 1708 | { | 1737 | { |
| 1709 | Lisp_Object result; | 1738 | Lisp_Object result; |
| 1710 | 1739 | ||
| 1711 | result = Fassq (parameter, decode_any_window (window)->window_parameters); | 1740 | result = Fassq (parameter, decode_valid_window (window)->window_parameters); |
| 1712 | return CDR_SAFE (result); | 1741 | return CDR_SAFE (result); |
| 1713 | } | 1742 | } |
| 1714 | 1743 | ||
| 1715 | DEFUN ("set-window-parameter", Fset_window_parameter, | 1744 | DEFUN ("set-window-parameter", Fset_window_parameter, |
| 1716 | Sset_window_parameter, 3, 3, 0, | 1745 | Sset_window_parameter, 3, 3, 0, |
| 1717 | doc: /* Set WINDOW's value of PARAMETER to VALUE. | 1746 | doc: /* Set WINDOW's value of PARAMETER to VALUE. |
| 1718 | WINDOW defaults to the selected window. Return VALUE. */) | 1747 | WINDOW must be a valid window and defaults to the selected one. |
| 1748 | Return VALUE. */) | ||
| 1719 | (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) | 1749 | (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) |
| 1720 | { | 1750 | { |
| 1721 | register struct window *w = decode_any_window (window); | 1751 | register struct window *w = decode_valid_window (window); |
| 1722 | Lisp_Object old_alist_elt; | 1752 | Lisp_Object old_alist_elt; |
| 1723 | 1753 | ||
| 1724 | old_alist_elt = Fassq (parameter, w->window_parameters); | 1754 | old_alist_elt = Fassq (parameter, w->window_parameters); |
| 1725 | if (NILP (old_alist_elt)) | 1755 | if (NILP (old_alist_elt)) |
| 1726 | w->window_parameters = Fcons (Fcons (parameter, value), w->window_parameters); | 1756 | WSET (w, window_parameters, |
| 1757 | Fcons (Fcons (parameter, value), w->window_parameters)); | ||
| 1727 | else | 1758 | else |
| 1728 | Fsetcdr (old_alist_elt, value); | 1759 | Fsetcdr (old_alist_elt, value); |
| 1729 | return value; | 1760 | return value; |
| @@ -1732,10 +1763,10 @@ WINDOW defaults to the selected window. Return VALUE. */) | |||
| 1732 | DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | 1763 | DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, |
| 1733 | 0, 1, 0, | 1764 | 0, 1, 0, |
| 1734 | doc: /* Return the display-table that WINDOW is using. | 1765 | doc: /* Return the display-table that WINDOW is using. |
| 1735 | WINDOW defaults to the selected window. */) | 1766 | WINDOW must be a live window and defaults to the selected one. */) |
| 1736 | (Lisp_Object window) | 1767 | (Lisp_Object window) |
| 1737 | { | 1768 | { |
| 1738 | return decode_window (window)->display_table; | 1769 | return decode_live_window (window)->display_table; |
| 1739 | } | 1770 | } |
| 1740 | 1771 | ||
| 1741 | /* Get the display table for use on window W. This is either W's | 1772 | /* Get the display table for use on window W. This is either W's |
| @@ -1764,14 +1795,11 @@ window_display_table (struct window *w) | |||
| 1764 | } | 1795 | } |
| 1765 | 1796 | ||
| 1766 | DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, | 1797 | DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, |
| 1767 | doc: /* Set WINDOW's display-table to TABLE. */) | 1798 | doc: /* Set WINDOW's display-table to TABLE. |
| 1799 | WINDOW must be a live window and defaults to the selected one. */) | ||
| 1768 | (register Lisp_Object window, Lisp_Object table) | 1800 | (register Lisp_Object window, Lisp_Object table) |
| 1769 | { | 1801 | { |
| 1770 | register struct window *w; | 1802 | return WSET (decode_live_window (window), display_table, table); |
| 1771 | |||
| 1772 | w = decode_window (window); | ||
| 1773 | w->display_table = table; | ||
| 1774 | return table; | ||
| 1775 | } | 1803 | } |
| 1776 | 1804 | ||
| 1777 | /* Record info on buffer window W is displaying | 1805 | /* Record info on buffer window W is displaying |
| @@ -1820,7 +1848,7 @@ unshow_buffer (register struct window *w) | |||
| 1820 | 1848 | ||
| 1821 | if (WINDOWP (BVAR (b, last_selected_window)) | 1849 | if (WINDOWP (BVAR (b, last_selected_window)) |
| 1822 | && w == XWINDOW (BVAR (b, last_selected_window))) | 1850 | && w == XWINDOW (BVAR (b, last_selected_window))) |
| 1823 | BVAR (b, last_selected_window) = Qnil; | 1851 | BSET (b, last_selected_window, Qnil); |
| 1824 | } | 1852 | } |
| 1825 | 1853 | ||
| 1826 | /* Put NEW into the window structure in place of OLD. SETFLAG zero | 1854 | /* Put NEW into the window structure in place of OLD. SETFLAG zero |
| @@ -1835,18 +1863,18 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 1835 | /* If OLD is its frame's root window, then NEW is the new | 1863 | /* If OLD is its frame's root window, then NEW is the new |
| 1836 | root window for that frame. */ | 1864 | root window for that frame. */ |
| 1837 | if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) | 1865 | if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) |
| 1838 | FRAME_ROOT_WINDOW (XFRAME (o->frame)) = new; | 1866 | FSET (XFRAME (o->frame), root_window, new); |
| 1839 | 1867 | ||
| 1840 | if (setflag) | 1868 | if (setflag) |
| 1841 | { | 1869 | { |
| 1842 | n->left_col = o->left_col; | 1870 | WSET (n, left_col, o->left_col); |
| 1843 | n->top_line = o->top_line; | 1871 | WSET (n, top_line, o->top_line); |
| 1844 | n->total_cols = o->total_cols; | 1872 | WSET (n, total_cols, o->total_cols); |
| 1845 | n->total_lines = o->total_lines; | 1873 | WSET (n, total_lines, o->total_lines); |
| 1846 | n->normal_cols = o->normal_cols; | 1874 | WSET (n, normal_cols, o->normal_cols); |
| 1847 | o->normal_cols = make_float (1.0); | 1875 | WSET (o, normal_cols, make_float (1.0)); |
| 1848 | n->normal_lines = o->normal_lines; | 1876 | WSET (n, normal_lines, o->normal_lines); |
| 1849 | o->normal_lines = make_float (1.0); | 1877 | WSET (o, normal_lines, make_float (1.0)); |
| 1850 | n->desired_matrix = n->current_matrix = 0; | 1878 | n->desired_matrix = n->current_matrix = 0; |
| 1851 | n->vscroll = 0; | 1879 | n->vscroll = 0; |
| 1852 | memset (&n->cursor, 0, sizeof (n->cursor)); | 1880 | memset (&n->cursor, 0, sizeof (n->cursor)); |
| @@ -1856,27 +1884,30 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 1856 | n->phys_cursor_width = -1; | 1884 | n->phys_cursor_width = -1; |
| 1857 | n->must_be_updated_p = 0; | 1885 | n->must_be_updated_p = 0; |
| 1858 | n->pseudo_window_p = 0; | 1886 | n->pseudo_window_p = 0; |
| 1859 | XSETFASTINT (n->window_end_vpos, 0); | 1887 | WSET (n, window_end_vpos, make_number (0)); |
| 1860 | XSETFASTINT (n->window_end_pos, 0); | 1888 | WSET (n, window_end_pos, make_number (0)); |
| 1861 | n->window_end_valid = Qnil; | 1889 | WSET (n, window_end_valid, Qnil); |
| 1862 | n->frozen_window_start_p = 0; | 1890 | n->frozen_window_start_p = 0; |
| 1863 | } | 1891 | } |
| 1864 | 1892 | ||
| 1865 | n->next = tem = o->next; | 1893 | tem = o->next; |
| 1894 | WSET (n, next, tem); | ||
| 1866 | if (!NILP (tem)) | 1895 | if (!NILP (tem)) |
| 1867 | XWINDOW (tem)->prev = new; | 1896 | WSET (XWINDOW (tem), prev, new); |
| 1868 | 1897 | ||
| 1869 | n->prev = tem = o->prev; | 1898 | tem = o->prev; |
| 1899 | WSET (n, prev, tem); | ||
| 1870 | if (!NILP (tem)) | 1900 | if (!NILP (tem)) |
| 1871 | XWINDOW (tem)->next = new; | 1901 | WSET (XWINDOW (tem), next, new); |
| 1872 | 1902 | ||
| 1873 | n->parent = tem = o->parent; | 1903 | tem = o->parent; |
| 1904 | WSET (n, parent, tem); | ||
| 1874 | if (!NILP (tem)) | 1905 | if (!NILP (tem)) |
| 1875 | { | 1906 | { |
| 1876 | if (EQ (XWINDOW (tem)->vchild, old)) | 1907 | if (EQ (XWINDOW (tem)->vchild, old)) |
| 1877 | XWINDOW (tem)->vchild = new; | 1908 | WSET (XWINDOW (tem), vchild, new); |
| 1878 | if (EQ (XWINDOW (tem)->hchild, old)) | 1909 | if (EQ (XWINDOW (tem)->hchild, old)) |
| 1879 | XWINDOW (tem)->hchild = new; | 1910 | WSET (XWINDOW (tem), hchild, new); |
| 1880 | } | 1911 | } |
| 1881 | } | 1912 | } |
| 1882 | 1913 | ||
| @@ -1909,34 +1940,34 @@ recombine_windows (Lisp_Object window) | |||
| 1909 | assign new normal sizes. */ | 1940 | assign new normal sizes. */ |
| 1910 | if (NILP (w->prev)) | 1941 | if (NILP (w->prev)) |
| 1911 | if (horflag) | 1942 | if (horflag) |
| 1912 | p->hchild = child; | 1943 | WSET (p, hchild, child); |
| 1913 | else | 1944 | else |
| 1914 | p->vchild = child; | 1945 | WSET (p, vchild, child); |
| 1915 | else | 1946 | else |
| 1916 | { | 1947 | { |
| 1917 | c->prev = w->prev; | 1948 | WSET (c, prev, w->prev); |
| 1918 | XWINDOW (w->prev)->next = child; | 1949 | WSET (XWINDOW (w->prev), next, child); |
| 1919 | } | 1950 | } |
| 1920 | 1951 | ||
| 1921 | while (c) | 1952 | while (c) |
| 1922 | { | 1953 | { |
| 1923 | c->parent = parent; | 1954 | WSET (c, parent, parent); |
| 1924 | 1955 | ||
| 1925 | if (horflag) | 1956 | if (horflag) |
| 1926 | c->normal_cols | 1957 | WSET (c, normal_cols, |
| 1927 | = make_float (XFLOATINT (c->total_cols) | 1958 | make_float (XFLOATINT (c->total_cols) |
| 1928 | / XFLOATINT (p->total_cols)); | 1959 | / XFLOATINT (p->total_cols))); |
| 1929 | else | 1960 | else |
| 1930 | c->normal_lines | 1961 | WSET (c, normal_lines, |
| 1931 | = make_float (XFLOATINT (c->total_lines) | 1962 | make_float (XFLOATINT (c->total_lines) |
| 1932 | / XFLOATINT (p->total_lines)); | 1963 | / XFLOATINT (p->total_lines))); |
| 1933 | 1964 | ||
| 1934 | if (NILP (c->next)) | 1965 | if (NILP (c->next)) |
| 1935 | { | 1966 | { |
| 1936 | if (!NILP (w->next)) | 1967 | if (!NILP (w->next)) |
| 1937 | { | 1968 | { |
| 1938 | c->next = w->next; | 1969 | WSET (c, next, w->next); |
| 1939 | XWINDOW (c->next)->prev = child; | 1970 | WSET (XWINDOW (c->next), prev, child); |
| 1940 | } | 1971 | } |
| 1941 | 1972 | ||
| 1942 | c = 0; | 1973 | c = 0; |
| @@ -1949,7 +1980,8 @@ recombine_windows (Lisp_Object window) | |||
| 1949 | } | 1980 | } |
| 1950 | 1981 | ||
| 1951 | /* WINDOW can be deleted now. */ | 1982 | /* WINDOW can be deleted now. */ |
| 1952 | w->vchild = w->hchild = Qnil; | 1983 | WSET (w, vchild, Qnil); |
| 1984 | WSET (w, hchild, Qnil); | ||
| 1953 | } | 1985 | } |
| 1954 | } | 1986 | } |
| 1955 | } | 1987 | } |
| @@ -2114,9 +2146,10 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object | |||
| 2114 | 2146 | ||
| 2115 | /* ALL_FRAMES nil doesn't specify which frames to include. */ | 2147 | /* ALL_FRAMES nil doesn't specify which frames to include. */ |
| 2116 | if (NILP (*all_frames)) | 2148 | if (NILP (*all_frames)) |
| 2117 | *all_frames = (!EQ (*minibuf, Qlambda) | 2149 | *all_frames |
| 2118 | ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) | 2150 | = (!EQ (*minibuf, Qlambda) |
| 2119 | : Qnil); | 2151 | ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) |
| 2152 | : Qnil); | ||
| 2120 | else if (EQ (*all_frames, Qvisible)) | 2153 | else if (EQ (*all_frames, Qvisible)) |
| 2121 | ; | 2154 | ; |
| 2122 | else if (EQ (*all_frames, make_number (0))) | 2155 | else if (EQ (*all_frames, make_number (0))) |
| @@ -2469,7 +2502,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2469 | if (EQ (w->buffer, obj)) | 2502 | if (EQ (w->buffer, obj)) |
| 2470 | { | 2503 | { |
| 2471 | /* Undedicate WINDOW. */ | 2504 | /* Undedicate WINDOW. */ |
| 2472 | w->dedicated = Qnil; | 2505 | WSET (w, dedicated, Qnil); |
| 2473 | /* Make WINDOW show the buffer returned by | 2506 | /* Make WINDOW show the buffer returned by |
| 2474 | other_buffer_safely, don't run any hooks. */ | 2507 | other_buffer_safely, don't run any hooks. */ |
| 2475 | set_window_buffer | 2508 | set_window_buffer |
| @@ -2562,8 +2595,8 @@ resize_root_window (Lisp_Object window, Lisp_Object delta, Lisp_Object horizonta | |||
| 2562 | DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, | 2595 | DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, |
| 2563 | Sdelete_other_windows_internal, 0, 2, "", | 2596 | Sdelete_other_windows_internal, 0, 2, "", |
| 2564 | doc: /* Make WINDOW fill its frame. | 2597 | doc: /* Make WINDOW fill its frame. |
| 2565 | Only the frame WINDOW is on is affected. WINDOW may be any window and | 2598 | Only the frame WINDOW is on is affected. WINDOW must be a valid window |
| 2566 | defaults to the selected one. | 2599 | and defaults to the selected one. |
| 2567 | 2600 | ||
| 2568 | Optional argument ROOT, if non-nil, must specify an internal window such | 2601 | Optional argument ROOT, if non-nil, must specify an internal window such |
| 2569 | that WINDOW is in its window subtree. If this is the case, replace ROOT | 2602 | that WINDOW is in its window subtree. If this is the case, replace ROOT |
| @@ -2582,7 +2615,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2582 | ptrdiff_t startpos IF_LINT (= 0); | 2615 | ptrdiff_t startpos IF_LINT (= 0); |
| 2583 | int top IF_LINT (= 0), new_top, resize_failed; | 2616 | int top IF_LINT (= 0), new_top, resize_failed; |
| 2584 | 2617 | ||
| 2585 | w = decode_any_window (window); | 2618 | w = decode_valid_window (window); |
| 2586 | XSETWINDOW (window, w); | 2619 | XSETWINDOW (window, w); |
| 2587 | f = XFRAME (w->frame); | 2620 | f = XFRAME (w->frame); |
| 2588 | 2621 | ||
| @@ -2595,7 +2628,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2595 | else | 2628 | else |
| 2596 | /* ROOT must be an ancestor of WINDOW. */ | 2629 | /* ROOT must be an ancestor of WINDOW. */ |
| 2597 | { | 2630 | { |
| 2598 | r = decode_any_window (root); | 2631 | r = decode_valid_window (root); |
| 2599 | pwindow = XWINDOW (window)->parent; | 2632 | pwindow = XWINDOW (window)->parent; |
| 2600 | while (!NILP (pwindow)) | 2633 | while (!NILP (pwindow)) |
| 2601 | if (EQ (pwindow, root)) | 2634 | if (EQ (pwindow, root)) |
| @@ -2626,7 +2659,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2626 | if (EQ (selected_frame, w->frame)) | 2659 | if (EQ (selected_frame, w->frame)) |
| 2627 | Fselect_window (window, Qnil); | 2660 | Fselect_window (window, Qnil); |
| 2628 | else | 2661 | else |
| 2629 | FRAME_SELECTED_WINDOW (f) = window; | 2662 | FSET (f, selected_window, window); |
| 2630 | } | 2663 | } |
| 2631 | } | 2664 | } |
| 2632 | else | 2665 | else |
| @@ -2656,7 +2689,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2656 | if (EQ (selected_frame, w->frame)) | 2689 | if (EQ (selected_frame, w->frame)) |
| 2657 | Fselect_window (swindow, Qnil); | 2690 | Fselect_window (swindow, Qnil); |
| 2658 | else | 2691 | else |
| 2659 | FRAME_SELECTED_WINDOW (f) = swindow; | 2692 | FSET (f, selected_window, swindow); |
| 2660 | } | 2693 | } |
| 2661 | } | 2694 | } |
| 2662 | 2695 | ||
| @@ -2689,8 +2722,9 @@ window-start value is reasonable when this function is called. */) | |||
| 2689 | if (NILP (w->buffer)) | 2722 | if (NILP (w->buffer)) |
| 2690 | { | 2723 | { |
| 2691 | /* Resize child windows vertically. */ | 2724 | /* Resize child windows vertically. */ |
| 2692 | XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); | 2725 | XSETINT (delta, XINT (r->total_lines) |
| 2693 | w->top_line = r->top_line; | 2726 | - XINT (w->total_lines)); |
| 2727 | WSET (w, top_line, r->top_line); | ||
| 2694 | resize_root_window (window, delta, Qnil, Qnil); | 2728 | resize_root_window (window, delta, Qnil, Qnil); |
| 2695 | if (window_resize_check (w, 0)) | 2729 | if (window_resize_check (w, 0)) |
| 2696 | window_resize_apply (w, 0); | 2730 | window_resize_apply (w, 0); |
| @@ -2706,9 +2740,10 @@ window-start value is reasonable when this function is called. */) | |||
| 2706 | /* Resize child windows horizontally. */ | 2740 | /* Resize child windows horizontally. */ |
| 2707 | if (!resize_failed) | 2741 | if (!resize_failed) |
| 2708 | { | 2742 | { |
| 2709 | w->left_col = r->left_col; | 2743 | WSET (w, left_col, r->left_col); |
| 2710 | XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols)); | 2744 | XSETINT (delta, XINT (r->total_cols) |
| 2711 | w->left_col = r->left_col; | 2745 | - XINT (w->total_cols)); |
| 2746 | WSET (w, left_col, r->left_col); | ||
| 2712 | resize_root_window (window, delta, Qt, Qnil); | 2747 | resize_root_window (window, delta, Qt, Qnil); |
| 2713 | if (window_resize_check (w, 1)) | 2748 | if (window_resize_check (w, 1)) |
| 2714 | window_resize_apply (w, 1); | 2749 | window_resize_apply (w, 1); |
| @@ -2736,32 +2771,32 @@ window-start value is reasonable when this function is called. */) | |||
| 2736 | { | 2771 | { |
| 2737 | sibling = w->prev; | 2772 | sibling = w->prev; |
| 2738 | s = XWINDOW (sibling); | 2773 | s = XWINDOW (sibling); |
| 2739 | s->next = w->next; | 2774 | WSET (s, next, w->next); |
| 2740 | if (!NILP (s->next)) | 2775 | if (!NILP (s->next)) |
| 2741 | XWINDOW (s->next)->prev = sibling; | 2776 | WSET (XWINDOW (s->next), prev, sibling); |
| 2742 | } | 2777 | } |
| 2743 | else | 2778 | else |
| 2744 | /* Get SIBLING below (on the right of) WINDOW. */ | 2779 | /* Get SIBLING below (on the right of) WINDOW. */ |
| 2745 | { | 2780 | { |
| 2746 | sibling = w->next; | 2781 | sibling = w->next; |
| 2747 | s = XWINDOW (sibling); | 2782 | s = XWINDOW (sibling); |
| 2748 | s->prev = Qnil; | 2783 | WSET (s, prev, Qnil); |
| 2749 | if (!NILP (XWINDOW (w->parent)->vchild)) | 2784 | if (!NILP (XWINDOW (w->parent)->vchild)) |
| 2750 | XWINDOW (w->parent)->vchild = sibling; | 2785 | WSET (XWINDOW (w->parent), vchild, sibling); |
| 2751 | else | 2786 | else |
| 2752 | XWINDOW (w->parent)->hchild = sibling; | 2787 | WSET (XWINDOW (w->parent), hchild, sibling); |
| 2753 | } | 2788 | } |
| 2754 | 2789 | ||
| 2755 | /* Delete ROOT and all child windows of ROOT. */ | 2790 | /* Delete ROOT and all child windows of ROOT. */ |
| 2756 | if (!NILP (r->vchild)) | 2791 | if (!NILP (r->vchild)) |
| 2757 | { | 2792 | { |
| 2758 | delete_all_child_windows (r->vchild); | 2793 | delete_all_child_windows (r->vchild); |
| 2759 | r->vchild = Qnil; | 2794 | WSET (r, vchild, Qnil); |
| 2760 | } | 2795 | } |
| 2761 | else if (!NILP (r->hchild)) | 2796 | else if (!NILP (r->hchild)) |
| 2762 | { | 2797 | { |
| 2763 | delete_all_child_windows (r->hchild); | 2798 | delete_all_child_windows (r->hchild); |
| 2764 | r->hchild = Qnil; | 2799 | WSET (r, hchild, Qnil); |
| 2765 | } | 2800 | } |
| 2766 | 2801 | ||
| 2767 | replace_window (root, window, 1); | 2802 | replace_window (root, window, 1); |
| @@ -2788,7 +2823,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2788 | pos = *vmotion (startpos, -top, w); | 2823 | pos = *vmotion (startpos, -top, w); |
| 2789 | 2824 | ||
| 2790 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); | 2825 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); |
| 2791 | w->window_end_valid = Qnil; | 2826 | WSET (w, window_end_valid, Qnil); |
| 2792 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE | 2827 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE |
| 2793 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); | 2828 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); |
| 2794 | /* We need to do this, so that the window-scroll-functions | 2829 | /* We need to do this, so that the window-scroll-functions |
| @@ -2878,13 +2913,15 @@ adjust_window_margins (struct window *w) | |||
| 2878 | if (WINDOW_RIGHT_MARGIN_COLS (w) > 0) | 2913 | if (WINDOW_RIGHT_MARGIN_COLS (w) > 0) |
| 2879 | { | 2914 | { |
| 2880 | if (WINDOW_LEFT_MARGIN_COLS (w) > 0) | 2915 | if (WINDOW_LEFT_MARGIN_COLS (w) > 0) |
| 2881 | w->left_margin_cols = w->right_margin_cols | 2916 | { |
| 2882 | = make_number (margin_cols/2); | 2917 | WSET (w, left_margin_cols, make_number (margin_cols / 2)); |
| 2918 | WSET (w, right_margin_cols, make_number (margin_cols / 2)); | ||
| 2919 | } | ||
| 2883 | else | 2920 | else |
| 2884 | w->right_margin_cols = make_number (margin_cols); | 2921 | WSET (w, right_margin_cols, make_number (margin_cols)); |
| 2885 | } | 2922 | } |
| 2886 | else | 2923 | else |
| 2887 | w->left_margin_cols = make_number (margin_cols); | 2924 | WSET (w, left_margin_cols, make_number (margin_cols)); |
| 2888 | return 1; | 2925 | return 1; |
| 2889 | } | 2926 | } |
| 2890 | 2927 | ||
| @@ -2984,23 +3021,23 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 2984 | ptrdiff_t count = SPECPDL_INDEX (); | 3021 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2985 | int samebuf = EQ (buffer, w->buffer); | 3022 | int samebuf = EQ (buffer, w->buffer); |
| 2986 | 3023 | ||
| 2987 | w->buffer = buffer; | 3024 | WSET (w, buffer, buffer); |
| 2988 | 3025 | ||
| 2989 | if (EQ (window, selected_window)) | 3026 | if (EQ (window, selected_window)) |
| 2990 | BVAR (b, last_selected_window) = window; | 3027 | BSET (b, last_selected_window, window); |
| 2991 | 3028 | ||
| 2992 | /* Let redisplay errors through. */ | 3029 | /* Let redisplay errors through. */ |
| 2993 | b->display_error_modiff = 0; | 3030 | b->display_error_modiff = 0; |
| 2994 | 3031 | ||
| 2995 | /* Update time stamps of buffer display. */ | 3032 | /* Update time stamps of buffer display. */ |
| 2996 | if (INTEGERP (BVAR (b, display_count))) | 3033 | if (INTEGERP (BVAR (b, display_count))) |
| 2997 | XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); | 3034 | BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1)); |
| 2998 | BVAR (b, display_time) = Fcurrent_time (); | 3035 | BSET (b, display_time, Fcurrent_time ()); |
| 2999 | 3036 | ||
| 3000 | XSETFASTINT (w->window_end_pos, 0); | 3037 | WSET (w, window_end_pos, make_number (0)); |
| 3001 | XSETFASTINT (w->window_end_vpos, 0); | 3038 | WSET (w, window_end_vpos, make_number (0)); |
| 3002 | memset (&w->last_cursor, 0, sizeof w->last_cursor); | 3039 | memset (&w->last_cursor, 0, sizeof w->last_cursor); |
| 3003 | w->window_end_valid = Qnil; | 3040 | WSET (w, window_end_valid, Qnil); |
| 3004 | if (!(keep_margins_p && samebuf)) | 3041 | if (!(keep_margins_p && samebuf)) |
| 3005 | { /* If we're not actually changing the buffer, don't reset hscroll and | 3042 | { /* If we're not actually changing the buffer, don't reset hscroll and |
| 3006 | vscroll. This case happens for example when called from | 3043 | vscroll. This case happens for example when called from |
| @@ -3045,7 +3082,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3045 | Lisp_Object save_left = w->left_margin_cols; | 3082 | Lisp_Object save_left = w->left_margin_cols; |
| 3046 | Lisp_Object save_right = w->right_margin_cols; | 3083 | Lisp_Object save_right = w->right_margin_cols; |
| 3047 | 3084 | ||
| 3048 | w->left_margin_cols = w->right_margin_cols = Qnil; | 3085 | WSET (w, left_margin_cols, Qnil); |
| 3086 | WSET (w, right_margin_cols, Qnil); | ||
| 3049 | 3087 | ||
| 3050 | Fset_window_fringes (window, | 3088 | Fset_window_fringes (window, |
| 3051 | BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), | 3089 | BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), |
| @@ -3055,8 +3093,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3055 | BVAR (b, scroll_bar_width), | 3093 | BVAR (b, scroll_bar_width), |
| 3056 | BVAR (b, vertical_scroll_bar_type), Qnil); | 3094 | BVAR (b, vertical_scroll_bar_type), Qnil); |
| 3057 | 3095 | ||
| 3058 | w->left_margin_cols = save_left; | 3096 | WSET (w, left_margin_cols, save_left); |
| 3059 | w->right_margin_cols = save_right; | 3097 | WSET (w, right_margin_cols, save_right); |
| 3060 | 3098 | ||
| 3061 | Fset_window_margins (window, | 3099 | Fset_window_margins (window, |
| 3062 | BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); | 3100 | BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); |
| @@ -3075,7 +3113,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3075 | 3113 | ||
| 3076 | DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, | 3114 | DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, |
| 3077 | doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. | 3115 | doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. |
| 3078 | WINDOW has to be a live window and defaults to the selected one. | 3116 | WINDOW must be a live window and defaults to the selected one. |
| 3079 | BUFFER-OR-NAME must be a buffer or the name of an existing buffer. | 3117 | BUFFER-OR-NAME must be a buffer or the name of an existing buffer. |
| 3080 | 3118 | ||
| 3081 | Optional third argument KEEP-MARGINS non-nil means that WINDOW's current | 3119 | Optional third argument KEEP-MARGINS non-nil means that WINDOW's current |
| @@ -3092,7 +3130,7 @@ This function runs `window-scroll-functions' before running | |||
| 3092 | (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) | 3130 | (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) |
| 3093 | { | 3131 | { |
| 3094 | register Lisp_Object tem, buffer; | 3132 | register Lisp_Object tem, buffer; |
| 3095 | register struct window *w = decode_window (window); | 3133 | register struct window *w = decode_live_window (window); |
| 3096 | 3134 | ||
| 3097 | XSETWINDOW (window, w); | 3135 | XSETWINDOW (window, w); |
| 3098 | buffer = Fget_buffer (buffer_or_name); | 3136 | buffer = Fget_buffer (buffer_or_name); |
| @@ -3115,7 +3153,7 @@ This function runs `window-scroll-functions' before running | |||
| 3115 | else | 3153 | else |
| 3116 | /* WINDOW is weakly dedicated to its buffer, reset | 3154 | /* WINDOW is weakly dedicated to its buffer, reset |
| 3117 | dedication. */ | 3155 | dedication. */ |
| 3118 | w->dedicated = Qnil; | 3156 | WSET (w, dedicated, Qnil); |
| 3119 | 3157 | ||
| 3120 | call1 (Qrecord_window_buffer, window); | 3158 | call1 (Qrecord_window_buffer, window); |
| 3121 | } | 3159 | } |
| @@ -3185,7 +3223,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3185 | register Lisp_Object window; | 3223 | register Lisp_Object window; |
| 3186 | register struct window *w; | 3224 | register struct window *w; |
| 3187 | 3225 | ||
| 3188 | BVAR (XBUFFER (buf), directory) = BVAR (current_buffer, directory); | 3226 | BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory)); |
| 3189 | 3227 | ||
| 3190 | Fset_buffer (buf); | 3228 | Fset_buffer (buf); |
| 3191 | BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; | 3229 | BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; |
| @@ -3254,24 +3292,24 @@ make_parent_window (Lisp_Object window, int horflag) | |||
| 3254 | p = allocate_window (); | 3292 | p = allocate_window (); |
| 3255 | memcpy ((char *) p + sizeof (struct vectorlike_header), | 3293 | memcpy ((char *) p + sizeof (struct vectorlike_header), |
| 3256 | (char *) o + sizeof (struct vectorlike_header), | 3294 | (char *) o + sizeof (struct vectorlike_header), |
| 3257 | sizeof (Lisp_Object) * VECSIZE (struct window)); | 3295 | word_size * VECSIZE (struct window)); |
| 3258 | XSETWINDOW (parent, p); | 3296 | XSETWINDOW (parent, p); |
| 3259 | 3297 | ||
| 3260 | p->sequence_number = ++sequence_number; | 3298 | p->sequence_number = ++sequence_number; |
| 3261 | 3299 | ||
| 3262 | replace_window (window, parent, 1); | 3300 | replace_window (window, parent, 1); |
| 3263 | 3301 | ||
| 3264 | o->next = Qnil; | 3302 | WSET (o, next, Qnil); |
| 3265 | o->prev = Qnil; | 3303 | WSET (o, prev, Qnil); |
| 3266 | o->parent = parent; | 3304 | WSET (o, parent, parent); |
| 3267 | 3305 | ||
| 3268 | p->hchild = horflag ? window : Qnil; | 3306 | WSET (p, hchild, horflag ? window : Qnil); |
| 3269 | p->vchild = horflag ? Qnil : window; | 3307 | WSET (p, vchild, horflag ? Qnil : window); |
| 3270 | p->start = Qnil; | 3308 | WSET (p, start, Qnil); |
| 3271 | p->pointm = Qnil; | 3309 | WSET (p, pointm, Qnil); |
| 3272 | p->buffer = Qnil; | 3310 | WSET (p, buffer, Qnil); |
| 3273 | p->combination_limit = Qnil; | 3311 | WSET (p, combination_limit, Qnil); |
| 3274 | p->window_parameters = Qnil; | 3312 | WSET (p, window_parameters, Qnil); |
| 3275 | } | 3313 | } |
| 3276 | 3314 | ||
| 3277 | /* Make new window from scratch. */ | 3315 | /* Make new window from scratch. */ |
| @@ -3284,19 +3322,19 @@ make_window (void) | |||
| 3284 | w = allocate_window (); | 3322 | w = allocate_window (); |
| 3285 | /* Initialize Lisp data. Note that allocate_window initializes all | 3323 | /* Initialize Lisp data. Note that allocate_window initializes all |
| 3286 | Lisp data to nil, so do it only for slots which should not be nil. */ | 3324 | Lisp data to nil, so do it only for slots which should not be nil. */ |
| 3287 | XSETFASTINT (w->left_col, 0); | 3325 | WSET (w, left_col, make_number (0)); |
| 3288 | XSETFASTINT (w->top_line, 0); | 3326 | WSET (w, top_line, make_number (0)); |
| 3289 | XSETFASTINT (w->total_lines, 0); | 3327 | WSET (w, total_lines, make_number (0)); |
| 3290 | XSETFASTINT (w->total_cols, 0); | 3328 | WSET (w, total_cols, make_number (0)); |
| 3291 | w->normal_lines = make_float (1.0); | 3329 | WSET (w, normal_lines, make_float (1.0)); |
| 3292 | w->normal_cols = make_float (1.0); | 3330 | WSET (w, normal_cols, make_float (1.0)); |
| 3293 | XSETFASTINT (w->new_total, 0); | 3331 | WSET (w, new_total, make_number (0)); |
| 3294 | XSETFASTINT (w->new_normal, 0); | 3332 | WSET (w, new_normal, make_number (0)); |
| 3295 | w->start = Fmake_marker (); | 3333 | WSET (w, start, Fmake_marker ()); |
| 3296 | w->pointm = Fmake_marker (); | 3334 | WSET (w, pointm, Fmake_marker ()); |
| 3297 | w->vertical_scroll_bar_type = Qt; | 3335 | WSET (w, vertical_scroll_bar_type, Qt); |
| 3298 | XSETFASTINT (w->window_end_pos, 0); | 3336 | WSET (w, window_end_pos, make_number (0)); |
| 3299 | XSETFASTINT (w->window_end_vpos, 0); | 3337 | WSET (w, window_end_vpos, make_number (0)); |
| 3300 | 3338 | ||
| 3301 | /* Initialize non-Lisp data. Note that allocate_window zeroes out all | 3339 | /* Initialize non-Lisp data. Note that allocate_window zeroes out all |
| 3302 | non-Lisp data, so do it only for slots which should not be zero. */ | 3340 | non-Lisp data, so do it only for slots which should not be zero. */ |
| @@ -3314,6 +3352,7 @@ make_window (void) | |||
| 3314 | 3352 | ||
| 3315 | DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, | 3353 | DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, |
| 3316 | doc: /* Set new total size of WINDOW to SIZE. | 3354 | doc: /* Set new total size of WINDOW to SIZE. |
| 3355 | WINDOW must be a valid window and defaults to the selected one. | ||
| 3317 | Return SIZE. | 3356 | Return SIZE. |
| 3318 | 3357 | ||
| 3319 | Optional argument ADD non-nil means add SIZE to the new total size of | 3358 | Optional argument ADD non-nil means add SIZE to the new total size of |
| @@ -3322,28 +3361,26 @@ WINDOW and return the sum. | |||
| 3322 | Note: This function does not operate on any child windows of WINDOW. */) | 3361 | Note: This function does not operate on any child windows of WINDOW. */) |
| 3323 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) | 3362 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) |
| 3324 | { | 3363 | { |
| 3325 | struct window *w = decode_any_window (window); | 3364 | struct window *w = decode_valid_window (window); |
| 3326 | 3365 | ||
| 3327 | CHECK_NUMBER (size); | 3366 | CHECK_NUMBER (size); |
| 3328 | if (NILP (add)) | 3367 | if (NILP (add)) |
| 3329 | XSETINT (w->new_total, XINT (size)); | 3368 | WSET (w, new_total, size); |
| 3330 | else | 3369 | else |
| 3331 | XSETINT (w->new_total, XINT (w->new_total) + XINT (size)); | 3370 | WSET (w, new_total, make_number (XINT (w->new_total) + XINT (size))); |
| 3332 | 3371 | ||
| 3333 | return w->new_total; | 3372 | return w->new_total; |
| 3334 | } | 3373 | } |
| 3335 | 3374 | ||
| 3336 | DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, | 3375 | DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, |
| 3337 | doc: /* Set new normal size of WINDOW to SIZE. | 3376 | doc: /* Set new normal size of WINDOW to SIZE. |
| 3377 | WINDOW must be a valid window and defaults to the selected one. | ||
| 3338 | Return SIZE. | 3378 | Return SIZE. |
| 3339 | 3379 | ||
| 3340 | Note: This function does not operate on any child windows of WINDOW. */) | 3380 | Note: This function does not operate on any child windows of WINDOW. */) |
| 3341 | (Lisp_Object window, Lisp_Object size) | 3381 | (Lisp_Object window, Lisp_Object size) |
| 3342 | { | 3382 | { |
| 3343 | struct window *w = decode_any_window (window); | 3383 | return WSET (decode_valid_window (window), new_normal, size); |
| 3344 | |||
| 3345 | w->new_normal = size; | ||
| 3346 | return w->new_normal; | ||
| 3347 | } | 3384 | } |
| 3348 | 3385 | ||
| 3349 | /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is | 3386 | /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is |
| @@ -3444,17 +3481,17 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3444 | parent window has been set *before*. */ | 3481 | parent window has been set *before*. */ |
| 3445 | if (horflag) | 3482 | if (horflag) |
| 3446 | { | 3483 | { |
| 3447 | w->total_cols = w->new_total; | 3484 | WSET (w, total_cols, w->new_total); |
| 3448 | if (NUMBERP (w->new_normal)) | 3485 | if (NUMBERP (w->new_normal)) |
| 3449 | w->normal_cols = w->new_normal; | 3486 | WSET (w, normal_cols, w->new_normal); |
| 3450 | 3487 | ||
| 3451 | pos = XINT (w->left_col); | 3488 | pos = XINT (w->left_col); |
| 3452 | } | 3489 | } |
| 3453 | else | 3490 | else |
| 3454 | { | 3491 | { |
| 3455 | w->total_lines = w->new_total; | 3492 | WSET (w, total_lines, w->new_total); |
| 3456 | if (NUMBERP (w->new_normal)) | 3493 | if (NUMBERP (w->new_normal)) |
| 3457 | w->normal_lines = w->new_normal; | 3494 | WSET (w, normal_lines, w->new_normal); |
| 3458 | 3495 | ||
| 3459 | pos = XINT (w->top_line); | 3496 | pos = XINT (w->top_line); |
| 3460 | } | 3497 | } |
| @@ -3466,9 +3503,9 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3466 | while (c) | 3503 | while (c) |
| 3467 | { | 3504 | { |
| 3468 | if (horflag) | 3505 | if (horflag) |
| 3469 | XSETFASTINT (c->left_col, pos); | 3506 | WSET (c, left_col, make_number (pos)); |
| 3470 | else | 3507 | else |
| 3471 | XSETFASTINT (c->top_line, pos); | 3508 | WSET (c, top_line, make_number (pos)); |
| 3472 | window_resize_apply (c, horflag); | 3509 | window_resize_apply (c, horflag); |
| 3473 | if (!horflag) | 3510 | if (!horflag) |
| 3474 | pos = pos + XINT (c->total_lines); | 3511 | pos = pos + XINT (c->total_lines); |
| @@ -3482,9 +3519,9 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3482 | while (c) | 3519 | while (c) |
| 3483 | { | 3520 | { |
| 3484 | if (horflag) | 3521 | if (horflag) |
| 3485 | XSETFASTINT (c->left_col, pos); | 3522 | WSET (c, left_col, make_number (pos)); |
| 3486 | else | 3523 | else |
| 3487 | XSETFASTINT (c->top_line, pos); | 3524 | WSET (c, top_line, make_number (pos)); |
| 3488 | window_resize_apply (c, horflag); | 3525 | window_resize_apply (c, horflag); |
| 3489 | if (horflag) | 3526 | if (horflag) |
| 3490 | pos = pos + XINT (c->total_cols); | 3527 | pos = pos + XINT (c->total_cols); |
| @@ -3524,7 +3561,8 @@ be applied on the Elisp level. */) | |||
| 3524 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); | 3561 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 3525 | 3562 | ||
| 3526 | if (!window_resize_check (r, horflag) | 3563 | if (!window_resize_check (r, horflag) |
| 3527 | || ! EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) | 3564 | || ! EQ (r->new_total, |
| 3565 | (horflag ? r->total_cols : r->total_lines))) | ||
| 3528 | return Qnil; | 3566 | return Qnil; |
| 3529 | 3567 | ||
| 3530 | BLOCK_INPUT; | 3568 | BLOCK_INPUT; |
| @@ -3564,23 +3602,25 @@ resize_frame_windows (struct frame *f, int size, int horflag) | |||
| 3564 | - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) | 3602 | - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) |
| 3565 | ? 1 : 0))); | 3603 | ? 1 : 0))); |
| 3566 | 3604 | ||
| 3567 | XSETFASTINT (r->top_line, FRAME_TOP_MARGIN (f)); | 3605 | WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); |
| 3568 | if (NILP (r->vchild) && NILP (r->hchild)) | 3606 | if (NILP (r->vchild) && NILP (r->hchild)) |
| 3569 | /* For a leaf root window just set the size. */ | 3607 | /* For a leaf root window just set the size. */ |
| 3570 | if (horflag) | 3608 | if (horflag) |
| 3571 | XSETFASTINT (r->total_cols, new_size); | 3609 | WSET (r, total_cols, make_number (new_size)); |
| 3572 | else | 3610 | else |
| 3573 | XSETFASTINT (r->total_lines, new_size); | 3611 | WSET (r, total_lines, make_number (new_size)); |
| 3574 | else | 3612 | else |
| 3575 | { | 3613 | { |
| 3576 | /* old_size is the old size of the frame's root window. */ | 3614 | /* old_size is the old size of the frame's root window. */ |
| 3577 | int old_size = XFASTINT (horflag ? r->total_cols : r->total_lines); | 3615 | int old_size = XFASTINT (horflag ? r->total_cols |
| 3616 | : r->total_lines); | ||
| 3578 | Lisp_Object delta; | 3617 | Lisp_Object delta; |
| 3579 | 3618 | ||
| 3580 | XSETINT (delta, new_size - old_size); | 3619 | XSETINT (delta, new_size - old_size); |
| 3581 | /* Try a "normal" resize first. */ | 3620 | /* Try a "normal" resize first. */ |
| 3582 | resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); | 3621 | resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); |
| 3583 | if (window_resize_check (r, horflag) && new_size == XINT (r->new_total)) | 3622 | if (window_resize_check (r, horflag) |
| 3623 | && new_size == XINT (r->new_total)) | ||
| 3584 | window_resize_apply (r, horflag); | 3624 | window_resize_apply (r, horflag); |
| 3585 | else | 3625 | else |
| 3586 | { | 3626 | { |
| @@ -3603,9 +3643,9 @@ resize_frame_windows (struct frame *f, int size, int horflag) | |||
| 3603 | root = f->selected_window; | 3643 | root = f->selected_window; |
| 3604 | Fdelete_other_windows_internal (root, Qnil); | 3644 | Fdelete_other_windows_internal (root, Qnil); |
| 3605 | if (horflag) | 3645 | if (horflag) |
| 3606 | XSETFASTINT (XWINDOW (root)->total_cols, new_size); | 3646 | WSET (XWINDOW (root), total_cols, make_number (new_size)); |
| 3607 | else | 3647 | else |
| 3608 | XSETFASTINT (XWINDOW (root)->total_lines, new_size); | 3648 | WSET (XWINDOW (root), total_lines, make_number (new_size)); |
| 3609 | } | 3649 | } |
| 3610 | } | 3650 | } |
| 3611 | } | 3651 | } |
| @@ -3615,12 +3655,13 @@ resize_frame_windows (struct frame *f, int size, int horflag) | |||
| 3615 | { | 3655 | { |
| 3616 | m = XWINDOW (mini); | 3656 | m = XWINDOW (mini); |
| 3617 | if (horflag) | 3657 | if (horflag) |
| 3618 | XSETFASTINT (m->total_cols, size); | 3658 | WSET (m, total_cols, make_number (size)); |
| 3619 | else | 3659 | else |
| 3620 | { | 3660 | { |
| 3621 | /* Are we sure we always want 1 line here? */ | 3661 | /* Are we sure we always want 1 line here? */ |
| 3622 | XSETFASTINT (m->total_lines, 1); | 3662 | WSET (m, total_lines, make_number (1)); |
| 3623 | XSETFASTINT (m->top_line, XINT (r->top_line) + XINT (r->total_lines)); | 3663 | WSET (m, top_line, |
| 3664 | make_number (XINT (r->top_line) + XINT (r->total_lines))); | ||
| 3624 | } | 3665 | } |
| 3625 | } | 3666 | } |
| 3626 | } | 3667 | } |
| @@ -3701,14 +3742,15 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3701 | { | 3742 | { |
| 3702 | p = XWINDOW (o->parent); | 3743 | p = XWINDOW (o->parent); |
| 3703 | /* Temporarily pretend we split the parent window. */ | 3744 | /* Temporarily pretend we split the parent window. */ |
| 3704 | XSETINT (p->new_total, | 3745 | WSET (p, new_total, |
| 3705 | XINT (horflag ? p->total_cols : p->total_lines) | 3746 | make_number (XINT (horflag ? p->total_cols : p->total_lines) |
| 3706 | - XINT (total_size)); | 3747 | - XINT (total_size))); |
| 3707 | if (!window_resize_check (p, horflag)) | 3748 | if (!window_resize_check (p, horflag)) |
| 3708 | error ("Window sizes don't fit"); | 3749 | error ("Window sizes don't fit"); |
| 3709 | else | 3750 | else |
| 3710 | /* Undo the temporary pretension. */ | 3751 | /* Undo the temporary pretension. */ |
| 3711 | p->new_total = horflag ? p->total_cols : p->total_lines; | 3752 | WSET (p, new_total, |
| 3753 | horflag ? p->total_cols : p->total_lines); | ||
| 3712 | } | 3754 | } |
| 3713 | else | 3755 | else |
| 3714 | { | 3756 | { |
| @@ -3725,16 +3767,17 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3725 | /* Save the old value of o->normal_cols/lines. It gets corrupted | 3767 | /* Save the old value of o->normal_cols/lines. It gets corrupted |
| 3726 | by make_parent_window and we need it below for assigning it to | 3768 | by make_parent_window and we need it below for assigning it to |
| 3727 | p->new_normal. */ | 3769 | p->new_normal. */ |
| 3728 | Lisp_Object new_normal = horflag ? o->normal_cols : o->normal_lines; | 3770 | Lisp_Object new_normal |
| 3771 | = horflag ? o->normal_cols : o->normal_lines; | ||
| 3729 | 3772 | ||
| 3730 | make_parent_window (old, horflag); | 3773 | make_parent_window (old, horflag); |
| 3731 | p = XWINDOW (o->parent); | 3774 | p = XWINDOW (o->parent); |
| 3732 | /* Store value of `window-combination-limit' in new parent's | 3775 | /* Store value of `window-combination-limit' in new parent's |
| 3733 | combination_limit slot. */ | 3776 | combination_limit slot. */ |
| 3734 | p->combination_limit = Vwindow_combination_limit; | 3777 | WSET (p, combination_limit, Vwindow_combination_limit); |
| 3735 | /* These get applied below. */ | 3778 | /* These get applied below. */ |
| 3736 | p->new_total = horflag ? o->total_cols : o->total_lines; | 3779 | WSET (p, new_total, horflag ? o->total_cols : o->total_lines); |
| 3737 | p->new_normal = new_normal; | 3780 | WSET (p, new_normal, new_normal); |
| 3738 | } | 3781 | } |
| 3739 | else | 3782 | else |
| 3740 | p = XWINDOW (o->parent); | 3783 | p = XWINDOW (o->parent); |
| @@ -3743,61 +3786,62 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3743 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3786 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 3744 | new = make_window (); | 3787 | new = make_window (); |
| 3745 | n = XWINDOW (new); | 3788 | n = XWINDOW (new); |
| 3746 | n->frame = frame; | 3789 | WSET (n, frame, frame); |
| 3747 | n->parent = o->parent; | 3790 | WSET (n, parent, o->parent); |
| 3748 | n->vchild = n->hchild = Qnil; | 3791 | WSET (n, vchild, Qnil); |
| 3792 | WSET (n, hchild, Qnil); | ||
| 3749 | 3793 | ||
| 3750 | if (EQ (side, Qabove) || EQ (side, Qleft)) | 3794 | if (EQ (side, Qabove) || EQ (side, Qleft)) |
| 3751 | { | 3795 | { |
| 3752 | n->prev = o->prev; | 3796 | WSET (n, prev, o->prev); |
| 3753 | if (NILP (n->prev)) | 3797 | if (NILP (n->prev)) |
| 3754 | if (horflag) | 3798 | if (horflag) |
| 3755 | p->hchild = new; | 3799 | WSET (p, hchild, new); |
| 3756 | else | 3800 | else |
| 3757 | p->vchild = new; | 3801 | WSET (p, vchild, new); |
| 3758 | else | 3802 | else |
| 3759 | XWINDOW (n->prev)->next = new; | 3803 | WSET (XWINDOW (n->prev), next, new); |
| 3760 | n->next = old; | 3804 | WSET (n, next, old); |
| 3761 | o->prev = new; | 3805 | WSET (o, prev, new); |
| 3762 | } | 3806 | } |
| 3763 | else | 3807 | else |
| 3764 | { | 3808 | { |
| 3765 | n->next = o->next; | 3809 | WSET (n, next, o->next); |
| 3766 | if (!NILP (n->next)) | 3810 | if (!NILP (n->next)) |
| 3767 | XWINDOW (n->next)->prev = new; | 3811 | WSET (XWINDOW (n->next), prev, new); |
| 3768 | n->prev = old; | 3812 | WSET (n, prev, old); |
| 3769 | o->next = new; | 3813 | WSET (o, next, new); |
| 3770 | } | 3814 | } |
| 3771 | 3815 | ||
| 3772 | n->buffer = Qt; | 3816 | WSET (n, buffer, Qt); |
| 3773 | n->window_end_valid = Qnil; | 3817 | WSET (n, window_end_valid, Qnil); |
| 3774 | memset (&n->last_cursor, 0, sizeof n->last_cursor); | 3818 | memset (&n->last_cursor, 0, sizeof n->last_cursor); |
| 3775 | 3819 | ||
| 3776 | /* Get special geometry settings from reference window. */ | 3820 | /* Get special geometry settings from reference window. */ |
| 3777 | n->left_margin_cols = r->left_margin_cols; | 3821 | WSET (n, left_margin_cols, r->left_margin_cols); |
| 3778 | n->right_margin_cols = r->right_margin_cols; | 3822 | WSET (n, right_margin_cols, r->right_margin_cols); |
| 3779 | n->left_fringe_width = r->left_fringe_width; | 3823 | WSET (n, left_fringe_width, r->left_fringe_width); |
| 3780 | n->right_fringe_width = r->right_fringe_width; | 3824 | WSET (n, right_fringe_width, r->right_fringe_width); |
| 3781 | n->fringes_outside_margins = r->fringes_outside_margins; | 3825 | n->fringes_outside_margins = r->fringes_outside_margins; |
| 3782 | n->scroll_bar_width = r->scroll_bar_width; | 3826 | WSET (n, scroll_bar_width, r->scroll_bar_width); |
| 3783 | n->vertical_scroll_bar_type = r->vertical_scroll_bar_type; | 3827 | WSET (n, vertical_scroll_bar_type, r->vertical_scroll_bar_type); |
| 3784 | 3828 | ||
| 3785 | /* Directly assign orthogonal coordinates and sizes. */ | 3829 | /* Directly assign orthogonal coordinates and sizes. */ |
| 3786 | if (horflag) | 3830 | if (horflag) |
| 3787 | { | 3831 | { |
| 3788 | n->top_line = o->top_line; | 3832 | WSET (n, top_line, o->top_line); |
| 3789 | n->total_lines = o->total_lines; | 3833 | WSET (n, total_lines, o->total_lines); |
| 3790 | } | 3834 | } |
| 3791 | else | 3835 | else |
| 3792 | { | 3836 | { |
| 3793 | n->left_col = o->left_col; | 3837 | WSET (n, left_col, o->left_col); |
| 3794 | n->total_cols = o->total_cols; | 3838 | WSET (n, total_cols, o->total_cols); |
| 3795 | } | 3839 | } |
| 3796 | 3840 | ||
| 3797 | /* Iso-coordinates and sizes are assigned by window_resize_apply, | 3841 | /* Iso-coordinates and sizes are assigned by window_resize_apply, |
| 3798 | get them ready here. */ | 3842 | get them ready here. */ |
| 3799 | n->new_total = total_size; | 3843 | WSET (n, new_total, total_size); |
| 3800 | n->new_normal = normal_size; | 3844 | WSET (n, new_normal, normal_size); |
| 3801 | 3845 | ||
| 3802 | BLOCK_INPUT; | 3846 | BLOCK_INPUT; |
| 3803 | window_resize_apply (p, horflag); | 3847 | window_resize_apply (p, horflag); |
| @@ -3831,7 +3875,8 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3831 | 3875 | ||
| 3832 | w = decode_any_window (window); | 3876 | w = decode_any_window (window); |
| 3833 | XSETWINDOW (window, w); | 3877 | XSETWINDOW (window, w); |
| 3834 | if (NILP (w->buffer) && NILP (w->hchild) && NILP (w->vchild)) | 3878 | if (NILP (w->buffer) |
| 3879 | && NILP (w->hchild) && NILP (w->vchild)) | ||
| 3835 | /* It's a no-op to delete an already deleted window. */ | 3880 | /* It's a no-op to delete an already deleted window. */ |
| 3836 | return Qnil; | 3881 | return Qnil; |
| 3837 | 3882 | ||
| @@ -3862,24 +3907,25 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3862 | before_sibling = 1; | 3907 | before_sibling = 1; |
| 3863 | sibling = w->next; | 3908 | sibling = w->next; |
| 3864 | s = XWINDOW (sibling); | 3909 | s = XWINDOW (sibling); |
| 3865 | s->prev = Qnil; | 3910 | WSET (s, prev, Qnil); |
| 3866 | if (horflag) | 3911 | if (horflag) |
| 3867 | p->hchild = sibling; | 3912 | WSET (p, hchild, sibling); |
| 3868 | else | 3913 | else |
| 3869 | p->vchild = sibling; | 3914 | WSET (p, vchild, sibling); |
| 3870 | } | 3915 | } |
| 3871 | else | 3916 | else |
| 3872 | /* Get SIBLING above (on the left of) WINDOW. */ | 3917 | /* Get SIBLING above (on the left of) WINDOW. */ |
| 3873 | { | 3918 | { |
| 3874 | sibling = w->prev; | 3919 | sibling = w->prev; |
| 3875 | s = XWINDOW (sibling); | 3920 | s = XWINDOW (sibling); |
| 3876 | s->next = w->next; | 3921 | WSET (s, next, w->next); |
| 3877 | if (!NILP (s->next)) | 3922 | if (!NILP (s->next)) |
| 3878 | XWINDOW (s->next)->prev = sibling; | 3923 | WSET (XWINDOW (s->next), prev, sibling); |
| 3879 | } | 3924 | } |
| 3880 | 3925 | ||
| 3881 | if (window_resize_check (r, horflag) | 3926 | if (window_resize_check (r, horflag) |
| 3882 | && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) | 3927 | && EQ (r->new_total, |
| 3928 | (horflag ? r->total_cols : r->total_lines))) | ||
| 3883 | /* We can delete WINDOW now. */ | 3929 | /* We can delete WINDOW now. */ |
| 3884 | { | 3930 | { |
| 3885 | 3931 | ||
| @@ -3901,25 +3947,25 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3901 | Vwindow_list = Qnil; | 3947 | Vwindow_list = Qnil; |
| 3902 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3948 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 3903 | 3949 | ||
| 3904 | w->next = Qnil; /* Don't delete w->next too. */ | 3950 | WSET (w, next, Qnil); /* Don't delete w->next too. */ |
| 3905 | free_window_matrices (w); | 3951 | free_window_matrices (w); |
| 3906 | 3952 | ||
| 3907 | if (!NILP (w->vchild)) | 3953 | if (!NILP (w->vchild)) |
| 3908 | { | 3954 | { |
| 3909 | delete_all_child_windows (w->vchild); | 3955 | delete_all_child_windows (w->vchild); |
| 3910 | w->vchild = Qnil; | 3956 | WSET (w, vchild, Qnil); |
| 3911 | } | 3957 | } |
| 3912 | else if (!NILP (w->hchild)) | 3958 | else if (!NILP (w->hchild)) |
| 3913 | { | 3959 | { |
| 3914 | delete_all_child_windows (w->hchild); | 3960 | delete_all_child_windows (w->hchild); |
| 3915 | w->hchild = Qnil; | 3961 | WSET (w, hchild, Qnil); |
| 3916 | } | 3962 | } |
| 3917 | else if (!NILP (w->buffer)) | 3963 | else if (!NILP (w->buffer)) |
| 3918 | { | 3964 | { |
| 3919 | unshow_buffer (w); | 3965 | unshow_buffer (w); |
| 3920 | unchain_marker (XMARKER (w->pointm)); | 3966 | unchain_marker (XMARKER (w->pointm)); |
| 3921 | unchain_marker (XMARKER (w->start)); | 3967 | unchain_marker (XMARKER (w->start)); |
| 3922 | w->buffer = Qnil; | 3968 | WSET (w, buffer, Qnil); |
| 3923 | } | 3969 | } |
| 3924 | 3970 | ||
| 3925 | if (NILP (s->prev) && NILP (s->next)) | 3971 | if (NILP (s->prev) && NILP (s->next)) |
| @@ -3930,10 +3976,11 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3930 | replace_window (parent, sibling, 0); | 3976 | replace_window (parent, sibling, 0); |
| 3931 | /* Have SIBLING inherit the following three slot values from | 3977 | /* Have SIBLING inherit the following three slot values from |
| 3932 | PARENT (the combination_limit slot is not inherited). */ | 3978 | PARENT (the combination_limit slot is not inherited). */ |
| 3933 | s->normal_cols = p->normal_cols; | 3979 | WSET (s, normal_cols, p->normal_cols); |
| 3934 | s->normal_lines = p->normal_lines; | 3980 | WSET (s, normal_lines, p->normal_lines); |
| 3935 | /* Mark PARENT as deleted. */ | 3981 | /* Mark PARENT as deleted. */ |
| 3936 | p->vchild = p->hchild = Qnil; | 3982 | WSET (p, vchild, Qnil); |
| 3983 | WSET (p, hchild, Qnil); | ||
| 3937 | /* Try to merge SIBLING into its new parent. */ | 3984 | /* Try to merge SIBLING into its new parent. */ |
| 3938 | recombine_windows (sibling); | 3985 | recombine_windows (sibling); |
| 3939 | } | 3986 | } |
| @@ -3953,7 +4000,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3953 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) | 4000 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) |
| 3954 | Fselect_window (new_selected_window, Qt); | 4001 | Fselect_window (new_selected_window, Qt); |
| 3955 | else | 4002 | else |
| 3956 | FRAME_SELECTED_WINDOW (f) = new_selected_window; | 4003 | FSET (f, selected_window, new_selected_window); |
| 3957 | 4004 | ||
| 3958 | UNBLOCK_INPUT; | 4005 | UNBLOCK_INPUT; |
| 3959 | 4006 | ||
| @@ -3967,7 +4014,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3967 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) | 4014 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) |
| 3968 | Fselect_window (new_selected_window, Qnil); | 4015 | Fselect_window (new_selected_window, Qnil); |
| 3969 | else | 4016 | else |
| 3970 | FRAME_SELECTED_WINDOW (f) = new_selected_window; | 4017 | FSET (f, selected_window, new_selected_window); |
| 3971 | } | 4018 | } |
| 3972 | else | 4019 | else |
| 3973 | UNBLOCK_INPUT; | 4020 | UNBLOCK_INPUT; |
| @@ -3980,17 +4027,17 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3980 | { | 4027 | { |
| 3981 | if (before_sibling) | 4028 | if (before_sibling) |
| 3982 | { | 4029 | { |
| 3983 | s->prev = window; | 4030 | WSET (s, prev, window); |
| 3984 | if (horflag) | 4031 | if (horflag) |
| 3985 | p->hchild = window; | 4032 | WSET (p, hchild, window); |
| 3986 | else | 4033 | else |
| 3987 | p->vchild = window; | 4034 | WSET (p, vchild, window); |
| 3988 | } | 4035 | } |
| 3989 | else | 4036 | else |
| 3990 | { | 4037 | { |
| 3991 | s->next = window; | 4038 | WSET (s, next, window); |
| 3992 | if (!NILP (w->next)) | 4039 | if (!NILP (w->next)) |
| 3993 | XWINDOW (w->next)->prev = window; | 4040 | WSET (XWINDOW (w->next), prev, window); |
| 3994 | } | 4041 | } |
| 3995 | error ("Deletion failed"); | 4042 | error ("Deletion failed"); |
| 3996 | } | 4043 | } |
| @@ -4024,8 +4071,10 @@ grow_mini_window (struct window *w, int delta) | |||
| 4024 | window_resize_apply (r, 0); | 4071 | window_resize_apply (r, 0); |
| 4025 | 4072 | ||
| 4026 | /* Grow the mini-window. */ | 4073 | /* Grow the mini-window. */ |
| 4027 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); | 4074 | WSET (w, top_line, |
| 4028 | XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); | 4075 | make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); |
| 4076 | WSET (w, total_lines, | ||
| 4077 | make_number (XFASTINT (w->total_lines) - XINT (value))); | ||
| 4029 | w->last_modified = 0; | 4078 | w->last_modified = 0; |
| 4030 | w->last_overlay_modified = 0; | 4079 | w->last_overlay_modified = 0; |
| 4031 | 4080 | ||
| @@ -4059,8 +4108,9 @@ shrink_mini_window (struct window *w) | |||
| 4059 | window_resize_apply (r, 0); | 4108 | window_resize_apply (r, 0); |
| 4060 | 4109 | ||
| 4061 | /* Shrink the mini-window. */ | 4110 | /* Shrink the mini-window. */ |
| 4062 | XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); | 4111 | WSET (w, top_line, |
| 4063 | XSETFASTINT (w->total_lines, 1); | 4112 | make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); |
| 4113 | WSET (w, total_lines, make_number (1)); | ||
| 4064 | 4114 | ||
| 4065 | w->last_modified = 0; | 4115 | w->last_modified = 0; |
| 4066 | w->last_overlay_modified = 0; | 4116 | w->last_overlay_modified = 0; |
| @@ -4101,8 +4151,9 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4101 | BLOCK_INPUT; | 4151 | BLOCK_INPUT; |
| 4102 | window_resize_apply (r, 0); | 4152 | window_resize_apply (r, 0); |
| 4103 | 4153 | ||
| 4104 | w->total_lines = w->new_total; | 4154 | WSET (w, total_lines, w->new_total); |
| 4105 | XSETFASTINT (w->top_line, XINT (r->top_line) + XINT (r->total_lines)); | 4155 | WSET (w, top_line, |
| 4156 | make_number (XINT (r->top_line) + XINT (r->total_lines))); | ||
| 4106 | 4157 | ||
| 4107 | windows_or_buffers_changed++; | 4158 | windows_or_buffers_changed++; |
| 4108 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4159 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| @@ -4451,7 +4502,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4451 | This code wants current_y to be zero at the window start position | 4502 | This code wants current_y to be zero at the window start position |
| 4452 | even if there is a header line. */ | 4503 | even if there is a header line. */ |
| 4453 | this_scroll_margin = max (0, scroll_margin); | 4504 | this_scroll_margin = max (0, scroll_margin); |
| 4454 | this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); | 4505 | this_scroll_margin |
| 4506 | = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); | ||
| 4455 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); | 4507 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
| 4456 | 4508 | ||
| 4457 | if (n > 0) | 4509 | if (n > 0) |
| @@ -5169,7 +5221,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5169 | 5221 | ||
| 5170 | /* Set the new window start. */ | 5222 | /* Set the new window start. */ |
| 5171 | set_marker_both (w->start, w->buffer, charpos, bytepos); | 5223 | set_marker_both (w->start, w->buffer, charpos, bytepos); |
| 5172 | w->window_end_valid = Qnil; | 5224 | WSET (w, window_end_valid, Qnil); |
| 5173 | 5225 | ||
| 5174 | w->optional_new_start = 1; | 5226 | w->optional_new_start = 1; |
| 5175 | 5227 | ||
| @@ -5183,13 +5235,13 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5183 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, | 5235 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, |
| 5184 | 0, 1, 0, | 5236 | 0, 1, 0, |
| 5185 | doc: /* Return the height in lines of the text display area of WINDOW. | 5237 | doc: /* Return the height in lines of the text display area of WINDOW. |
| 5186 | If WINDOW is omitted or nil, it defaults to the selected window. | 5238 | WINDOW must be a live window and defaults to the selected one. |
| 5187 | 5239 | ||
| 5188 | The returned height does not include the mode line, any header line, | 5240 | The returned height does not include the mode line, any header line, |
| 5189 | nor any partial-height lines at the bottom of the text area. */) | 5241 | nor any partial-height lines at the bottom of the text area. */) |
| 5190 | (Lisp_Object window) | 5242 | (Lisp_Object window) |
| 5191 | { | 5243 | { |
| 5192 | struct window *w = decode_window (window); | 5244 | struct window *w = decode_live_window (window); |
| 5193 | int pixel_height = window_box_height (w); | 5245 | int pixel_height = window_box_height (w); |
| 5194 | int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); | 5246 | int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); |
| 5195 | return make_number (line_height); | 5247 | return make_number (line_height); |
| @@ -5487,34 +5539,34 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5487 | p = SAVED_WINDOW_N (saved_windows, k); | 5539 | p = SAVED_WINDOW_N (saved_windows, k); |
| 5488 | window = p->window; | 5540 | window = p->window; |
| 5489 | w = XWINDOW (window); | 5541 | w = XWINDOW (window); |
| 5490 | w->next = Qnil; | 5542 | WSET (w, next, Qnil); |
| 5491 | 5543 | ||
| 5492 | if (!NILP (p->parent)) | 5544 | if (!NILP (p->parent)) |
| 5493 | w->parent = SAVED_WINDOW_N (saved_windows, | 5545 | WSET (w, parent, SAVED_WINDOW_N |
| 5494 | XFASTINT (p->parent))->window; | 5546 | (saved_windows, XFASTINT (p->parent))->window); |
| 5495 | else | 5547 | else |
| 5496 | w->parent = Qnil; | 5548 | WSET (w, parent, Qnil); |
| 5497 | 5549 | ||
| 5498 | if (!NILP (p->prev)) | 5550 | if (!NILP (p->prev)) |
| 5499 | { | 5551 | { |
| 5500 | w->prev = SAVED_WINDOW_N (saved_windows, | 5552 | WSET (w, prev, SAVED_WINDOW_N |
| 5501 | XFASTINT (p->prev))->window; | 5553 | (saved_windows, XFASTINT (p->prev))->window); |
| 5502 | XWINDOW (w->prev)->next = p->window; | 5554 | WSET (XWINDOW (w->prev), next, p->window); |
| 5503 | } | 5555 | } |
| 5504 | else | 5556 | else |
| 5505 | { | 5557 | { |
| 5506 | w->prev = Qnil; | 5558 | WSET (w, prev, Qnil); |
| 5507 | if (!NILP (w->parent)) | 5559 | if (!NILP (w->parent)) |
| 5508 | { | 5560 | { |
| 5509 | if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) | 5561 | if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) |
| 5510 | { | 5562 | { |
| 5511 | XWINDOW (w->parent)->vchild = p->window; | 5563 | WSET (XWINDOW (w->parent), vchild, p->window); |
| 5512 | XWINDOW (w->parent)->hchild = Qnil; | 5564 | WSET (XWINDOW (w->parent), hchild, Qnil); |
| 5513 | } | 5565 | } |
| 5514 | else | 5566 | else |
| 5515 | { | 5567 | { |
| 5516 | XWINDOW (w->parent)->hchild = p->window; | 5568 | WSET (XWINDOW (w->parent), hchild, p->window); |
| 5517 | XWINDOW (w->parent)->vchild = Qnil; | 5569 | WSET (XWINDOW (w->parent), vchild, Qnil); |
| 5518 | } | 5570 | } |
| 5519 | } | 5571 | } |
| 5520 | } | 5572 | } |
| @@ -5522,25 +5574,25 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5522 | /* If we squirreled away the buffer in the window's height, | 5574 | /* If we squirreled away the buffer in the window's height, |
| 5523 | restore it now. */ | 5575 | restore it now. */ |
| 5524 | if (BUFFERP (w->total_lines)) | 5576 | if (BUFFERP (w->total_lines)) |
| 5525 | w->buffer = w->total_lines; | 5577 | WSET (w, buffer, w->total_lines); |
| 5526 | w->left_col = p->left_col; | 5578 | WSET (w, left_col, p->left_col); |
| 5527 | w->top_line = p->top_line; | 5579 | WSET (w, top_line, p->top_line); |
| 5528 | w->total_cols = p->total_cols; | 5580 | WSET (w, total_cols, p->total_cols); |
| 5529 | w->total_lines = p->total_lines; | 5581 | WSET (w, total_lines, p->total_lines); |
| 5530 | w->normal_cols = p->normal_cols; | 5582 | WSET (w, normal_cols, p->normal_cols); |
| 5531 | w->normal_lines = p->normal_lines; | 5583 | WSET (w, normal_lines, p->normal_lines); |
| 5532 | w->hscroll = XFASTINT (p->hscroll); | 5584 | w->hscroll = XFASTINT (p->hscroll); |
| 5533 | w->min_hscroll = XFASTINT (p->min_hscroll); | 5585 | w->min_hscroll = XFASTINT (p->min_hscroll); |
| 5534 | w->display_table = p->display_table; | 5586 | WSET (w, display_table, p->display_table); |
| 5535 | w->left_margin_cols = p->left_margin_cols; | 5587 | WSET (w, left_margin_cols, p->left_margin_cols); |
| 5536 | w->right_margin_cols = p->right_margin_cols; | 5588 | WSET (w, right_margin_cols, p->right_margin_cols); |
| 5537 | w->left_fringe_width = p->left_fringe_width; | 5589 | WSET (w, left_fringe_width, p->left_fringe_width); |
| 5538 | w->right_fringe_width = p->right_fringe_width; | 5590 | WSET (w, right_fringe_width, p->right_fringe_width); |
| 5539 | w->fringes_outside_margins = !NILP (p->fringes_outside_margins); | 5591 | w->fringes_outside_margins = !NILP (p->fringes_outside_margins); |
| 5540 | w->scroll_bar_width = p->scroll_bar_width; | 5592 | WSET (w, scroll_bar_width, p->scroll_bar_width); |
| 5541 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; | 5593 | WSET (w, vertical_scroll_bar_type, p->vertical_scroll_bar_type); |
| 5542 | w->dedicated = p->dedicated; | 5594 | WSET (w, dedicated, p->dedicated); |
| 5543 | w->combination_limit = p->combination_limit; | 5595 | WSET (w, combination_limit, p->combination_limit); |
| 5544 | /* Restore any window parameters that have been saved. | 5596 | /* Restore any window parameters that have been saved. |
| 5545 | Parameters that have not been saved are left alone. */ | 5597 | Parameters that have not been saved are left alone. */ |
| 5546 | for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) | 5598 | for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) |
| @@ -5569,45 +5621,50 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5569 | /* Reinstall the saved buffer and pointers into it. */ | 5621 | /* Reinstall the saved buffer and pointers into it. */ |
| 5570 | if (NILP (p->buffer)) | 5622 | if (NILP (p->buffer)) |
| 5571 | /* An internal window. */ | 5623 | /* An internal window. */ |
| 5572 | w->buffer = p->buffer; | 5624 | WSET (w, buffer, p->buffer); |
| 5573 | else if (!NILP (BVAR (XBUFFER (p->buffer), name))) | 5625 | else if (!NILP (BVAR (XBUFFER (p->buffer), name))) |
| 5574 | /* If saved buffer is alive, install it. */ | 5626 | /* If saved buffer is alive, install it. */ |
| 5575 | { | 5627 | { |
| 5576 | w->buffer = p->buffer; | 5628 | WSET (w, buffer, p->buffer); |
| 5577 | w->start_at_line_beg = !NILP (p->start_at_line_beg); | 5629 | w->start_at_line_beg = !NILP (p->start_at_line_beg); |
| 5578 | set_marker_restricted (w->start, p->start, w->buffer); | 5630 | set_marker_restricted (w->start, p->start, w->buffer); |
| 5579 | set_marker_restricted (w->pointm, p->pointm, w->buffer); | 5631 | set_marker_restricted (w->pointm, p->pointm, |
| 5580 | Fset_marker (BVAR (XBUFFER (w->buffer), mark), | 5632 | w->buffer); |
| 5581 | p->mark, w->buffer); | 5633 | Fset_marker (BVAR (XBUFFER (w->buffer), mark), |
| 5582 | 5634 | p->mark, w->buffer); | |
| 5583 | /* As documented in Fcurrent_window_configuration, don't | 5635 | |
| 5584 | restore the location of point in the buffer which was | 5636 | /* As documented in Fcurrent_window_configuration, don't |
| 5585 | current when the window configuration was recorded. */ | 5637 | restore the location of point in the buffer which was |
| 5586 | if (!EQ (p->buffer, new_current_buffer) | 5638 | current when the window configuration was recorded. */ |
| 5587 | && XBUFFER (p->buffer) == current_buffer) | 5639 | if (!EQ (p->buffer, new_current_buffer) |
| 5588 | Fgoto_char (w->pointm); | 5640 | && XBUFFER (p->buffer) == current_buffer) |
| 5589 | } | 5641 | Fgoto_char (w->pointm); |
| 5590 | else if (!NILP (w->buffer) && !NILP (BVAR (XBUFFER (w->buffer), name))) | 5642 | } |
| 5591 | /* Keep window's old buffer; make sure the markers are | 5643 | else if (!NILP (w->buffer) |
| 5592 | real. */ | 5644 | && !NILP (BVAR (XBUFFER (w->buffer), name))) |
| 5593 | { | 5645 | /* Keep window's old buffer; make sure the markers are |
| 5594 | /* Set window markers at start of visible range. */ | 5646 | real. */ |
| 5595 | if (XMARKER (w->start)->buffer == 0) | 5647 | { |
| 5596 | set_marker_restricted (w->start, make_number (0), | 5648 | /* Set window markers at start of visible range. */ |
| 5597 | w->buffer); | 5649 | if (XMARKER (w->start)->buffer == 0) |
| 5598 | if (XMARKER (w->pointm)->buffer == 0) | 5650 | set_marker_restricted (w->start, make_number (0), |
| 5599 | set_marker_restricted_both (w->pointm, w->buffer, | 5651 | w->buffer); |
| 5600 | BUF_PT (XBUFFER (w->buffer)), | 5652 | if (XMARKER (w->pointm)->buffer == 0) |
| 5601 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5653 | set_marker_restricted_both |
| 5602 | w->start_at_line_beg = 1; | 5654 | (w->pointm, w->buffer, |
| 5603 | } | 5655 | BUF_PT (XBUFFER (w->buffer)), |
| 5604 | else if (STRINGP (auto_buffer_name = | 5656 | BUF_PT_BYTE (XBUFFER (w->buffer))); |
| 5605 | Fwindow_parameter (window, Qauto_buffer_name)) | 5657 | w->start_at_line_beg = 1; |
| 5606 | && SCHARS (auto_buffer_name) != 0 | 5658 | } |
| 5607 | && !NILP (w->buffer = Fget_buffer_create (auto_buffer_name))) | 5659 | else if (STRINGP (auto_buffer_name = |
| 5660 | Fwindow_parameter (window, Qauto_buffer_name)) | ||
| 5661 | && SCHARS (auto_buffer_name) != 0 | ||
| 5662 | && !NILP (WSET (w, buffer, Fget_buffer_create (auto_buffer_name)))) | ||
| 5608 | { | 5663 | { |
| 5609 | set_marker_restricted (w->start, make_number (0), w->buffer); | 5664 | set_marker_restricted (w->start, |
| 5610 | set_marker_restricted (w->pointm, make_number (0), w->buffer); | 5665 | make_number (0), w->buffer); |
| 5666 | set_marker_restricted (w->pointm, | ||
| 5667 | make_number (0), w->buffer); | ||
| 5611 | w->start_at_line_beg = 1; | 5668 | w->start_at_line_beg = 1; |
| 5612 | } | 5669 | } |
| 5613 | else | 5670 | else |
| @@ -5617,21 +5674,23 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5617 | avoid showing an unimportant buffer and, if necessary, to | 5674 | avoid showing an unimportant buffer and, if necessary, to |
| 5618 | recreate *scratch* in the course (part of Juanma's bs-show | 5675 | recreate *scratch* in the course (part of Juanma's bs-show |
| 5619 | scenario from March 2011). */ | 5676 | scenario from March 2011). */ |
| 5620 | w->buffer = other_buffer_safely (Fcurrent_buffer ()); | 5677 | WSET (w, buffer, other_buffer_safely (Fcurrent_buffer ())); |
| 5621 | /* This will set the markers to beginning of visible | 5678 | /* This will set the markers to beginning of visible |
| 5622 | range. */ | 5679 | range. */ |
| 5623 | set_marker_restricted (w->start, make_number (0), w->buffer); | 5680 | set_marker_restricted (w->start, |
| 5624 | set_marker_restricted (w->pointm, make_number (0), w->buffer); | 5681 | make_number (0), w->buffer); |
| 5682 | set_marker_restricted (w->pointm, | ||
| 5683 | make_number (0), w->buffer); | ||
| 5625 | w->start_at_line_beg = 1; | 5684 | w->start_at_line_beg = 1; |
| 5626 | if (!NILP (w->dedicated)) | 5685 | if (!NILP (w->dedicated)) |
| 5627 | /* Record this window as dead. */ | 5686 | /* Record this window as dead. */ |
| 5628 | dead_windows = Fcons (window, dead_windows); | 5687 | dead_windows = Fcons (window, dead_windows); |
| 5629 | /* Make sure window is no more dedicated. */ | 5688 | /* Make sure window is no more dedicated. */ |
| 5630 | w->dedicated = Qnil; | 5689 | WSET (w, dedicated, Qnil); |
| 5631 | } | 5690 | } |
| 5632 | } | 5691 | } |
| 5633 | 5692 | ||
| 5634 | FRAME_ROOT_WINDOW (f) = data->root_window; | 5693 | FSET (f, root_window, data->root_window); |
| 5635 | /* Arrange *not* to restore point in the buffer that was | 5694 | /* Arrange *not* to restore point in the buffer that was |
| 5636 | current when the window configuration was saved. */ | 5695 | current when the window configuration was saved. */ |
| 5637 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5696 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) |
| @@ -5727,24 +5786,24 @@ delete_all_child_windows (Lisp_Object window) | |||
| 5727 | /* Delete WINDOW's siblings (we traverse postorderly). */ | 5786 | /* Delete WINDOW's siblings (we traverse postorderly). */ |
| 5728 | delete_all_child_windows (w->next); | 5787 | delete_all_child_windows (w->next); |
| 5729 | 5788 | ||
| 5730 | w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ | 5789 | WSET (w, total_lines, w->buffer); /* See Fset_window_configuration for excuse. */ |
| 5731 | 5790 | ||
| 5732 | if (!NILP (w->vchild)) | 5791 | if (!NILP (w->vchild)) |
| 5733 | { | 5792 | { |
| 5734 | delete_all_child_windows (w->vchild); | 5793 | delete_all_child_windows (w->vchild); |
| 5735 | w->vchild = Qnil; | 5794 | WSET (w, vchild, Qnil); |
| 5736 | } | 5795 | } |
| 5737 | else if (!NILP (w->hchild)) | 5796 | else if (!NILP (w->hchild)) |
| 5738 | { | 5797 | { |
| 5739 | delete_all_child_windows (w->hchild); | 5798 | delete_all_child_windows (w->hchild); |
| 5740 | w->hchild = Qnil; | 5799 | WSET (w, hchild, Qnil); |
| 5741 | } | 5800 | } |
| 5742 | else if (!NILP (w->buffer)) | 5801 | else if (!NILP (w->buffer)) |
| 5743 | { | 5802 | { |
| 5744 | unshow_buffer (w); | 5803 | unshow_buffer (w); |
| 5745 | unchain_marker (XMARKER (w->pointm)); | 5804 | unchain_marker (XMARKER (w->pointm)); |
| 5746 | unchain_marker (XMARKER (w->start)); | 5805 | unchain_marker (XMARKER (w->start)); |
| 5747 | w->buffer = Qnil; | 5806 | WSET (w, buffer, Qnil); |
| 5748 | } | 5807 | } |
| 5749 | 5808 | ||
| 5750 | Vwindow_list = Qnil; | 5809 | Vwindow_list = Qnil; |
| @@ -5836,7 +5895,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 5836 | p = SAVED_WINDOW_N (vector, i); | 5895 | p = SAVED_WINDOW_N (vector, i); |
| 5837 | w = XWINDOW (window); | 5896 | w = XWINDOW (window); |
| 5838 | 5897 | ||
| 5839 | XSETFASTINT (w->temslot, i); i++; | 5898 | WSET (w, temslot, make_number (i)); i++; |
| 5840 | p->window = window; | 5899 | p->window = window; |
| 5841 | p->buffer = w->buffer; | 5900 | p->buffer = w->buffer; |
| 5842 | p->left_col = w->left_col; | 5901 | p->left_col = w->left_col; |
| @@ -6009,14 +6068,15 @@ saved by this function. */) | |||
| 6009 | DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, | 6068 | DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, |
| 6010 | 2, 3, 0, | 6069 | 2, 3, 0, |
| 6011 | doc: /* Set width of marginal areas of window WINDOW. | 6070 | doc: /* Set width of marginal areas of window WINDOW. |
| 6012 | If WINDOW is nil, set margins of the currently selected window. | 6071 | WINDOW must be a live window and defaults to the selected one. |
| 6072 | |||
| 6013 | Second arg LEFT-WIDTH specifies the number of character cells to | 6073 | Second arg LEFT-WIDTH specifies the number of character cells to |
| 6014 | reserve for the left marginal area. Optional third arg RIGHT-WIDTH | 6074 | reserve for the left marginal area. Optional third arg RIGHT-WIDTH |
| 6015 | does the same for the right marginal area. A nil width parameter | 6075 | does the same for the right marginal area. A nil width parameter |
| 6016 | means no margin. */) | 6076 | means no margin. */) |
| 6017 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) | 6077 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) |
| 6018 | { | 6078 | { |
| 6019 | struct window *w = decode_window (window); | 6079 | struct window *w = decode_live_window (window); |
| 6020 | 6080 | ||
| 6021 | /* Translate negative or zero widths to nil. | 6081 | /* Translate negative or zero widths to nil. |
| 6022 | Margins that are too wide have to be checked elsewhere. */ | 6082 | Margins that are too wide have to be checked elsewhere. */ |
| @@ -6038,8 +6098,8 @@ means no margin. */) | |||
| 6038 | if (!EQ (w->left_margin_cols, left_width) | 6098 | if (!EQ (w->left_margin_cols, left_width) |
| 6039 | || !EQ (w->right_margin_cols, right_width)) | 6099 | || !EQ (w->right_margin_cols, right_width)) |
| 6040 | { | 6100 | { |
| 6041 | w->left_margin_cols = left_width; | 6101 | WSET (w, left_margin_cols, left_width); |
| 6042 | w->right_margin_cols = right_width; | 6102 | WSET (w, right_margin_cols, right_width); |
| 6043 | 6103 | ||
| 6044 | adjust_window_margins (w); | 6104 | adjust_window_margins (w); |
| 6045 | 6105 | ||
| @@ -6054,13 +6114,14 @@ means no margin. */) | |||
| 6054 | DEFUN ("window-margins", Fwindow_margins, Swindow_margins, | 6114 | DEFUN ("window-margins", Fwindow_margins, Swindow_margins, |
| 6055 | 0, 1, 0, | 6115 | 0, 1, 0, |
| 6056 | doc: /* Get width of marginal areas of window WINDOW. | 6116 | doc: /* Get width of marginal areas of window WINDOW. |
| 6057 | If WINDOW is omitted or nil, it defaults to the selected window. | 6117 | WINDOW must be a live window and defaults to the selected one. |
| 6118 | |||
| 6058 | Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). | 6119 | Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). |
| 6059 | If a marginal area does not exist, its width will be returned | 6120 | If a marginal area does not exist, its width will be returned |
| 6060 | as nil. */) | 6121 | as nil. */) |
| 6061 | (Lisp_Object window) | 6122 | (Lisp_Object window) |
| 6062 | { | 6123 | { |
| 6063 | struct window *w = decode_window (window); | 6124 | struct window *w = decode_live_window (window); |
| 6064 | return Fcons (w->left_margin_cols, w->right_margin_cols); | 6125 | return Fcons (w->left_margin_cols, w->right_margin_cols); |
| 6065 | } | 6126 | } |
| 6066 | 6127 | ||
| @@ -6073,8 +6134,8 @@ as nil. */) | |||
| 6073 | DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, | 6134 | DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, |
| 6074 | 2, 4, 0, | 6135 | 2, 4, 0, |
| 6075 | doc: /* Set the fringe widths of window WINDOW. | 6136 | doc: /* Set the fringe widths of window WINDOW. |
| 6076 | If WINDOW is nil, set the fringe widths of the currently selected | 6137 | WINDOW must be a live window and defaults to the selected one. |
| 6077 | window. | 6138 | |
| 6078 | Second arg LEFT-WIDTH specifies the number of pixels to reserve for | 6139 | Second arg LEFT-WIDTH specifies the number of pixels to reserve for |
| 6079 | the left fringe. Optional third arg RIGHT-WIDTH specifies the right | 6140 | the left fringe. Optional third arg RIGHT-WIDTH specifies the right |
| 6080 | fringe width. If a fringe width arg is nil, that means to use the | 6141 | fringe width. If a fringe width arg is nil, that means to use the |
| @@ -6085,7 +6146,7 @@ outside of the display margins. By default, fringes are drawn between | |||
| 6085 | display marginal areas and the text area. */) | 6146 | display marginal areas and the text area. */) |
| 6086 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) | 6147 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) |
| 6087 | { | 6148 | { |
| 6088 | struct window *w = decode_window (window); | 6149 | struct window *w = decode_live_window (window); |
| 6089 | int outside = !NILP (outside_margins); | 6150 | int outside = !NILP (outside_margins); |
| 6090 | 6151 | ||
| 6091 | if (!NILP (left_width)) | 6152 | if (!NILP (left_width)) |
| @@ -6099,14 +6160,14 @@ display marginal areas and the text area. */) | |||
| 6099 | || !EQ (w->right_fringe_width, right_width) | 6160 | || !EQ (w->right_fringe_width, right_width) |
| 6100 | || w->fringes_outside_margins != outside)) | 6161 | || w->fringes_outside_margins != outside)) |
| 6101 | { | 6162 | { |
| 6102 | w->left_fringe_width = left_width; | 6163 | WSET (w, left_fringe_width, left_width); |
| 6103 | w->right_fringe_width = right_width; | 6164 | WSET (w, right_fringe_width, right_width); |
| 6104 | w->fringes_outside_margins = outside; | 6165 | w->fringes_outside_margins = outside; |
| 6105 | 6166 | ||
| 6106 | adjust_window_margins (w); | 6167 | adjust_window_margins (w); |
| 6107 | 6168 | ||
| 6108 | clear_glyph_matrix (w->current_matrix); | 6169 | clear_glyph_matrix (w->current_matrix); |
| 6109 | w->window_end_valid = Qnil; | 6170 | WSET (w, window_end_valid, Qnil); |
| 6110 | 6171 | ||
| 6111 | ++windows_or_buffers_changed; | 6172 | ++windows_or_buffers_changed; |
| 6112 | adjust_glyphs (XFRAME (WINDOW_FRAME (w))); | 6173 | adjust_glyphs (XFRAME (WINDOW_FRAME (w))); |
| @@ -6119,11 +6180,12 @@ display marginal areas and the text area. */) | |||
| 6119 | DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, | 6180 | DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, |
| 6120 | 0, 1, 0, | 6181 | 0, 1, 0, |
| 6121 | doc: /* Get width of fringes of window WINDOW. | 6182 | doc: /* Get width of fringes of window WINDOW. |
| 6122 | If WINDOW is omitted or nil, it defaults to the selected window. | 6183 | WINDOW must be a live window and defaults to the selected one. |
| 6184 | |||
| 6123 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) | 6185 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) |
| 6124 | (Lisp_Object window) | 6186 | (Lisp_Object window) |
| 6125 | { | 6187 | { |
| 6126 | struct window *w = decode_window (window); | 6188 | struct window *w = decode_live_window (window); |
| 6127 | 6189 | ||
| 6128 | return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), | 6190 | return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), |
| 6129 | Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), | 6191 | Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), |
| @@ -6140,7 +6202,8 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) | |||
| 6140 | DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars, | 6202 | DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars, |
| 6141 | Sset_window_scroll_bars, 2, 4, 0, | 6203 | Sset_window_scroll_bars, 2, 4, 0, |
| 6142 | doc: /* Set width and type of scroll bars of window WINDOW. | 6204 | doc: /* Set width and type of scroll bars of window WINDOW. |
| 6143 | If window is nil, set scroll bars of the currently selected window. | 6205 | WINDOW must be a live window and defaults to the selected one. |
| 6206 | |||
| 6144 | Second parameter WIDTH specifies the pixel width for the scroll bar; | 6207 | Second parameter WIDTH specifies the pixel width for the scroll bar; |
| 6145 | this is automatically adjusted to a multiple of the frame column width. | 6208 | this is automatically adjusted to a multiple of the frame column width. |
| 6146 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll | 6209 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll |
| @@ -6150,7 +6213,7 @@ If VERTICAL-TYPE is t, use the frame's scroll-bar type. | |||
| 6150 | Fourth parameter HORIZONTAL-TYPE is currently unused. */) | 6213 | Fourth parameter HORIZONTAL-TYPE is currently unused. */) |
| 6151 | (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) | 6214 | (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) |
| 6152 | { | 6215 | { |
| 6153 | struct window *w = decode_window (window); | 6216 | struct window *w = decode_live_window (window); |
| 6154 | 6217 | ||
| 6155 | if (!NILP (width)) | 6218 | if (!NILP (width)) |
| 6156 | { | 6219 | { |
| @@ -6169,13 +6232,13 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) | |||
| 6169 | if (!EQ (w->scroll_bar_width, width) | 6232 | if (!EQ (w->scroll_bar_width, width) |
| 6170 | || !EQ (w->vertical_scroll_bar_type, vertical_type)) | 6233 | || !EQ (w->vertical_scroll_bar_type, vertical_type)) |
| 6171 | { | 6234 | { |
| 6172 | w->scroll_bar_width = width; | 6235 | WSET (w, scroll_bar_width, width); |
| 6173 | w->vertical_scroll_bar_type = vertical_type; | 6236 | WSET (w, vertical_scroll_bar_type, vertical_type); |
| 6174 | 6237 | ||
| 6175 | adjust_window_margins (w); | 6238 | adjust_window_margins (w); |
| 6176 | 6239 | ||
| 6177 | clear_glyph_matrix (w->current_matrix); | 6240 | clear_glyph_matrix (w->current_matrix); |
| 6178 | w->window_end_valid = Qnil; | 6241 | WSET (w, window_end_valid, Qnil); |
| 6179 | 6242 | ||
| 6180 | ++windows_or_buffers_changed; | 6243 | ++windows_or_buffers_changed; |
| 6181 | adjust_glyphs (XFRAME (WINDOW_FRAME (w))); | 6244 | adjust_glyphs (XFRAME (WINDOW_FRAME (w))); |
| @@ -6188,13 +6251,14 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) | |||
| 6188 | DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, | 6251 | DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, |
| 6189 | 0, 1, 0, | 6252 | 0, 1, 0, |
| 6190 | doc: /* Get width and type of scroll bars of window WINDOW. | 6253 | doc: /* Get width and type of scroll bars of window WINDOW. |
| 6191 | If WINDOW is omitted or nil, it defaults to the selected window. | 6254 | WINDOW must be a live window and defaults to the selected one. |
| 6255 | |||
| 6192 | Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). | 6256 | Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). |
| 6193 | If WIDTH is nil or TYPE is t, the window is using the frame's corresponding | 6257 | If WIDTH is nil or TYPE is t, the window is using the frame's corresponding |
| 6194 | value. */) | 6258 | value. */) |
| 6195 | (Lisp_Object window) | 6259 | (Lisp_Object window) |
| 6196 | { | 6260 | { |
| 6197 | struct window *w = decode_window (window); | 6261 | struct window *w = decode_live_window (window); |
| 6198 | return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | 6262 | return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) |
| 6199 | ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | 6263 | ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) |
| 6200 | : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), | 6264 | : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), |
| @@ -6488,6 +6552,7 @@ syms_of_window (void) | |||
| 6488 | DEFSYM (Qwindowp, "windowp"); | 6552 | DEFSYM (Qwindowp, "windowp"); |
| 6489 | DEFSYM (Qwindow_configuration_p, "window-configuration-p"); | 6553 | DEFSYM (Qwindow_configuration_p, "window-configuration-p"); |
| 6490 | DEFSYM (Qwindow_live_p, "window-live-p"); | 6554 | DEFSYM (Qwindow_live_p, "window-live-p"); |
| 6555 | DEFSYM (Qwindow_valid_p, "window-valid-p"); | ||
| 6491 | DEFSYM (Qwindow_deletable_p, "window-deletable-p"); | 6556 | DEFSYM (Qwindow_deletable_p, "window-deletable-p"); |
| 6492 | DEFSYM (Qdelete_window, "delete-window"); | 6557 | DEFSYM (Qdelete_window, "delete-window"); |
| 6493 | DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); | 6558 | DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); |
| @@ -6640,6 +6705,7 @@ respectively are not installed by `window-state-put'. */); | |||
| 6640 | defsubr (&Sminibuffer_window); | 6705 | defsubr (&Sminibuffer_window); |
| 6641 | defsubr (&Swindow_minibuffer_p); | 6706 | defsubr (&Swindow_minibuffer_p); |
| 6642 | defsubr (&Swindowp); | 6707 | defsubr (&Swindowp); |
| 6708 | defsubr (&Swindow_valid_p); | ||
| 6643 | defsubr (&Swindow_live_p); | 6709 | defsubr (&Swindow_live_p); |
| 6644 | defsubr (&Swindow_frame); | 6710 | defsubr (&Swindow_frame); |
| 6645 | defsubr (&Sframe_root_window); | 6711 | defsubr (&Sframe_root_window); |