aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-04-05 23:47:38 +0000
committerKarl Heuer1994-04-05 23:47:38 +0000
commit88af3af464269760aa7bb6975681cdfbde9e27e1 (patch)
treef11410564408c10fe4bd97051db68f908c535a4a /src
parent63cf923df4cc9c9858fa2543ba80b603262b6fad (diff)
downloademacs-88af3af464269760aa7bb6975681cdfbde9e27e1.tar.gz
emacs-88af3af464269760aa7bb6975681cdfbde9e27e1.zip
(compute_motion): Add window argument.
(Fcompute_motion): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/indent.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/indent.c b/src/indent.c
index 61d7e280479..91ea2f9709e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -435,10 +435,11 @@ struct position val_compute_motion;
435 the scroll bars if they are turned on. */ 435 the scroll bars if they are turned on. */
436 436
437struct position * 437struct position *
438compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, tab_offset) 438compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, tab_offset, win)
439 int from, fromvpos, fromhpos, to, tovpos, tohpos; 439 int from, fromvpos, fromhpos, to, tovpos, tohpos;
440 register int width; 440 register int width;
441 int hscroll, tab_offset; 441 int hscroll, tab_offset;
442 struct window *win;
442{ 443{
443 register int hpos = fromhpos; 444 register int hpos = fromhpos;
444 register int vpos = fromvpos; 445 register int vpos = fromvpos;
@@ -447,7 +448,7 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta
447 register int c; 448 register int c;
448 register int tab_width = XFASTINT (current_buffer->tab_width); 449 register int tab_width = XFASTINT (current_buffer->tab_width);
449 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 450 register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
450 register struct Lisp_Vector *dp = buffer_display_table (); 451 register struct Lisp_Vector *dp = window_display_table (win);
451 int selective 452 int selective
452 = XTYPE (current_buffer->selective_display) == Lisp_Int 453 = XTYPE (current_buffer->selective_display) == Lisp_Int
453 ? XINT (current_buffer->selective_display) 454 ? XINT (current_buffer->selective_display)
@@ -462,6 +463,9 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta
462 Lisp_Object prop, position; 463 Lisp_Object prop, position;
463#endif 464#endif
464 465
466 if (! BUFFERP (win->buffer) || XBUFFER (win->buffer) != current_buffer)
467 abort ();
468
465 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 469 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
466 for (pos = from; pos < to; pos++) 470 for (pos = from; pos < to; pos++)
467 { 471 {
@@ -612,14 +616,14 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta
612 616
613#if 0 /* The doc string is too long for some compilers, 617#if 0 /* The doc string is too long for some compilers,
614 but make-docfile can find it in this comment. */ 618 but make-docfile can find it in this comment. */
615DEFUN ("compute-motion", Ffoo, Sfoo, 6, 6, 0, 619DEFUN ("compute-motion", Ffoo, Sfoo, 7, 7, 0,
616 "Scan through the current buffer, calculating screen position.\n\ 620 "Scan through the current buffer, calculating screen position.\n\
617Scan the current buffer forward from offset FROM,\n\ 621Scan the current buffer forward from offset FROM,\n\
618assuming it is at position FROMPOS--a cons of the form (HPOS . VPOS)--\n\ 622assuming it is at position FROMPOS--a cons of the form (HPOS . VPOS)--\n\
619to position TO or position TOPOS--another cons of the form (HPOS . VPOS)--\n\ 623to position TO or position TOPOS--another cons of the form (HPOS . VPOS)--\n\
620and return the ending buffer position and screen location.\n\ 624and return the ending buffer position and screen location.\n\
621\n\ 625\n\
622There are two additional arguments:\n\ 626There are three additional arguments:\n\
623\n\ 627\n\
624WIDTH is the number of columns available to display text;\n\ 628WIDTH is the number of columns available to display text;\n\
625this affects handling of continuation lines.\n\ 629this affects handling of continuation lines.\n\
@@ -632,6 +636,8 @@ margin; this is usually taken from a window's hscroll member.\n\
632TAB-OFFSET is the number of columns of the first tab that aren't\n\ 636TAB-OFFSET is the number of columns of the first tab that aren't\n\
633being displayed, perhaps because the line was continued within it.\n\ 637being displayed, perhaps because the line was continued within it.\n\
634If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero.\n\ 638If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero.\n\
639WINDOW is the window to operate on. Currently this is used only to\n\
640find the buffer and the display table.\n\
635\n\ 641\n\
636The value is a list of five elements:\n\ 642The value is a list of five elements:\n\
637 (POS HPOS VPOS PREVHPOS CONTIN)\n\ 643 (POS HPOS VPOS PREVHPOS CONTIN)\n\
@@ -649,15 +655,16 @@ Pass the buffer's (point-max) as TO, to limit the scan to the end of the\n\
649visible section of the buffer, and pass LINE and COL as TOPOS.") 655visible section of the buffer, and pass LINE and COL as TOPOS.")
650#endif 656#endif
651 657
652DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 6, 6, 0, 658DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 7, 7, 0,
653 0) 659 0)
654 (from, frompos, to, topos, width, offsets) 660 (from, frompos, to, topos, width, offsets, window)
655 Lisp_Object from, frompos, to, topos; 661 Lisp_Object from, frompos, to, topos;
656 Lisp_Object width, offsets; 662 Lisp_Object width, offsets, window;
657{ 663{
658 Lisp_Object bufpos, hpos, vpos, prevhpos, contin; 664 Lisp_Object bufpos, hpos, vpos, prevhpos, contin;
659 struct position *pos; 665 struct position *pos;
660 int hscroll, tab_offset; 666 int hscroll, tab_offset;
667 struct buffer *old_buffer;
661 668
662 CHECK_NUMBER_COERCE_MARKER (from, 0); 669 CHECK_NUMBER_COERCE_MARKER (from, 0);
663 CHECK_CONS (frompos, 0); 670 CHECK_CONS (frompos, 0);
@@ -679,11 +686,22 @@ DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 6, 6, 0,
679 else 686 else
680 hscroll = tab_offset = 0; 687 hscroll = tab_offset = 0;
681 688
689 if (NILP (window))
690 window = Fselected_window ();
691 else
692 CHECK_LIVE_WINDOW (window, 0);
693
694 /* Might as well use the buffer on the specified window, rather than
695 generating an error. */
696 old_buffer = current_buffer;
697 current_buffer = XBUFFER (XWINDOW (window)->buffer);
682 pos = compute_motion (XINT (from), XINT (XCONS (frompos)->cdr), 698 pos = compute_motion (XINT (from), XINT (XCONS (frompos)->cdr),
683 XINT (XCONS (frompos)->car), 699 XINT (XCONS (frompos)->car),
684 XINT (to), XINT (XCONS (topos)->cdr), 700 XINT (to), XINT (XCONS (topos)->cdr),
685 XINT (XCONS (topos)->car), 701 XINT (XCONS (topos)->car),
686 XINT (width), hscroll, tab_offset); 702 XINT (width), hscroll, tab_offset,
703 XWINDOW (window));
704 current_buffer = old_buffer;
687 705
688 XFASTINT (bufpos) = pos->bufpos; 706 XFASTINT (bufpos) = pos->bufpos;
689 XSET (hpos, Lisp_Int, pos->hpos); 707 XSET (hpos, Lisp_Int, pos->hpos);
@@ -766,7 +784,7 @@ vmotion (from, vtarget, width, hscroll, window)
766 pos = *compute_motion (prevline, 0, 784 pos = *compute_motion (prevline, 0,
767 lmargin + (prevline == 1 ? start_hpos : 0), 785 lmargin + (prevline == 1 ? start_hpos : 0),
768 from, 1 << (INTBITS - 2), 0, 786 from, 1 << (INTBITS - 2), 0,
769 width, hscroll, 0); 787 width, hscroll, 0, XWINDOW (window));
770 } 788 }
771 else 789 else
772 { 790 {
@@ -775,7 +793,8 @@ vmotion (from, vtarget, width, hscroll, window)
775 } 793 }
776 return compute_motion (from, vpos, pos.hpos, 794 return compute_motion (from, vpos, pos.hpos,
777 ZV, vtarget, - (1 << (INTBITS - 2)), 795 ZV, vtarget, - (1 << (INTBITS - 2)),
778 width, hscroll, pos.vpos * width); 796 width, hscroll, pos.vpos * width,
797 XWINDOW (window));
779 } 798 }
780 799
781 /* To move upward, go a line at a time until 800 /* To move upward, go a line at a time until
@@ -804,7 +823,7 @@ vmotion (from, vtarget, width, hscroll, window)
804 pos = *compute_motion (prevline, 0, 823 pos = *compute_motion (prevline, 0,
805 lmargin + (prevline == 1 ? start_hpos : 0), 824 lmargin + (prevline == 1 ? start_hpos : 0),
806 from, 1 << (INTBITS - 2), 0, 825 from, 1 << (INTBITS - 2), 0,
807 width, hscroll, 0); 826 width, hscroll, 0, XWINDOW (window));
808 vpos -= pos.vpos; 827 vpos -= pos.vpos;
809 first = 0; 828 first = 0;
810 from = prevline; 829 from = prevline;