aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-06 14:24:26 +0400
committerDmitry Antipov2012-08-06 14:24:26 +0400
commit077288cf3f654776ee44bc9b56954c4e26b10d96 (patch)
tree00bbcb4dab9c879efde73a01786977b1c1364f67 /src/window.c
parent71688bd7f9169c12ea8be54e084470f19d44ce44 (diff)
downloademacs-077288cf3f654776ee44bc9b56954c4e26b10d96.tar.gz
emacs-077288cf3f654776ee44bc9b56954c4e26b10d96.zip
Separate read and write access to Lisp_Object slots of struct window.
* window.h (WGET, WSET): New macros similar to AREF and ASET. * alloc.c, buffer.c, composite.c, dispextern.h, dispnew.c, editfns.c: * fileio.c, font.c, fontset.c, frame.c, frame.h, fringe.c, indent.c: * insdel.c, keyboard.c, keymap.c, lisp.h, minibuf.c, msdos.c, nsfns.m: * nsmenu.m, nsterm.m, print.c, textprop.c, w32fns.c, w32menu.c: * w32term.c, window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Adjust users.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c1278
1 files changed, 636 insertions, 642 deletions
diff --git a/src/window.c b/src/window.c
index 1c62e6f00a7..a71fa0b1088 100644
--- a/src/window.c
+++ b/src/window.c
@@ -178,7 +178,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
178If WINDOW is omitted or nil, it defaults to the selected window. */) 178If WINDOW is omitted or nil, it defaults to the selected window. */)
179 (Lisp_Object window) 179 (Lisp_Object window)
180{ 180{
181 return WVAR (decode_any_window (window), frame); 181 return WGET (decode_any_window (window), frame);
182} 182}
183 183
184DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 184DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
@@ -244,12 +244,12 @@ the first window of that frame. */)
244 window = FGET (XFRAME (frame_or_window), root_window); 244 window = FGET (XFRAME (frame_or_window), root_window);
245 } 245 }
246 246
247 while (NILP (WVAR (XWINDOW (window), buffer))) 247 while (NILP (WGET (XWINDOW (window), buffer)))
248 { 248 {
249 if (! NILP (WVAR (XWINDOW (window), hchild))) 249 if (! NILP (WGET (XWINDOW (window), hchild)))
250 window = WVAR (XWINDOW (window), hchild); 250 window = WGET (XWINDOW (window), hchild);
251 else if (! NILP (WVAR (XWINDOW (window), vchild))) 251 else if (! NILP (WGET (XWINDOW (window), vchild)))
252 window = WVAR (XWINDOW (window), vchild); 252 window = WGET (XWINDOW (window), vchild);
253 else 253 else
254 abort (); 254 abort ();
255 } 255 }
@@ -338,7 +338,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
338 if (NILP (norecord)) 338 if (NILP (norecord))
339 { 339 {
340 w->use_time = ++window_select_count; 340 w->use_time = ++window_select_count;
341 record_buffer (WVAR (w, buffer)); 341 record_buffer (WGET (w, buffer));
342 } 342 }
343 343
344 if (EQ (window, selected_window) && !inhibit_point_swap) 344 if (EQ (window, selected_window) && !inhibit_point_swap)
@@ -366,17 +366,17 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
366 if (!inhibit_point_swap) 366 if (!inhibit_point_swap)
367 { 367 {
368 ow = XWINDOW (selected_window); 368 ow = XWINDOW (selected_window);
369 if (! NILP (WVAR (ow, buffer))) 369 if (! NILP (WGET (ow, buffer)))
370 set_marker_both (WVAR (ow, pointm), WVAR (ow, buffer), 370 set_marker_both (WGET (ow, pointm), WGET (ow, buffer),
371 BUF_PT (XBUFFER (WVAR (ow, buffer))), 371 BUF_PT (XBUFFER (WGET (ow, buffer))),
372 BUF_PT_BYTE (XBUFFER (WVAR (ow, buffer)))); 372 BUF_PT_BYTE (XBUFFER (WGET (ow, buffer))));
373 } 373 }
374 374
375 selected_window = window; 375 selected_window = window;
376 376
377 Fset_buffer (WVAR (w, buffer)); 377 Fset_buffer (WGET (w, buffer));
378 378
379 BVAR (XBUFFER (WVAR (w, buffer)), last_selected_window) = window; 379 BVAR (XBUFFER (WGET (w, buffer)), last_selected_window) = window;
380 380
381 /* Go to the point recorded in the window. 381 /* Go to the point recorded in the window.
382 This is important when the buffer is in more 382 This is important when the buffer is in more
@@ -384,7 +384,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
384 redisplay_window has altered point after scrolling, 384 redisplay_window has altered point after scrolling,
385 because it makes the change only in the window. */ 385 because it makes the change only in the window. */
386 { 386 {
387 register ptrdiff_t new_point = marker_position (WVAR (w, pointm)); 387 register ptrdiff_t new_point = marker_position (WGET (w, pointm));
388 if (new_point < BEGV) 388 if (new_point < BEGV)
389 SET_PT (BEGV); 389 SET_PT (BEGV);
390 else if (new_point > ZV) 390 else if (new_point > ZV)
@@ -419,7 +419,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
419Return nil for an internal window or a deleted window. */) 419Return nil for an internal window or a deleted window. */)
420 (Lisp_Object window) 420 (Lisp_Object window)
421{ 421{
422 return WVAR (decode_any_window (window), buffer); 422 return WGET (decode_any_window (window), buffer);
423} 423}
424 424
425DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, 425DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
@@ -428,7 +428,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
428Return nil for a window with no parent (e.g. a root window). */) 428Return nil for a window with no parent (e.g. a root window). */)
429 (Lisp_Object window) 429 (Lisp_Object window)
430{ 430{
431 return WVAR (decode_any_window (window), parent); 431 return WGET (decode_any_window (window), parent);
432} 432}
433 433
434DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, 434DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
@@ -439,7 +439,7 @@ horizontal combination. */)
439 (Lisp_Object window) 439 (Lisp_Object window)
440{ 440{
441 CHECK_WINDOW (window); 441 CHECK_WINDOW (window);
442 return WVAR (decode_any_window (window), vchild); 442 return WGET (decode_any_window (window), vchild);
443} 443}
444 444
445DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, 445DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
@@ -450,7 +450,7 @@ vertical combination. */)
450 (Lisp_Object window) 450 (Lisp_Object window)
451{ 451{
452 CHECK_WINDOW (window); 452 CHECK_WINDOW (window);
453 return WVAR (decode_any_window (window), hchild); 453 return WGET (decode_any_window (window), hchild);
454} 454}
455 455
456DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, 456DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
@@ -459,7 +459,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
459Return nil if WINDOW has no next sibling. */) 459Return nil if WINDOW has no next sibling. */)
460 (Lisp_Object window) 460 (Lisp_Object window)
461{ 461{
462 return WVAR (decode_any_window (window), next); 462 return WGET (decode_any_window (window), next);
463} 463}
464 464
465DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, 465DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
@@ -468,7 +468,7 @@ If WINDOW is omitted or nil, it defaults to the selected window.
468Return nil if WINDOW has no previous sibling. */) 468Return nil if WINDOW has no previous sibling. */)
469 (Lisp_Object window) 469 (Lisp_Object window)
470{ 470{
471 return WVAR (decode_any_window (window), prev); 471 return WGET (decode_any_window (window), prev);
472} 472}
473 473
474DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, 474DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0,
@@ -478,7 +478,7 @@ WINDOW's siblings. A return value of t means that child windows of
478WINDOW are never \(re-)combined with WINDOW's siblings. */) 478WINDOW are never \(re-)combined with WINDOW's siblings. */)
479 (Lisp_Object window) 479 (Lisp_Object window)
480{ 480{
481 return WVAR (decode_any_window (window), combination_limit); 481 return WGET (decode_any_window (window), combination_limit);
482} 482}
483 483
484DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, 484DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
@@ -489,9 +489,7 @@ never \(re-)combined with WINDOW's siblings. Other values are reserved
489for future use. */) 489for future use. */)
490 (Lisp_Object window, Lisp_Object limit) 490 (Lisp_Object window, Lisp_Object limit)
491{ 491{
492 register struct window *w = decode_any_window (window); 492 return WSET (decode_any_window (window), combination_limit, limit);
493 WVAR (w, combination_limit) = limit;
494 return WVAR (w, combination_limit);
495} 493}
496 494
497DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 495DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
@@ -517,7 +515,7 @@ On a graphical display, this total height is reported as an
517integer multiple of the default character height. */) 515integer multiple of the default character height. */)
518 (Lisp_Object window) 516 (Lisp_Object window)
519{ 517{
520 return WVAR (decode_any_window (window), total_lines); 518 return WGET (decode_any_window (window), total_lines);
521} 519}
522 520
523DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, 521DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0,
@@ -532,7 +530,7 @@ On a graphical display, this total width is reported as an
532integer multiple of the default character width. */) 530integer multiple of the default character width. */)
533 (Lisp_Object window) 531 (Lisp_Object window)
534{ 532{
535 return WVAR (decode_any_window (window), total_cols); 533 return WGET (decode_any_window (window), total_cols);
536} 534}
537 535
538DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 536DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
@@ -540,7 +538,7 @@ DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
540If WINDOW is omitted or nil, it defaults to the selected window. */) 538If WINDOW is omitted or nil, it defaults to the selected window. */)
541 (Lisp_Object window) 539 (Lisp_Object window)
542{ 540{
543 return WVAR (decode_any_window (window), new_total); 541 return WGET (decode_any_window (window), new_total);
544} 542}
545 543
546DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 544DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
@@ -550,9 +548,9 @@ If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
550 (Lisp_Object window, Lisp_Object horizontal) 548 (Lisp_Object window, Lisp_Object horizontal)
551{ 549{
552 if (NILP (horizontal)) 550 if (NILP (horizontal))
553 return WVAR (decode_any_window (window), normal_lines); 551 return WGET (decode_any_window (window), normal_lines);
554 else 552 else
555 return WVAR (decode_any_window (window), normal_cols); 553 return WGET (decode_any_window (window), normal_cols);
556} 554}
557 555
558DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 556DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
@@ -560,7 +558,7 @@ DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
560If WINDOW is omitted or nil, it defaults to the selected window. */) 558If WINDOW is omitted or nil, it defaults to the selected window. */)
561 (Lisp_Object window) 559 (Lisp_Object window)
562{ 560{
563 return WVAR (decode_any_window (window), new_normal); 561 return WGET (decode_any_window (window), new_normal);
564} 562}
565 563
566DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 564DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
@@ -572,7 +570,7 @@ value is 0 if there is no window to the left of WINDOW.
572If WINDOW is omitted or nil, it defaults to the selected window. */) 570If WINDOW is omitted or nil, it defaults to the selected window. */)
573 (Lisp_Object window) 571 (Lisp_Object window)
574{ 572{
575 return WVAR (decode_any_window (window), left_col); 573 return WGET (decode_any_window (window), left_col);
576} 574}
577 575
578DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 576DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
@@ -584,7 +582,7 @@ there is no window above WINDOW.
584If WINDOW is omitted or nil, it defaults to the selected window. */) 582If WINDOW is omitted or nil, it defaults to the selected window. */)
585 (Lisp_Object window) 583 (Lisp_Object window)
586{ 584{
587 return WVAR (decode_any_window (window), top_line); 585 return WGET (decode_any_window (window), top_line);
588} 586}
589 587
590/* Return the number of lines of W's body. Don't count any mode or 588/* Return the number of lines of W's body. Don't count any mode or
@@ -593,7 +591,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. */)
593static int 591static int
594window_body_lines (struct window *w) 592window_body_lines (struct window *w)
595{ 593{
596 int height = XFASTINT (WVAR (w, total_lines)); 594 int height = XFASTINT (WGET (w, total_lines));
597 595
598 if (!MINI_WINDOW_P (w)) 596 if (!MINI_WINDOW_P (w))
599 { 597 {
@@ -615,7 +613,7 @@ int
615window_body_cols (struct window *w) 613window_body_cols (struct window *w)
616{ 614{
617 struct frame *f = XFRAME (WINDOW_FRAME (w)); 615 struct frame *f = XFRAME (WINDOW_FRAME (w));
618 int width = XINT (WVAR (w, total_cols)); 616 int width = XINT (WGET (w, total_cols));
619 617
620 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) 618 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
621 /* Scroll bars occupy a few columns. */ 619 /* Scroll bars occupy a few columns. */
@@ -690,7 +688,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll)
690 688
691 /* Prevent redisplay shortcuts when changing the hscroll. */ 689 /* Prevent redisplay shortcuts when changing the hscroll. */
692 if (w->hscroll != new_hscroll) 690 if (w->hscroll != new_hscroll)
693 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; 691 XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
694 692
695 w->hscroll = new_hscroll; 693 w->hscroll = new_hscroll;
696 return make_number (new_hscroll); 694 return make_number (new_hscroll);
@@ -719,7 +717,7 @@ WINDOW defaults to the selected window.
719See `set-window-redisplay-end-trigger' for more information. */) 717See `set-window-redisplay-end-trigger' for more information. */)
720 (Lisp_Object window) 718 (Lisp_Object window)
721{ 719{
722 return WVAR (decode_window (window), redisplay_end_trigger); 720 return WGET (decode_window (window), redisplay_end_trigger);
723} 721}
724 722
725DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, 723DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger,
@@ -732,11 +730,7 @@ with two arguments: WINDOW, and the end trigger value.
732Afterwards the end-trigger value is reset to nil. */) 730Afterwards the end-trigger value is reset to nil. */)
733 (register Lisp_Object window, Lisp_Object value) 731 (register Lisp_Object window, Lisp_Object value)
734{ 732{
735 register struct window *w; 733 return WSET (decode_window (window), redisplay_end_trigger, value);
736
737 w = decode_window (window);
738 WVAR (w, redisplay_end_trigger) = value;
739 return value;
740} 734}
741 735
742DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, 736DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
@@ -785,7 +779,7 @@ of just the text area, use `window-inside-pixel-edges'. */)
785static void 779static void
786calc_absolute_offset (struct window *w, int *add_x, int *add_y) 780calc_absolute_offset (struct window *w, int *add_x, int *add_y)
787{ 781{
788 struct frame *f = XFRAME (WVAR (w, frame)); 782 struct frame *f = XFRAME (WGET (w, frame));
789 *add_y = f->top_pos; 783 *add_y = f->top_pos;
790#ifdef FRAME_MENUBAR_HEIGHT 784#ifdef FRAME_MENUBAR_HEIGHT
791 *add_y += FRAME_MENUBAR_HEIGHT (f); 785 *add_y += FRAME_MENUBAR_HEIGHT (f);
@@ -1095,7 +1089,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1095 1089
1096 CHECK_LIVE_WINDOW (window); 1090 CHECK_LIVE_WINDOW (window);
1097 w = XWINDOW (window); 1091 w = XWINDOW (window);
1098 f = XFRAME (WVAR (w, frame)); 1092 f = XFRAME (WGET (w, frame));
1099 CHECK_CONS (coordinates); 1093 CHECK_CONS (coordinates);
1100 lx = Fcar (coordinates); 1094 lx = Fcar (coordinates);
1101 ly = Fcdr (coordinates); 1095 ly = Fcdr (coordinates);
@@ -1275,9 +1269,9 @@ But that is hard to define. */)
1275 register struct window *w = decode_window (window); 1269 register struct window *w = decode_window (window);
1276 1270
1277 if (w == XWINDOW (selected_window) 1271 if (w == XWINDOW (selected_window)
1278 && current_buffer == XBUFFER (WVAR (w, buffer))) 1272 && current_buffer == XBUFFER (WGET (w, buffer)))
1279 return Fpoint (); 1273 return Fpoint ();
1280 return Fmarker_position (WVAR (w, pointm)); 1274 return Fmarker_position (WGET (w, pointm));
1281} 1275}
1282 1276
1283DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, 1277DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
@@ -1286,7 +1280,7 @@ WINDOW must be a live window and defaults to the selected one.
1286This is updated by redisplay or by calling `set-window-start'. */) 1280This is updated by redisplay or by calling `set-window-start'. */)
1287 (Lisp_Object window) 1281 (Lisp_Object window)
1288{ 1282{
1289 return Fmarker_position (WVAR (decode_window (window), start)); 1283 return Fmarker_position (WGET (decode_window (window), start));
1290} 1284}
1291 1285
1292/* This is text temporarily removed from the doc string below. 1286/* This is text temporarily removed from the doc string below.
@@ -1317,7 +1311,7 @@ if it isn't already recorded. */)
1317 Lisp_Object buf; 1311 Lisp_Object buf;
1318 struct buffer *b; 1312 struct buffer *b;
1319 1313
1320 buf = WVAR (w, buffer); 1314 buf = WGET (w, buffer);
1321 CHECK_BUFFER (buf); 1315 CHECK_BUFFER (buf);
1322 b = XBUFFER (buf); 1316 b = XBUFFER (buf);
1323 1317
@@ -1326,12 +1320,12 @@ if it isn't already recorded. */)
1326 The user can compute it with vertical-motion if he wants to. 1320 The user can compute it with vertical-motion if he wants to.
1327 It would be nicer to do it automatically, 1321 It would be nicer to do it automatically,
1328 but that's so slow that it would probably bother people. */ 1322 but that's so slow that it would probably bother people. */
1329 if (NILP (WVAR (w, window_end_valid))) 1323 if (NILP (WGET (w, window_end_valid)))
1330 return Qnil; 1324 return Qnil;
1331#endif 1325#endif
1332 1326
1333 if (! NILP (update) 1327 if (! NILP (update)
1334 && ! (! NILP (WVAR (w, window_end_valid)) 1328 && ! (! NILP (WGET (w, window_end_valid))
1335 && w->last_modified >= BUF_MODIFF (b) 1329 && w->last_modified >= BUF_MODIFF (b)
1336 && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b)) 1330 && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b))
1337 && !noninteractive) 1331 && !noninteractive)
@@ -1354,12 +1348,12 @@ if it isn't already recorded. */)
1354 `-l' containing a call to `rmail' with subsequent other 1348 `-l' containing a call to `rmail' with subsequent other
1355 commands. At the end, W->start happened to be BEG, while 1349 commands. At the end, W->start happened to be BEG, while
1356 rmail had already narrowed the buffer. */ 1350 rmail had already narrowed the buffer. */
1357 if (XMARKER (WVAR (w, start))->charpos < BEGV) 1351 if (XMARKER (WGET (w, start))->charpos < BEGV)
1358 SET_TEXT_POS (startp, BEGV, BEGV_BYTE); 1352 SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
1359 else if (XMARKER (WVAR (w, start))->charpos > ZV) 1353 else if (XMARKER (WGET (w, start))->charpos > ZV)
1360 SET_TEXT_POS (startp, ZV, ZV_BYTE); 1354 SET_TEXT_POS (startp, ZV, ZV_BYTE);
1361 else 1355 else
1362 SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); 1356 SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start));
1363 1357
1364 itdata = bidi_shelve_cache (); 1358 itdata = bidi_shelve_cache ();
1365 start_display (&it, w, startp); 1359 start_display (&it, w, startp);
@@ -1373,7 +1367,7 @@ if it isn't already recorded. */)
1373 set_buffer_internal (old_buffer); 1367 set_buffer_internal (old_buffer);
1374 } 1368 }
1375 else 1369 else
1376 XSETINT (value, BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos))); 1370 XSETINT (value, BUF_Z (b) - XFASTINT (WGET (w, window_end_pos)));
1377 1371
1378 return value; 1372 return value;
1379} 1373}
@@ -1387,10 +1381,10 @@ Return POS. */)
1387 1381
1388 CHECK_NUMBER_COERCE_MARKER (pos); 1382 CHECK_NUMBER_COERCE_MARKER (pos);
1389 if (w == XWINDOW (selected_window) 1383 if (w == XWINDOW (selected_window)
1390 && XBUFFER (WVAR (w, buffer)) == current_buffer) 1384 && XBUFFER (WGET (w, buffer)) == current_buffer)
1391 Fgoto_char (pos); 1385 Fgoto_char (pos);
1392 else 1386 else
1393 set_marker_restricted (WVAR (w, pointm), pos, WVAR (w, buffer)); 1387 set_marker_restricted (WGET (w, pointm), pos, WGET (w, buffer));
1394 1388
1395 /* We have to make sure that redisplay updates the window to show 1389 /* We have to make sure that redisplay updates the window to show
1396 the new value of point. */ 1390 the new value of point. */
@@ -1410,7 +1404,7 @@ overriding motion of point in order to display at this exact start. */)
1410 register struct window *w = decode_window (window); 1404 register struct window *w = decode_window (window);
1411 1405
1412 CHECK_NUMBER_COERCE_MARKER (pos); 1406 CHECK_NUMBER_COERCE_MARKER (pos);
1413 set_marker_restricted (WVAR (w, start), pos, WVAR (w, buffer)); 1407 set_marker_restricted (WGET (w, start), pos, WGET (w, buffer));
1414 /* this is not right, but much easier than doing what is right. */ 1408 /* this is not right, but much easier than doing what is right. */
1415 w->start_at_line_beg = 0; 1409 w->start_at_line_beg = 0;
1416 if (NILP (noforce)) 1410 if (NILP (noforce))
@@ -1452,8 +1446,8 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1452 int x, y; 1446 int x, y;
1453 1447
1454 w = decode_window (window); 1448 w = decode_window (window);
1455 buf = XBUFFER (WVAR (w, buffer)); 1449 buf = XBUFFER (WGET (w, buffer));
1456 SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start)); 1450 SET_TEXT_POS_FROM_MARKER (top, WGET (w, start));
1457 1451
1458 if (EQ (pos, Qt)) 1452 if (EQ (pos, Qt))
1459 posint = -1; 1453 posint = -1;
@@ -1465,7 +1459,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1465 else if (w == XWINDOW (selected_window)) 1459 else if (w == XWINDOW (selected_window))
1466 posint = PT; 1460 posint = PT;
1467 else 1461 else
1468 posint = XMARKER (WVAR (w, pointm))->charpos; 1462 posint = XMARKER (WGET (w, pointm))->charpos;
1469 1463
1470 /* If position is above window start or outside buffer boundaries, 1464 /* If position is above window start or outside buffer boundaries,
1471 or if window start is out of range, position is not visible. */ 1465 or if window start is out of range, position is not visible. */
@@ -1522,11 +1516,11 @@ Return nil if window display is not up-to-date. In that case, use
1522 if (noninteractive || w->pseudo_window_p) 1516 if (noninteractive || w->pseudo_window_p)
1523 return Qnil; 1517 return Qnil;
1524 1518
1525 CHECK_BUFFER (WVAR (w, buffer)); 1519 CHECK_BUFFER (WGET (w, buffer));
1526 b = XBUFFER (WVAR (w, buffer)); 1520 b = XBUFFER (WGET (w, buffer));
1527 1521
1528 /* Fail if current matrix is not up-to-date. */ 1522 /* Fail if current matrix is not up-to-date. */
1529 if (NILP (WVAR (w, window_end_valid)) 1523 if (NILP (WGET (w, window_end_valid))
1530 || current_buffer->clip_changed 1524 || current_buffer->clip_changed
1531 || current_buffer->prevent_redisplay_optimizations_p 1525 || current_buffer->prevent_redisplay_optimizations_p
1532 || w->last_modified < BUF_MODIFF (b) 1526 || w->last_modified < BUF_MODIFF (b)
@@ -1619,7 +1613,7 @@ window, unless that window is "strongly" dedicated to its buffer, that
1619is the value returned by `window-dedicated-p' is t. */) 1613is the value returned by `window-dedicated-p' is t. */)
1620 (Lisp_Object window) 1614 (Lisp_Object window)
1621{ 1615{
1622 return WVAR (decode_window (window), dedicated); 1616 return WGET (decode_window (window), dedicated);
1623} 1617}
1624 1618
1625DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, 1619DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p,
@@ -1643,10 +1637,7 @@ buffer. If and when `set-window-buffer' displays another buffer in a
1643window, it also makes sure that the window is no more dedicated. */) 1637window, it also makes sure that the window is no more dedicated. */)
1644 (Lisp_Object window, Lisp_Object flag) 1638 (Lisp_Object window, Lisp_Object flag)
1645{ 1639{
1646 register struct window *w = decode_window (window); 1640 return WSET (decode_window (window), dedicated, flag);
1647
1648 WVAR (w, dedicated) = flag;
1649 return WVAR (w, dedicated);
1650} 1641}
1651 1642
1652DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, 1643DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers,
@@ -1659,7 +1650,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1659window for that buffer, and POS is a window-specific point value. */) 1650window for that buffer, and POS is a window-specific point value. */)
1660 (Lisp_Object window) 1651 (Lisp_Object window)
1661{ 1652{
1662 return WVAR (decode_window (window), prev_buffers); 1653 return WGET (decode_window (window), prev_buffers);
1663} 1654}
1664 1655
1665DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, 1656DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers,
@@ -1672,7 +1663,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1672window for that buffer, and POS is a window-specific point value. */) 1663window for that buffer, and POS is a window-specific point value. */)
1673 (Lisp_Object window, Lisp_Object prev_buffers) 1664 (Lisp_Object window, Lisp_Object prev_buffers)
1674{ 1665{
1675 return WVAR (decode_window (window), prev_buffers) = prev_buffers; 1666 return WSET (decode_window (window), prev_buffers, prev_buffers);
1676} 1667}
1677 1668
1678DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, 1669DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
@@ -1681,7 +1672,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
1681WINDOW must be a live window and defaults to the selected one. */) 1672WINDOW must be a live window and defaults to the selected one. */)
1682 (Lisp_Object window) 1673 (Lisp_Object window)
1683{ 1674{
1684 return WVAR (decode_window (window), next_buffers); 1675 return WGET (decode_window (window), next_buffers);
1685} 1676}
1686 1677
1687DEFUN ("set-window-next-buffers", Fset_window_next_buffers, 1678DEFUN ("set-window-next-buffers", Fset_window_next_buffers,
@@ -1691,7 +1682,7 @@ WINDOW must be a live window and defaults to the selected one.
1691NEXT-BUFFERS should be a list of buffers. */) 1682NEXT-BUFFERS should be a list of buffers. */)
1692 (Lisp_Object window, Lisp_Object next_buffers) 1683 (Lisp_Object window, Lisp_Object next_buffers)
1693{ 1684{
1694 return WVAR (decode_window (window), next_buffers) = next_buffers; 1685 return WSET (decode_window (window), next_buffers, next_buffers);
1695} 1686}
1696 1687
1697DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, 1688DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
@@ -1701,7 +1692,7 @@ WINDOW defaults to the selected window. The return value is a list of
1701elements of the form (PARAMETER . VALUE). */) 1692elements of the form (PARAMETER . VALUE). */)
1702 (Lisp_Object window) 1693 (Lisp_Object window)
1703{ 1694{
1704 return Fcopy_alist (WVAR (decode_any_window (window), window_parameters)); 1695 return Fcopy_alist (WGET (decode_any_window (window), window_parameters));
1705} 1696}
1706 1697
1707DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, 1698DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
@@ -1712,7 +1703,7 @@ WINDOW defaults to the selected window. */)
1712{ 1703{
1713 Lisp_Object result; 1704 Lisp_Object result;
1714 1705
1715 result = Fassq (parameter, WVAR (decode_any_window (window), 1706 result = Fassq (parameter, WGET (decode_any_window (window),
1716 window_parameters)); 1707 window_parameters));
1717 return CDR_SAFE (result); 1708 return CDR_SAFE (result);
1718} 1709}
@@ -1726,10 +1717,10 @@ WINDOW defaults to the selected window. Return VALUE. */)
1726 register struct window *w = decode_any_window (window); 1717 register struct window *w = decode_any_window (window);
1727 Lisp_Object old_alist_elt; 1718 Lisp_Object old_alist_elt;
1728 1719
1729 old_alist_elt = Fassq (parameter, WVAR (w, window_parameters)); 1720 old_alist_elt = Fassq (parameter, WGET (w, window_parameters));
1730 if (NILP (old_alist_elt)) 1721 if (NILP (old_alist_elt))
1731 WVAR (w, window_parameters) 1722 WSET (w, window_parameters,
1732 = Fcons (Fcons (parameter, value), WVAR (w, window_parameters)); 1723 Fcons (Fcons (parameter, value), WGET (w, window_parameters)));
1733 else 1724 else
1734 Fsetcdr (old_alist_elt, value); 1725 Fsetcdr (old_alist_elt, value);
1735 return value; 1726 return value;
@@ -1741,7 +1732,7 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
1741WINDOW defaults to the selected window. */) 1732WINDOW defaults to the selected window. */)
1742 (Lisp_Object window) 1733 (Lisp_Object window)
1743{ 1734{
1744 return WVAR (decode_window (window), display_table); 1735 return WGET (decode_window (window), display_table);
1745} 1736}
1746 1737
1747/* Get the display table for use on window W. This is either W's 1738/* Get the display table for use on window W. This is either W's
@@ -1754,11 +1745,11 @@ window_display_table (struct window *w)
1754{ 1745{
1755 struct Lisp_Char_Table *dp = NULL; 1746 struct Lisp_Char_Table *dp = NULL;
1756 1747
1757 if (DISP_TABLE_P (WVAR (w, display_table))) 1748 if (DISP_TABLE_P (WGET (w, display_table)))
1758 dp = XCHAR_TABLE (WVAR (w, display_table)); 1749 dp = XCHAR_TABLE (WGET (w, display_table));
1759 else if (BUFFERP (WVAR (w, buffer))) 1750 else if (BUFFERP (WGET (w, buffer)))
1760 { 1751 {
1761 struct buffer *b = XBUFFER (WVAR (w, buffer)); 1752 struct buffer *b = XBUFFER (WGET (w, buffer));
1762 1753
1763 if (DISP_TABLE_P (BVAR (b, display_table))) 1754 if (DISP_TABLE_P (BVAR (b, display_table)))
1764 dp = XCHAR_TABLE (BVAR (b, display_table)); 1755 dp = XCHAR_TABLE (BVAR (b, display_table));
@@ -1773,11 +1764,7 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa
1773 doc: /* Set WINDOW's display-table to TABLE. */) 1764 doc: /* Set WINDOW's display-table to TABLE. */)
1774 (register Lisp_Object window, Lisp_Object table) 1765 (register Lisp_Object window, Lisp_Object table)
1775{ 1766{
1776 register struct window *w; 1767 return WSET (decode_window (window), display_table, table);
1777
1778 w = decode_window (window);
1779 WVAR (w, display_table) = table;
1780 return table;
1781} 1768}
1782 1769
1783/* Record info on buffer window W is displaying 1770/* Record info on buffer window W is displaying
@@ -1788,14 +1775,14 @@ unshow_buffer (register struct window *w)
1788 Lisp_Object buf; 1775 Lisp_Object buf;
1789 struct buffer *b; 1776 struct buffer *b;
1790 1777
1791 buf = WVAR (w, buffer); 1778 buf = WGET (w, buffer);
1792 b = XBUFFER (buf); 1779 b = XBUFFER (buf);
1793 if (b != XMARKER (WVAR (w, pointm))->buffer) 1780 if (b != XMARKER (WGET (w, pointm))->buffer)
1794 abort (); 1781 abort ();
1795 1782
1796#if 0 1783#if 0
1797 if (w == XWINDOW (selected_window) 1784 if (w == XWINDOW (selected_window)
1798 || ! EQ (buf, WVAR (XWINDOW (selected_window), buffer))) 1785 || ! EQ (buf, WGET (XWINDOW (selected_window), buffer)))
1799 /* Do this except when the selected window's buffer 1786 /* Do this except when the selected window's buffer
1800 is being removed from some other window. */ 1787 is being removed from some other window. */
1801#endif 1788#endif
@@ -1806,22 +1793,22 @@ unshow_buffer (register struct window *w)
1806 selected window, while last_window_start reflects another 1793 selected window, while last_window_start reflects another
1807 window which was recently showing the same buffer. 1794 window which was recently showing the same buffer.
1808 Some people might say that might be a good thing. Let's see. */ 1795 Some people might say that might be a good thing. Let's see. */
1809 b->last_window_start = marker_position (WVAR (w, start)); 1796 b->last_window_start = marker_position (WGET (w, start));
1810 1797
1811 /* Point in the selected window's buffer 1798 /* Point in the selected window's buffer
1812 is actually stored in that buffer, and the window's pointm isn't used. 1799 is actually stored in that buffer, and the window's pointm isn't used.
1813 So don't clobber point in that buffer. */ 1800 So don't clobber point in that buffer. */
1814 if (! EQ (buf, WVAR (XWINDOW (selected_window), buffer)) 1801 if (! EQ (buf, WGET (XWINDOW (selected_window), buffer))
1815 /* This line helps to fix Horsley's testbug.el bug. */ 1802 /* This line helps to fix Horsley's testbug.el bug. */
1816 && !(WINDOWP (BVAR (b, last_selected_window)) 1803 && !(WINDOWP (BVAR (b, last_selected_window))
1817 && w != XWINDOW (BVAR (b, last_selected_window)) 1804 && w != XWINDOW (BVAR (b, last_selected_window))
1818 && EQ (buf, WVAR (XWINDOW (BVAR (b, last_selected_window)), buffer)))) 1805 && EQ (buf, WGET (XWINDOW (BVAR (b, last_selected_window)), buffer))))
1819 temp_set_point_both (b, 1806 temp_set_point_both (b,
1820 clip_to_bounds (BUF_BEGV (b), 1807 clip_to_bounds (BUF_BEGV (b),
1821 XMARKER (WVAR (w, pointm))->charpos, 1808 XMARKER (WGET (w, pointm))->charpos,
1822 BUF_ZV (b)), 1809 BUF_ZV (b)),
1823 clip_to_bounds (BUF_BEGV_BYTE (b), 1810 clip_to_bounds (BUF_BEGV_BYTE (b),
1824 marker_byte_position (WVAR (w, pointm)), 1811 marker_byte_position (WGET (w, pointm)),
1825 BUF_ZV_BYTE (b))); 1812 BUF_ZV_BYTE (b)));
1826 1813
1827 if (WINDOWP (BVAR (b, last_selected_window)) 1814 if (WINDOWP (BVAR (b, last_selected_window))
@@ -1840,19 +1827,19 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1840 1827
1841 /* If OLD is its frame's root window, then NEW is the new 1828 /* If OLD is its frame's root window, then NEW is the new
1842 root window for that frame. */ 1829 root window for that frame. */
1843 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (WVAR (o, frame))))) 1830 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (WGET (o, frame)))))
1844 FSET (XFRAME (WVAR (o, frame)), root_window, new); 1831 FSET (XFRAME (WGET (o, frame)), root_window, new);
1845 1832
1846 if (setflag) 1833 if (setflag)
1847 { 1834 {
1848 WVAR (n, left_col) = WVAR (o, left_col); 1835 WSET (n, left_col, WGET (o, left_col));
1849 WVAR (n, top_line) = WVAR (o, top_line); 1836 WSET (n, top_line, WGET (o, top_line));
1850 WVAR (n, total_cols) = WVAR (o, total_cols); 1837 WSET (n, total_cols, WGET (o, total_cols));
1851 WVAR (n, total_lines) = WVAR (o, total_lines); 1838 WSET (n, total_lines, WGET (o, total_lines));
1852 WVAR (n, normal_cols) = WVAR (o, normal_cols); 1839 WSET (n, normal_cols, WGET (o, normal_cols));
1853 WVAR (o, normal_cols) = make_float (1.0); 1840 WSET (o, normal_cols, make_float (1.0));
1854 WVAR (n, normal_lines) = WVAR (o, normal_lines); 1841 WSET (n, normal_lines, WGET (o, normal_lines));
1855 WVAR (o, normal_lines) = make_float (1.0); 1842 WSET (o, normal_lines, make_float (1.0));
1856 n->desired_matrix = n->current_matrix = 0; 1843 n->desired_matrix = n->current_matrix = 0;
1857 n->vscroll = 0; 1844 n->vscroll = 0;
1858 memset (&n->cursor, 0, sizeof (n->cursor)); 1845 memset (&n->cursor, 0, sizeof (n->cursor));
@@ -1862,27 +1849,30 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1862 n->phys_cursor_width = -1; 1849 n->phys_cursor_width = -1;
1863 n->must_be_updated_p = 0; 1850 n->must_be_updated_p = 0;
1864 n->pseudo_window_p = 0; 1851 n->pseudo_window_p = 0;
1865 XSETFASTINT (WVAR (n, window_end_vpos), 0); 1852 WSET (n, window_end_vpos, make_number (0));
1866 XSETFASTINT (WVAR (n, window_end_pos), 0); 1853 WSET (n, window_end_pos, make_number (0));
1867 WVAR (n, window_end_valid) = Qnil; 1854 WSET (n, window_end_valid, Qnil);
1868 n->frozen_window_start_p = 0; 1855 n->frozen_window_start_p = 0;
1869 } 1856 }
1870 1857
1871 WVAR (n, next) = tem = WVAR (o, next); 1858 tem = WGET (o, next);
1859 WSET (n, next, tem);
1872 if (!NILP (tem)) 1860 if (!NILP (tem))
1873 WVAR (XWINDOW (tem), prev) = new; 1861 WSET (XWINDOW (tem), prev, new);
1874 1862
1875 WVAR (n, prev) = tem = WVAR (o, prev); 1863 tem = WGET (o, prev);
1864 WSET (n, prev, tem);
1876 if (!NILP (tem)) 1865 if (!NILP (tem))
1877 WVAR (XWINDOW (tem), next) = new; 1866 WSET (XWINDOW (tem), next, new);
1878 1867
1879 WVAR (n, parent) = tem = WVAR (o, parent); 1868 tem = WGET (o, parent);
1869 WSET (n, parent, tem);
1880 if (!NILP (tem)) 1870 if (!NILP (tem))
1881 { 1871 {
1882 if (EQ (WVAR (XWINDOW (tem), vchild), old)) 1872 if (EQ (WGET (XWINDOW (tem), vchild), old))
1883 WVAR (XWINDOW (tem), vchild) = new; 1873 WSET (XWINDOW (tem), vchild, new);
1884 if (EQ (WVAR (XWINDOW (tem), hchild), old)) 1874 if (EQ (WGET (XWINDOW (tem), hchild), old))
1885 WVAR (XWINDOW (tem), hchild) = new; 1875 WSET (XWINDOW (tem), hchild, new);
1886 } 1876 }
1887} 1877}
1888 1878
@@ -1898,64 +1888,65 @@ recombine_windows (Lisp_Object window)
1898 int horflag; 1888 int horflag;
1899 1889
1900 w = XWINDOW (window); 1890 w = XWINDOW (window);
1901 parent = WVAR (w, parent); 1891 parent = WGET (w, parent);
1902 if (!NILP (parent) && NILP (WVAR (w, combination_limit))) 1892 if (!NILP (parent) && NILP (WGET (w, combination_limit)))
1903 { 1893 {
1904 p = XWINDOW (parent); 1894 p = XWINDOW (parent);
1905 if (((!NILP (WVAR (p, vchild)) && !NILP (WVAR (w, vchild))) 1895 if (((!NILP (WGET (p, vchild)) && !NILP (WGET (w, vchild)))
1906 || (!NILP (WVAR (p, hchild)) && !NILP (WVAR (w, hchild))))) 1896 || (!NILP (WGET (p, hchild)) && !NILP (WGET (w, hchild)))))
1907 /* WINDOW and PARENT are both either a vertical or a horizontal 1897 /* WINDOW and PARENT are both either a vertical or a horizontal
1908 combination. */ 1898 combination. */
1909 { 1899 {
1910 horflag = NILP (WVAR (w, vchild)); 1900 horflag = NILP (WGET (w, vchild));
1911 child = horflag ? WVAR (w, hchild) : WVAR (w, vchild); 1901 child = horflag ? WGET (w, hchild) : WGET (w, vchild);
1912 c = XWINDOW (child); 1902 c = XWINDOW (child);
1913 1903
1914 /* Splice WINDOW's children into its parent's children and 1904 /* Splice WINDOW's children into its parent's children and
1915 assign new normal sizes. */ 1905 assign new normal sizes. */
1916 if (NILP (WVAR (w, prev))) 1906 if (NILP (WGET (w, prev)))
1917 if (horflag) 1907 if (horflag)
1918 WVAR (p, hchild) = child; 1908 WSET (p, hchild, child);
1919 else 1909 else
1920 WVAR (p, vchild) = child; 1910 WSET (p, vchild, child);
1921 else 1911 else
1922 { 1912 {
1923 WVAR (c, prev) = WVAR (w, prev); 1913 WSET (c, prev, WGET (w, prev));
1924 WVAR (XWINDOW (WVAR (w, prev)), next) = child; 1914 WSET (XWINDOW (WGET (w, prev)), next, child);
1925 } 1915 }
1926 1916
1927 while (c) 1917 while (c)
1928 { 1918 {
1929 WVAR (c, parent) = parent; 1919 WSET (c, parent, parent);
1930 1920
1931 if (horflag) 1921 if (horflag)
1932 WVAR (c, normal_cols) 1922 WSET (c, normal_cols,
1933 = make_float (XFLOATINT (WVAR (c, total_cols)) 1923 make_float (XFLOATINT (WGET (c, total_cols))
1934 / XFLOATINT (WVAR (p, total_cols))); 1924 / XFLOATINT (WGET (p, total_cols))));
1935 else 1925 else
1936 WVAR (c, normal_lines) 1926 WSET (c, normal_lines,
1937 = make_float (XFLOATINT (WVAR (c, total_lines)) 1927 make_float (XFLOATINT (WGET (c, total_lines))
1938 / XFLOATINT (WVAR (p, total_lines))); 1928 / XFLOATINT (WGET (p, total_lines))));
1939 1929
1940 if (NILP (WVAR (c, next))) 1930 if (NILP (WGET (c, next)))
1941 { 1931 {
1942 if (!NILP (WVAR (w, next))) 1932 if (!NILP (WGET (w, next)))
1943 { 1933 {
1944 WVAR (c, next) = WVAR (w, next); 1934 WSET (c, next, WGET (w, next));
1945 WVAR (XWINDOW (WVAR (c, next)), prev) = child; 1935 WSET (XWINDOW (WGET (c, next)), prev, child);
1946 } 1936 }
1947 1937
1948 c = 0; 1938 c = 0;
1949 } 1939 }
1950 else 1940 else
1951 { 1941 {
1952 child = WVAR (c, next); 1942 child = WGET (c, next);
1953 c = XWINDOW (child); 1943 c = XWINDOW (child);
1954 } 1944 }
1955 } 1945 }
1956 1946
1957 /* WINDOW can be deleted now. */ 1947 /* WINDOW can be deleted now. */
1958 WVAR (w, vchild) = WVAR (w, hchild) = Qnil; 1948 WSET (w, vchild, Qnil);
1949 WSET (w, hchild, Qnil);
1959 } 1950 }
1960 } 1951 }
1961} 1952}
@@ -2038,10 +2029,10 @@ static int
2038candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames) 2029candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames)
2039{ 2030{
2040 struct window *w = XWINDOW (window); 2031 struct window *w = XWINDOW (window);
2041 struct frame *f = XFRAME (WVAR (w, frame)); 2032 struct frame *f = XFRAME (WGET (w, frame));
2042 int candidate_p = 1; 2033 int candidate_p = 1;
2043 2034
2044 if (!BUFFERP (WVAR (w, buffer))) 2035 if (!BUFFERP (WGET (w, buffer)))
2045 candidate_p = 0; 2036 candidate_p = 0;
2046 else if (MINI_WINDOW_P (w) 2037 else if (MINI_WINDOW_P (w)
2047 && (EQ (minibuf, Qlambda) 2038 && (EQ (minibuf, Qlambda)
@@ -2056,13 +2047,13 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
2056 else if (NILP (all_frames)) 2047 else if (NILP (all_frames))
2057 { 2048 {
2058 eassert (WINDOWP (owindow)); 2049 eassert (WINDOWP (owindow));
2059 candidate_p = EQ (WVAR (w, frame), WVAR (XWINDOW (owindow), frame)); 2050 candidate_p = EQ (WGET (w, frame), WGET (XWINDOW (owindow), frame));
2060 } 2051 }
2061 else if (EQ (all_frames, Qvisible)) 2052 else if (EQ (all_frames, Qvisible))
2062 { 2053 {
2063 FRAME_SAMPLE_VISIBILITY (f); 2054 FRAME_SAMPLE_VISIBILITY (f);
2064 candidate_p = FRAME_VISIBLE_P (f) 2055 candidate_p = FRAME_VISIBLE_P (f)
2065 && (FRAME_TERMINAL (XFRAME (WVAR (w, frame))) 2056 && (FRAME_TERMINAL (XFRAME (WGET (w, frame)))
2066 == FRAME_TERMINAL (XFRAME (selected_frame))); 2057 == FRAME_TERMINAL (XFRAME (selected_frame)));
2067 2058
2068 } 2059 }
@@ -2081,15 +2072,15 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
2081 && !f->output_data.x->has_been_visible) 2072 && !f->output_data.x->has_been_visible)
2082#endif 2073#endif
2083 ) 2074 )
2084 && (FRAME_TERMINAL (XFRAME (WVAR (w, frame))) 2075 && (FRAME_TERMINAL (XFRAME (WGET (w, frame)))
2085 == FRAME_TERMINAL (XFRAME (selected_frame))); 2076 == FRAME_TERMINAL (XFRAME (selected_frame)));
2086 } 2077 }
2087 else if (WINDOWP (all_frames)) 2078 else if (WINDOWP (all_frames))
2088 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) 2079 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames)
2089 || EQ (WVAR (XWINDOW (all_frames), frame), WVAR (w, frame)) 2080 || EQ (WGET (XWINDOW (all_frames), frame), WGET (w, frame))
2090 || EQ (WVAR (XWINDOW (all_frames), frame), FRAME_FOCUS_FRAME (f))); 2081 || EQ (WGET (XWINDOW (all_frames), frame), FRAME_FOCUS_FRAME (f)));
2091 else if (FRAMEP (all_frames)) 2082 else if (FRAMEP (all_frames))
2092 candidate_p = EQ (all_frames, WVAR (w, frame)); 2083 candidate_p = EQ (all_frames, WGET (w, frame));
2093 2084
2094 return candidate_p; 2085 return candidate_p;
2095} 2086}
@@ -2122,7 +2113,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
2122 if (NILP (*all_frames)) 2113 if (NILP (*all_frames))
2123 *all_frames 2114 *all_frames
2124 = (!EQ (*minibuf, Qlambda) 2115 = (!EQ (*minibuf, Qlambda)
2125 ? FRAME_MINIBUF_WINDOW (XFRAME (WVAR (XWINDOW (*window), frame))) 2116 ? FRAME_MINIBUF_WINDOW (XFRAME (WGET (XWINDOW (*window), frame)))
2126 : Qnil); 2117 : Qnil);
2127 else if (EQ (*all_frames, Qvisible)) 2118 else if (EQ (*all_frames, Qvisible))
2128 ; 2119 ;
@@ -2148,7 +2139,7 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, in
2148 /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just 2139 /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just
2149 return the first window on the frame. */ 2140 return the first window on the frame. */
2150 if (FRAMEP (all_frames) 2141 if (FRAMEP (all_frames)
2151 && !EQ (all_frames, WVAR (XWINDOW (window), frame))) 2142 && !EQ (all_frames, WGET (XWINDOW (window), frame)))
2152 return Fframe_first_window (all_frames); 2143 return Fframe_first_window (all_frames);
2153 2144
2154 if (next_p) 2145 if (next_p)
@@ -2328,7 +2319,7 @@ MINIBUF neither nil nor t means never include the minibuffer window. */)
2328 if (NILP (frame)) 2319 if (NILP (frame))
2329 frame = selected_frame; 2320 frame = selected_frame;
2330 2321
2331 if (!EQ (frame, WVAR (XWINDOW (window), frame))) 2322 if (!EQ (frame, WGET (XWINDOW (window), frame)))
2332 error ("Window is on a different frame"); 2323 error ("Window is on a different frame");
2333 2324
2334 return window_list_1 (window, minibuf, frame); 2325 return window_list_1 (window, minibuf, frame);
@@ -2449,7 +2440,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2449 switch (type) 2440 switch (type)
2450 { 2441 {
2451 case GET_BUFFER_WINDOW: 2442 case GET_BUFFER_WINDOW:
2452 if (EQ (WVAR (w, buffer), obj) 2443 if (EQ (WGET (w, buffer), obj)
2453 /* Don't find any minibuffer window except the one that 2444 /* Don't find any minibuffer window except the one that
2454 is currently in use. */ 2445 is currently in use. */
2455 && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) 2446 && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1))
@@ -2457,7 +2448,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2457 if (EQ (window, selected_window)) 2448 if (EQ (window, selected_window))
2458 /* Preferably return the selected window. */ 2449 /* Preferably return the selected window. */
2459 RETURN_UNGCPRO (window); 2450 RETURN_UNGCPRO (window);
2460 else if (EQ (WVAR (XWINDOW (window), frame), selected_frame) 2451 else if (EQ (WGET (XWINDOW (window), frame), selected_frame)
2461 && !frame_best_window_flag) 2452 && !frame_best_window_flag)
2462 /* Prefer windows on the current frame (but don't 2453 /* Prefer windows on the current frame (but don't
2463 choose another one if we have one already). */ 2454 choose another one if we have one already). */
@@ -2473,25 +2464,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2473 case REPLACE_BUFFER_IN_WINDOWS_SAFELY: 2464 case REPLACE_BUFFER_IN_WINDOWS_SAFELY:
2474 /* We could simply check whether the buffer shown by window 2465 /* We could simply check whether the buffer shown by window
2475 is live, and show another buffer in case it isn't. */ 2466 is live, and show another buffer in case it isn't. */
2476 if (EQ (WVAR (w, buffer), obj)) 2467 if (EQ (WGET (w, buffer), obj))
2477 { 2468 {
2478 /* Undedicate WINDOW. */ 2469 /* Undedicate WINDOW. */
2479 WVAR (w, dedicated) = Qnil; 2470 WSET (w, dedicated, Qnil);
2480 /* Make WINDOW show the buffer returned by 2471 /* Make WINDOW show the buffer returned by
2481 other_buffer_safely, don't run any hooks. */ 2472 other_buffer_safely, don't run any hooks. */
2482 set_window_buffer 2473 set_window_buffer
2483 (window, other_buffer_safely (WVAR (w, buffer)), 0, 0); 2474 (window, other_buffer_safely (WGET (w, buffer)), 0, 0);
2484 /* If WINDOW is the selected window, make its buffer 2475 /* If WINDOW is the selected window, make its buffer
2485 current. But do so only if the window shows the 2476 current. But do so only if the window shows the
2486 current buffer (Bug#6454). */ 2477 current buffer (Bug#6454). */
2487 if (EQ (window, selected_window) 2478 if (EQ (window, selected_window)
2488 && XBUFFER (WVAR (w, buffer)) == current_buffer) 2479 && XBUFFER (WGET (w, buffer)) == current_buffer)
2489 Fset_buffer (WVAR (w, buffer)); 2480 Fset_buffer (WGET (w, buffer));
2490 } 2481 }
2491 break; 2482 break;
2492 2483
2493 case REDISPLAY_BUFFER_WINDOWS: 2484 case REDISPLAY_BUFFER_WINDOWS:
2494 if (EQ (WVAR (w, buffer), obj)) 2485 if (EQ (WGET (w, buffer), obj))
2495 { 2486 {
2496 mark_window_display_accurate (window, 0); 2487 mark_window_display_accurate (window, 0);
2497 w->update_mode_line = 1; 2488 w->update_mode_line = 1;
@@ -2503,8 +2494,8 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2503 2494
2504 /* Check for a window that has a killed buffer. */ 2495 /* Check for a window that has a killed buffer. */
2505 case CHECK_ALL_WINDOWS: 2496 case CHECK_ALL_WINDOWS:
2506 if (! NILP (WVAR (w, buffer)) 2497 if (! NILP (WGET (w, buffer))
2507 && NILP (BVAR (XBUFFER (WVAR (w, buffer)), name))) 2498 && NILP (BVAR (XBUFFER (WGET (w, buffer)), name)))
2508 abort (); 2499 abort ();
2509 break; 2500 break;
2510 2501
@@ -2591,7 +2582,7 @@ window-start value is reasonable when this function is called. */)
2591 2582
2592 w = decode_any_window (window); 2583 w = decode_any_window (window);
2593 XSETWINDOW (window, w); 2584 XSETWINDOW (window, w);
2594 f = XFRAME (WVAR (w, frame)); 2585 f = XFRAME (WGET (w, frame));
2595 2586
2596 if (NILP (root)) 2587 if (NILP (root))
2597 /* ROOT is the frame's root window. */ 2588 /* ROOT is the frame's root window. */
@@ -2603,12 +2594,12 @@ window-start value is reasonable when this function is called. */)
2603 /* ROOT must be an ancestor of WINDOW. */ 2594 /* ROOT must be an ancestor of WINDOW. */
2604 { 2595 {
2605 r = decode_any_window (root); 2596 r = decode_any_window (root);
2606 pwindow = WVAR (XWINDOW (window), parent); 2597 pwindow = WGET (XWINDOW (window), parent);
2607 while (!NILP (pwindow)) 2598 while (!NILP (pwindow))
2608 if (EQ (pwindow, root)) 2599 if (EQ (pwindow, root))
2609 break; 2600 break;
2610 else 2601 else
2611 pwindow = WVAR (XWINDOW (pwindow), parent); 2602 pwindow = WGET (XWINDOW (pwindow), parent);
2612 if (!EQ (pwindow, root)) 2603 if (!EQ (pwindow, root))
2613 error ("Specified root is not an ancestor of specified window"); 2604 error ("Specified root is not an ancestor of specified window");
2614 } 2605 }
@@ -2622,15 +2613,15 @@ window-start value is reasonable when this function is called. */)
2622 else if (MINI_WINDOW_P (w)) /* && top > 0) */ 2613 else if (MINI_WINDOW_P (w)) /* && top > 0) */
2623 error ("Can't expand minibuffer to full frame"); 2614 error ("Can't expand minibuffer to full frame");
2624 2615
2625 if (!NILP (WVAR (w, buffer))) 2616 if (!NILP (WGET (w, buffer)))
2626 { 2617 {
2627 startpos = marker_position (WVAR (w, start)); 2618 startpos = marker_position (WGET (w, start));
2628 top = WINDOW_TOP_EDGE_LINE (w) 2619 top = WINDOW_TOP_EDGE_LINE (w)
2629 - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); 2620 - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
2630 /* Make sure WINDOW is the frame's selected window. */ 2621 /* Make sure WINDOW is the frame's selected window. */
2631 if (!EQ (window, FRAME_SELECTED_WINDOW (f))) 2622 if (!EQ (window, FRAME_SELECTED_WINDOW (f)))
2632 { 2623 {
2633 if (EQ (selected_frame, WVAR (w, frame))) 2624 if (EQ (selected_frame, WGET (w, frame)))
2634 Fselect_window (window, Qnil); 2625 Fselect_window (window, Qnil);
2635 else 2626 else
2636 FSET (f, selected_window, window); 2627 FSET (f, selected_window, window);
@@ -2647,7 +2638,7 @@ window-start value is reasonable when this function is called. */)
2647 { 2638 {
2648 pwindow = swindow; 2639 pwindow = swindow;
2649 while (!NILP (pwindow) && !EQ (window, pwindow)) 2640 while (!NILP (pwindow) && !EQ (window, pwindow))
2650 pwindow = WVAR (XWINDOW (pwindow), parent); 2641 pwindow = WGET (XWINDOW (pwindow), parent);
2651 2642
2652 if (EQ (window, pwindow)) 2643 if (EQ (window, pwindow))
2653 /* If WINDOW is an ancestor of SWINDOW, then SWINDOW is ok 2644 /* If WINDOW is an ancestor of SWINDOW, then SWINDOW is ok
@@ -2660,7 +2651,7 @@ window-start value is reasonable when this function is called. */)
2660 2651
2661 if (!EQ (swindow, FRAME_SELECTED_WINDOW (f))) 2652 if (!EQ (swindow, FRAME_SELECTED_WINDOW (f)))
2662 { 2653 {
2663 if (EQ (selected_frame, WVAR (w, frame))) 2654 if (EQ (selected_frame, WGET (w, frame)))
2664 Fselect_window (swindow, Qnil); 2655 Fselect_window (swindow, Qnil);
2665 else 2656 else
2666 FSET (f, selected_window, swindow); 2657 FSET (f, selected_window, swindow);
@@ -2693,12 +2684,12 @@ window-start value is reasonable when this function is called. */)
2693 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 2684 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
2694 resize_failed = 0; 2685 resize_failed = 0;
2695 2686
2696 if (NILP (WVAR (w, buffer))) 2687 if (NILP (WGET (w, buffer)))
2697 { 2688 {
2698 /* Resize child windows vertically. */ 2689 /* Resize child windows vertically. */
2699 XSETINT (delta, XINT (WVAR (r, total_lines)) 2690 XSETINT (delta, XINT (WGET (r, total_lines))
2700 - XINT (WVAR (w, total_lines))); 2691 - XINT (WGET (w, total_lines)));
2701 WVAR (w, top_line) = WVAR (r, top_line); 2692 WSET (w, top_line, WGET (r, top_line));
2702 resize_root_window (window, delta, Qnil, Qnil); 2693 resize_root_window (window, delta, Qnil, Qnil);
2703 if (window_resize_check (w, 0)) 2694 if (window_resize_check (w, 0))
2704 window_resize_apply (w, 0); 2695 window_resize_apply (w, 0);
@@ -2714,10 +2705,10 @@ window-start value is reasonable when this function is called. */)
2714 /* Resize child windows horizontally. */ 2705 /* Resize child windows horizontally. */
2715 if (!resize_failed) 2706 if (!resize_failed)
2716 { 2707 {
2717 WVAR (w, left_col) = WVAR (r, left_col); 2708 WSET (w, left_col, WGET (r, left_col));
2718 XSETINT (delta, XINT (WVAR (r, total_cols)) 2709 XSETINT (delta, XINT (WGET (r, total_cols))
2719 - XINT (WVAR (w, total_cols))); 2710 - XINT (WGET (w, total_cols)));
2720 WVAR (w, left_col) = WVAR (r, left_col); 2711 WSET (w, left_col, WGET (r, left_col));
2721 resize_root_window (window, delta, Qt, Qnil); 2712 resize_root_window (window, delta, Qt, Qnil);
2722 if (window_resize_check (w, 1)) 2713 if (window_resize_check (w, 1))
2723 window_resize_apply (w, 1); 2714 window_resize_apply (w, 1);
@@ -2740,43 +2731,43 @@ window-start value is reasonable when this function is called. */)
2740 } 2731 }
2741 2732
2742 /* Cleanly unlink WINDOW from window-tree. */ 2733 /* Cleanly unlink WINDOW from window-tree. */
2743 if (!NILP (WVAR (w, prev))) 2734 if (!NILP (WGET (w, prev)))
2744 /* Get SIBLING above (on the left of) WINDOW. */ 2735 /* Get SIBLING above (on the left of) WINDOW. */
2745 { 2736 {
2746 sibling = WVAR (w, prev); 2737 sibling = WGET (w, prev);
2747 s = XWINDOW (sibling); 2738 s = XWINDOW (sibling);
2748 WVAR (s, next) = WVAR (w, next); 2739 WSET (s, next, WGET (w, next));
2749 if (!NILP (WVAR (s, next))) 2740 if (!NILP (WGET (s, next)))
2750 WVAR (XWINDOW (WVAR (s, next)), prev) = sibling; 2741 WSET (XWINDOW (WGET (s, next)), prev, sibling);
2751 } 2742 }
2752 else 2743 else
2753 /* Get SIBLING below (on the right of) WINDOW. */ 2744 /* Get SIBLING below (on the right of) WINDOW. */
2754 { 2745 {
2755 sibling = WVAR (w, next); 2746 sibling = WGET (w, next);
2756 s = XWINDOW (sibling); 2747 s = XWINDOW (sibling);
2757 WVAR (s, prev) = Qnil; 2748 WSET (s, prev, Qnil);
2758 if (!NILP (WVAR (XWINDOW (WVAR (w, parent)), vchild))) 2749 if (!NILP (WGET (XWINDOW (WGET (w, parent)), vchild)))
2759 WVAR (XWINDOW (WVAR (w, parent)), vchild) = sibling; 2750 WSET (XWINDOW (WGET (w, parent)), vchild, sibling);
2760 else 2751 else
2761 WVAR (XWINDOW (WVAR (w, parent)), hchild) = sibling; 2752 WSET (XWINDOW (WGET (w, parent)), hchild, sibling);
2762 } 2753 }
2763 2754
2764 /* Delete ROOT and all child windows of ROOT. */ 2755 /* Delete ROOT and all child windows of ROOT. */
2765 if (!NILP (WVAR (r, vchild))) 2756 if (!NILP (WGET (r, vchild)))
2766 { 2757 {
2767 delete_all_child_windows (WVAR (r, vchild)); 2758 delete_all_child_windows (WGET (r, vchild));
2768 WVAR (r, vchild) = Qnil; 2759 WSET (r, vchild, Qnil);
2769 } 2760 }
2770 else if (!NILP (WVAR (r, hchild))) 2761 else if (!NILP (WGET (r, hchild)))
2771 { 2762 {
2772 delete_all_child_windows (WVAR (r, hchild)); 2763 delete_all_child_windows (WGET (r, hchild));
2773 WVAR (r, hchild) = Qnil; 2764 WSET (r, hchild, Qnil);
2774 } 2765 }
2775 2766
2776 replace_window (root, window, 1); 2767 replace_window (root, window, 1);
2777 2768
2778 /* This must become SWINDOW anyway ....... */ 2769 /* This must become SWINDOW anyway ....... */
2779 if (!NILP (WVAR (w, buffer)) && !resize_failed) 2770 if (!NILP (WGET (w, buffer)) && !resize_failed)
2780 { 2771 {
2781 /* Try to minimize scrolling, by setting the window start to the 2772 /* Try to minimize scrolling, by setting the window start to the
2782 point will cause the text at the old window start to be at the 2773 point will cause the text at the old window start to be at the
@@ -2785,19 +2776,19 @@ window-start value is reasonable when this function is called. */)
2785 when the display is not current, due to typeahead). */ 2776 when the display is not current, due to typeahead). */
2786 new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); 2777 new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
2787 if (new_top != top 2778 if (new_top != top
2788 && startpos >= BUF_BEGV (XBUFFER (WVAR (w, buffer))) 2779 && startpos >= BUF_BEGV (XBUFFER (WGET (w, buffer)))
2789 && startpos <= BUF_ZV (XBUFFER (WVAR (w, buffer)))) 2780 && startpos <= BUF_ZV (XBUFFER (WGET (w, buffer))))
2790 { 2781 {
2791 struct position pos; 2782 struct position pos;
2792 struct buffer *obuf = current_buffer; 2783 struct buffer *obuf = current_buffer;
2793 2784
2794 Fset_buffer (WVAR (w, buffer)); 2785 Fset_buffer (WGET (w, buffer));
2795 /* This computation used to temporarily move point, but that 2786 /* This computation used to temporarily move point, but that
2796 can have unwanted side effects due to text properties. */ 2787 can have unwanted side effects due to text properties. */
2797 pos = *vmotion (startpos, -top, w); 2788 pos = *vmotion (startpos, -top, w);
2798 2789
2799 set_marker_both (WVAR (w, start), WVAR (w, buffer), pos.bufpos, pos.bytepos); 2790 set_marker_both (WGET (w, start), WGET (w, buffer), pos.bufpos, pos.bytepos);
2800 WVAR (w, window_end_valid) = Qnil; 2791 WSET (w, window_end_valid, Qnil);
2801 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE 2792 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
2802 || FETCH_BYTE (pos.bytepos - 1) == '\n'); 2793 || FETCH_BYTE (pos.bytepos - 1) == '\n');
2803 /* We need to do this, so that the window-scroll-functions 2794 /* We need to do this, so that the window-scroll-functions
@@ -2887,13 +2878,15 @@ adjust_window_margins (struct window *w)
2887 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0) 2878 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0)
2888 { 2879 {
2889 if (WINDOW_LEFT_MARGIN_COLS (w) > 0) 2880 if (WINDOW_LEFT_MARGIN_COLS (w) > 0)
2890 WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols) 2881 {
2891 = make_number (margin_cols/2); 2882 WSET (w, left_margin_cols, make_number (margin_cols / 2));
2883 WSET (w, right_margin_cols, make_number (margin_cols / 2));
2884 }
2892 else 2885 else
2893 WVAR (w, right_margin_cols) = make_number (margin_cols); 2886 WSET (w, right_margin_cols, make_number (margin_cols));
2894 } 2887 }
2895 else 2888 else
2896 WVAR (w, left_margin_cols) = make_number (margin_cols); 2889 WSET (w, left_margin_cols, make_number (margin_cols));
2897 return 1; 2890 return 1;
2898} 2891}
2899 2892
@@ -2991,9 +2984,9 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
2991 struct window *w = XWINDOW (window); 2984 struct window *w = XWINDOW (window);
2992 struct buffer *b = XBUFFER (buffer); 2985 struct buffer *b = XBUFFER (buffer);
2993 ptrdiff_t count = SPECPDL_INDEX (); 2986 ptrdiff_t count = SPECPDL_INDEX ();
2994 int samebuf = EQ (buffer, WVAR (w, buffer)); 2987 int samebuf = EQ (buffer, WGET (w, buffer));
2995 2988
2996 WVAR (w, buffer) = buffer; 2989 WSET (w, buffer, buffer);
2997 2990
2998 if (EQ (window, selected_window)) 2991 if (EQ (window, selected_window))
2999 BVAR (b, last_selected_window) = window; 2992 BVAR (b, last_selected_window) = window;
@@ -3006,10 +2999,10 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3006 XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); 2999 XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1);
3007 BVAR (b, display_time) = Fcurrent_time (); 3000 BVAR (b, display_time) = Fcurrent_time ();
3008 3001
3009 XSETFASTINT (WVAR (w, window_end_pos), 0); 3002 WSET (w, window_end_pos, make_number (0));
3010 XSETFASTINT (WVAR (w, window_end_vpos), 0); 3003 WSET (w, window_end_vpos, make_number (0));
3011 memset (&w->last_cursor, 0, sizeof w->last_cursor); 3004 memset (&w->last_cursor, 0, sizeof w->last_cursor);
3012 WVAR (w, window_end_valid) = Qnil; 3005 WSET (w, window_end_valid, Qnil);
3013 if (!(keep_margins_p && samebuf)) 3006 if (!(keep_margins_p && samebuf))
3014 { /* If we're not actually changing the buffer, don't reset hscroll and 3007 { /* If we're not actually changing the buffer, don't reset hscroll and
3015 vscroll. This case happens for example when called from 3008 vscroll. This case happens for example when called from
@@ -3021,8 +3014,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3021 whenever we resize the frame. */ 3014 whenever we resize the frame. */
3022 w->hscroll = w->min_hscroll = 0; 3015 w->hscroll = w->min_hscroll = 0;
3023 w->vscroll = 0; 3016 w->vscroll = 0;
3024 set_marker_both (WVAR (w, pointm), buffer, BUF_PT (b), BUF_PT_BYTE (b)); 3017 set_marker_both (WGET (w, pointm), buffer, BUF_PT (b), BUF_PT_BYTE (b));
3025 set_marker_restricted (WVAR (w, start), 3018 set_marker_restricted (WGET (w, start),
3026 make_number (b->last_window_start), 3019 make_number (b->last_window_start),
3027 buffer); 3020 buffer);
3028 w->start_at_line_beg = 0; 3021 w->start_at_line_beg = 0;
@@ -3043,7 +3036,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3043 Fset_buffer (buffer); 3036 Fset_buffer (buffer);
3044 } 3037 }
3045 3038
3046 XMARKER (WVAR (w, pointm))->insertion_type = !NILP (Vwindow_point_insertion_type); 3039 XMARKER (WGET (w, pointm))->insertion_type = !NILP (Vwindow_point_insertion_type);
3047 3040
3048 if (!keep_margins_p) 3041 if (!keep_margins_p)
3049 { 3042 {
@@ -3051,10 +3044,11 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3051 3044
3052 /* This may call adjust_window_margins three times, so 3045 /* This may call adjust_window_margins three times, so
3053 temporarily disable window margins. */ 3046 temporarily disable window margins. */
3054 Lisp_Object save_left = WVAR (w, left_margin_cols); 3047 Lisp_Object save_left = WGET (w, left_margin_cols);
3055 Lisp_Object save_right = WVAR (w, right_margin_cols); 3048 Lisp_Object save_right = WGET (w, right_margin_cols);
3056 3049
3057 WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols) = Qnil; 3050 WSET (w, left_margin_cols, Qnil);
3051 WSET (w, right_margin_cols, Qnil);
3058 3052
3059 Fset_window_fringes (window, 3053 Fset_window_fringes (window,
3060 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), 3054 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
@@ -3064,8 +3058,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3064 BVAR (b, scroll_bar_width), 3058 BVAR (b, scroll_bar_width),
3065 BVAR (b, vertical_scroll_bar_type), Qnil); 3059 BVAR (b, vertical_scroll_bar_type), Qnil);
3066 3060
3067 WVAR (w, left_margin_cols) = save_left; 3061 WSET (w, left_margin_cols, save_left);
3068 WVAR (w, right_margin_cols) = save_right; 3062 WSET (w, right_margin_cols, save_right);
3069 3063
3070 Fset_window_margins (window, 3064 Fset_window_margins (window,
3071 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); 3065 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
@@ -3075,7 +3069,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3075 { 3069 {
3076 if (! NILP (Vwindow_scroll_functions)) 3070 if (! NILP (Vwindow_scroll_functions))
3077 run_hook_with_args_2 (Qwindow_scroll_functions, window, 3071 run_hook_with_args_2 (Qwindow_scroll_functions, window,
3078 Fmarker_position (WVAR (w, start))); 3072 Fmarker_position (WGET (w, start)));
3079 run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w))); 3073 run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w)));
3080 } 3074 }
3081 3075
@@ -3109,7 +3103,7 @@ This function runs `window-scroll-functions' before running
3109 if (NILP (BVAR (XBUFFER (buffer), name))) 3103 if (NILP (BVAR (XBUFFER (buffer), name)))
3110 error ("Attempt to display deleted buffer"); 3104 error ("Attempt to display deleted buffer");
3111 3105
3112 tem = WVAR (w, buffer); 3106 tem = WGET (w, buffer);
3113 if (NILP (tem)) 3107 if (NILP (tem))
3114 error ("Window is deleted"); 3108 error ("Window is deleted");
3115 else if (!EQ (tem, Qt)) 3109 else if (!EQ (tem, Qt))
@@ -3117,14 +3111,14 @@ This function runs `window-scroll-functions' before running
3117 { 3111 {
3118 if (!EQ (tem, buffer)) 3112 if (!EQ (tem, buffer))
3119 { 3113 {
3120 if (EQ (WVAR (w, dedicated), Qt)) 3114 if (EQ (WGET (w, dedicated), Qt))
3121 /* WINDOW is strongly dedicated to its buffer, signal an 3115 /* WINDOW is strongly dedicated to its buffer, signal an
3122 error. */ 3116 error. */
3123 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name))); 3117 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
3124 else 3118 else
3125 /* WINDOW is weakly dedicated to its buffer, reset 3119 /* WINDOW is weakly dedicated to its buffer, reset
3126 dedication. */ 3120 dedication. */
3127 WVAR (w, dedicated) = Qnil; 3121 WSET (w, dedicated, Qnil);
3128 3122
3129 call1 (Qrecord_window_buffer, window); 3123 call1 (Qrecord_window_buffer, window);
3130 } 3124 }
@@ -3163,8 +3157,8 @@ displaying that buffer. */)
3163 struct window *w = XWINDOW (object); 3157 struct window *w = XWINDOW (object);
3164 mark_window_display_accurate (object, 0); 3158 mark_window_display_accurate (object, 0);
3165 w->update_mode_line = 1; 3159 w->update_mode_line = 1;
3166 if (BUFFERP (WVAR (w, buffer))) 3160 if (BUFFERP (WGET (w, buffer)))
3167 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; 3161 XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
3168 ++update_mode_lines; 3162 ++update_mode_lines;
3169 return Qt; 3163 return Qt;
3170 } 3164 }
@@ -3209,14 +3203,14 @@ temp_output_buffer_show (register Lisp_Object buf)
3209 { 3203 {
3210 window = display_buffer (buf, Qnil, Qnil); 3204 window = display_buffer (buf, Qnil, Qnil);
3211 3205
3212 if (!EQ (WVAR (XWINDOW (window), frame), selected_frame)) 3206 if (!EQ (WGET (XWINDOW (window), frame), selected_frame))
3213 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 3207 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
3214 Vminibuf_scroll_window = window; 3208 Vminibuf_scroll_window = window;
3215 w = XWINDOW (window); 3209 w = XWINDOW (window);
3216 w->hscroll = 0; 3210 w->hscroll = 0;
3217 w->min_hscroll = 0; 3211 w->min_hscroll = 0;
3218 set_marker_restricted_both (WVAR (w, start), buf, BEG, BEG); 3212 set_marker_restricted_both (WGET (w, start), buf, BEG, BEG);
3219 set_marker_restricted_both (WVAR (w, pointm), buf, BEG, BEG); 3213 set_marker_restricted_both (WGET (w, pointm), buf, BEG, BEG);
3220 3214
3221 /* Run temp-buffer-show-hook, with the chosen window selected 3215 /* Run temp-buffer-show-hook, with the chosen window selected
3222 and its buffer current. */ 3216 and its buffer current. */
@@ -3233,7 +3227,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3233 record_unwind_protect (Fset_buffer, prev_buffer); 3227 record_unwind_protect (Fset_buffer, prev_buffer);
3234 record_unwind_protect (select_window_norecord, prev_window); 3228 record_unwind_protect (select_window_norecord, prev_window);
3235 Fselect_window (window, Qt); 3229 Fselect_window (window, Qt);
3236 Fset_buffer (WVAR (w, buffer)); 3230 Fset_buffer (WGET (w, buffer));
3237 Frun_hooks (1, &Qtemp_buffer_show_hook); 3231 Frun_hooks (1, &Qtemp_buffer_show_hook);
3238 unbind_to (count, Qnil); 3232 unbind_to (count, Qnil);
3239 } 3233 }
@@ -3270,17 +3264,17 @@ make_parent_window (Lisp_Object window, int horflag)
3270 3264
3271 replace_window (window, parent, 1); 3265 replace_window (window, parent, 1);
3272 3266
3273 WVAR (o, next) = Qnil; 3267 WSET (o, next, Qnil);
3274 WVAR (o, prev) = Qnil; 3268 WSET (o, prev, Qnil);
3275 WVAR (o, parent) = parent; 3269 WSET (o, parent, parent);
3276 3270
3277 WVAR (p, hchild) = horflag ? window : Qnil; 3271 WSET (p, hchild, horflag ? window : Qnil);
3278 WVAR (p, vchild) = horflag ? Qnil : window; 3272 WSET (p, vchild, horflag ? Qnil : window);
3279 WVAR (p, start) = Qnil; 3273 WSET (p, start, Qnil);
3280 WVAR (p, pointm) = Qnil; 3274 WSET (p, pointm, Qnil);
3281 WVAR (p, buffer) = Qnil; 3275 WSET (p, buffer, Qnil);
3282 WVAR (p, combination_limit) = Qnil; 3276 WSET (p, combination_limit, Qnil);
3283 WVAR (p, window_parameters) = Qnil; 3277 WSET (p, window_parameters, Qnil);
3284} 3278}
3285 3279
3286/* Make new window from scratch. */ 3280/* Make new window from scratch. */
@@ -3293,19 +3287,19 @@ make_window (void)
3293 w = allocate_window (); 3287 w = allocate_window ();
3294 /* Initialize Lisp data. Note that allocate_window initializes all 3288 /* Initialize Lisp data. Note that allocate_window initializes all
3295 Lisp data to nil, so do it only for slots which should not be nil. */ 3289 Lisp data to nil, so do it only for slots which should not be nil. */
3296 XSETFASTINT (WVAR (w, left_col), 0); 3290 WSET (w, left_col, make_number (0));
3297 XSETFASTINT (WVAR (w, top_line), 0); 3291 WSET (w, top_line, make_number (0));
3298 XSETFASTINT (WVAR (w, total_lines), 0); 3292 WSET (w, total_lines, make_number (0));
3299 XSETFASTINT (WVAR (w, total_cols), 0); 3293 WSET (w, total_cols, make_number (0));
3300 WVAR (w, normal_lines) = make_float (1.0); 3294 WSET (w, normal_lines, make_float (1.0));
3301 WVAR (w, normal_cols) = make_float (1.0); 3295 WSET (w, normal_cols, make_float (1.0));
3302 XSETFASTINT (WVAR (w, new_total), 0); 3296 WSET (w, new_total, make_number (0));
3303 XSETFASTINT (WVAR (w, new_normal), 0); 3297 WSET (w, new_normal, make_number (0));
3304 WVAR (w, start) = Fmake_marker (); 3298 WSET (w, start, Fmake_marker ());
3305 WVAR (w, pointm) = Fmake_marker (); 3299 WSET (w, pointm, Fmake_marker ());
3306 WVAR (w, vertical_scroll_bar_type) = Qt; 3300 WSET (w, vertical_scroll_bar_type, Qt);
3307 XSETFASTINT (WVAR (w, window_end_pos), 0); 3301 WSET (w, window_end_pos, make_number (0));
3308 XSETFASTINT (WVAR (w, window_end_vpos), 0); 3302 WSET (w, window_end_vpos, make_number (0));
3309 3303
3310 /* Initialize non-Lisp data. Note that allocate_window zeroes out all 3304 /* Initialize non-Lisp data. Note that allocate_window zeroes out all
3311 non-Lisp data, so do it only for slots which should not be zero. */ 3305 non-Lisp data, so do it only for slots which should not be zero. */
@@ -3335,11 +3329,11 @@ Note: This function does not operate on any child windows of WINDOW. */)
3335 3329
3336 CHECK_NUMBER (size); 3330 CHECK_NUMBER (size);
3337 if (NILP (add)) 3331 if (NILP (add))
3338 XSETINT (WVAR (w, new_total), XINT (size)); 3332 WSET (w, new_total, size);
3339 else 3333 else
3340 XSETINT (WVAR (w, new_total), XINT (WVAR (w, new_total)) + XINT (size)); 3334 WSET (w, new_total, make_number (XINT (WGET (w, new_total)) + XINT (size)));
3341 3335
3342 return WVAR (w, new_total); 3336 return WGET (w, new_total);
3343} 3337}
3344 3338
3345DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, 3339DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0,
@@ -3349,10 +3343,7 @@ Return SIZE.
3349Note: This function does not operate on any child windows of WINDOW. */) 3343Note: This function does not operate on any child windows of WINDOW. */)
3350 (Lisp_Object window, Lisp_Object size) 3344 (Lisp_Object window, Lisp_Object size)
3351{ 3345{
3352 struct window *w = decode_any_window (window); 3346 return WSET (decode_any_window (window), new_normal, size);
3353
3354 WVAR (w, new_normal) = size;
3355 return WVAR (w, new_normal);
3356} 3347}
3357 3348
3358/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is 3349/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is
@@ -3367,19 +3358,19 @@ window_resize_check (struct window *w, int horflag)
3367{ 3358{
3368 struct window *c; 3359 struct window *c;
3369 3360
3370 if (!NILP (WVAR (w, vchild))) 3361 if (!NILP (WGET (w, vchild)))
3371 /* W is a vertical combination. */ 3362 /* W is a vertical combination. */
3372 { 3363 {
3373 c = XWINDOW (WVAR (w, vchild)); 3364 c = XWINDOW (WGET (w, vchild));
3374 if (horflag) 3365 if (horflag)
3375 /* All child windows of W must have the same width as W. */ 3366 /* All child windows of W must have the same width as W. */
3376 { 3367 {
3377 while (c) 3368 while (c)
3378 { 3369 {
3379 if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total))) 3370 if ((XINT (WGET (c, new_total)) != XINT (WGET (w, new_total)))
3380 || !window_resize_check (c, horflag)) 3371 || !window_resize_check (c, horflag))
3381 return 0; 3372 return 0;
3382 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); 3373 c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
3383 } 3374 }
3384 return 1; 3375 return 1;
3385 } 3376 }
@@ -3392,16 +3383,16 @@ window_resize_check (struct window *w, int horflag)
3392 { 3383 {
3393 if (!window_resize_check (c, horflag)) 3384 if (!window_resize_check (c, horflag))
3394 return 0; 3385 return 0;
3395 sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total)); 3386 sum_of_sizes = sum_of_sizes + XINT (WGET (c, new_total));
3396 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); 3387 c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
3397 } 3388 }
3398 return (sum_of_sizes == XINT (WVAR (w, new_total))); 3389 return (sum_of_sizes == XINT (WGET (w, new_total)));
3399 } 3390 }
3400 } 3391 }
3401 else if (!NILP (WVAR (w, hchild))) 3392 else if (!NILP (WGET (w, hchild)))
3402 /* W is a horizontal combination. */ 3393 /* W is a horizontal combination. */
3403 { 3394 {
3404 c = XWINDOW (WVAR (w, hchild)); 3395 c = XWINDOW (WGET (w, hchild));
3405 if (horflag) 3396 if (horflag)
3406 /* The sum of the widths of the child windows of W must equal W's 3397 /* The sum of the widths of the child windows of W must equal W's
3407 width. */ 3398 width. */
@@ -3411,20 +3402,20 @@ window_resize_check (struct window *w, int horflag)
3411 { 3402 {
3412 if (!window_resize_check (c, horflag)) 3403 if (!window_resize_check (c, horflag))
3413 return 0; 3404 return 0;
3414 sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total)); 3405 sum_of_sizes = sum_of_sizes + XINT (WGET (c, new_total));
3415 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); 3406 c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
3416 } 3407 }
3417 return (sum_of_sizes == XINT (WVAR (w, new_total))); 3408 return (sum_of_sizes == XINT (WGET (w, new_total)));
3418 } 3409 }
3419 else 3410 else
3420 /* All child windows of W must have the same height as W. */ 3411 /* All child windows of W must have the same height as W. */
3421 { 3412 {
3422 while (c) 3413 while (c)
3423 { 3414 {
3424 if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total))) 3415 if ((XINT (WGET (c, new_total)) != XINT (WGET (w, new_total)))
3425 || !window_resize_check (c, horflag)) 3416 || !window_resize_check (c, horflag))
3426 return 0; 3417 return 0;
3427 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); 3418 c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
3428 } 3419 }
3429 return 1; 3420 return 1;
3430 } 3421 }
@@ -3433,7 +3424,7 @@ window_resize_check (struct window *w, int horflag)
3433 /* A leaf window. Make sure it's not too small. The following 3424 /* A leaf window. Make sure it's not too small. The following
3434 hardcodes the values of `window-safe-min-width' (2) and 3425 hardcodes the values of `window-safe-min-width' (2) and
3435 `window-safe-min-height' (1) which are defined in window.el. */ 3426 `window-safe-min-height' (1) which are defined in window.el. */
3436 return XINT (WVAR (w, new_total)) >= (horflag ? 2 : 1); 3427 return XINT (WGET (w, new_total)) >= (horflag ? 2 : 1);
3437} 3428}
3438 3429
3439/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to 3430/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to
@@ -3453,51 +3444,51 @@ window_resize_apply (struct window *w, int horflag)
3453 parent window has been set *before*. */ 3444 parent window has been set *before*. */
3454 if (horflag) 3445 if (horflag)
3455 { 3446 {
3456 WVAR (w, total_cols) = WVAR (w, new_total); 3447 WSET (w, total_cols, WGET (w, new_total));
3457 if (NUMBERP (WVAR (w, new_normal))) 3448 if (NUMBERP (WGET (w, new_normal)))
3458 WVAR (w, normal_cols) = WVAR (w, new_normal); 3449 WSET (w, normal_cols, WGET (w, new_normal));
3459 3450
3460 pos = XINT (WVAR (w, left_col)); 3451 pos = XINT (WGET (w, left_col));
3461 } 3452 }
3462 else 3453 else
3463 { 3454 {
3464 WVAR (w, total_lines) = WVAR (w, new_total); 3455 WSET (w, total_lines, WGET (w, new_total));
3465 if (NUMBERP (WVAR (w, new_normal))) 3456 if (NUMBERP (WGET (w, new_normal)))
3466 WVAR (w, normal_lines) = WVAR (w, new_normal); 3457 WSET (w, normal_lines, WGET (w, new_normal));
3467 3458
3468 pos = XINT (WVAR (w, top_line)); 3459 pos = XINT (WGET (w, top_line));
3469 } 3460 }
3470 3461
3471 if (!NILP (WVAR (w, vchild))) 3462 if (!NILP (WGET (w, vchild)))
3472 /* W is a vertical combination. */ 3463 /* W is a vertical combination. */
3473 { 3464 {
3474 c = XWINDOW (WVAR (w, vchild)); 3465 c = XWINDOW (WGET (w, vchild));
3475 while (c) 3466 while (c)
3476 { 3467 {
3477 if (horflag) 3468 if (horflag)
3478 XSETFASTINT (WVAR (c, left_col), pos); 3469 WSET (c, left_col, make_number (pos));
3479 else 3470 else
3480 XSETFASTINT (WVAR (c, top_line), pos); 3471 WSET (c, top_line, make_number (pos));
3481 window_resize_apply (c, horflag); 3472 window_resize_apply (c, horflag);
3482 if (!horflag) 3473 if (!horflag)
3483 pos = pos + XINT (WVAR (c, total_lines)); 3474 pos = pos + XINT (WGET (c, total_lines));
3484 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); 3475 c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
3485 } 3476 }
3486 } 3477 }
3487 else if (!NILP (WVAR (w, hchild))) 3478 else if (!NILP (WGET (w, hchild)))
3488 /* W is a horizontal combination. */ 3479 /* W is a horizontal combination. */
3489 { 3480 {
3490 c = XWINDOW (WVAR (w, hchild)); 3481 c = XWINDOW (WGET (w, hchild));
3491 while (c) 3482 while (c)
3492 { 3483 {
3493 if (horflag) 3484 if (horflag)
3494 XSETFASTINT (WVAR (c, left_col), pos); 3485 WSET (c, left_col, make_number (pos));
3495 else 3486 else
3496 XSETFASTINT (WVAR (c, top_line), pos); 3487 WSET (c, top_line, make_number (pos));
3497 window_resize_apply (c, horflag); 3488 window_resize_apply (c, horflag);
3498 if (horflag) 3489 if (horflag)
3499 pos = pos + XINT (WVAR (c, total_cols)); 3490 pos = pos + XINT (WGET (c, total_cols));
3500 c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); 3491 c = NILP (WGET (c, next)) ? 0 : XWINDOW (WGET (c, next));
3501 } 3492 }
3502 } 3493 }
3503 3494
@@ -3533,8 +3524,8 @@ be applied on the Elisp level. */)
3533 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 3524 r = XWINDOW (FRAME_ROOT_WINDOW (f));
3534 3525
3535 if (!window_resize_check (r, horflag) 3526 if (!window_resize_check (r, horflag)
3536 || ! EQ (WVAR (r, new_total), 3527 || ! EQ (WGET (r, new_total),
3537 (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines)))) 3528 (horflag ? WGET (r, total_cols) : WGET (r, total_lines))))
3538 return Qnil; 3529 return Qnil;
3539 3530
3540 BLOCK_INPUT; 3531 BLOCK_INPUT;
@@ -3574,39 +3565,39 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3574 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 3565 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
3575 ? 1 : 0))); 3566 ? 1 : 0)));
3576 3567
3577 XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f)); 3568 WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f)));
3578 if (NILP (WVAR (r, vchild)) && NILP (WVAR (r, hchild))) 3569 if (NILP (WGET (r, vchild)) && NILP (WGET (r, hchild)))
3579 /* For a leaf root window just set the size. */ 3570 /* For a leaf root window just set the size. */
3580 if (horflag) 3571 if (horflag)
3581 XSETFASTINT (WVAR (r, total_cols), new_size); 3572 WSET (r, total_cols, make_number (new_size));
3582 else 3573 else
3583 XSETFASTINT (WVAR (r, total_lines), new_size); 3574 WSET (r, total_lines, make_number (new_size));
3584 else 3575 else
3585 { 3576 {
3586 /* old_size is the old size of the frame's root window. */ 3577 /* old_size is the old size of the frame's root window. */
3587 int old_size = XFASTINT (horflag ? WVAR (r, total_cols) 3578 int old_size = XFASTINT (horflag ? WGET (r, total_cols)
3588 : WVAR (r, total_lines)); 3579 : WGET (r, total_lines));
3589 Lisp_Object delta; 3580 Lisp_Object delta;
3590 3581
3591 XSETINT (delta, new_size - old_size); 3582 XSETINT (delta, new_size - old_size);
3592 /* Try a "normal" resize first. */ 3583 /* Try a "normal" resize first. */
3593 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); 3584 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil);
3594 if (window_resize_check (r, horflag) 3585 if (window_resize_check (r, horflag)
3595 && new_size == XINT (WVAR (r, new_total))) 3586 && new_size == XINT (WGET (r, new_total)))
3596 window_resize_apply (r, horflag); 3587 window_resize_apply (r, horflag);
3597 else 3588 else
3598 { 3589 {
3599 /* Try with "reasonable" minimum sizes next. */ 3590 /* Try with "reasonable" minimum sizes next. */
3600 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt); 3591 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt);
3601 if (window_resize_check (r, horflag) 3592 if (window_resize_check (r, horflag)
3602 && new_size == XINT (WVAR (r, new_total))) 3593 && new_size == XINT (WGET (r, new_total)))
3603 window_resize_apply (r, horflag); 3594 window_resize_apply (r, horflag);
3604 else 3595 else
3605 { 3596 {
3606 /* Finally, try with "safe" minimum sizes. */ 3597 /* Finally, try with "safe" minimum sizes. */
3607 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe); 3598 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe);
3608 if (window_resize_check (r, horflag) 3599 if (window_resize_check (r, horflag)
3609 && new_size == XINT (WVAR (r, new_total))) 3600 && new_size == XINT (WGET (r, new_total)))
3610 window_resize_apply (r, horflag); 3601 window_resize_apply (r, horflag);
3611 else 3602 else
3612 { 3603 {
@@ -3615,9 +3606,9 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3615 root = FGET (f, selected_window); 3606 root = FGET (f, selected_window);
3616 Fdelete_other_windows_internal (root, Qnil); 3607 Fdelete_other_windows_internal (root, Qnil);
3617 if (horflag) 3608 if (horflag)
3618 XSETFASTINT (WVAR (XWINDOW (root), total_cols), new_size); 3609 WSET (XWINDOW (root), total_cols, make_number (new_size));
3619 else 3610 else
3620 XSETFASTINT (WVAR (XWINDOW (root), total_lines), new_size); 3611 WSET (XWINDOW (root), total_lines, make_number (new_size));
3621 } 3612 }
3622 } 3613 }
3623 } 3614 }
@@ -3627,13 +3618,13 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3627 { 3618 {
3628 m = XWINDOW (mini); 3619 m = XWINDOW (mini);
3629 if (horflag) 3620 if (horflag)
3630 XSETFASTINT (WVAR (m, total_cols), size); 3621 WSET (m, total_cols, make_number (size));
3631 else 3622 else
3632 { 3623 {
3633 /* Are we sure we always want 1 line here? */ 3624 /* Are we sure we always want 1 line here? */
3634 XSETFASTINT (WVAR (m, total_lines), 1); 3625 WSET (m, total_lines, make_number (1));
3635 XSETFASTINT (WVAR (m, top_line), XINT (WVAR (r, top_line)) 3626 WSET (m, top_line,
3636 + XINT (WVAR (r, total_lines))); 3627 make_number (XINT (WGET (r, top_line)) + XINT (WGET (r, total_lines))));
3637 } 3628 }
3638 } 3629 }
3639} 3630}
@@ -3689,10 +3680,10 @@ set correctly. See the code of `split-window' for how this is done. */)
3689 parent, or OLD is ortho-combined. */ 3680 parent, or OLD is ortho-combined. */
3690 combination_limit = 3681 combination_limit =
3691 !NILP (Vwindow_combination_limit) 3682 !NILP (Vwindow_combination_limit)
3692 || NILP (WVAR (o, parent)) 3683 || NILP (WGET (o, parent))
3693 || NILP (horflag 3684 || NILP (horflag
3694 ? (WVAR (XWINDOW (WVAR (o, parent)), hchild)) 3685 ? (WGET (XWINDOW (WGET (o, parent)), hchild))
3695 : (WVAR (XWINDOW (WVAR (o, parent)), vchild))); 3686 : (WGET (XWINDOW (WGET (o, parent)), vchild)));
3696 3687
3697 /* We need a live reference window to initialize some parameters. */ 3688 /* We need a live reference window to initialize some parameters. */
3698 if (WINDOW_LIVE_P (old)) 3689 if (WINDOW_LIVE_P (old))
@@ -3712,24 +3703,24 @@ set correctly. See the code of `split-window' for how this is done. */)
3712 /* `window-combination-resize' non-nil means try to resize OLD's siblings 3703 /* `window-combination-resize' non-nil means try to resize OLD's siblings
3713 proportionally. */ 3704 proportionally. */
3714 { 3705 {
3715 p = XWINDOW (WVAR (o, parent)); 3706 p = XWINDOW (WGET (o, parent));
3716 /* Temporarily pretend we split the parent window. */ 3707 /* Temporarily pretend we split the parent window. */
3717 XSETINT (WVAR (p, new_total), 3708 WSET (p, new_total,
3718 XINT (horflag ? WVAR (p, total_cols) : WVAR (p, total_lines)) 3709 make_number (XINT (horflag ? WGET (p, total_cols) : WGET (p, total_lines))
3719 - XINT (total_size)); 3710 - XINT (total_size)));
3720 if (!window_resize_check (p, horflag)) 3711 if (!window_resize_check (p, horflag))
3721 error ("Window sizes don't fit"); 3712 error ("Window sizes don't fit");
3722 else 3713 else
3723 /* Undo the temporary pretension. */ 3714 /* Undo the temporary pretension. */
3724 WVAR (p, new_total) 3715 WSET (p, new_total,
3725 = horflag ? WVAR (p, total_cols) : WVAR (p, total_lines); 3716 horflag ? WGET (p, total_cols) : WGET (p, total_lines));
3726 } 3717 }
3727 else 3718 else
3728 { 3719 {
3729 if (!window_resize_check (o, horflag)) 3720 if (!window_resize_check (o, horflag))
3730 error ("Resizing old window failed"); 3721 error ("Resizing old window failed");
3731 else if (XINT (total_size) + XINT (WVAR (o, new_total)) 3722 else if (XINT (total_size) + XINT (WGET (o, new_total))
3732 != XINT (horflag ? WVAR (o, total_cols) : WVAR (o, total_lines))) 3723 != XINT (horflag ? WGET (o, total_cols) : WGET (o, total_lines)))
3733 error ("Sum of sizes of old and new window don't fit"); 3724 error ("Sum of sizes of old and new window don't fit");
3734 } 3725 }
3735 3726
@@ -3740,94 +3731,95 @@ set correctly. See the code of `split-window' for how this is done. */)
3740 by make_parent_window and we need it below for assigning it to 3731 by make_parent_window and we need it below for assigning it to
3741 p->new_normal. */ 3732 p->new_normal. */
3742 Lisp_Object new_normal 3733 Lisp_Object new_normal
3743 = horflag ? WVAR (o, normal_cols) : WVAR (o, normal_lines); 3734 = horflag ? WGET (o, normal_cols) : WGET (o, normal_lines);
3744 3735
3745 make_parent_window (old, horflag); 3736 make_parent_window (old, horflag);
3746 p = XWINDOW (WVAR (o, parent)); 3737 p = XWINDOW (WGET (o, parent));
3747 /* Store value of `window-combination-limit' in new parent's 3738 /* Store value of `window-combination-limit' in new parent's
3748 combination_limit slot. */ 3739 combination_limit slot. */
3749 WVAR (p, combination_limit) = Vwindow_combination_limit; 3740 WSET (p, combination_limit, Vwindow_combination_limit);
3750 /* These get applied below. */ 3741 /* These get applied below. */
3751 WVAR (p, new_total) 3742 WSET (p, new_total,
3752 = horflag ? WVAR (o, total_cols) : WVAR (o, total_lines); 3743 horflag ? WGET (o, total_cols) : WGET (o, total_lines));
3753 WVAR (p, new_normal) = new_normal; 3744 WSET (p, new_normal, new_normal);
3754 } 3745 }
3755 else 3746 else
3756 p = XWINDOW (WVAR (o, parent)); 3747 p = XWINDOW (WGET (o, parent));
3757 3748
3758 windows_or_buffers_changed++; 3749 windows_or_buffers_changed++;
3759 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3750 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3760 new = make_window (); 3751 new = make_window ();
3761 n = XWINDOW (new); 3752 n = XWINDOW (new);
3762 WVAR (n, frame) = frame; 3753 WSET (n, frame, frame);
3763 WVAR (n, parent) = WVAR (o, parent); 3754 WSET (n, parent, WGET (o, parent));
3764 WVAR (n, vchild) = WVAR (n, hchild) = Qnil; 3755 WSET (n, vchild, Qnil);
3756 WSET (n, hchild, Qnil);
3765 3757
3766 if (EQ (side, Qabove) || EQ (side, Qleft)) 3758 if (EQ (side, Qabove) || EQ (side, Qleft))
3767 { 3759 {
3768 WVAR (n, prev) = WVAR (o, prev); 3760 WSET (n, prev, WGET (o, prev));
3769 if (NILP (WVAR (n, prev))) 3761 if (NILP (WGET (n, prev)))
3770 if (horflag) 3762 if (horflag)
3771 WVAR (p, hchild) = new; 3763 WSET (p, hchild, new);
3772 else 3764 else
3773 WVAR (p, vchild) = new; 3765 WSET (p, vchild, new);
3774 else 3766 else
3775 WVAR (XWINDOW (WVAR (n, prev)), next) = new; 3767 WSET (XWINDOW (WGET (n, prev)), next, new);
3776 WVAR (n, next) = old; 3768 WSET (n, next, old);
3777 WVAR (o, prev) = new; 3769 WSET (o, prev, new);
3778 } 3770 }
3779 else 3771 else
3780 { 3772 {
3781 WVAR (n, next) = WVAR (o, next); 3773 WSET (n, next, WGET (o, next));
3782 if (!NILP (WVAR (n, next))) 3774 if (!NILP (WGET (n, next)))
3783 WVAR (XWINDOW (WVAR (n, next)), prev) = new; 3775 WSET (XWINDOW (WGET (n, next)), prev, new);
3784 WVAR (n, prev) = old; 3776 WSET (n, prev, old);
3785 WVAR (o, next) = new; 3777 WSET (o, next, new);
3786 } 3778 }
3787 3779
3788 WVAR (n, buffer) = Qt; 3780 WSET (n, buffer, Qt);
3789 WVAR (n, window_end_valid) = Qnil; 3781 WSET (n, window_end_valid, Qnil);
3790 memset (&n->last_cursor, 0, sizeof n->last_cursor); 3782 memset (&n->last_cursor, 0, sizeof n->last_cursor);
3791 3783
3792 /* Get special geometry settings from reference window. */ 3784 /* Get special geometry settings from reference window. */
3793 WVAR (n, left_margin_cols) = WVAR (r, left_margin_cols); 3785 WSET (n, left_margin_cols, WGET (r, left_margin_cols));
3794 WVAR (n, right_margin_cols) = WVAR (r, right_margin_cols); 3786 WSET (n, right_margin_cols, WGET (r, right_margin_cols));
3795 WVAR (n, left_fringe_width) = WVAR (r, left_fringe_width); 3787 WSET (n, left_fringe_width, WGET (r, left_fringe_width));
3796 WVAR (n, right_fringe_width) = WVAR (r, right_fringe_width); 3788 WSET (n, right_fringe_width, WGET (r, right_fringe_width));
3797 n->fringes_outside_margins = r->fringes_outside_margins; 3789 n->fringes_outside_margins = r->fringes_outside_margins;
3798 WVAR (n, scroll_bar_width) = WVAR (r, scroll_bar_width); 3790 WSET (n, scroll_bar_width, WGET (r, scroll_bar_width));
3799 WVAR (n, vertical_scroll_bar_type) = WVAR (r, vertical_scroll_bar_type); 3791 WSET (n, vertical_scroll_bar_type, WGET (r, vertical_scroll_bar_type));
3800 3792
3801 /* Directly assign orthogonal coordinates and sizes. */ 3793 /* Directly assign orthogonal coordinates and sizes. */
3802 if (horflag) 3794 if (horflag)
3803 { 3795 {
3804 WVAR (n, top_line) = WVAR (o, top_line); 3796 WSET (n, top_line, WGET (o, top_line));
3805 WVAR (n, total_lines) = WVAR (o, total_lines); 3797 WSET (n, total_lines, WGET (o, total_lines));
3806 } 3798 }
3807 else 3799 else
3808 { 3800 {
3809 WVAR (n, left_col) = WVAR (o, left_col); 3801 WSET (n, left_col, WGET (o, left_col));
3810 WVAR (n, total_cols) = WVAR (o, total_cols); 3802 WSET (n, total_cols, WGET (o, total_cols));
3811 } 3803 }
3812 3804
3813 /* Iso-coordinates and sizes are assigned by window_resize_apply, 3805 /* Iso-coordinates and sizes are assigned by window_resize_apply,
3814 get them ready here. */ 3806 get them ready here. */
3815 WVAR (n, new_total) = total_size; 3807 WSET (n, new_total, total_size);
3816 WVAR (n, new_normal) = normal_size; 3808 WSET (n, new_normal, normal_size);
3817 3809
3818 BLOCK_INPUT; 3810 BLOCK_INPUT;
3819 window_resize_apply (p, horflag); 3811 window_resize_apply (p, horflag);
3820 adjust_glyphs (f); 3812 adjust_glyphs (f);
3821 /* Set buffer of NEW to buffer of reference window. Don't run 3813 /* Set buffer of NEW to buffer of reference window. Don't run
3822 any hooks. */ 3814 any hooks. */
3823 set_window_buffer (new, WVAR (r, buffer), 0, 1); 3815 set_window_buffer (new, WGET (r, buffer), 0, 1);
3824 UNBLOCK_INPUT; 3816 UNBLOCK_INPUT;
3825 3817
3826 /* Maybe we should run the scroll functions in Elisp (which already 3818 /* Maybe we should run the scroll functions in Elisp (which already
3827 runs the configuration change hook). */ 3819 runs the configuration change hook). */
3828 if (! NILP (Vwindow_scroll_functions)) 3820 if (! NILP (Vwindow_scroll_functions))
3829 run_hook_with_args_2 (Qwindow_scroll_functions, new, 3821 run_hook_with_args_2 (Qwindow_scroll_functions, new,
3830 Fmarker_position (WVAR (n, start))); 3822 Fmarker_position (WGET (n, start)));
3831 /* Return NEW. */ 3823 /* Return NEW. */
3832 return new; 3824 return new;
3833} 3825}
@@ -3847,22 +3839,22 @@ Signal an error when WINDOW is the only window on its frame. */)
3847 3839
3848 w = decode_any_window (window); 3840 w = decode_any_window (window);
3849 XSETWINDOW (window, w); 3841 XSETWINDOW (window, w);
3850 if (NILP (WVAR (w, buffer)) 3842 if (NILP (WGET (w, buffer))
3851 && NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild))) 3843 && NILP (WGET (w, hchild)) && NILP (WGET (w, vchild)))
3852 /* It's a no-op to delete an already deleted window. */ 3844 /* It's a no-op to delete an already deleted window. */
3853 return Qnil; 3845 return Qnil;
3854 3846
3855 parent = WVAR (w, parent); 3847 parent = WGET (w, parent);
3856 if (NILP (parent)) 3848 if (NILP (parent))
3857 /* Never delete a minibuffer or frame root window. */ 3849 /* Never delete a minibuffer or frame root window. */
3858 error ("Attempt to delete minibuffer or sole ordinary window"); 3850 error ("Attempt to delete minibuffer or sole ordinary window");
3859 else if (NILP (WVAR (w, prev)) && NILP (WVAR (w, next))) 3851 else if (NILP (WGET (w, prev)) && NILP (WGET (w, next)))
3860 /* Rather bow out here, this case should be handled on the Elisp 3852 /* Rather bow out here, this case should be handled on the Elisp
3861 level. */ 3853 level. */
3862 error ("Attempt to delete sole window of parent"); 3854 error ("Attempt to delete sole window of parent");
3863 3855
3864 p = XWINDOW (parent); 3856 p = XWINDOW (parent);
3865 horflag = NILP (WVAR (p, vchild)); 3857 horflag = NILP (WGET (p, vchild));
3866 3858
3867 frame = WINDOW_FRAME (w); 3859 frame = WINDOW_FRAME (w);
3868 f = XFRAME (frame); 3860 f = XFRAME (frame);
@@ -3871,33 +3863,33 @@ Signal an error when WINDOW is the only window on its frame. */)
3871 r = XWINDOW (root); 3863 r = XWINDOW (root);
3872 3864
3873 /* Unlink WINDOW from window tree. */ 3865 /* Unlink WINDOW from window tree. */
3874 if (NILP (WVAR (w, prev))) 3866 if (NILP (WGET (w, prev)))
3875 /* Get SIBLING below (on the right of) WINDOW. */ 3867 /* Get SIBLING below (on the right of) WINDOW. */
3876 { 3868 {
3877 /* before_sibling 1 means WINDOW is the first child of its 3869 /* before_sibling 1 means WINDOW is the first child of its
3878 parent and thus before the sibling. */ 3870 parent and thus before the sibling. */
3879 before_sibling = 1; 3871 before_sibling = 1;
3880 sibling = WVAR (w, next); 3872 sibling = WGET (w, next);
3881 s = XWINDOW (sibling); 3873 s = XWINDOW (sibling);
3882 WVAR (s, prev) = Qnil; 3874 WSET (s, prev, Qnil);
3883 if (horflag) 3875 if (horflag)
3884 WVAR (p, hchild) = sibling; 3876 WSET (p, hchild, sibling);
3885 else 3877 else
3886 WVAR (p, vchild) = sibling; 3878 WSET (p, vchild, sibling);
3887 } 3879 }
3888 else 3880 else
3889 /* Get SIBLING above (on the left of) WINDOW. */ 3881 /* Get SIBLING above (on the left of) WINDOW. */
3890 { 3882 {
3891 sibling = WVAR (w, prev); 3883 sibling = WGET (w, prev);
3892 s = XWINDOW (sibling); 3884 s = XWINDOW (sibling);
3893 WVAR (s, next) = WVAR (w, next); 3885 WSET (s, next, WGET (w, next));
3894 if (!NILP (WVAR (s, next))) 3886 if (!NILP (WGET (s, next)))
3895 WVAR (XWINDOW (WVAR (s, next)), prev) = sibling; 3887 WSET (XWINDOW (WGET (s, next)), prev, sibling);
3896 } 3888 }
3897 3889
3898 if (window_resize_check (r, horflag) 3890 if (window_resize_check (r, horflag)
3899 && EQ (WVAR (r, new_total), 3891 && EQ (WGET (r, new_total),
3900 (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines)))) 3892 (horflag ? WGET (r, total_cols) : WGET (r, total_lines))))
3901 /* We can delete WINDOW now. */ 3893 /* We can delete WINDOW now. */
3902 { 3894 {
3903 3895
@@ -3919,28 +3911,28 @@ Signal an error when WINDOW is the only window on its frame. */)
3919 Vwindow_list = Qnil; 3911 Vwindow_list = Qnil;
3920 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3912 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3921 3913
3922 WVAR (w, next) = Qnil; /* Don't delete w->next too. */ 3914 WSET (w, next, Qnil); /* Don't delete w->next too. */
3923 free_window_matrices (w); 3915 free_window_matrices (w);
3924 3916
3925 if (!NILP (WVAR (w, vchild))) 3917 if (!NILP (WGET (w, vchild)))
3926 { 3918 {
3927 delete_all_child_windows (WVAR (w, vchild)); 3919 delete_all_child_windows (WGET (w, vchild));
3928 WVAR (w, vchild) = Qnil; 3920 WSET (w, vchild, Qnil);
3929 } 3921 }
3930 else if (!NILP (WVAR (w, hchild))) 3922 else if (!NILP (WGET (w, hchild)))
3931 { 3923 {
3932 delete_all_child_windows (WVAR (w, hchild)); 3924 delete_all_child_windows (WGET (w, hchild));
3933 WVAR (w, hchild) = Qnil; 3925 WSET (w, hchild, Qnil);
3934 } 3926 }
3935 else if (!NILP (WVAR (w, buffer))) 3927 else if (!NILP (WGET (w, buffer)))
3936 { 3928 {
3937 unshow_buffer (w); 3929 unshow_buffer (w);
3938 unchain_marker (XMARKER (WVAR (w, pointm))); 3930 unchain_marker (XMARKER (WGET (w, pointm)));
3939 unchain_marker (XMARKER (WVAR (w, start))); 3931 unchain_marker (XMARKER (WGET (w, start)));
3940 WVAR (w, buffer) = Qnil; 3932 WSET (w, buffer, Qnil);
3941 } 3933 }
3942 3934
3943 if (NILP (WVAR (s, prev)) && NILP (WVAR (s, next))) 3935 if (NILP (WGET (s, prev)) && NILP (WGET (s, next)))
3944 /* A matrjoshka where SIBLING has become the only child of 3936 /* A matrjoshka where SIBLING has become the only child of
3945 PARENT. */ 3937 PARENT. */
3946 { 3938 {
@@ -3948,10 +3940,11 @@ Signal an error when WINDOW is the only window on its frame. */)
3948 replace_window (parent, sibling, 0); 3940 replace_window (parent, sibling, 0);
3949 /* Have SIBLING inherit the following three slot values from 3941 /* Have SIBLING inherit the following three slot values from
3950 PARENT (the combination_limit slot is not inherited). */ 3942 PARENT (the combination_limit slot is not inherited). */
3951 WVAR (s, normal_cols) = WVAR (p, normal_cols); 3943 WSET (s, normal_cols, WGET (p, normal_cols));
3952 WVAR (s, normal_lines) = WVAR (p, normal_lines); 3944 WSET (s, normal_lines, WGET (p, normal_lines));
3953 /* Mark PARENT as deleted. */ 3945 /* Mark PARENT as deleted. */
3954 WVAR (p, vchild) = WVAR (p, hchild) = Qnil; 3946 WSET (p, vchild, Qnil);
3947 WSET (p, hchild, Qnil);
3955 /* Try to merge SIBLING into its new parent. */ 3948 /* Try to merge SIBLING into its new parent. */
3956 recombine_windows (sibling); 3949 recombine_windows (sibling);
3957 } 3950 }
@@ -3978,7 +3971,7 @@ Signal an error when WINDOW is the only window on its frame. */)
3978 /* Now look whether `get-mru-window' gets us something. */ 3971 /* Now look whether `get-mru-window' gets us something. */
3979 mru_window = call1 (Qget_mru_window, frame); 3972 mru_window = call1 (Qget_mru_window, frame);
3980 if (WINDOW_LIVE_P (mru_window) 3973 if (WINDOW_LIVE_P (mru_window)
3981 && EQ (WVAR (XWINDOW (mru_window), frame), frame)) 3974 && EQ (WGET (XWINDOW (mru_window), frame), frame))
3982 new_selected_window = mru_window; 3975 new_selected_window = mru_window;
3983 3976
3984 /* If all ended up well, we now promote the mru window. */ 3977 /* If all ended up well, we now promote the mru window. */
@@ -3998,17 +3991,17 @@ Signal an error when WINDOW is the only window on its frame. */)
3998 { 3991 {
3999 if (before_sibling) 3992 if (before_sibling)
4000 { 3993 {
4001 WVAR (s, prev) = window; 3994 WSET (s, prev, window);
4002 if (horflag) 3995 if (horflag)
4003 WVAR (p, hchild) = window; 3996 WSET (p, hchild, window);
4004 else 3997 else
4005 WVAR (p, vchild) = window; 3998 WSET (p, vchild, window);
4006 } 3999 }
4007 else 4000 else
4008 { 4001 {
4009 WVAR (s, next) = window; 4002 WSET (s, next, window);
4010 if (!NILP (WVAR (w, next))) 4003 if (!NILP (WGET (w, next)))
4011 WVAR (XWINDOW (WVAR (w, next)), prev) = window; 4004 WSET (XWINDOW (WGET (w, next)), prev, window);
4012 } 4005 }
4013 error ("Deletion failed"); 4006 error ("Deletion failed");
4014 } 4007 }
@@ -4025,7 +4018,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4025void 4018void
4026grow_mini_window (struct window *w, int delta) 4019grow_mini_window (struct window *w, int delta)
4027{ 4020{
4028 struct frame *f = XFRAME (WVAR (w, frame)); 4021 struct frame *f = XFRAME (WGET (w, frame));
4029 struct window *r; 4022 struct window *r;
4030 Lisp_Object root, value; 4023 Lisp_Object root, value;
4031 4024
@@ -4042,9 +4035,10 @@ grow_mini_window (struct window *w, int delta)
4042 window_resize_apply (r, 0); 4035 window_resize_apply (r, 0);
4043 4036
4044 /* Grow the mini-window. */ 4037 /* Grow the mini-window. */
4045 XSETFASTINT (WVAR (w, top_line), 4038 WSET (w, top_line,
4046 XFASTINT (WVAR (r, top_line)) + XFASTINT (WVAR (r, total_lines))); 4039 make_number (XFASTINT (WGET (r, top_line)) + XFASTINT (WGET (r, total_lines))));
4047 XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - XINT (value)); 4040 WSET (w, total_lines,
4041 make_number (XFASTINT (WGET (w, total_lines)) - XINT (value)));
4048 w->last_modified = 0; 4042 w->last_modified = 0;
4049 w->last_overlay_modified = 0; 4043 w->last_overlay_modified = 0;
4050 4044
@@ -4058,14 +4052,14 @@ grow_mini_window (struct window *w, int delta)
4058void 4052void
4059shrink_mini_window (struct window *w) 4053shrink_mini_window (struct window *w)
4060{ 4054{
4061 struct frame *f = XFRAME (WVAR (w, frame)); 4055 struct frame *f = XFRAME (WGET (w, frame));
4062 struct window *r; 4056 struct window *r;
4063 Lisp_Object root, value; 4057 Lisp_Object root, value;
4064 EMACS_INT size; 4058 EMACS_INT size;
4065 4059
4066 eassert (MINI_WINDOW_P (w)); 4060 eassert (MINI_WINDOW_P (w));
4067 4061
4068 size = XINT (WVAR (w, total_lines)); 4062 size = XINT (WGET (w, total_lines));
4069 if (size > 1) 4063 if (size > 1)
4070 { 4064 {
4071 root = FRAME_ROOT_WINDOW (f); 4065 root = FRAME_ROOT_WINDOW (f);
@@ -4078,9 +4072,9 @@ shrink_mini_window (struct window *w)
4078 window_resize_apply (r, 0); 4072 window_resize_apply (r, 0);
4079 4073
4080 /* Shrink the mini-window. */ 4074 /* Shrink the mini-window. */
4081 XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (r, top_line)) 4075 WSET (w, top_line,
4082 + XFASTINT (WVAR (r, total_lines))); 4076 make_number (XFASTINT (WGET (r, top_line)) + XFASTINT (WGET (r, total_lines))));
4083 XSETFASTINT (WVAR (w, total_lines), 1); 4077 WSET (w, total_lines, make_number (1));
4084 4078
4085 w->last_modified = 0; 4079 w->last_modified = 0;
4086 w->last_overlay_modified = 0; 4080 w->last_overlay_modified = 0;
@@ -4105,25 +4099,25 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4105 int height; 4099 int height;
4106 4100
4107 CHECK_WINDOW (window); 4101 CHECK_WINDOW (window);
4108 f = XFRAME (WVAR (w, frame)); 4102 f = XFRAME (WGET (w, frame));
4109 4103
4110 if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (WVAR (w, frame))), window)) 4104 if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (WGET (w, frame))), window))
4111 error ("Not a valid minibuffer window"); 4105 error ("Not a valid minibuffer window");
4112 else if (FRAME_MINIBUF_ONLY_P (f)) 4106 else if (FRAME_MINIBUF_ONLY_P (f))
4113 error ("Cannot resize a minibuffer-only frame"); 4107 error ("Cannot resize a minibuffer-only frame");
4114 4108
4115 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 4109 r = XWINDOW (FRAME_ROOT_WINDOW (f));
4116 height = XINT (WVAR (r, total_lines)) + XINT (WVAR (w, total_lines)); 4110 height = XINT (WGET (r, total_lines)) + XINT (WGET (w, total_lines));
4117 if (window_resize_check (r, 0) 4111 if (window_resize_check (r, 0)
4118 && XINT (WVAR (w, new_total)) > 0 4112 && XINT (WGET (w, new_total)) > 0
4119 && height == XINT (WVAR (r, new_total)) + XINT (WVAR (w, new_total))) 4113 && height == XINT (WGET (r, new_total)) + XINT (WGET (w, new_total)))
4120 { 4114 {
4121 BLOCK_INPUT; 4115 BLOCK_INPUT;
4122 window_resize_apply (r, 0); 4116 window_resize_apply (r, 0);
4123 4117
4124 WVAR (w, total_lines) = WVAR (w, new_total); 4118 WSET (w, total_lines, WGET (w, new_total));
4125 XSETFASTINT (WVAR (w, top_line), 4119 WSET (w, top_line,
4126 XINT (WVAR (r, top_line)) + XINT (WVAR (r, total_lines))); 4120 make_number (XINT (WGET (r, top_line)) + XINT (WGET (r, total_lines))));
4127 4121
4128 windows_or_buffers_changed++; 4122 windows_or_buffers_changed++;
4129 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4123 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -4146,14 +4140,14 @@ mark_window_cursors_off (struct window *w)
4146{ 4140{
4147 while (w) 4141 while (w)
4148 { 4142 {
4149 if (!NILP (WVAR (w, hchild))) 4143 if (!NILP (WGET (w, hchild)))
4150 mark_window_cursors_off (XWINDOW (WVAR (w, hchild))); 4144 mark_window_cursors_off (XWINDOW (WGET (w, hchild)));
4151 else if (!NILP (WVAR (w, vchild))) 4145 else if (!NILP (WGET (w, vchild)))
4152 mark_window_cursors_off (XWINDOW (WVAR (w, vchild))); 4146 mark_window_cursors_off (XWINDOW (WGET (w, vchild)));
4153 else 4147 else
4154 w->phys_cursor_on_p = 0; 4148 w->phys_cursor_on_p = 0;
4155 4149
4156 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); 4150 w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
4157 } 4151 }
4158} 4152}
4159 4153
@@ -4163,15 +4157,15 @@ mark_window_cursors_off (struct window *w)
4163int 4157int
4164window_internal_height (struct window *w) 4158window_internal_height (struct window *w)
4165{ 4159{
4166 int ht = XFASTINT (WVAR (w, total_lines)); 4160 int ht = XFASTINT (WGET (w, total_lines));
4167 4161
4168 if (!MINI_WINDOW_P (w)) 4162 if (!MINI_WINDOW_P (w))
4169 { 4163 {
4170 if (!NILP (WVAR (w, parent)) 4164 if (!NILP (WGET (w, parent))
4171 || !NILP (WVAR (w, vchild)) 4165 || !NILP (WGET (w, vchild))
4172 || !NILP (WVAR (w, hchild)) 4166 || !NILP (WGET (w, hchild))
4173 || !NILP (WVAR (w, next)) 4167 || !NILP (WGET (w, next))
4174 || !NILP (WVAR (w, prev)) 4168 || !NILP (WGET (w, prev))
4175 || WINDOW_WANTS_MODELINE_P (w)) 4169 || WINDOW_WANTS_MODELINE_P (w))
4176 --ht; 4170 --ht;
4177 4171
@@ -4201,7 +4195,7 @@ window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror)
4201 4195
4202 /* If we must, use the pixel-based version which is much slower than 4196 /* If we must, use the pixel-based version which is much slower than
4203 the line-based one but can handle varying line heights. */ 4197 the line-based one but can handle varying line heights. */
4204 if (FRAME_WINDOW_P (XFRAME (WVAR (XWINDOW (window), frame)))) 4198 if (FRAME_WINDOW_P (XFRAME (WGET (XWINDOW (window), frame))))
4205 window_scroll_pixel_based (window, n, whole, noerror); 4199 window_scroll_pixel_based (window, n, whole, noerror);
4206 else 4200 else
4207 window_scroll_line_based (window, n, whole, noerror); 4201 window_scroll_line_based (window, n, whole, noerror);
@@ -4226,7 +4220,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4226 int x, y, rtop, rbot, rowh, vpos; 4220 int x, y, rtop, rbot, rowh, vpos;
4227 void *itdata = NULL; 4221 void *itdata = NULL;
4228 4222
4229 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); 4223 SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
4230 /* Scrolling a minibuffer window via scroll bar when the echo area 4224 /* Scrolling a minibuffer window via scroll bar when the echo area
4231 shows long text sometimes resets the minibuffer contents behind 4225 shows long text sometimes resets the minibuffer contents behind
4232 our backs. */ 4226 our backs. */
@@ -4307,8 +4301,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4307 spos = XINT (Fline_beginning_position (Qnil)); 4301 spos = XINT (Fline_beginning_position (Qnil));
4308 else 4302 else
4309 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); 4303 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
4310 set_marker_restricted (WVAR (w, start), make_number (spos), 4304 set_marker_restricted (WGET (w, start), make_number (spos),
4311 WVAR (w, buffer)); 4305 WGET (w, buffer));
4312 w->start_at_line_beg = 1; 4306 w->start_at_line_beg = 1;
4313 w->update_mode_line = 1; 4307 w->update_mode_line = 1;
4314 w->last_modified = 0; 4308 w->last_modified = 0;
@@ -4432,7 +4426,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4432 4426
4433 /* If control gets here, then we vscrolled. */ 4427 /* If control gets here, then we vscrolled. */
4434 4428
4435 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; 4429 XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
4436 4430
4437 /* Don't try to change the window start below. */ 4431 /* Don't try to change the window start below. */
4438 vscrolled = 1; 4432 vscrolled = 1;
@@ -4452,9 +4446,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4452 } 4446 }
4453 4447
4454 /* Set the window start, and set up the window for redisplay. */ 4448 /* Set the window start, and set up the window for redisplay. */
4455 set_marker_restricted (WVAR (w, start), make_number (pos), 4449 set_marker_restricted (WGET (w, start), make_number (pos),
4456 WVAR (w, buffer)); 4450 WGET (w, buffer));
4457 bytepos = XMARKER (WVAR (w, start))->bytepos; 4451 bytepos = XMARKER (WGET (w, start))->bytepos;
4458 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); 4452 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
4459 w->update_mode_line = 1; 4453 w->update_mode_line = 1;
4460 w->last_modified = 0; 4454 w->last_modified = 0;
@@ -4473,7 +4467,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4473 even if there is a header line. */ 4467 even if there is a header line. */
4474 this_scroll_margin = max (0, scroll_margin); 4468 this_scroll_margin = max (0, scroll_margin);
4475 this_scroll_margin 4469 this_scroll_margin
4476 = min (this_scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4); 4470 = min (this_scroll_margin, XFASTINT (WGET (w, total_lines)) / 4);
4477 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 4471 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
4478 4472
4479 if (n > 0) 4473 if (n > 0)
@@ -4547,7 +4541,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4547 ; 4541 ;
4548 else if (window_scroll_pixel_based_preserve_y >= 0) 4542 else if (window_scroll_pixel_based_preserve_y >= 0)
4549 { 4543 {
4550 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); 4544 SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
4551 start_display (&it, w, start); 4545 start_display (&it, w, start);
4552 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT 4546 /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT
4553 here because we called start_display again and did not 4547 here because we called start_display again and did not
@@ -4601,7 +4595,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4601 if (whole) 4595 if (whole)
4602 n *= max (1, ht - next_screen_context_lines); 4596 n *= max (1, ht - next_screen_context_lines);
4603 4597
4604 startpos = marker_position (WVAR (w, start)); 4598 startpos = marker_position (WGET (w, start));
4605 4599
4606 if (!NILP (Vscroll_preserve_screen_position)) 4600 if (!NILP (Vscroll_preserve_screen_position))
4607 { 4601 {
@@ -4652,9 +4646,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4652 { 4646 {
4653 /* Don't use a scroll margin that is negative or too large. */ 4647 /* Don't use a scroll margin that is negative or too large. */
4654 int this_scroll_margin = 4648 int this_scroll_margin =
4655 max (0, min (scroll_margin, XINT (WVAR (w, total_lines)) / 4)); 4649 max (0, min (scroll_margin, XINT (WGET (w, total_lines)) / 4));
4656 4650
4657 set_marker_restricted_both (WVAR (w, start), WVAR (w, buffer), pos, pos_byte); 4651 set_marker_restricted_both (WGET (w, start), WGET (w, buffer), pos, pos_byte);
4658 w->start_at_line_beg = !NILP (bolp); 4652 w->start_at_line_beg = !NILP (bolp);
4659 w->update_mode_line = 1; 4653 w->update_mode_line = 1;
4660 w->last_modified = 0; 4654 w->last_modified = 0;
@@ -4748,10 +4742,10 @@ scroll_command (Lisp_Object n, int direction)
4748 4742
4749 /* If selected window's buffer isn't current, make it current for 4743 /* If selected window's buffer isn't current, make it current for
4750 the moment. But don't screw up if window_scroll gets an error. */ 4744 the moment. But don't screw up if window_scroll gets an error. */
4751 if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer) 4745 if (XBUFFER (WGET (XWINDOW (selected_window), buffer)) != current_buffer)
4752 { 4746 {
4753 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 4747 record_unwind_protect (save_excursion_restore, save_excursion_save ());
4754 Fset_buffer (WVAR (XWINDOW (selected_window), buffer)); 4748 Fset_buffer (WGET (XWINDOW (selected_window), buffer));
4755 4749
4756 /* Make redisplay consider other windows than just selected_window. */ 4750 /* Make redisplay consider other windows than just selected_window. */
4757 ++windows_or_buffers_changed; 4751 ++windows_or_buffers_changed;
@@ -4866,8 +4860,8 @@ specifies the window to scroll. This takes precedence over
4866 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 4860 record_unwind_protect (save_excursion_restore, save_excursion_save ());
4867 ++windows_or_buffers_changed; 4861 ++windows_or_buffers_changed;
4868 4862
4869 Fset_buffer (WVAR (w, buffer)); 4863 Fset_buffer (WGET (w, buffer));
4870 SET_PT (marker_position (WVAR (w, pointm))); 4864 SET_PT (marker_position (WGET (w, pointm)));
4871 4865
4872 if (NILP (arg)) 4866 if (NILP (arg))
4873 window_scroll (window, 1, 1, 1); 4867 window_scroll (window, 1, 1, 1);
@@ -4881,7 +4875,7 @@ specifies the window to scroll. This takes precedence over
4881 window_scroll (window, XINT (arg), 0, 1); 4875 window_scroll (window, XINT (arg), 0, 1);
4882 } 4876 }
4883 4877
4884 set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE); 4878 set_marker_both (WGET (w, pointm), Qnil, PT, PT_BYTE);
4885 unbind_to (count, Qnil); 4879 unbind_to (count, Qnil);
4886 4880
4887 return Qnil; 4881 return Qnil;
@@ -4959,10 +4953,10 @@ displayed_window_lines (struct window *w)
4959 int bottom_y; 4953 int bottom_y;
4960 void *itdata = NULL; 4954 void *itdata = NULL;
4961 4955
4962 if (XBUFFER (WVAR (w, buffer)) != current_buffer) 4956 if (XBUFFER (WGET (w, buffer)) != current_buffer)
4963 { 4957 {
4964 old_buffer = current_buffer; 4958 old_buffer = current_buffer;
4965 set_buffer_internal (XBUFFER (WVAR (w, buffer))); 4959 set_buffer_internal (XBUFFER (WGET (w, buffer)));
4966 } 4960 }
4967 else 4961 else
4968 old_buffer = NULL; 4962 old_buffer = NULL;
@@ -4970,12 +4964,12 @@ displayed_window_lines (struct window *w)
4970 /* In case W->start is out of the accessible range, do something 4964 /* In case W->start is out of the accessible range, do something
4971 reasonable. This happens in Info mode when Info-scroll-down 4965 reasonable. This happens in Info mode when Info-scroll-down
4972 calls (recenter -1) while W->start is 1. */ 4966 calls (recenter -1) while W->start is 1. */
4973 if (XMARKER (WVAR (w, start))->charpos < BEGV) 4967 if (XMARKER (WGET (w, start))->charpos < BEGV)
4974 SET_TEXT_POS (start, BEGV, BEGV_BYTE); 4968 SET_TEXT_POS (start, BEGV, BEGV_BYTE);
4975 else if (XMARKER (WVAR (w, start))->charpos > ZV) 4969 else if (XMARKER (WGET (w, start))->charpos > ZV)
4976 SET_TEXT_POS (start, ZV, ZV_BYTE); 4970 SET_TEXT_POS (start, ZV, ZV_BYTE);
4977 else 4971 else
4978 SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); 4972 SET_TEXT_POS_FROM_MARKER (start, WGET (w, start));
4979 4973
4980 itdata = bidi_shelve_cache (); 4974 itdata = bidi_shelve_cache ();
4981 start_display (&it, w, start); 4975 start_display (&it, w, start);
@@ -4989,7 +4983,7 @@ displayed_window_lines (struct window *w)
4989 This kludge fixes a bug whereby (move-to-window-line -1) 4983 This kludge fixes a bug whereby (move-to-window-line -1)
4990 when ZV is on the last screen line 4984 when ZV is on the last screen line
4991 moves to the previous screen line instead of the last one. */ 4985 moves to the previous screen line instead of the last one. */
4992 if (! FRAME_WINDOW_P (XFRAME (WVAR (w, frame)))) 4986 if (! FRAME_WINDOW_P (XFRAME (WGET (w, frame))))
4993 height++; 4987 height++;
4994 4988
4995 /* Add in empty lines at the bottom of the window. */ 4989 /* Add in empty lines at the bottom of the window. */
@@ -5024,7 +5018,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5024 (register Lisp_Object arg) 5018 (register Lisp_Object arg)
5025{ 5019{
5026 struct window *w = XWINDOW (selected_window); 5020 struct window *w = XWINDOW (selected_window);
5027 struct buffer *buf = XBUFFER (WVAR (w, buffer)); 5021 struct buffer *buf = XBUFFER (WGET (w, buffer));
5028 struct buffer *obuf = current_buffer; 5022 struct buffer *obuf = current_buffer;
5029 int center_p = 0; 5023 int center_p = 0;
5030 ptrdiff_t charpos, bytepos; 5024 ptrdiff_t charpos, bytepos;
@@ -5068,12 +5062,12 @@ and redisplay normally--don't erase and redraw the frame. */)
5068 /* Do this after making BUF current 5062 /* Do this after making BUF current
5069 in case scroll_margin is buffer-local. */ 5063 in case scroll_margin is buffer-local. */
5070 this_scroll_margin = 5064 this_scroll_margin =
5071 max (0, min (scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4)); 5065 max (0, min (scroll_margin, XFASTINT (WGET (w, total_lines)) / 4));
5072 5066
5073 /* Handle centering on a graphical frame specially. Such frames can 5067 /* Handle centering on a graphical frame specially. Such frames can
5074 have variable-height lines and centering point on the basis of 5068 have variable-height lines and centering point on the basis of
5075 line counts would lead to strange effects. */ 5069 line counts would lead to strange effects. */
5076 if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame)))) 5070 if (FRAME_WINDOW_P (XFRAME (WGET (w, frame))))
5077 { 5071 {
5078 if (center_p) 5072 if (center_p)
5079 { 5073 {
@@ -5190,8 +5184,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5190 } 5184 }
5191 5185
5192 /* Set the new window start. */ 5186 /* Set the new window start. */
5193 set_marker_both (WVAR (w, start), WVAR (w, buffer), charpos, bytepos); 5187 set_marker_both (WGET (w, start), WGET (w, buffer), charpos, bytepos);
5194 WVAR (w, window_end_valid) = Qnil; 5188 WSET (w, window_end_valid, Qnil);
5195 5189
5196 w->optional_new_start = 1; 5190 w->optional_new_start = 1;
5197 5191
@@ -5213,7 +5207,7 @@ nor any partial-height lines at the bottom of the text area. */)
5213{ 5207{
5214 struct window *w = decode_window (window); 5208 struct window *w = decode_window (window);
5215 int pixel_height = window_box_height (w); 5209 int pixel_height = window_box_height (w);
5216 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (WVAR (w, frame))); 5210 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (WGET (w, frame)));
5217 return make_number (line_height); 5211 return make_number (line_height);
5218} 5212}
5219 5213
@@ -5234,24 +5228,24 @@ zero means top of window, negative means relative to bottom of window. */)
5234 int this_scroll_margin; 5228 int this_scroll_margin;
5235#endif 5229#endif
5236 5230
5237 if (!(BUFFERP (WVAR (w, buffer)) 5231 if (!(BUFFERP (WGET (w, buffer))
5238 && XBUFFER (WVAR (w, buffer)) == current_buffer)) 5232 && XBUFFER (WGET (w, buffer)) == current_buffer))
5239 /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer 5233 /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer
5240 when passed below to set_marker_both. */ 5234 when passed below to set_marker_both. */
5241 error ("move-to-window-line called from unrelated buffer"); 5235 error ("move-to-window-line called from unrelated buffer");
5242 5236
5243 window = selected_window; 5237 window = selected_window;
5244 start = marker_position (WVAR (w, start)); 5238 start = marker_position (WGET (w, start));
5245 if (start < BEGV || start > ZV) 5239 if (start < BEGV || start > ZV)
5246 { 5240 {
5247 int height = window_internal_height (w); 5241 int height = window_internal_height (w);
5248 Fvertical_motion (make_number (- (height / 2)), window); 5242 Fvertical_motion (make_number (- (height / 2)), window);
5249 set_marker_both (WVAR (w, start), WVAR (w, buffer), PT, PT_BYTE); 5243 set_marker_both (WGET (w, start), WGET (w, buffer), PT, PT_BYTE);
5250 w->start_at_line_beg = !NILP (Fbolp ()); 5244 w->start_at_line_beg = !NILP (Fbolp ());
5251 w->force_start = 1; 5245 w->force_start = 1;
5252 } 5246 }
5253 else 5247 else
5254 Fgoto_char (WVAR (w, start)); 5248 Fgoto_char (WGET (w, start));
5255 5249
5256 lines = displayed_window_lines (w); 5250 lines = displayed_window_lines (w);
5257 5251
@@ -5355,7 +5349,7 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
5355 5349
5356 data = (struct save_window_data *) XVECTOR (config); 5350 data = (struct save_window_data *) XVECTOR (config);
5357 saved_windows = XVECTOR (data->saved_windows); 5351 saved_windows = XVECTOR (data->saved_windows);
5358 return WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame); 5352 return WGET (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
5359} 5353}
5360 5354
5361DEFUN ("set-window-configuration", Fset_window_configuration, 5355DEFUN ("set-window-configuration", Fset_window_configuration,
@@ -5397,11 +5391,11 @@ the return value is nil. Otherwise the value is t. */)
5397 window-point of the final-selected-window to the window-point of 5391 window-point of the final-selected-window to the window-point of
5398 the current-selected-window. So we have to be careful which 5392 the current-selected-window. So we have to be careful which
5399 point of the current-buffer we copy into old_point. */ 5393 point of the current-buffer we copy into old_point. */
5400 if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer) 5394 if (EQ (WGET (XWINDOW (data->current_window), buffer), new_current_buffer)
5401 && WINDOWP (selected_window) 5395 && WINDOWP (selected_window)
5402 && EQ (WVAR (XWINDOW (selected_window), buffer), new_current_buffer) 5396 && EQ (WGET (XWINDOW (selected_window), buffer), new_current_buffer)
5403 && !EQ (selected_window, data->current_window)) 5397 && !EQ (selected_window, data->current_window))
5404 old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos; 5398 old_point = XMARKER (WGET (XWINDOW (data->current_window), pointm))->charpos;
5405 else 5399 else
5406 old_point = PT; 5400 old_point = PT;
5407 else 5401 else
@@ -5413,15 +5407,15 @@ the return value is nil. Otherwise the value is t. */)
5413 So if possible we want this arbitrary choice of "which point" to 5407 So if possible we want this arbitrary choice of "which point" to
5414 be the one from the to-be-selected-window so as to prevent this 5408 be the one from the to-be-selected-window so as to prevent this
5415 window's cursor from being copied from another window. */ 5409 window's cursor from being copied from another window. */
5416 if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer) 5410 if (EQ (WGET (XWINDOW (data->current_window), buffer), new_current_buffer)
5417 /* If current_window = selected_window, its point is in BUF_PT. */ 5411 /* If current_window = selected_window, its point is in BUF_PT. */
5418 && !EQ (selected_window, data->current_window)) 5412 && !EQ (selected_window, data->current_window))
5419 old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos; 5413 old_point = XMARKER (WGET (XWINDOW (data->current_window), pointm))->charpos;
5420 else 5414 else
5421 old_point = BUF_PT (XBUFFER (new_current_buffer)); 5415 old_point = BUF_PT (XBUFFER (new_current_buffer));
5422 } 5416 }
5423 5417
5424 frame = WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame); 5418 frame = WGET (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame);
5425 f = XFRAME (frame); 5419 f = XFRAME (frame);
5426 5420
5427 /* If f is a dead frame, don't bother rebuilding its window tree. 5421 /* If f is a dead frame, don't bother rebuilding its window tree.
@@ -5474,13 +5468,13 @@ the return value is nil. Otherwise the value is t. */)
5474 window holds garbage.) We do this now, before 5468 window holds garbage.) We do this now, before
5475 restoring the window contents, and prevent it from 5469 restoring the window contents, and prevent it from
5476 being done later on when we select a new window. */ 5470 being done later on when we select a new window. */
5477 if (! NILP (WVAR (XWINDOW (selected_window), buffer))) 5471 if (! NILP (WGET (XWINDOW (selected_window), buffer)))
5478 { 5472 {
5479 w = XWINDOW (selected_window); 5473 w = XWINDOW (selected_window);
5480 set_marker_both (WVAR (w, pointm), 5474 set_marker_both (WGET (w, pointm),
5481 WVAR (w, buffer), 5475 WGET (w, buffer),
5482 BUF_PT (XBUFFER (WVAR (w, buffer))), 5476 BUF_PT (XBUFFER (WGET (w, buffer))),
5483 BUF_PT_BYTE (XBUFFER (WVAR (w, buffer)))); 5477 BUF_PT_BYTE (XBUFFER (WGET (w, buffer))));
5484 } 5478 }
5485 5479
5486 windows_or_buffers_changed++; 5480 windows_or_buffers_changed++;
@@ -5509,60 +5503,60 @@ the return value is nil. Otherwise the value is t. */)
5509 p = SAVED_WINDOW_N (saved_windows, k); 5503 p = SAVED_WINDOW_N (saved_windows, k);
5510 window = p->window; 5504 window = p->window;
5511 w = XWINDOW (window); 5505 w = XWINDOW (window);
5512 WVAR (w, next) = Qnil; 5506 WSET (w, next, Qnil);
5513 5507
5514 if (!NILP (p->parent)) 5508 if (!NILP (p->parent))
5515 WVAR (w, parent) = SAVED_WINDOW_N (saved_windows, 5509 WSET (w, parent, SAVED_WINDOW_N (saved_windows,
5516 XFASTINT (p->parent))->window; 5510 XFASTINT (p->parent))->window);
5517 else 5511 else
5518 WVAR (w, parent) = Qnil; 5512 WSET (w, parent, Qnil);
5519 5513
5520 if (!NILP (p->prev)) 5514 if (!NILP (p->prev))
5521 { 5515 {
5522 WVAR (w, prev) = SAVED_WINDOW_N (saved_windows, 5516 WSET (w, prev, SAVED_WINDOW_N (saved_windows,
5523 XFASTINT (p->prev))->window; 5517 XFASTINT (p->prev))->window);
5524 WVAR (XWINDOW (WVAR (w, prev)), next) = p->window; 5518 WSET (XWINDOW (WGET (w, prev)), next, p->window);
5525 } 5519 }
5526 else 5520 else
5527 { 5521 {
5528 WVAR (w, prev) = Qnil; 5522 WSET (w, prev, Qnil);
5529 if (!NILP (WVAR (w, parent))) 5523 if (!NILP (WGET (w, parent)))
5530 { 5524 {
5531 if (EQ (p->total_cols, WVAR (XWINDOW (WVAR (w, parent)), total_cols))) 5525 if (EQ (p->total_cols, WGET (XWINDOW (WGET (w, parent)), total_cols)))
5532 { 5526 {
5533 WVAR (XWINDOW (WVAR (w, parent)), vchild) = p->window; 5527 WSET (XWINDOW (WGET (w, parent)), vchild, p->window);
5534 WVAR (XWINDOW (WVAR (w, parent)), hchild) = Qnil; 5528 WSET (XWINDOW (WGET (w, parent)), hchild, Qnil);
5535 } 5529 }
5536 else 5530 else
5537 { 5531 {
5538 WVAR (XWINDOW (WVAR (w, parent)), hchild) = p->window; 5532 WSET (XWINDOW (WGET (w, parent)), hchild, p->window);
5539 WVAR (XWINDOW (WVAR (w, parent)), vchild) = Qnil; 5533 WSET (XWINDOW (WGET (w, parent)), vchild, Qnil);
5540 } 5534 }
5541 } 5535 }
5542 } 5536 }
5543 5537
5544 /* If we squirreled away the buffer in the window's height, 5538 /* If we squirreled away the buffer in the window's height,
5545 restore it now. */ 5539 restore it now. */
5546 if (BUFFERP (WVAR (w, total_lines))) 5540 if (BUFFERP (WGET (w, total_lines)))
5547 WVAR (w, buffer) = WVAR (w, total_lines); 5541 WSET (w, buffer, WGET (w, total_lines));
5548 WVAR (w, left_col) = p->left_col; 5542 WSET (w, left_col, p->left_col);
5549 WVAR (w, top_line) = p->top_line; 5543 WSET (w, top_line, p->top_line);
5550 WVAR (w, total_cols) = p->total_cols; 5544 WSET (w, total_cols, p->total_cols);
5551 WVAR (w, total_lines) = p->total_lines; 5545 WSET (w, total_lines, p->total_lines);
5552 WVAR (w, normal_cols) = p->normal_cols; 5546 WSET (w, normal_cols, p->normal_cols);
5553 WVAR (w, normal_lines) = p->normal_lines; 5547 WSET (w, normal_lines, p->normal_lines);
5554 w->hscroll = XFASTINT (p->hscroll); 5548 w->hscroll = XFASTINT (p->hscroll);
5555 w->min_hscroll = XFASTINT (p->min_hscroll); 5549 w->min_hscroll = XFASTINT (p->min_hscroll);
5556 WVAR (w, display_table) = p->display_table; 5550 WSET (w, display_table, p->display_table);
5557 WVAR (w, left_margin_cols) = p->left_margin_cols; 5551 WSET (w, left_margin_cols, p->left_margin_cols);
5558 WVAR (w, right_margin_cols) = p->right_margin_cols; 5552 WSET (w, right_margin_cols, p->right_margin_cols);
5559 WVAR (w, left_fringe_width) = p->left_fringe_width; 5553 WSET (w, left_fringe_width, p->left_fringe_width);
5560 WVAR (w, right_fringe_width) = p->right_fringe_width; 5554 WSET (w, right_fringe_width, p->right_fringe_width);
5561 w->fringes_outside_margins = !NILP (p->fringes_outside_margins); 5555 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
5562 WVAR (w, scroll_bar_width) = p->scroll_bar_width; 5556 WSET (w, scroll_bar_width, p->scroll_bar_width);
5563 WVAR (w, vertical_scroll_bar_type) = p->vertical_scroll_bar_type; 5557 WSET (w, vertical_scroll_bar_type, p->vertical_scroll_bar_type);
5564 WVAR (w, dedicated) = p->dedicated; 5558 WSET (w, dedicated, p->dedicated);
5565 WVAR (w, combination_limit) = p->combination_limit; 5559 WSET (w, combination_limit, p->combination_limit);
5566 /* Restore any window parameters that have been saved. 5560 /* Restore any window parameters that have been saved.
5567 Parameters that have not been saved are left alone. */ 5561 Parameters that have not been saved are left alone. */
5568 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) 5562 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem))
@@ -5572,7 +5566,7 @@ the return value is nil. Otherwise the value is t. */)
5572 { 5566 {
5573 if (NILP (XCDR (pers))) 5567 if (NILP (XCDR (pers)))
5574 { 5568 {
5575 par = Fassq (XCAR (pers), WVAR (w, window_parameters)); 5569 par = Fassq (XCAR (pers), WGET (w, window_parameters));
5576 if (CONSP (par) && !NILP (XCDR (par))) 5570 if (CONSP (par) && !NILP (XCDR (par)))
5577 /* Reset a parameter to nil if and only if it 5571 /* Reset a parameter to nil if and only if it
5578 has a non-nil association. Don't make new 5572 has a non-nil association. Don't make new
@@ -5591,50 +5585,50 @@ the return value is nil. Otherwise the value is t. */)
5591 /* Reinstall the saved buffer and pointers into it. */ 5585 /* Reinstall the saved buffer and pointers into it. */
5592 if (NILP (p->buffer)) 5586 if (NILP (p->buffer))
5593 /* An internal window. */ 5587 /* An internal window. */
5594 WVAR (w, buffer) = p->buffer; 5588 WSET (w, buffer, p->buffer);
5595 else if (!NILP (BVAR (XBUFFER (p->buffer), name))) 5589 else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
5596 /* If saved buffer is alive, install it. */ 5590 /* If saved buffer is alive, install it. */
5597 { 5591 {
5598 WVAR (w, buffer) = p->buffer; 5592 WSET (w, buffer, p->buffer);
5599 w->start_at_line_beg = !NILP (p->start_at_line_beg); 5593 w->start_at_line_beg = !NILP (p->start_at_line_beg);
5600 set_marker_restricted (WVAR (w, start), p->start, WVAR (w, buffer)); 5594 set_marker_restricted (WGET (w, start), p->start, WGET (w, buffer));
5601 set_marker_restricted (WVAR (w, pointm), p->pointm, 5595 set_marker_restricted (WGET (w, pointm), p->pointm,
5602 WVAR (w, buffer)); 5596 WGET (w, buffer));
5603 Fset_marker (BVAR (XBUFFER (WVAR (w, buffer)), mark), 5597 Fset_marker (BVAR (XBUFFER (WGET (w, buffer)), mark),
5604 p->mark, WVAR (w, buffer)); 5598 p->mark, WGET (w, buffer));
5605 5599
5606 /* As documented in Fcurrent_window_configuration, don't 5600 /* As documented in Fcurrent_window_configuration, don't
5607 restore the location of point in the buffer which was 5601 restore the location of point in the buffer which was
5608 current when the window configuration was recorded. */ 5602 current when the window configuration was recorded. */
5609 if (!EQ (p->buffer, new_current_buffer) 5603 if (!EQ (p->buffer, new_current_buffer)
5610 && XBUFFER (p->buffer) == current_buffer) 5604 && XBUFFER (p->buffer) == current_buffer)
5611 Fgoto_char (WVAR (w, pointm)); 5605 Fgoto_char (WGET (w, pointm));
5612 } 5606 }
5613 else if (!NILP (WVAR (w, buffer)) 5607 else if (!NILP (WGET (w, buffer))
5614 && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), name))) 5608 && !NILP (BVAR (XBUFFER (WGET (w, buffer)), name)))
5615 /* Keep window's old buffer; make sure the markers are 5609 /* Keep window's old buffer; make sure the markers are
5616 real. */ 5610 real. */
5617 { 5611 {
5618 /* Set window markers at start of visible range. */ 5612 /* Set window markers at start of visible range. */
5619 if (XMARKER (WVAR (w, start))->buffer == 0) 5613 if (XMARKER (WGET (w, start))->buffer == 0)
5620 set_marker_restricted (WVAR (w, start), make_number (0), 5614 set_marker_restricted (WGET (w, start), make_number (0),
5621 WVAR (w, buffer)); 5615 WGET (w, buffer));
5622 if (XMARKER (WVAR (w, pointm))->buffer == 0) 5616 if (XMARKER (WGET (w, pointm))->buffer == 0)
5623 set_marker_restricted_both 5617 set_marker_restricted_both
5624 (WVAR (w, pointm), WVAR (w, buffer), 5618 (WGET (w, pointm), WGET (w, buffer),
5625 BUF_PT (XBUFFER (WVAR (w, buffer))), 5619 BUF_PT (XBUFFER (WGET (w, buffer))),
5626 BUF_PT_BYTE (XBUFFER (WVAR (w, buffer)))); 5620 BUF_PT_BYTE (XBUFFER (WGET (w, buffer))));
5627 w->start_at_line_beg = 1; 5621 w->start_at_line_beg = 1;
5628 } 5622 }
5629 else if (STRINGP (auto_buffer_name = 5623 else if (STRINGP (auto_buffer_name =
5630 Fwindow_parameter (window, Qauto_buffer_name)) 5624 Fwindow_parameter (window, Qauto_buffer_name))
5631 && SCHARS (auto_buffer_name) != 0 5625 && SCHARS (auto_buffer_name) != 0
5632 && !NILP (WVAR (w, buffer) = Fget_buffer_create (auto_buffer_name))) 5626 && !NILP (WSET (w, buffer, Fget_buffer_create (auto_buffer_name))))
5633 { 5627 {
5634 set_marker_restricted (WVAR (w, start), 5628 set_marker_restricted (WGET (w, start),
5635 make_number (0), WVAR (w, buffer)); 5629 make_number (0), WGET (w, buffer));
5636 set_marker_restricted (WVAR (w, pointm), 5630 set_marker_restricted (WGET (w, pointm),
5637 make_number (0), WVAR (w, buffer)); 5631 make_number (0), WGET (w, buffer));
5638 w->start_at_line_beg = 1; 5632 w->start_at_line_beg = 1;
5639 } 5633 }
5640 else 5634 else
@@ -5644,36 +5638,36 @@ the return value is nil. Otherwise the value is t. */)
5644 avoid showing an unimportant buffer and, if necessary, to 5638 avoid showing an unimportant buffer and, if necessary, to
5645 recreate *scratch* in the course (part of Juanma's bs-show 5639 recreate *scratch* in the course (part of Juanma's bs-show
5646 scenario from March 2011). */ 5640 scenario from March 2011). */
5647 WVAR (w, buffer) = other_buffer_safely (Fcurrent_buffer ()); 5641 WSET (w, buffer, other_buffer_safely (Fcurrent_buffer ()));
5648 /* This will set the markers to beginning of visible 5642 /* This will set the markers to beginning of visible
5649 range. */ 5643 range. */
5650 set_marker_restricted (WVAR (w, start), 5644 set_marker_restricted (WGET (w, start),
5651 make_number (0), WVAR (w, buffer)); 5645 make_number (0), WGET (w, buffer));
5652 set_marker_restricted (WVAR (w, pointm), 5646 set_marker_restricted (WGET (w, pointm),
5653 make_number (0), WVAR (w, buffer)); 5647 make_number (0), WGET (w, buffer));
5654 w->start_at_line_beg = 1; 5648 w->start_at_line_beg = 1;
5655 if (!NILP (WVAR (w, dedicated))) 5649 if (!NILP (WGET (w, dedicated)))
5656 /* Record this window as dead. */ 5650 /* Record this window as dead. */
5657 dead_windows = Fcons (window, dead_windows); 5651 dead_windows = Fcons (window, dead_windows);
5658 /* Make sure window is no more dedicated. */ 5652 /* Make sure window is no more dedicated. */
5659 WVAR (w, dedicated) = Qnil; 5653 WSET (w, dedicated, Qnil);
5660 } 5654 }
5661 } 5655 }
5662 5656
5663 FSET (f, root_window, data->root_window); 5657 FSET (f, root_window, data->root_window);
5664 /* Arrange *not* to restore point in the buffer that was 5658 /* Arrange *not* to restore point in the buffer that was
5665 current when the window configuration was saved. */ 5659 current when the window configuration was saved. */
5666 if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer)) 5660 if (EQ (WGET (XWINDOW (data->current_window), buffer), new_current_buffer))
5667 set_marker_restricted (WVAR (XWINDOW (data->current_window), pointm), 5661 set_marker_restricted (WGET (XWINDOW (data->current_window), pointm),
5668 make_number (old_point), 5662 make_number (old_point),
5669 WVAR (XWINDOW (data->current_window), buffer)); 5663 WGET (XWINDOW (data->current_window), buffer));
5670 5664
5671 /* In the following call to `select-window', prevent "swapping out 5665 /* In the following call to `select-window', prevent "swapping out
5672 point" in the old selected window using the buffer that has 5666 point" in the old selected window using the buffer that has
5673 been restored into it. We already swapped out that point from 5667 been restored into it. We already swapped out that point from
5674 that window's old buffer. */ 5668 that window's old buffer. */
5675 select_window (data->current_window, Qnil, 1); 5669 select_window (data->current_window, Qnil, 1);
5676 BVAR (XBUFFER (WVAR (XWINDOW (selected_window), buffer)), last_selected_window) 5670 BVAR (XBUFFER (WGET (XWINDOW (selected_window), buffer)), last_selected_window)
5677 = selected_window; 5671 = selected_window;
5678 5672
5679 if (NILP (data->focus_frame) 5673 if (NILP (data->focus_frame)
@@ -5700,14 +5694,14 @@ the return value is nil. Otherwise the value is t. */)
5700 /* Now, free glyph matrices in windows that were not reused. */ 5694 /* Now, free glyph matrices in windows that were not reused. */
5701 for (i = n = 0; i < n_leaf_windows; ++i) 5695 for (i = n = 0; i < n_leaf_windows; ++i)
5702 { 5696 {
5703 if (NILP (WVAR (leaf_windows[i], buffer))) 5697 if (NILP (WGET (leaf_windows[i], buffer)))
5704 { 5698 {
5705 /* Assert it's not reused as a combination. */ 5699 /* Assert it's not reused as a combination. */
5706 eassert (NILP (WVAR (leaf_windows[i], hchild)) 5700 eassert (NILP (WGET (leaf_windows[i], hchild))
5707 && NILP (WVAR (leaf_windows[i], vchild))); 5701 && NILP (WGET (leaf_windows[i], vchild)));
5708 free_window_matrices (leaf_windows[i]); 5702 free_window_matrices (leaf_windows[i]);
5709 } 5703 }
5710 else if (EQ (WVAR (leaf_windows[i], buffer), new_current_buffer)) 5704 else if (EQ (WGET (leaf_windows[i], buffer), new_current_buffer))
5711 ++n; 5705 ++n;
5712 } 5706 }
5713 5707
@@ -5752,28 +5746,28 @@ delete_all_child_windows (Lisp_Object window)
5752 5746
5753 w = XWINDOW (window); 5747 w = XWINDOW (window);
5754 5748
5755 if (!NILP (WVAR (w, next))) 5749 if (!NILP (WGET (w, next)))
5756 /* Delete WINDOW's siblings (we traverse postorderly). */ 5750 /* Delete WINDOW's siblings (we traverse postorderly). */
5757 delete_all_child_windows (WVAR (w, next)); 5751 delete_all_child_windows (WGET (w, next));
5758 5752
5759 WVAR (w, total_lines) = WVAR (w, buffer); /* See Fset_window_configuration for excuse. */ 5753 WSET (w, total_lines, WGET (w, buffer)); /* See Fset_window_configuration for excuse. */
5760 5754
5761 if (!NILP (WVAR (w, vchild))) 5755 if (!NILP (WGET (w, vchild)))
5762 { 5756 {
5763 delete_all_child_windows (WVAR (w, vchild)); 5757 delete_all_child_windows (WGET (w, vchild));
5764 WVAR (w, vchild) = Qnil; 5758 WSET (w, vchild, Qnil);
5765 } 5759 }
5766 else if (!NILP (WVAR (w, hchild))) 5760 else if (!NILP (WGET (w, hchild)))
5767 { 5761 {
5768 delete_all_child_windows (WVAR (w, hchild)); 5762 delete_all_child_windows (WGET (w, hchild));
5769 WVAR (w, hchild) = Qnil; 5763 WSET (w, hchild, Qnil);
5770 } 5764 }
5771 else if (!NILP (WVAR (w, buffer))) 5765 else if (!NILP (WGET (w, buffer)))
5772 { 5766 {
5773 unshow_buffer (w); 5767 unshow_buffer (w);
5774 unchain_marker (XMARKER (WVAR (w, pointm))); 5768 unchain_marker (XMARKER (WGET (w, pointm)));
5775 unchain_marker (XMARKER (WVAR (w, start))); 5769 unchain_marker (XMARKER (WGET (w, start)));
5776 WVAR (w, buffer) = Qnil; 5770 WSET (w, buffer, Qnil);
5777 } 5771 }
5778 5772
5779 Vwindow_list = Qnil; 5773 Vwindow_list = Qnil;
@@ -5783,12 +5777,12 @@ static int
5783count_windows (register struct window *window) 5777count_windows (register struct window *window)
5784{ 5778{
5785 register int count = 1; 5779 register int count = 1;
5786 if (!NILP (WVAR (window, next))) 5780 if (!NILP (WGET (window, next)))
5787 count += count_windows (XWINDOW (WVAR (window, next))); 5781 count += count_windows (XWINDOW (WGET (window, next)));
5788 if (!NILP (WVAR (window, vchild))) 5782 if (!NILP (WGET (window, vchild)))
5789 count += count_windows (XWINDOW (WVAR (window, vchild))); 5783 count += count_windows (XWINDOW (WGET (window, vchild)));
5790 if (!NILP (WVAR (window, hchild))) 5784 if (!NILP (WGET (window, hchild)))
5791 count += count_windows (XWINDOW (WVAR (window, hchild))); 5785 count += count_windows (XWINDOW (WGET (window, hchild)));
5792 return count; 5786 return count;
5793} 5787}
5794 5788
@@ -5800,14 +5794,14 @@ get_leaf_windows (struct window *w, struct window **flat, int i)
5800{ 5794{
5801 while (w) 5795 while (w)
5802 { 5796 {
5803 if (!NILP (WVAR (w, hchild))) 5797 if (!NILP (WGET (w, hchild)))
5804 i = get_leaf_windows (XWINDOW (WVAR (w, hchild)), flat, i); 5798 i = get_leaf_windows (XWINDOW (WGET (w, hchild)), flat, i);
5805 else if (!NILP (WVAR (w, vchild))) 5799 else if (!NILP (WGET (w, vchild)))
5806 i = get_leaf_windows (XWINDOW (WVAR (w, vchild)), flat, i); 5800 i = get_leaf_windows (XWINDOW (WGET (w, vchild)), flat, i);
5807 else 5801 else
5808 flat[i++] = w; 5802 flat[i++] = w;
5809 5803
5810 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); 5804 w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
5811 } 5805 }
5812 5806
5813 return i; 5807 return i;
@@ -5860,32 +5854,32 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5860 register struct window *w; 5854 register struct window *w;
5861 register Lisp_Object tem, pers, par; 5855 register Lisp_Object tem, pers, par;
5862 5856
5863 for (;!NILP (window); window = WVAR (w, next)) 5857 for (;!NILP (window); window = WGET (w, next))
5864 { 5858 {
5865 p = SAVED_WINDOW_N (vector, i); 5859 p = SAVED_WINDOW_N (vector, i);
5866 w = XWINDOW (window); 5860 w = XWINDOW (window);
5867 5861
5868 XSETFASTINT (WVAR (w, temslot), i); i++; 5862 WSET (w, temslot, make_number (i)); i++;
5869 p->window = window; 5863 p->window = window;
5870 p->buffer = WVAR (w, buffer); 5864 p->buffer = WGET (w, buffer);
5871 p->left_col = WVAR (w, left_col); 5865 p->left_col = WGET (w, left_col);
5872 p->top_line = WVAR (w, top_line); 5866 p->top_line = WGET (w, top_line);
5873 p->total_cols = WVAR (w, total_cols); 5867 p->total_cols = WGET (w, total_cols);
5874 p->total_lines = WVAR (w, total_lines); 5868 p->total_lines = WGET (w, total_lines);
5875 p->normal_cols = WVAR (w, normal_cols); 5869 p->normal_cols = WGET (w, normal_cols);
5876 p->normal_lines = WVAR (w, normal_lines); 5870 p->normal_lines = WGET (w, normal_lines);
5877 XSETFASTINT (p->hscroll, w->hscroll); 5871 XSETFASTINT (p->hscroll, w->hscroll);
5878 XSETFASTINT (p->min_hscroll, w->min_hscroll); 5872 XSETFASTINT (p->min_hscroll, w->min_hscroll);
5879 p->display_table = WVAR (w, display_table); 5873 p->display_table = WGET (w, display_table);
5880 p->left_margin_cols = WVAR (w, left_margin_cols); 5874 p->left_margin_cols = WGET (w, left_margin_cols);
5881 p->right_margin_cols = WVAR (w, right_margin_cols); 5875 p->right_margin_cols = WGET (w, right_margin_cols);
5882 p->left_fringe_width = WVAR (w, left_fringe_width); 5876 p->left_fringe_width = WGET (w, left_fringe_width);
5883 p->right_fringe_width = WVAR (w, right_fringe_width); 5877 p->right_fringe_width = WGET (w, right_fringe_width);
5884 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil; 5878 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
5885 p->scroll_bar_width = WVAR (w, scroll_bar_width); 5879 p->scroll_bar_width = WGET (w, scroll_bar_width);
5886 p->vertical_scroll_bar_type = WVAR (w, vertical_scroll_bar_type); 5880 p->vertical_scroll_bar_type = WGET (w, vertical_scroll_bar_type);
5887 p->dedicated = WVAR (w, dedicated); 5881 p->dedicated = WGET (w, dedicated);
5888 p->combination_limit = WVAR (w, combination_limit); 5882 p->combination_limit = WGET (w, combination_limit);
5889 p->window_parameters = Qnil; 5883 p->window_parameters = Qnil;
5890 5884
5891 if (!NILP (Vwindow_persistent_parameters)) 5885 if (!NILP (Vwindow_persistent_parameters))
@@ -5918,7 +5912,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5918 /* Save values for persistent window parameters. */ 5912 /* Save values for persistent window parameters. */
5919 if (CONSP (pers) && !NILP (XCDR (pers))) 5913 if (CONSP (pers) && !NILP (XCDR (pers)))
5920 { 5914 {
5921 par = Fassq (XCAR (pers), WVAR (w, window_parameters)); 5915 par = Fassq (XCAR (pers), WGET (w, window_parameters));
5922 if (NILP (par)) 5916 if (NILP (par))
5923 /* If the window has no value for the parameter, 5917 /* If the window has no value for the parameter,
5924 make one. */ 5918 make one. */
@@ -5934,24 +5928,24 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5934 } 5928 }
5935 } 5929 }
5936 5930
5937 if (!NILP (WVAR (w, buffer))) 5931 if (!NILP (WGET (w, buffer)))
5938 { 5932 {
5939 /* Save w's value of point in the window configuration. If w 5933 /* Save w's value of point in the window configuration. If w
5940 is the selected window, then get the value of point from 5934 is the selected window, then get the value of point from
5941 the buffer; pointm is garbage in the selected window. */ 5935 the buffer; pointm is garbage in the selected window. */
5942 if (EQ (window, selected_window)) 5936 if (EQ (window, selected_window))
5943 p->pointm = build_marker (XBUFFER (WVAR (w, buffer)), 5937 p->pointm = build_marker (XBUFFER (WGET (w, buffer)),
5944 BUF_PT (XBUFFER (WVAR (w, buffer))), 5938 BUF_PT (XBUFFER (WGET (w, buffer))),
5945 BUF_PT_BYTE (XBUFFER (WVAR (w, buffer)))); 5939 BUF_PT_BYTE (XBUFFER (WGET (w, buffer))));
5946 else 5940 else
5947 p->pointm = Fcopy_marker (WVAR (w, pointm), Qnil); 5941 p->pointm = Fcopy_marker (WGET (w, pointm), Qnil);
5948 XMARKER (p->pointm)->insertion_type 5942 XMARKER (p->pointm)->insertion_type
5949 = !NILP (Vwindow_point_insertion_type); 5943 = !NILP (Vwindow_point_insertion_type);
5950 5944
5951 p->start = Fcopy_marker (WVAR (w, start), Qnil); 5945 p->start = Fcopy_marker (WGET (w, start), Qnil);
5952 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; 5946 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
5953 5947
5954 tem = BVAR (XBUFFER (WVAR (w, buffer)), mark); 5948 tem = BVAR (XBUFFER (WGET (w, buffer)), mark);
5955 p->mark = Fcopy_marker (tem, Qnil); 5949 p->mark = Fcopy_marker (tem, Qnil);
5956 } 5950 }
5957 else 5951 else
@@ -5962,20 +5956,20 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5962 p->start_at_line_beg = Qnil; 5956 p->start_at_line_beg = Qnil;
5963 } 5957 }
5964 5958
5965 if (NILP (WVAR (w, parent))) 5959 if (NILP (WGET (w, parent)))
5966 p->parent = Qnil; 5960 p->parent = Qnil;
5967 else 5961 else
5968 p->parent = WVAR (XWINDOW (WVAR (w, parent)), temslot); 5962 p->parent = WGET (XWINDOW (WGET (w, parent)), temslot);
5969 5963
5970 if (NILP (WVAR (w, prev))) 5964 if (NILP (WGET (w, prev)))
5971 p->prev = Qnil; 5965 p->prev = Qnil;
5972 else 5966 else
5973 p->prev = WVAR (XWINDOW (WVAR (w, prev)), temslot); 5967 p->prev = WGET (XWINDOW (WGET (w, prev)), temslot);
5974 5968
5975 if (!NILP (WVAR (w, vchild))) 5969 if (!NILP (WGET (w, vchild)))
5976 i = save_window_save (WVAR (w, vchild), vector, i); 5970 i = save_window_save (WGET (w, vchild), vector, i);
5977 if (!NILP (WVAR (w, hchild))) 5971 if (!NILP (WGET (w, hchild)))
5978 i = save_window_save (WVAR (w, hchild), vector, i); 5972 i = save_window_save (WGET (w, hchild), vector, i);
5979 } 5973 }
5980 5974
5981 return i; 5975 return i;
@@ -6064,11 +6058,11 @@ means no margin. */)
6064 right_width = Qnil; 6058 right_width = Qnil;
6065 } 6059 }
6066 6060
6067 if (!EQ (WVAR (w, left_margin_cols), left_width) 6061 if (!EQ (WGET (w, left_margin_cols), left_width)
6068 || !EQ (WVAR (w, right_margin_cols), right_width)) 6062 || !EQ (WGET (w, right_margin_cols), right_width))
6069 { 6063 {
6070 WVAR (w, left_margin_cols) = left_width; 6064 WSET (w, left_margin_cols, left_width);
6071 WVAR (w, right_margin_cols) = right_width; 6065 WSET (w, right_margin_cols, right_width);
6072 6066
6073 adjust_window_margins (w); 6067 adjust_window_margins (w);
6074 6068
@@ -6090,7 +6084,7 @@ as nil. */)
6090 (Lisp_Object window) 6084 (Lisp_Object window)
6091{ 6085{
6092 struct window *w = decode_window (window); 6086 struct window *w = decode_window (window);
6093 return Fcons (WVAR (w, left_margin_cols), WVAR (w, right_margin_cols)); 6087 return Fcons (WGET (w, left_margin_cols), WGET (w, right_margin_cols));
6094} 6088}
6095 6089
6096 6090
@@ -6124,18 +6118,18 @@ display marginal areas and the text area. */)
6124 6118
6125 /* Do nothing on a tty. */ 6119 /* Do nothing on a tty. */
6126 if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) 6120 if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
6127 && (!EQ (WVAR (w, left_fringe_width), left_width) 6121 && (!EQ (WGET (w, left_fringe_width), left_width)
6128 || !EQ (WVAR (w, right_fringe_width), right_width) 6122 || !EQ (WGET (w, right_fringe_width), right_width)
6129 || w->fringes_outside_margins != outside)) 6123 || w->fringes_outside_margins != outside))
6130 { 6124 {
6131 WVAR (w, left_fringe_width) = left_width; 6125 WSET (w, left_fringe_width, left_width);
6132 WVAR (w, right_fringe_width) = right_width; 6126 WSET (w, right_fringe_width, right_width);
6133 w->fringes_outside_margins = outside; 6127 w->fringes_outside_margins = outside;
6134 6128
6135 adjust_window_margins (w); 6129 adjust_window_margins (w);
6136 6130
6137 clear_glyph_matrix (w->current_matrix); 6131 clear_glyph_matrix (w->current_matrix);
6138 WVAR (w, window_end_valid) = Qnil; 6132 WSET (w, window_end_valid, Qnil);
6139 6133
6140 ++windows_or_buffers_changed; 6134 ++windows_or_buffers_changed;
6141 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6135 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6195,16 +6189,16 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6195 || EQ (vertical_type, Qt))) 6189 || EQ (vertical_type, Qt)))
6196 error ("Invalid type of vertical scroll bar"); 6190 error ("Invalid type of vertical scroll bar");
6197 6191
6198 if (!EQ (WVAR (w, scroll_bar_width), width) 6192 if (!EQ (WGET (w, scroll_bar_width), width)
6199 || !EQ (WVAR (w, vertical_scroll_bar_type), vertical_type)) 6193 || !EQ (WGET (w, vertical_scroll_bar_type), vertical_type))
6200 { 6194 {
6201 WVAR (w, scroll_bar_width) = width; 6195 WSET (w, scroll_bar_width, width);
6202 WVAR (w, vertical_scroll_bar_type) = vertical_type; 6196 WSET (w, vertical_scroll_bar_type, vertical_type);
6203 6197
6204 adjust_window_margins (w); 6198 adjust_window_margins (w);
6205 6199
6206 clear_glyph_matrix (w->current_matrix); 6200 clear_glyph_matrix (w->current_matrix);
6207 WVAR (w, window_end_valid) = Qnil; 6201 WSET (w, window_end_valid, Qnil);
6208 6202
6209 ++windows_or_buffers_changed; 6203 ++windows_or_buffers_changed;
6210 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6204 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6228,7 +6222,7 @@ value. */)
6228 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6222 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6229 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), 6223 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
6230 Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)), 6224 Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)),
6231 Fcons (WVAR (w, vertical_scroll_bar_type), 6225 Fcons (WGET (w, vertical_scroll_bar_type),
6232 Fcons (Qnil, Qnil)))); 6226 Fcons (Qnil, Qnil))));
6233} 6227}
6234 6228
@@ -6254,7 +6248,7 @@ optional second arg PIXELS-P means value is measured in pixels. */)
6254 else 6248 else
6255 CHECK_WINDOW (window); 6249 CHECK_WINDOW (window);
6256 w = XWINDOW (window); 6250 w = XWINDOW (window);
6257 f = XFRAME (WVAR (w, frame)); 6251 f = XFRAME (WGET (w, frame));
6258 6252
6259 if (FRAME_WINDOW_P (f)) 6253 if (FRAME_WINDOW_P (f))
6260 result = (NILP (pixels_p) 6254 result = (NILP (pixels_p)
@@ -6288,7 +6282,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6288 CHECK_NUMBER_OR_FLOAT (vscroll); 6282 CHECK_NUMBER_OR_FLOAT (vscroll);
6289 6283
6290 w = XWINDOW (window); 6284 w = XWINDOW (window);
6291 f = XFRAME (WVAR (w, frame)); 6285 f = XFRAME (WGET (w, frame));
6292 6286
6293 if (FRAME_WINDOW_P (f)) 6287 if (FRAME_WINDOW_P (f))
6294 { 6288 {
@@ -6307,7 +6301,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6307 adjust_glyphs (f); 6301 adjust_glyphs (f);
6308 6302
6309 /* Prevent redisplay shortcuts. */ 6303 /* Prevent redisplay shortcuts. */
6310 XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; 6304 XBUFFER (WGET (w, buffer))->prevent_redisplay_optimizations_p = 1;
6311 } 6305 }
6312 } 6306 }
6313 6307
@@ -6341,14 +6335,14 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u
6341 6335
6342 for (cont = 1; w && cont;) 6336 for (cont = 1; w && cont;)
6343 { 6337 {
6344 if (!NILP (WVAR (w, hchild))) 6338 if (!NILP (WGET (w, hchild)))
6345 cont = foreach_window_1 (XWINDOW (WVAR (w, hchild)), fn, user_data); 6339 cont = foreach_window_1 (XWINDOW (WGET (w, hchild)), fn, user_data);
6346 else if (!NILP (WVAR (w, vchild))) 6340 else if (!NILP (WGET (w, vchild)))
6347 cont = foreach_window_1 (XWINDOW (WVAR (w, vchild)), fn, user_data); 6341 cont = foreach_window_1 (XWINDOW (WGET (w, vchild)), fn, user_data);
6348 else 6342 else
6349 cont = fn (w, user_data); 6343 cont = fn (w, user_data);
6350 6344
6351 w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); 6345 w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next));
6352 } 6346 }
6353 6347
6354 return cont; 6348 return cont;