Mercurial > emacs
comparison src/indent.c @ 8905:2ef3da79aabb
(vmotion, Fvertical_motion): Fix Lisp_Object vs. int problems.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 19 Sep 1994 00:17:26 +0000 |
parents | f047d8c6db79 |
children | f2249e034d50 |
comparison
equal
deleted
inserted
replaced
8904:af3ff2dbaddd | 8905:2ef3da79aabb |
---|---|
746 Lisp_Object window; | 746 Lisp_Object window; |
747 { | 747 { |
748 struct position pos; | 748 struct position pos; |
749 /* vpos is cumulative vertical position, changed as from is changed */ | 749 /* vpos is cumulative vertical position, changed as from is changed */ |
750 register int vpos = 0; | 750 register int vpos = 0; |
751 register int prevline; | 751 Lisp_Object prevline; |
752 register int first; | 752 register int first; |
753 int lmargin = hscroll > 0 ? 1 - hscroll : 0; | 753 int lmargin = hscroll > 0 ? 1 - hscroll : 0; |
754 int selective | 754 int selective |
755 = XTYPE (current_buffer->selective_display) == Lisp_Int | 755 = XTYPE (current_buffer->selective_display) == Lisp_Int |
756 ? XINT (current_buffer->selective_display) | 756 ? XINT (current_buffer->selective_display) |
766 { | 766 { |
767 /* Moving downward is simple, but must calculate from beg of line | 767 /* Moving downward is simple, but must calculate from beg of line |
768 to determine hpos of starting point */ | 768 to determine hpos of starting point */ |
769 if (from > BEGV && FETCH_CHAR (from - 1) != '\n') | 769 if (from > BEGV && FETCH_CHAR (from - 1) != '\n') |
770 { | 770 { |
771 prevline = find_next_newline_no_quit (from, -1); | 771 XFASTINT (prevline) = find_next_newline_no_quit (from, -1); |
772 while (prevline > BEGV | 772 while (XFASTINT (prevline) > BEGV |
773 && ((selective > 0 | 773 && ((selective > 0 |
774 && indented_beyond_p (prevline, selective)) | 774 && indented_beyond_p (XFASTINT (prevline), selective)) |
775 #ifdef USE_TEXT_PROPERTIES | 775 #ifdef USE_TEXT_PROPERTIES |
776 /* watch out for newlines with `invisible' property */ | 776 /* watch out for newlines with `invisible' property */ |
777 || ! NILP (Fget_char_property (XFASTINT (prevline), | 777 || ! NILP (Fget_char_property (prevline, |
778 Qinvisible, | 778 Qinvisible, |
779 window)) | 779 window)) |
780 #endif | 780 #endif |
781 )) | 781 )) |
782 prevline = find_next_newline_no_quit (prevline - 1, -1); | 782 XFASTINT (prevline) |
783 pos = *compute_motion (prevline, 0, | 783 = find_next_newline_no_quit (XFASTINT (prevline) - 1, -1); |
784 lmargin + (prevline == 1 ? start_hpos : 0), | 784 pos = *compute_motion (XFASTINT (prevline), 0, |
785 lmargin + (XFASTINT (prevline) == 1 | |
786 ? start_hpos : 0), | |
785 from, 1 << (INTBITS - 2), 0, | 787 from, 1 << (INTBITS - 2), 0, |
786 width, hscroll, 0, XWINDOW (window)); | 788 width, hscroll, 0, XWINDOW (window)); |
787 } | 789 } |
788 else | 790 else |
789 { | 791 { |
801 | 803 |
802 first = 1; | 804 first = 1; |
803 | 805 |
804 while ((vpos > vtarget || first) && from > BEGV) | 806 while ((vpos > vtarget || first) && from > BEGV) |
805 { | 807 { |
806 prevline = from; | 808 XFASTINT (prevline) = from; |
807 while (1) | 809 while (1) |
808 { | 810 { |
809 prevline = find_next_newline_no_quit (prevline - 1, -1); | 811 XFASTINT (prevline) |
810 if (prevline == BEGV | 812 = find_next_newline_no_quit (XFASTINT (prevline) - 1, -1); |
813 if (XFASTINT (prevline) == BEGV | |
811 || ((selective <= 0 | 814 || ((selective <= 0 |
812 || ! indented_beyond_p (prevline, selective)) | 815 || ! indented_beyond_p (XFASTINT (prevline), selective)) |
813 #ifdef USE_TEXT_PROPERTIES | 816 #ifdef USE_TEXT_PROPERTIES |
814 /* watch out for newlines with `invisible' property */ | 817 /* watch out for newlines with `invisible' property */ |
815 && NILP (Fget_char_property (XFASTINT (prevline), | 818 && NILP (Fget_char_property (prevline, Qinvisible, window)) |
816 Qinvisible, | |
817 window)) | |
818 #endif | 819 #endif |
819 )) | 820 )) |
820 break; | 821 break; |
821 } | 822 } |
822 pos = *compute_motion (prevline, 0, | 823 pos = *compute_motion (XFASTINT (prevline), 0, |
823 lmargin + (prevline == 1 ? start_hpos : 0), | 824 lmargin + (XFASTINT (prevline) == 1 |
825 ? start_hpos : 0), | |
824 from, 1 << (INTBITS - 2), 0, | 826 from, 1 << (INTBITS - 2), 0, |
825 width, hscroll, 0, XWINDOW (window)); | 827 width, hscroll, 0, XWINDOW (window)); |
826 vpos -= pos.vpos; | 828 vpos -= pos.vpos; |
827 first = 0; | 829 first = 0; |
828 from = prevline; | 830 from = XFASTINT (prevline); |
829 } | 831 } |
830 | 832 |
831 /* If we made exactly the desired vertical distance, | 833 /* If we made exactly the desired vertical distance, |
832 or if we hit beginning of buffer, | 834 or if we hit beginning of buffer, |
833 return point found */ | 835 return point found */ |
867 | 869 |
868 CHECK_NUMBER (lines, 0); | 870 CHECK_NUMBER (lines, 0); |
869 if (! NILP (window)) | 871 if (! NILP (window)) |
870 CHECK_WINDOW (window, 0); | 872 CHECK_WINDOW (window, 0); |
871 else | 873 else |
872 XSET (window, Lisp_Window, selected_window); | 874 window = selected_window; |
873 | 875 |
874 w = XWINDOW (window); | 876 w = XWINDOW (window); |
875 | 877 |
876 pos = *vmotion (point, XINT (lines), window_internal_width (w) - 1, | 878 pos = *vmotion (point, XINT (lines), window_internal_width (w) - 1, |
877 /* Not XFASTINT since perhaps could be negative */ | 879 /* Not XFASTINT since perhaps could be negative */ |