comparison src/window.c @ 485:8c615e453683

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 13 Jan 1992 21:48:08 +0000
parents 4d44159f7481
children bacdab90fa8b
comparison
equal deleted inserted replaced
484:3165b2697c78 485:8c615e453683
180 register int height; 180 register int height;
181 register int posint; 181 register int posint;
182 register struct buffer *buf; 182 register struct buffer *buf;
183 struct position posval; 183 struct position posval;
184 184
185 if (NULL (pos)) 185 if (NILP (pos))
186 posint = point; 186 posint = point;
187 else 187 else
188 { 188 {
189 CHECK_NUMBER_COERCE_MARKER (pos, 0); 189 CHECK_NUMBER_COERCE_MARKER (pos, 0);
190 posint = XINT (pos); 190 posint = XINT (pos);
191 } 191 }
192 192
193 if (NULL (window)) 193 if (NILP (window))
194 window = selected_window; 194 window = selected_window;
195 else 195 else
196 CHECK_WINDOW (window, 1); 196 CHECK_WINDOW (window, 1);
197 w = XWINDOW (window); 197 w = XWINDOW (window);
198 top = marker_position (w->start); 198 top = marker_position (w->start);
230 230
231 static struct window * 231 static struct window *
232 decode_window (window) 232 decode_window (window)
233 register Lisp_Object window; 233 register Lisp_Object window;
234 { 234 {
235 if (NULL (window)) 235 if (NILP (window))
236 return XWINDOW (selected_window); 236 return XWINDOW (selected_window);
237 237
238 CHECK_WINDOW (window, 0); 238 CHECK_WINDOW (window, 0);
239 return XWINDOW (window); 239 return XWINDOW (window);
240 } 240 }
431 (coordinates, screen) 431 (coordinates, screen)
432 Lisp_Object coordinates, screen; 432 Lisp_Object coordinates, screen;
433 { 433 {
434 int part; 434 int part;
435 435
436 if (NULL (screen)) 436 if (NILP (screen))
437 XSET (screen, Lisp_Screen, selected_screen); 437 XSET (screen, Lisp_Screen, selected_screen);
438 else 438 else
439 CHECK_LIVE_SCREEN (screen, 0); 439 CHECK_LIVE_SCREEN (screen, 0);
440 CHECK_CONS (coordinates, 1); 440 CHECK_CONS (coordinates, 1);
441 CHECK_NUMBER (XCONS (coordinates)->car, 1); 441 CHECK_NUMBER (XCONS (coordinates)->car, 1);
517 517
518 CHECK_NUMBER_COERCE_MARKER (pos, 1); 518 CHECK_NUMBER_COERCE_MARKER (pos, 1);
519 set_marker_restricted (w->start, pos, w->buffer); 519 set_marker_restricted (w->start, pos, w->buffer);
520 /* this is not right, but much easier than doing what is right. */ 520 /* this is not right, but much easier than doing what is right. */
521 w->start_at_line_beg = Qnil; 521 w->start_at_line_beg = Qnil;
522 if (NULL (noforce)) 522 if (NILP (noforce))
523 w->force_start = Qt; 523 w->force_start = Qt;
524 w->update_mode_line = Qt; 524 w->update_mode_line = Qt;
525 XFASTINT (w->last_modified) = 0; 525 XFASTINT (w->last_modified) = 0;
526 if (!EQ (window, selected_window)) 526 if (!EQ (window, selected_window))
527 windows_or_buffers_changed++; 527 windows_or_buffers_changed++;
547 (window, arg) 547 (window, arg)
548 Lisp_Object window, arg; 548 Lisp_Object window, arg;
549 { 549 {
550 register struct window *w = decode_window (window); 550 register struct window *w = decode_window (window);
551 551
552 if (NULL (arg)) 552 if (NILP (arg))
553 w->dedicated = Qnil; 553 w->dedicated = Qnil;
554 else 554 else
555 { 555 {
556 Fset_window_buffer (window, Fget_buffer_create (arg)); 556 Fset_window_buffer (window, Fget_buffer_create (arg));
557 w->dedicated = Qt; 557 w->dedicated = Qt;
650 p->top = o->top; 650 p->top = o->top;
651 p->width = o->width; 651 p->width = o->width;
652 p->height = o->height; 652 p->height = o->height;
653 653
654 p->next = tem = o->next; 654 p->next = tem = o->next;
655 if (!NULL (tem)) 655 if (!NILP (tem))
656 XWINDOW (tem)->prev = replacement; 656 XWINDOW (tem)->prev = replacement;
657 657
658 p->prev = tem = o->prev; 658 p->prev = tem = o->prev;
659 if (!NULL (tem)) 659 if (!NILP (tem))
660 XWINDOW (tem)->next = replacement; 660 XWINDOW (tem)->next = replacement;
661 661
662 p->parent = tem = o->parent; 662 p->parent = tem = o->parent;
663 if (!NULL (tem)) 663 if (!NILP (tem))
664 { 664 {
665 if (EQ (XWINDOW (tem)->vchild, old)) 665 if (EQ (XWINDOW (tem)->vchild, old))
666 XWINDOW (tem)->vchild = replacement; 666 XWINDOW (tem)->vchild = replacement;
667 if (EQ (XWINDOW (tem)->hchild, old)) 667 if (EQ (XWINDOW (tem)->hchild, old))
668 XWINDOW (tem)->hchild = replacement; 668 XWINDOW (tem)->hchild = replacement;
680 { 680 {
681 register Lisp_Object tem, parent, sib; 681 register Lisp_Object tem, parent, sib;
682 register struct window *p; 682 register struct window *p;
683 register struct window *par; 683 register struct window *par;
684 684
685 if (NULL (window)) 685 if (NILP (window))
686 window = selected_window; 686 window = selected_window;
687 else 687 else
688 CHECK_WINDOW (window, 0); 688 CHECK_WINDOW (window, 0);
689 689
690 p = XWINDOW (window); 690 p = XWINDOW (window);
691 parent = p->parent; 691 parent = p->parent;
692 if (NULL (parent)) 692 if (NILP (parent))
693 error ("Attempt to delete minibuffer or sole ordinary window"); 693 error ("Attempt to delete minibuffer or sole ordinary window");
694 par = XWINDOW (parent); 694 par = XWINDOW (parent);
695 695
696 windows_or_buffers_changed++; 696 windows_or_buffers_changed++;
697 697
699 Fselect_window (Fnext_window (window, Qnil, Qnil)); 699 Fselect_window (Fnext_window (window, Qnil, Qnil));
700 700
701 tem = p->buffer; 701 tem = p->buffer;
702 /* tem is null for dummy parent windows 702 /* tem is null for dummy parent windows
703 (which have inferiors but not any contents themselves) */ 703 (which have inferiors but not any contents themselves) */
704 if (!NULL (tem)) 704 if (!NILP (tem))
705 { 705 {
706 unshow_buffer (p); 706 unshow_buffer (p);
707 unchain_marker (p->pointm); 707 unchain_marker (p->pointm);
708 unchain_marker (p->start); 708 unchain_marker (p->start);
709 p->buffer = Qnil; 709 p->buffer = Qnil;
710 } 710 }
711 711
712 tem = p->next; 712 tem = p->next;
713 if (!NULL (tem)) 713 if (!NILP (tem))
714 XWINDOW (tem)->prev = p->prev; 714 XWINDOW (tem)->prev = p->prev;
715 715
716 tem = p->prev; 716 tem = p->prev;
717 if (!NULL (tem)) 717 if (!NILP (tem))
718 XWINDOW (tem)->next = p->next; 718 XWINDOW (tem)->next = p->next;
719 719
720 if (EQ (window, par->hchild)) 720 if (EQ (window, par->hchild))
721 par->hchild = p->next; 721 par->hchild = p->next;
722 if (EQ (window, par->vchild)) 722 if (EQ (window, par->vchild))
723 par->vchild = p->next; 723 par->vchild = p->next;
724 724
725 /* Find one of our siblings to give our space to. */ 725 /* Find one of our siblings to give our space to. */
726 sib = p->prev; 726 sib = p->prev;
727 if (NULL (sib)) 727 if (NILP (sib))
728 { 728 {
729 /* If p gives its space to its next sibling, that sibling needs 729 /* If p gives its space to its next sibling, that sibling needs
730 to have its top/left side pulled back to where p's is. 730 to have its top/left side pulled back to where p's is.
731 set_window_{height,width} will re-position the sibling's 731 set_window_{height,width} will re-position the sibling's
732 children. */ 732 children. */
734 XFASTINT (XWINDOW (sib)->top) = p->top; 734 XFASTINT (XWINDOW (sib)->top) = p->top;
735 XFASTINT (XWINDOW (sib)->left) = p->left; 735 XFASTINT (XWINDOW (sib)->left) = p->left;
736 } 736 }
737 737
738 /* Stretch that sibling. */ 738 /* Stretch that sibling. */
739 if (!NULL (par->vchild)) 739 if (!NILP (par->vchild))
740 set_window_height (sib, 740 set_window_height (sib,
741 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height), 741 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height),
742 1); 742 1);
743 if (!NULL (par->hchild)) 743 if (!NILP (par->hchild))
744 set_window_width (sib, 744 set_window_width (sib,
745 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width), 745 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width),
746 1); 746 1);
747 747
748 /* If parent now has only one child, 748 /* If parent now has only one child,
749 put the child into the parent's place. */ 749 put the child into the parent's place. */
750 750
751 tem = par->hchild; 751 tem = par->hchild;
752 if (NULL (tem)) 752 if (NILP (tem))
753 tem = par->vchild; 753 tem = par->vchild;
754 if (NULL (XWINDOW (tem)->next)) 754 if (NILP (XWINDOW (tem)->next))
755 replace_window (parent, tem); 755 replace_window (parent, tem);
756 return Qnil; 756 return Qnil;
757 } 757 }
758 758
759 759
781 register Lisp_Object window, minibuf, all_screens; 781 register Lisp_Object window, minibuf, all_screens;
782 { 782 {
783 register Lisp_Object tem; 783 register Lisp_Object tem;
784 Lisp_Object start_window; 784 Lisp_Object start_window;
785 785
786 if (NULL (window)) 786 if (NILP (window))
787 window = selected_window; 787 window = selected_window;
788 else 788 else
789 CHECK_WINDOW (window, 0); 789 CHECK_WINDOW (window, 0);
790 790
791 start_window = window; 791 start_window = window;
792 792
793 /* minibuf == nil may or may not include minibuffers. 793 /* minibuf == nil may or may not include minibuffers.
794 Decide if it does. */ 794 Decide if it does. */
795 if (NULL (minibuf)) 795 if (NILP (minibuf))
796 minibuf = (minibuf_level ? Qt : Qlambda); 796 minibuf = (minibuf_level ? Qt : Qlambda);
797 797
798 /* all_screens == nil doesn't specify which screens to include. 798 /* all_screens == nil doesn't specify which screens to include.
799 Decide which screens it includes. */ 799 Decide which screens it includes. */
800 if (NULL (all_screens)) 800 if (NILP (all_screens))
801 all_screens = (EQ (minibuf, Qt) 801 all_screens = (EQ (minibuf, Qt)
802 ? (SCREEN_MINIBUF_WINDOW 802 ? (SCREEN_MINIBUF_WINDOW
803 (XSCREEN 803 (XSCREEN
804 (WINDOW_SCREEN 804 (WINDOW_SCREEN
805 (XWINDOW (window))))) 805 (XWINDOW (window)))))
811 again, if we hit the minibuffer and that is not acceptable. */ 811 again, if we hit the minibuffer and that is not acceptable. */
812 do 812 do
813 { 813 {
814 /* Find a window that actually has a next one. This loop 814 /* Find a window that actually has a next one. This loop
815 climbs up the tree. */ 815 climbs up the tree. */
816 while (tem = XWINDOW (window)->next, NULL (tem)) 816 while (tem = XWINDOW (window)->next, NILP (tem))
817 if (tem = XWINDOW (window)->parent, !NULL (tem)) 817 if (tem = XWINDOW (window)->parent, !NILP (tem))
818 window = tem; 818 window = tem;
819 else 819 else
820 { 820 {
821 /* We've reached the end of this screen. 821 /* We've reached the end of this screen.
822 Which other screens are acceptable? */ 822 Which other screens are acceptable? */
823 tem = WINDOW_SCREEN (XWINDOW (window)); 823 tem = WINDOW_SCREEN (XWINDOW (window));
824 #ifdef MULTI_SCREEN 824 #ifdef MULTI_SCREEN
825 if (! NULL (all_screens)) 825 if (! NILP (all_screens))
826 tem = next_screen (tem, all_screens); 826 tem = next_screen (tem, all_screens);
827 #endif 827 #endif
828 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); 828 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem));
829 829
830 break; 830 break;
834 834
835 /* If we're in a combination window, find its first child and 835 /* If we're in a combination window, find its first child and
836 recurse on that. Otherwise, we've found the window we want. */ 836 recurse on that. Otherwise, we've found the window we want. */
837 while (1) 837 while (1)
838 { 838 {
839 if (!NULL (XWINDOW (window)->hchild)) 839 if (!NILP (XWINDOW (window)->hchild))
840 window = XWINDOW (window)->hchild; 840 window = XWINDOW (window)->hchild;
841 else if (!NULL (XWINDOW (window)->vchild)) 841 else if (!NILP (XWINDOW (window)->vchild))
842 window = XWINDOW (window)->vchild; 842 window = XWINDOW (window)->vchild;
843 else break; 843 else break;
844 } 844 }
845 } 845 }
846 /* Which windows are acceptible? 846 /* Which windows are acceptible?
878 register Lisp_Object window, minibuf, all_screens; 878 register Lisp_Object window, minibuf, all_screens;
879 { 879 {
880 register Lisp_Object tem; 880 register Lisp_Object tem;
881 Lisp_Object start_window; 881 Lisp_Object start_window;
882 882
883 if (NULL (window)) 883 if (NILP (window))
884 window = selected_window; 884 window = selected_window;
885 else 885 else
886 CHECK_WINDOW (window, 0); 886 CHECK_WINDOW (window, 0);
887 887
888 start_window = window; 888 start_window = window;
889 889
890 /* minibuf == nil may or may not include minibuffers. 890 /* minibuf == nil may or may not include minibuffers.
891 Decide if it does. */ 891 Decide if it does. */
892 if (NULL (minibuf)) 892 if (NILP (minibuf))
893 minibuf = (minibuf_level ? Qt : Qlambda); 893 minibuf = (minibuf_level ? Qt : Qlambda);
894 894
895 /* all_screens == nil doesn't specify which screens to include. 895 /* all_screens == nil doesn't specify which screens to include.
896 Decide which screens it includes. */ 896 Decide which screens it includes. */
897 if (NULL (all_screens)) 897 if (NILP (all_screens))
898 all_screens = (EQ (minibuf, Qt) 898 all_screens = (EQ (minibuf, Qt)
899 ? (SCREEN_MINIBUF_WINDOW 899 ? (SCREEN_MINIBUF_WINDOW
900 (XSCREEN 900 (XSCREEN
901 (WINDOW_SCREEN 901 (WINDOW_SCREEN
902 (XWINDOW (window))))) 902 (XWINDOW (window)))))
908 again, if we hit the minibuffer and that is not acceptable. */ 908 again, if we hit the minibuffer and that is not acceptable. */
909 do 909 do
910 { 910 {
911 /* Find a window that actually has a previous one. This loop 911 /* Find a window that actually has a previous one. This loop
912 climbs up the tree. */ 912 climbs up the tree. */
913 while (tem = XWINDOW (window)->prev, NULL (tem)) 913 while (tem = XWINDOW (window)->prev, NILP (tem))
914 if (tem = XWINDOW (window)->parent, !NULL (tem)) 914 if (tem = XWINDOW (window)->parent, !NILP (tem))
915 window = tem; 915 window = tem;
916 else 916 else
917 { 917 {
918 /* We have found the top window on the screen. 918 /* We have found the top window on the screen.
919 Which screens are acceptable? */ 919 Which screens are acceptable? */
920 tem = WINDOW_SCREEN (XWINDOW (window)); 920 tem = WINDOW_SCREEN (XWINDOW (window));
921 #ifdef MULTI_SCREEN 921 #ifdef MULTI_SCREEN
922 if (! NULL (all_screens)) 922 if (! NILP (all_screens))
923 tem = next_screen (tem, all_screens); 923 tem = next_screen (tem, all_screens);
924 #endif 924 #endif
925 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); 925 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem));
926 926
927 break; 927 break;
930 window = tem; 930 window = tem;
931 /* If we're in a combination window, find its last child and 931 /* If we're in a combination window, find its last child and
932 recurse on that. Otherwise, we've found the window we want. */ 932 recurse on that. Otherwise, we've found the window we want. */
933 while (1) 933 while (1)
934 { 934 {
935 if (!NULL (XWINDOW (window)->hchild)) 935 if (!NILP (XWINDOW (window)->hchild))
936 window = XWINDOW (window)->hchild; 936 window = XWINDOW (window)->hchild;
937 else if (!NULL (XWINDOW (window)->vchild)) 937 else if (!NILP (XWINDOW (window)->vchild))
938 window = XWINDOW (window)->vchild; 938 window = XWINDOW (window)->vchild;
939 else break; 939 else break;
940 while (tem = XWINDOW (window)->next, !NULL (tem)) 940 while (tem = XWINDOW (window)->next, !NILP (tem))
941 window = tem; 941 window = tem;
942 } 942 }
943 } 943 }
944 /* Which windows are acceptable? 944 /* Which windows are acceptable?
945 Exit the loop and accept this window if 945 Exit the loop and accept this window if
1016 /* If we're only looping through windows on a particular screen, 1016 /* If we're only looping through windows on a particular screen,
1017 screen points to that screen. If we're looping through windows 1017 screen points to that screen. If we're looping through windows
1018 on all screens, screen is 0. */ 1018 on all screens, screen is 0. */
1019 if (SCREENP (screens)) 1019 if (SCREENP (screens))
1020 screen = XSCREEN (screens); 1020 screen = XSCREEN (screens);
1021 else if (NULL (screens)) 1021 else if (NILP (screens))
1022 screen = selected_screen; 1022 screen = selected_screen;
1023 else 1023 else
1024 screen = 0; 1024 screen = 0;
1025 1025
1026 /* Pick a window to start with. */ 1026 /* Pick a window to start with. */
1061 return w; 1061 return w;
1062 break; 1062 break;
1063 1063
1064 case GET_LRU_WINDOW: 1064 case GET_LRU_WINDOW:
1065 /* t as arg means consider only full-width windows */ 1065 /* t as arg means consider only full-width windows */
1066 if (!NULL (obj) && XFASTINT (XWINDOW (w)->width) != screen->width) 1066 if (!NILP (obj) && XFASTINT (XWINDOW (w)->width) != screen->width)
1067 break; 1067 break;
1068 #if 0 1068 #if 0
1069 /* Ignore invisible and iconified screens. */ 1069 /* Ignore invisible and iconified screens. */
1070 if (! SCREEN_VISIBLE_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w)))) 1070 if (! SCREEN_VISIBLE_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w))))
1071 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w))))) 1071 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w)))))
1072 break; 1072 break;
1073 #endif 1073 #endif
1074 /* Ignore dedicated windows and minibuffers. */ 1074 /* Ignore dedicated windows and minibuffers. */
1075 if (MINI_WINDOW_P (XWINDOW (w)) 1075 if (MINI_WINDOW_P (XWINDOW (w))
1076 || !NULL (XWINDOW (w)->dedicated)) 1076 || !NILP (XWINDOW (w)->dedicated))
1077 break; 1077 break;
1078 if (NULL (best_window) 1078 if (NILP (best_window)
1079 || (XFASTINT (XWINDOW (best_window)->use_time) 1079 || (XFASTINT (XWINDOW (best_window)->use_time)
1080 > XFASTINT (XWINDOW (w)->use_time))) 1080 > XFASTINT (XWINDOW (w)->use_time)))
1081 best_window = w; 1081 best_window = w;
1082 break; 1082 break;
1083 1083
1089 case DELETE_BUFFER_WINDOWS: 1089 case DELETE_BUFFER_WINDOWS:
1090 if (EQ (XWINDOW (w)->buffer, obj)) 1090 if (EQ (XWINDOW (w)->buffer, obj))
1091 { 1091 {
1092 /* If we're deleting the buffer displayed in the only window 1092 /* If we're deleting the buffer displayed in the only window
1093 on the screen, find a new buffer to display there. */ 1093 on the screen, find a new buffer to display there. */
1094 if (NULL (XWINDOW (w)->parent)) 1094 if (NILP (XWINDOW (w)->parent))
1095 { 1095 {
1096 Lisp_Object new_buffer = Fother_buffer (obj); 1096 Lisp_Object new_buffer = Fother_buffer (obj);
1097 if (NULL (new_buffer)) 1097 if (NILP (new_buffer))
1098 new_buffer 1098 new_buffer
1099 = Fget_buffer_create (build_string ("*scratch*")); 1099 = Fget_buffer_create (build_string ("*scratch*"));
1100 Fset_window_buffer (w, new_buffer); 1100 Fset_window_buffer (w, new_buffer);
1101 Fset_buffer (XWINDOW (w)->buffer); 1101 Fset_buffer (XWINDOW (w)->buffer);
1102 } 1102 }
1112 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w))))) 1112 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w)))))
1113 break; 1113 break;
1114 #endif 1114 #endif
1115 /* Ignore dedicated windows and minibuffers. */ 1115 /* Ignore dedicated windows and minibuffers. */
1116 if (MINI_WINDOW_P (XWINDOW (w)) 1116 if (MINI_WINDOW_P (XWINDOW (w))
1117 || !NULL (XWINDOW (w)->dedicated)) 1117 || !NILP (XWINDOW (w)->dedicated))
1118 break; 1118 break;
1119 { 1119 {
1120 struct window *best_window_ptr = XWINDOW (best_window); 1120 struct window *best_window_ptr = XWINDOW (best_window);
1121 struct window *w_ptr = XWINDOW (w); 1121 struct window *w_ptr = XWINDOW (w);
1122 if (NULL (best_window) || 1122 if (NILP (best_window) ||
1123 (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width)) 1123 (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width))
1124 > (XFASTINT (best_window_ptr->height) 1124 > (XFASTINT (best_window_ptr->height)
1125 * XFASTINT (best_window_ptr->width))) 1125 * XFASTINT (best_window_ptr->width)))
1126 best_window = w; 1126 best_window = w;
1127 } 1127 }
1130 case UNSHOW_BUFFER: 1130 case UNSHOW_BUFFER:
1131 if (EQ (XWINDOW (w)->buffer, obj)) 1131 if (EQ (XWINDOW (w)->buffer, obj))
1132 { 1132 {
1133 /* Find another buffer to show in this window. */ 1133 /* Find another buffer to show in this window. */
1134 Lisp_Object another_buffer = Fother_buffer (obj); 1134 Lisp_Object another_buffer = Fother_buffer (obj);
1135 if (NULL (another_buffer)) 1135 if (NILP (another_buffer))
1136 another_buffer 1136 another_buffer
1137 = Fget_buffer_create (build_string ("*scratch*")); 1137 = Fget_buffer_create (build_string ("*scratch*"));
1138 Fset_window_buffer (w, another_buffer); 1138 Fset_window_buffer (w, another_buffer);
1139 if (EQ (w, selected_window)) 1139 if (EQ (w, selected_window))
1140 Fset_buffer (XWINDOW (w)->buffer); 1140 Fset_buffer (XWINDOW (w)->buffer);
1156 Lisp_Object screens; 1156 Lisp_Object screens;
1157 { 1157 {
1158 register Lisp_Object w; 1158 register Lisp_Object w;
1159 /* First try for a window that is full-width */ 1159 /* First try for a window that is full-width */
1160 w = window_loop (GET_LRU_WINDOW, Qt, 0, screens); 1160 w = window_loop (GET_LRU_WINDOW, Qt, 0, screens);
1161 if (!NULL (w) && !EQ (w, selected_window)) 1161 if (!NILP (w) && !EQ (w, selected_window))
1162 return w; 1162 return w;
1163 /* If none of them, try the rest */ 1163 /* If none of them, try the rest */
1164 return window_loop (GET_LRU_WINDOW, Qnil, 0, screens); 1164 return window_loop (GET_LRU_WINDOW, Qnil, 0, screens);
1165 } 1165 }
1166 1166
1199 struct window *w; 1199 struct window *w;
1200 int opoint = point; 1200 int opoint = point;
1201 struct buffer *obuf = current_buffer; 1201 struct buffer *obuf = current_buffer;
1202 int top; 1202 int top;
1203 1203
1204 if (NULL (window)) 1204 if (NILP (window))
1205 window = selected_window; 1205 window = selected_window;
1206 else 1206 else
1207 CHECK_WINDOW (window, 0); 1207 CHECK_WINDOW (window, 0);
1208 1208
1209 w = XWINDOW (window); 1209 w = XWINDOW (window);
1224 1, 1, "bDelete windows on (buffer): ", 1224 1, 1, "bDelete windows on (buffer): ",
1225 "Delete all windows showing BUFFER.") 1225 "Delete all windows showing BUFFER.")
1226 (buffer) 1226 (buffer)
1227 Lisp_Object buffer; 1227 Lisp_Object buffer;
1228 { 1228 {
1229 if (!NULL (buffer)) 1229 if (!NILP (buffer))
1230 { 1230 {
1231 buffer = Fget_buffer (buffer); 1231 buffer = Fget_buffer (buffer);
1232 CHECK_BUFFER (buffer, 0); 1232 CHECK_BUFFER (buffer, 0);
1233 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, Qt); 1233 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, Qt);
1234 } 1234 }
1240 1, 1, "bReplace buffer in windows: ", 1240 1, 1, "bReplace buffer in windows: ",
1241 "Replace BUFFER with some other buffer in all windows showing it.") 1241 "Replace BUFFER with some other buffer in all windows showing it.")
1242 (buffer) 1242 (buffer)
1243 Lisp_Object buffer; 1243 Lisp_Object buffer;
1244 { 1244 {
1245 if (!NULL (buffer)) 1245 if (!NILP (buffer))
1246 { 1246 {
1247 buffer = Fget_buffer (buffer); 1247 buffer = Fget_buffer (buffer);
1248 CHECK_BUFFER (buffer, 0); 1248 CHECK_BUFFER (buffer, 0);
1249 window_loop (UNSHOW_BUFFER, buffer, 0, Qt); 1249 window_loop (UNSHOW_BUFFER, buffer, 0, Qt);
1250 } 1250 }
1266 int oheight = XFASTINT (w->height); 1266 int oheight = XFASTINT (w->height);
1267 int top, pos, lastbot, opos, lastobot; 1267 int top, pos, lastbot, opos, lastobot;
1268 Lisp_Object child; 1268 Lisp_Object child;
1269 1269
1270 if (!nodelete 1270 if (!nodelete
1271 && ! NULL (w->parent) 1271 && ! NILP (w->parent)
1272 && height < window_min_height) 1272 && height < window_min_height)
1273 { 1273 {
1274 Fdelete_window (window); 1274 Fdelete_window (window);
1275 return; 1275 return;
1276 } 1276 }
1277 1277
1278 XFASTINT (w->last_modified) = 0; 1278 XFASTINT (w->last_modified) = 0;
1279 windows_or_buffers_changed++; 1279 windows_or_buffers_changed++;
1280 XFASTINT (w->height) = height; 1280 XFASTINT (w->height) = height;
1281 if (!NULL (w->hchild)) 1281 if (!NILP (w->hchild))
1282 { 1282 {
1283 for (child = w->hchild; !NULL (child); child = XWINDOW (child)->next) 1283 for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
1284 { 1284 {
1285 XWINDOW (child)->top = w->top; 1285 XWINDOW (child)->top = w->top;
1286 set_window_height (child, height, nodelete); 1286 set_window_height (child, height, nodelete);
1287 } 1287 }
1288 } 1288 }
1289 else if (!NULL (w->vchild)) 1289 else if (!NILP (w->vchild))
1290 { 1290 {
1291 lastbot = top = XFASTINT (w->top); 1291 lastbot = top = XFASTINT (w->top);
1292 lastobot = 0; 1292 lastobot = 0;
1293 for (child = w->vchild; !NULL (child); child = c->next) 1293 for (child = w->vchild; !NILP (child); child = c->next)
1294 { 1294 {
1295 c = XWINDOW (child); 1295 c = XWINDOW (child);
1296 1296
1297 opos = lastobot + XFASTINT (c->height); 1297 opos = lastobot + XFASTINT (c->height);
1298 1298
1308 lastbot = pos + top; 1308 lastbot = pos + top;
1309 lastobot = opos; 1309 lastobot = opos;
1310 } 1310 }
1311 /* Now delete any children that became too small. */ 1311 /* Now delete any children that became too small. */
1312 if (!nodelete) 1312 if (!nodelete)
1313 for (child = w->vchild; !NULL (child); child = XWINDOW (child)->next) 1313 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
1314 { 1314 {
1315 set_window_height (child, XINT (XWINDOW (child)->height), 0); 1315 set_window_height (child, XINT (XWINDOW (child)->height), 0);
1316 } 1316 }
1317 } 1317 }
1318 } 1318 }
1337 } 1337 }
1338 1338
1339 XFASTINT (w->last_modified) = 0; 1339 XFASTINT (w->last_modified) = 0;
1340 windows_or_buffers_changed++; 1340 windows_or_buffers_changed++;
1341 XFASTINT (w->width) = width; 1341 XFASTINT (w->width) = width;
1342 if (!NULL (w->vchild)) 1342 if (!NILP (w->vchild))
1343 { 1343 {
1344 for (child = w->vchild; !NULL (child); child = XWINDOW (child)->next) 1344 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
1345 { 1345 {
1346 XWINDOW (child)->left = w->left; 1346 XWINDOW (child)->left = w->left;
1347 set_window_width (child, width, nodelete); 1347 set_window_width (child, width, nodelete);
1348 } 1348 }
1349 } 1349 }
1350 else if (!NULL (w->hchild)) 1350 else if (!NILP (w->hchild))
1351 { 1351 {
1352 lastright = left = XFASTINT (w->left); 1352 lastright = left = XFASTINT (w->left);
1353 lastoright = 0; 1353 lastoright = 0;
1354 for (child = w->hchild; !NULL (child); child = c->next) 1354 for (child = w->hchild; !NILP (child); child = c->next)
1355 { 1355 {
1356 c = XWINDOW (child); 1356 c = XWINDOW (child);
1357 1357
1358 opos = lastoright + XFASTINT (c->width); 1358 opos = lastoright + XFASTINT (c->width);
1359 1359
1368 and set lastright if child was not just deleted. */ 1368 and set lastright if child was not just deleted. */
1369 lastright = pos + left, lastoright = opos; 1369 lastright = pos + left, lastoright = opos;
1370 } 1370 }
1371 /* Delete children that became too small */ 1371 /* Delete children that became too small */
1372 if (!nodelete) 1372 if (!nodelete)
1373 for (child = w->hchild; !NULL (child); child = XWINDOW (child)->next) 1373 for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
1374 { 1374 {
1375 set_window_width (child, XINT (XWINDOW (child)->width), 0); 1375 set_window_width (child, XINT (XWINDOW (child)->width), 0);
1376 } 1376 }
1377 } 1377 }
1378 } 1378 }
1389 register struct window *w = decode_window (window); 1389 register struct window *w = decode_window (window);
1390 1390
1391 buffer = Fget_buffer (buffer); 1391 buffer = Fget_buffer (buffer);
1392 CHECK_BUFFER (buffer, 1); 1392 CHECK_BUFFER (buffer, 1);
1393 1393
1394 if (NULL (XBUFFER (buffer)->name)) 1394 if (NILP (XBUFFER (buffer)->name))
1395 error ("Attempt to display deleted buffer"); 1395 error ("Attempt to display deleted buffer");
1396 1396
1397 tem = w->buffer; 1397 tem = w->buffer;
1398 if (NULL (tem)) 1398 if (NILP (tem))
1399 error ("Window is deleted"); 1399 error ("Window is deleted");
1400 else if (! EQ (tem, Qt)) /* w->buffer is t when the window 1400 else if (! EQ (tem, Qt)) /* w->buffer is t when the window
1401 is first being set up. */ 1401 is first being set up. */
1402 { 1402 {
1403 if (!NULL (w->dedicated) && !EQ (tem, buffer)) 1403 if (!NILP (w->dedicated) && !EQ (tem, buffer))
1404 error ("Window is dedicated to %s\n", tem); 1404 error ("Window is dedicated to %s\n", tem);
1405 1405
1406 unshow_buffer (w); 1406 unshow_buffer (w);
1407 } 1407 }
1408 1408
1434 1434
1435 CHECK_WINDOW (window, 0); 1435 CHECK_WINDOW (window, 0);
1436 1436
1437 w = XWINDOW (window); 1437 w = XWINDOW (window);
1438 1438
1439 if (NULL (w->buffer)) 1439 if (NILP (w->buffer))
1440 error ("Trying to select deleted window or non-leaf window"); 1440 error ("Trying to select deleted window or non-leaf window");
1441 1441
1442 XFASTINT (w->use_time) = ++window_select_count; 1442 XFASTINT (w->use_time) = ++window_select_count;
1443 if (EQ (window, selected_window)) 1443 if (EQ (window, selected_window))
1444 return window; 1444 return window;
1492 register Lisp_Object window; 1492 register Lisp_Object window;
1493 1493
1494 buffer = Fget_buffer (buffer); 1494 buffer = Fget_buffer (buffer);
1495 CHECK_BUFFER (buffer, 0); 1495 CHECK_BUFFER (buffer, 0);
1496 1496
1497 if (!NULL (Vdisplay_buffer_function)) 1497 if (!NILP (Vdisplay_buffer_function))
1498 return call2 (Vdisplay_buffer_function, buffer, not_this_window); 1498 return call2 (Vdisplay_buffer_function, buffer, not_this_window);
1499 1499
1500 if (NULL (not_this_window) 1500 if (NILP (not_this_window)
1501 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer)) 1501 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
1502 return selected_window; 1502 return selected_window;
1503 1503
1504 window = Fget_buffer_window (buffer, Qnil); 1504 window = Fget_buffer_window (buffer, Qnil);
1505 if (!NULL (window) 1505 if (!NILP (window)
1506 && (NULL (not_this_window) || !EQ (window, selected_window))) 1506 && (NILP (not_this_window) || !EQ (window, selected_window)))
1507 return window; 1507 return window;
1508 1508
1509 #ifdef MULTI_SCREEN 1509 #ifdef MULTI_SCREEN
1510 /* If there are no screens open that have more than a minibuffer, 1510 /* If there are no screens open that have more than a minibuffer,
1511 we need to create a new screen. */ 1511 we need to create a new screen. */
1537 if (split_height_threshold < window_min_height << 1) 1537 if (split_height_threshold < window_min_height << 1)
1538 split_height_threshold = window_min_height << 1; 1538 split_height_threshold = window_min_height << 1;
1539 1539
1540 window = Fget_largest_window (screens); 1540 window = Fget_largest_window (screens);
1541 1541
1542 if (!NULL (window) 1542 if (!NILP (window)
1543 && window_height (window) >= split_height_threshold 1543 && window_height (window) >= split_height_threshold
1544 && 1544 &&
1545 (XFASTINT (XWINDOW (window)->width) 1545 (XFASTINT (XWINDOW (window)->width)
1546 == SCREEN_WIDTH (XSCREEN (WINDOW_SCREEN (XWINDOW (window)))))) 1546 == SCREEN_WIDTH (XSCREEN (WINDOW_SCREEN (XWINDOW (window))))))
1547 window = Fsplit_window (window, Qnil, Qnil); 1547 window = Fsplit_window (window, Qnil, Qnil);
1635 { 1635 {
1636 register Lisp_Object new; 1636 register Lisp_Object new;
1637 register struct window *o, *p; 1637 register struct window *o, *p;
1638 register int size; 1638 register int size;
1639 1639
1640 if (NULL (window)) 1640 if (NILP (window))
1641 window = selected_window; 1641 window = selected_window;
1642 else 1642 else
1643 CHECK_WINDOW (window, 0); 1643 CHECK_WINDOW (window, 0);
1644 1644
1645 o = XWINDOW (window); 1645 o = XWINDOW (window);
1646 1646
1647 if (NULL (chsize)) 1647 if (NILP (chsize))
1648 { 1648 {
1649 if (!NULL (horflag)) 1649 if (!NILP (horflag))
1650 /* Round odd size up, since this is for the left-hand window, 1650 /* Round odd size up, since this is for the left-hand window,
1651 and it will lose a column for the separators. */ 1651 and it will lose a column for the separators. */
1652 size = ((XFASTINT (o->width) + 1) & -2) >> 1; 1652 size = ((XFASTINT (o->width) + 1) & -2) >> 1;
1653 else 1653 else
1654 size = XFASTINT (o->height) >> 1; 1654 size = XFASTINT (o->height) >> 1;
1668 if (window_min_width < 2) 1668 if (window_min_width < 2)
1669 window_min_width = 2; 1669 window_min_width = 2;
1670 if (window_min_height < 2) 1670 if (window_min_height < 2)
1671 window_min_height = 2; 1671 window_min_height = 2;
1672 1672
1673 if (NULL (horflag)) 1673 if (NILP (horflag))
1674 { 1674 {
1675 if (size < window_min_height 1675 if (size < window_min_height
1676 || size + window_min_height > XFASTINT (o->height)) 1676 || size + window_min_height > XFASTINT (o->height))
1677 args_out_of_range_3 (window, chsize, horflag); 1677 args_out_of_range_3 (window, chsize, horflag);
1678 if (NULL (o->parent) 1678 if (NILP (o->parent)
1679 || NULL (XWINDOW (o->parent)->vchild)) 1679 || NILP (XWINDOW (o->parent)->vchild))
1680 { 1680 {
1681 make_dummy_parent (window); 1681 make_dummy_parent (window);
1682 new = o->parent; 1682 new = o->parent;
1683 XWINDOW (new)->vchild = window; 1683 XWINDOW (new)->vchild = window;
1684 } 1684 }
1686 else 1686 else
1687 { 1687 {
1688 if (size < window_min_width 1688 if (size < window_min_width
1689 || size + window_min_width > XFASTINT (o->width)) 1689 || size + window_min_width > XFASTINT (o->width))
1690 args_out_of_range_3 (window, chsize, horflag); 1690 args_out_of_range_3 (window, chsize, horflag);
1691 if (NULL (o->parent) 1691 if (NILP (o->parent)
1692 || NULL (XWINDOW (o->parent)->hchild)) 1692 || NILP (XWINDOW (o->parent)->hchild))
1693 { 1693 {
1694 make_dummy_parent (window); 1694 make_dummy_parent (window);
1695 new = o->parent; 1695 new = o->parent;
1696 XWINDOW (new)->hchild = window; 1696 XWINDOW (new)->hchild = window;
1697 } 1697 }
1705 new = make_window (); 1705 new = make_window ();
1706 p = XWINDOW (new); 1706 p = XWINDOW (new);
1707 1707
1708 p->screen = o->screen; 1708 p->screen = o->screen;
1709 p->next = o->next; 1709 p->next = o->next;
1710 if (!NULL (p->next)) 1710 if (!NILP (p->next))
1711 XWINDOW (p->next)->prev = new; 1711 XWINDOW (p->next)->prev = new;
1712 p->prev = window; 1712 p->prev = window;
1713 o->next = new; 1713 o->next = new;
1714 p->parent = o->parent; 1714 p->parent = o->parent;
1715 p->buffer = Qt; 1715 p->buffer = Qt;
1716 1716
1717 Fset_window_buffer (new, o->buffer); 1717 Fset_window_buffer (new, o->buffer);
1718 1718
1719 /* Apportion the available screen space among the two new windows */ 1719 /* Apportion the available screen space among the two new windows */
1720 1720
1721 if (!NULL (horflag)) 1721 if (!NILP (horflag))
1722 { 1722 {
1723 p->height = o->height; 1723 p->height = o->height;
1724 p->top = o->top; 1724 p->top = o->top;
1725 XFASTINT (p->width) = XFASTINT (o->width) - size; 1725 XFASTINT (p->width) = XFASTINT (o->width) - size;
1726 XFASTINT (o->width) = size; 1726 XFASTINT (o->width) = size;
1743 From program, optional second arg non-nil means grow sideways ARG columns.") 1743 From program, optional second arg non-nil means grow sideways ARG columns.")
1744 (n, side) 1744 (n, side)
1745 register Lisp_Object n, side; 1745 register Lisp_Object n, side;
1746 { 1746 {
1747 CHECK_NUMBER (n, 0); 1747 CHECK_NUMBER (n, 0);
1748 change_window_height (XINT (n), !NULL (side)); 1748 change_window_height (XINT (n), !NILP (side));
1749 return Qnil; 1749 return Qnil;
1750 } 1750 }
1751 1751
1752 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", 1752 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p",
1753 "Make current window ARG lines smaller.\n\ 1753 "Make current window ARG lines smaller.\n\
1754 From program, optional second arg non-nil means shrink sideways ARG columns.") 1754 From program, optional second arg non-nil means shrink sideways ARG columns.")
1755 (n, side) 1755 (n, side)
1756 register Lisp_Object n, side; 1756 register Lisp_Object n, side;
1757 { 1757 {
1758 CHECK_NUMBER (n, 0); 1758 CHECK_NUMBER (n, 0);
1759 change_window_height (-XINT (n), !NULL (side)); 1759 change_window_height (-XINT (n), !NILP (side));
1760 return Qnil; 1760 return Qnil;
1761 } 1761 }
1762 1762
1763 int 1763 int
1764 window_height (window) 1764 window_height (window)
1811 window = selected_window; 1811 window = selected_window;
1812 while (1) 1812 while (1)
1813 { 1813 {
1814 p = XWINDOW (window); 1814 p = XWINDOW (window);
1815 parent = p->parent; 1815 parent = p->parent;
1816 if (NULL (parent)) 1816 if (NILP (parent))
1817 { 1817 {
1818 if (widthflag) 1818 if (widthflag)
1819 error ("No other window to side of this one"); 1819 error ("No other window to side of this one");
1820 break; 1820 break;
1821 } 1821 }
1822 if (widthflag ? !NULL (XWINDOW (parent)->hchild) 1822 if (widthflag ? !NILP (XWINDOW (parent)->hchild)
1823 : !NULL (XWINDOW (parent)->vchild)) 1823 : !NILP (XWINDOW (parent)->vchild))
1824 break; 1824 break;
1825 window = parent; 1825 window = parent;
1826 } 1826 }
1827 1827
1828 sizep = &CURSIZE (p); 1828 sizep = &CURSIZE (p);
1829 1829
1830 if (*sizep + delta < MINSIZE (p) 1830 if (*sizep + delta < MINSIZE (p)
1831 && !NULL (XWINDOW (window)->parent)) 1831 && !NILP (XWINDOW (window)->parent))
1832 { 1832 {
1833 Fdelete_window (window); 1833 Fdelete_window (window);
1834 return; 1834 return;
1835 } 1835 }
1836 1836
1837 { 1837 {
1838 register int maxdelta; 1838 register int maxdelta;
1839 1839
1840 maxdelta = (!NULL (parent) ? (*sizefun) (parent) - *sizep 1840 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep
1841 : !NULL (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) 1841 : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next)
1842 : !NULL (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) 1842 : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev)
1843 /* This is a screen with only one window, a minibuffer-only 1843 /* This is a screen with only one window, a minibuffer-only
1844 or a minibufferless screen. */ 1844 or a minibufferless screen. */
1845 : (delta = 0)); 1845 : (delta = 0));
1846 1846
1847 if (delta > maxdelta) 1847 if (delta > maxdelta)
1852 1852
1853 if (delta == 0) 1853 if (delta == 0)
1854 return; 1854 return;
1855 } 1855 }
1856 1856
1857 if (!NULL (p->next) && 1857 if (!NILP (p->next) &&
1858 (*sizefun) (p->next) - delta >= MINSIZE (p->next)) 1858 (*sizefun) (p->next) - delta >= MINSIZE (p->next))
1859 { 1859 {
1860 (*setsizefun) (p->next, (*sizefun) (p->next) - delta, 0); 1860 (*setsizefun) (p->next, (*sizefun) (p->next) - delta, 0);
1861 (*setsizefun) (window, *sizep + delta, 0); 1861 (*setsizefun) (window, *sizep + delta, 0);
1862 CURBEG (XWINDOW (p->next)) += delta; 1862 CURBEG (XWINDOW (p->next)) += delta;
1863 /* This does not change size of p->next, 1863 /* This does not change size of p->next,
1864 but it propagates the new top edge to its children */ 1864 but it propagates the new top edge to its children */
1865 (*setsizefun) (p->next, (*sizefun) (p->next), 0); 1865 (*setsizefun) (p->next, (*sizefun) (p->next), 0);
1866 } 1866 }
1867 else if (!NULL (p->prev) && 1867 else if (!NILP (p->prev) &&
1868 (*sizefun) (p->prev) - delta >= MINSIZE (p->prev)) 1868 (*sizefun) (p->prev) - delta >= MINSIZE (p->prev))
1869 { 1869 {
1870 (*setsizefun) (p->prev, (*sizefun) (p->prev) - delta, 0); 1870 (*setsizefun) (p->prev, (*sizefun) (p->prev) - delta, 0);
1871 CURBEG (p) -= delta; 1871 CURBEG (p) -= delta;
1872 (*setsizefun) (window, *sizep + delta, 0); 1872 (*setsizefun) (window, *sizep + delta, 0);
1917 int ht = XFASTINT (w->height); 1917 int ht = XFASTINT (w->height);
1918 1918
1919 if (MINI_WINDOW_P (w)) 1919 if (MINI_WINDOW_P (w))
1920 return ht; 1920 return ht;
1921 1921
1922 if (!NULL (w->parent) || !NULL (w->vchild) || !NULL (w->hchild) 1922 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild)
1923 || !NULL (w->next) || !NULL (w->prev) 1923 || !NILP (w->next) || !NILP (w->prev)
1924 || SCREEN_WANTS_MODELINE_P (XSCREEN (WINDOW_SCREEN (w)))) 1924 || SCREEN_WANTS_MODELINE_P (XSCREEN (WINDOW_SCREEN (w))))
1925 return ht - 1; 1925 return ht - 1;
1926 1926
1927 return ht; 1927 return ht;
1928 } 1928 }
1943 Lisp_Object bolp, nmoved; 1943 Lisp_Object bolp, nmoved;
1944 1944
1945 XFASTINT (tem) = point; 1945 XFASTINT (tem) = point;
1946 tem = Fpos_visible_in_window_p (tem, window); 1946 tem = Fpos_visible_in_window_p (tem, window);
1947 1947
1948 if (NULL (tem)) 1948 if (NILP (tem))
1949 { 1949 {
1950 Fvertical_motion (make_number (- ht / 2)); 1950 Fvertical_motion (make_number (- ht / 2));
1951 XFASTINT (tem) = point; 1951 XFASTINT (tem) = point;
1952 Fset_marker (w->start, tem, w->buffer); 1952 Fset_marker (w->start, tem, w->buffer);
1953 w->force_start = Qt; 1953 w->force_start = Qt;
2010 2010
2011 defalt = (window_internal_height (XWINDOW (selected_window)) 2011 defalt = (window_internal_height (XWINDOW (selected_window))
2012 - next_screen_context_lines); 2012 - next_screen_context_lines);
2013 defalt = direction * (defalt < 1 ? 1 : defalt); 2013 defalt = direction * (defalt < 1 ? 1 : defalt);
2014 2014
2015 if (NULL (n)) 2015 if (NILP (n))
2016 window_scroll (selected_window, defalt); 2016 window_scroll (selected_window, defalt);
2017 else if (EQ (n, Qminus)) 2017 else if (EQ (n, Qminus))
2018 window_scroll (selected_window, - defalt); 2018 window_scroll (selected_window, - defalt);
2019 else 2019 else
2020 { 2020 {
2064 register int ht; 2064 register int ht;
2065 register struct window *w; 2065 register struct window *w;
2066 register int count = specpdl_ptr - specpdl; 2066 register int count = specpdl_ptr - specpdl;
2067 2067
2068 if (MINI_WINDOW_P (XWINDOW (selected_window)) 2068 if (MINI_WINDOW_P (XWINDOW (selected_window))
2069 && !NULL (Vminibuf_scroll_window)) 2069 && !NILP (Vminibuf_scroll_window))
2070 window = Vminibuf_scroll_window; 2070 window = Vminibuf_scroll_window;
2071 /* If buffer is specified, scroll that buffer. */ 2071 /* If buffer is specified, scroll that buffer. */
2072 else if (!NULL (Vother_window_scroll_buffer)) 2072 else if (!NILP (Vother_window_scroll_buffer))
2073 { 2073 {
2074 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); 2074 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil);
2075 if (NULL (window)) 2075 if (NILP (window))
2076 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt); 2076 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt);
2077 } 2077 }
2078 else 2078 else
2079 /* Nothing specified; pick a neighboring window. */ 2079 /* Nothing specified; pick a neighboring window. */
2080 window = Fnext_window (selected_window, Qnil, Qt); 2080 window = Fnext_window (selected_window, Qnil, Qt);
2090 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 2090 record_unwind_protect (save_excursion_restore, save_excursion_save ());
2091 2091
2092 Fset_buffer (w->buffer); 2092 Fset_buffer (w->buffer);
2093 SET_PT (marker_position (w->pointm)); 2093 SET_PT (marker_position (w->pointm));
2094 2094
2095 if (NULL (n)) 2095 if (NILP (n))
2096 window_scroll (window, ht - next_screen_context_lines); 2096 window_scroll (window, ht - next_screen_context_lines);
2097 else if (EQ (n, Qminus)) 2097 else if (EQ (n, Qminus))
2098 window_scroll (window, next_screen_context_lines - ht); 2098 window_scroll (window, next_screen_context_lines - ht);
2099 else 2099 else
2100 { 2100 {
2115 Default for ARG is window width minus 2.") 2115 Default for ARG is window width minus 2.")
2116 (arg) 2116 (arg)
2117 register Lisp_Object arg; 2117 register Lisp_Object arg;
2118 { 2118 {
2119 2119
2120 if (NULL (arg)) 2120 if (NILP (arg))
2121 XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2; 2121 XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
2122 else 2122 else
2123 arg = Fprefix_numeric_value (arg); 2123 arg = Fprefix_numeric_value (arg);
2124 2124
2125 return 2125 return
2132 "Scroll selected window display ARG columns right.\n\ 2132 "Scroll selected window display ARG columns right.\n\
2133 Default for ARG is window width minus 2.") 2133 Default for ARG is window width minus 2.")
2134 (arg) 2134 (arg)
2135 register Lisp_Object arg; 2135 register Lisp_Object arg;
2136 { 2136 {
2137 if (NULL (arg)) 2137 if (NILP (arg))
2138 XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2; 2138 XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
2139 else 2139 else
2140 arg = Fprefix_numeric_value (arg); 2140 arg = Fprefix_numeric_value (arg);
2141 2141
2142 return 2142 return
2156 { 2156 {
2157 register struct window *w = XWINDOW (selected_window); 2157 register struct window *w = XWINDOW (selected_window);
2158 register int ht = window_internal_height (w); 2158 register int ht = window_internal_height (w);
2159 register int opoint = point; 2159 register int opoint = point;
2160 2160
2161 if (NULL (n)) 2161 if (NILP (n))
2162 { 2162 {
2163 extern int screen_garbaged; 2163 extern int screen_garbaged;
2164 2164
2165 SET_SCREEN_GARBAGED (XSCREEN (WINDOW_SCREEN (w))); 2165 SET_SCREEN_GARBAGED (XSCREEN (WINDOW_SCREEN (w)));
2166 XFASTINT (n) = ht / 2; 2166 XFASTINT (n) = ht / 2;
2201 { 2201 {
2202 register struct window *w = XWINDOW (selected_window); 2202 register struct window *w = XWINDOW (selected_window);
2203 register int height = window_internal_height (w); 2203 register int height = window_internal_height (w);
2204 register int start; 2204 register int start;
2205 2205
2206 if (NULL (arg)) 2206 if (NILP (arg))
2207 XFASTINT (arg) = height / 2; 2207 XFASTINT (arg) = height / 2;
2208 else 2208 else
2209 { 2209 {
2210 arg = Fprefix_numeric_value (arg); 2210 arg = Fprefix_numeric_value (arg);
2211 if (XINT (arg) < 0) 2211 if (XINT (arg) < 0)
2308 XFASTINT (data->screen_width)); 2308 XFASTINT (data->screen_width));
2309 } 2309 }
2310 2310
2311 windows_or_buffers_changed++; 2311 windows_or_buffers_changed++;
2312 new_current_buffer = data->current_buffer; 2312 new_current_buffer = data->current_buffer;
2313 if (NULL (XBUFFER (new_current_buffer)->name)) 2313 if (NILP (XBUFFER (new_current_buffer)->name))
2314 new_current_buffer = Qnil; 2314 new_current_buffer = Qnil;
2315 2315
2316 /* Mark all windows now on screen as "deleted". 2316 /* Mark all windows now on screen as "deleted".
2317 Restoring the new configuration "undeletes" any that are in it. */ 2317 Restoring the new configuration "undeletes" any that are in it. */
2318 2318
2326 { 2326 {
2327 p = SAVED_WINDOW_N (saved_windows, k); 2327 p = SAVED_WINDOW_N (saved_windows, k);
2328 w = XWINDOW (p->window); 2328 w = XWINDOW (p->window);
2329 w->next = Qnil; 2329 w->next = Qnil;
2330 2330
2331 if (!NULL (p->parent)) 2331 if (!NILP (p->parent))
2332 w->parent = SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window; 2332 w->parent = SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window;
2333 else 2333 else
2334 w->parent = Qnil; 2334 w->parent = Qnil;
2335 2335
2336 if (!NULL (p->prev)) 2336 if (!NILP (p->prev))
2337 { 2337 {
2338 w->prev = SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window; 2338 w->prev = SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window;
2339 #ifdef MULTI_SCREEN 2339 #ifdef MULTI_SCREEN
2340 /* This is true for a minibuffer-only screen. */ 2340 /* This is true for a minibuffer-only screen. */
2341 if (w->mini_p && EQ (w->prev, p->window)) 2341 if (w->mini_p && EQ (w->prev, p->window))
2345 XWINDOW (w->prev)->next = p->window; 2345 XWINDOW (w->prev)->next = p->window;
2346 } 2346 }
2347 else 2347 else
2348 { 2348 {
2349 w->prev = Qnil; 2349 w->prev = Qnil;
2350 if (!NULL (w->parent)) 2350 if (!NILP (w->parent))
2351 { 2351 {
2352 if (EQ (p->width, XWINDOW (w->parent)->width)) 2352 if (EQ (p->width, XWINDOW (w->parent)->width))
2353 { 2353 {
2354 XWINDOW (w->parent)->vchild = p->window; 2354 XWINDOW (w->parent)->vchild = p->window;
2355 XWINDOW (w->parent)->hchild = Qnil; 2355 XWINDOW (w->parent)->hchild = Qnil;
2368 w->hscroll = p->hscroll; 2368 w->hscroll = p->hscroll;
2369 w->display_table = p->display_table; 2369 w->display_table = p->display_table;
2370 XFASTINT (w->last_modified) = 0; 2370 XFASTINT (w->last_modified) = 0;
2371 2371
2372 /* Reinstall the saved buffer and pointers into it. */ 2372 /* Reinstall the saved buffer and pointers into it. */
2373 if (NULL (p->buffer)) 2373 if (NILP (p->buffer))
2374 w->buffer = p->buffer; 2374 w->buffer = p->buffer;
2375 else 2375 else
2376 { 2376 {
2377 if (!NULL (XBUFFER (p->buffer)->name)) 2377 if (!NILP (XBUFFER (p->buffer)->name))
2378 /* If saved buffer is alive, install it. */ 2378 /* If saved buffer is alive, install it. */
2379 { 2379 {
2380 w->buffer = p->buffer; 2380 w->buffer = p->buffer;
2381 w->start_at_line_beg = p->start_at_line_beg; 2381 w->start_at_line_beg = p->start_at_line_beg;
2382 set_marker_restricted (w->start, Fmarker_position (p->start), w->buffer); 2382 set_marker_restricted (w->start, Fmarker_position (p->start), w->buffer);
2386 2386
2387 if (!EQ (p->buffer, new_current_buffer) && 2387 if (!EQ (p->buffer, new_current_buffer) &&
2388 XBUFFER (p->buffer) == current_buffer) 2388 XBUFFER (p->buffer) == current_buffer)
2389 Fgoto_char (w->pointm); 2389 Fgoto_char (w->pointm);
2390 } 2390 }
2391 else if (NULL (XBUFFER (w->buffer)->name)) 2391 else if (NILP (XBUFFER (w->buffer)->name))
2392 /* Else if window's old buffer is dead too, get a live one. */ 2392 /* Else if window's old buffer is dead too, get a live one. */
2393 { 2393 {
2394 w->buffer = Fcdr (Fcar (Vbuffer_alist)); 2394 w->buffer = Fcdr (Fcar (Vbuffer_alist));
2395 /* This will set the markers to beginning of visible range. */ 2395 /* This will set the markers to beginning of visible range. */
2396 set_marker_restricted (w->start, make_number (0), w->buffer); 2396 set_marker_restricted (w->start, make_number (0), w->buffer);
2421 #endif 2421 #endif
2422 2422
2423 if (s == selected_screen) 2423 if (s == selected_screen)
2424 { 2424 {
2425 Fselect_window (data->current_window); 2425 Fselect_window (data->current_window);
2426 if (!NULL (new_current_buffer)) 2426 if (!NILP (new_current_buffer))
2427 Fset_buffer (new_current_buffer); 2427 Fset_buffer (new_current_buffer);
2428 else 2428 else
2429 Fset_buffer (XWINDOW (selected_window)->buffer); 2429 Fset_buffer (XWINDOW (selected_window)->buffer);
2430 } 2430 }
2431 2431
2440 delete_all_subwindows (w) 2440 delete_all_subwindows (w)
2441 register struct window *w; 2441 register struct window *w;
2442 { 2442 {
2443 register int count = 1; 2443 register int count = 1;
2444 w->buffer = Qnil; 2444 w->buffer = Qnil;
2445 if (!NULL (w->next)) 2445 if (!NILP (w->next))
2446 delete_all_subwindows (XWINDOW (w->next)); 2446 delete_all_subwindows (XWINDOW (w->next));
2447 if (!NULL (w->vchild)) 2447 if (!NILP (w->vchild))
2448 delete_all_subwindows (XWINDOW (w->vchild)); 2448 delete_all_subwindows (XWINDOW (w->vchild));
2449 if (!NULL (w->hchild)) 2449 if (!NILP (w->hchild))
2450 delete_all_subwindows (XWINDOW (w->hchild)); 2450 delete_all_subwindows (XWINDOW (w->hchild));
2451 } 2451 }
2452 2452
2453 static int 2453 static int
2454 count_windows (window) 2454 count_windows (window)
2455 register struct window *window; 2455 register struct window *window;
2456 { 2456 {
2457 register int count = 1; 2457 register int count = 1;
2458 if (!NULL (window->next)) 2458 if (!NILP (window->next))
2459 count += count_windows (XWINDOW (window->next)); 2459 count += count_windows (XWINDOW (window->next));
2460 if (!NULL (window->vchild)) 2460 if (!NILP (window->vchild))
2461 count += count_windows (XWINDOW (window->vchild)); 2461 count += count_windows (XWINDOW (window->vchild));
2462 if (!NULL (window->hchild)) 2462 if (!NILP (window->hchild))
2463 count += count_windows (XWINDOW (window->hchild)); 2463 count += count_windows (XWINDOW (window->hchild));
2464 return count; 2464 return count;
2465 } 2465 }
2466 2466
2467 static int 2467 static int
2472 { 2472 {
2473 register struct saved_window *p; 2473 register struct saved_window *p;
2474 register struct window *w; 2474 register struct window *w;
2475 register Lisp_Object tem; 2475 register Lisp_Object tem;
2476 2476
2477 for (;!NULL (window); window = w->next) 2477 for (;!NILP (window); window = w->next)
2478 { 2478 {
2479 p = SAVED_WINDOW_N (vector, i); 2479 p = SAVED_WINDOW_N (vector, i);
2480 w = XWINDOW (window); 2480 w = XWINDOW (window);
2481 2481
2482 XFASTINT (w->temslot) = i++; 2482 XFASTINT (w->temslot) = i++;
2486 p->top = w->top; 2486 p->top = w->top;
2487 p->width = w->width; 2487 p->width = w->width;
2488 p->height = w->height; 2488 p->height = w->height;
2489 p->hscroll = w->hscroll; 2489 p->hscroll = w->hscroll;
2490 p->display_table = w->display_table; 2490 p->display_table = w->display_table;
2491 if (!NULL (w->buffer)) 2491 if (!NILP (w->buffer))
2492 { 2492 {
2493 /* Save w's value of point in the window configuration. 2493 /* Save w's value of point in the window configuration.
2494 If w is the selected window, then get the value of point 2494 If w is the selected window, then get the value of point
2495 from the buffer; pointm is garbage in the selected window. */ 2495 from the buffer; pointm is garbage in the selected window. */
2496 if (EQ (window, selected_window)) 2496 if (EQ (window, selected_window))
2514 p->start = Qnil; 2514 p->start = Qnil;
2515 p->mark = Qnil; 2515 p->mark = Qnil;
2516 p->start_at_line_beg = Qnil; 2516 p->start_at_line_beg = Qnil;
2517 } 2517 }
2518 2518
2519 if (NULL (w->parent)) 2519 if (NILP (w->parent))
2520 p->parent = Qnil; 2520 p->parent = Qnil;
2521 else 2521 else
2522 p->parent = XWINDOW (w->parent)->temslot; 2522 p->parent = XWINDOW (w->parent)->temslot;
2523 2523
2524 if (NULL (w->prev)) 2524 if (NILP (w->prev))
2525 p->prev = Qnil; 2525 p->prev = Qnil;
2526 else 2526 else
2527 p->prev = XWINDOW (w->prev)->temslot; 2527 p->prev = XWINDOW (w->prev)->temslot;
2528 2528
2529 if (!NULL (w->vchild)) 2529 if (!NILP (w->vchild))
2530 i = save_window_save (w->vchild, vector, i); 2530 i = save_window_save (w->vchild, vector, i);
2531 if (!NULL (w->hchild)) 2531 if (!NILP (w->hchild))
2532 i = save_window_save (w->hchild, vector, i); 2532 i = save_window_save (w->hchild, vector, i);
2533 } 2533 }
2534 2534
2535 return i; 2535 return i;
2536 } 2536 }
2550 register int n_windows; 2550 register int n_windows;
2551 register struct save_window_data *data; 2551 register struct save_window_data *data;
2552 register int i; 2552 register int i;
2553 SCREEN_PTR s; 2553 SCREEN_PTR s;
2554 2554
2555 if (NULL (screen)) 2555 if (NILP (screen))
2556 s = selected_screen; 2556 s = selected_screen;
2557 else 2557 else
2558 { 2558 {
2559 CHECK_LIVE_SCREEN (screen, 0); 2559 CHECK_LIVE_SCREEN (screen, 0);
2560 s = XSCREEN (screen); 2560 s = XSCREEN (screen);