Mercurial > hg > xemacs-beta
comparison src/indent.c @ 276:6330739388db r21-0b36
Import from CVS: tag r21-0b36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:30:37 +0200 |
parents | c5d627a313b1 |
children | e11d67e05968 |
comparison
equal
deleted
inserted
replaced
275:a68ae4439f57 | 276:6330739388db |
---|---|
647 vmotion (struct window *w, Bufpos orig, int vtarget, int *ret_vpos) | 647 vmotion (struct window *w, Bufpos orig, int vtarget, int *ret_vpos) |
648 { | 648 { |
649 return vmotion_1 (w, orig, vtarget, ret_vpos, NULL); | 649 return vmotion_1 (w, orig, vtarget, ret_vpos, NULL); |
650 } | 650 } |
651 | 651 |
652 /* Helper for Fvertical_motion and Fvertical_motion_pixels. | |
653 * Share as much code as possible so these stay synched. | |
654 */ | |
655 static | |
656 Lisp_Object vertical_motion_1 (Lisp_Object lines, Lisp_Object window, | |
657 int pixels) | |
658 { | |
659 Bufpos bufpos; | |
660 Bufpos orig; | |
661 int selected; | |
662 int *vpos, *vpix; | |
663 int value=0; | |
664 struct window *w; | |
665 | |
666 if (NILP (window)) | |
667 window = Fselected_window (Qnil); | |
668 | |
669 CHECK_WINDOW (window); | |
670 CHECK_INT (lines); | |
671 | |
672 selected = (EQ (window, Fselected_window (Qnil))); | |
673 | |
674 w = XWINDOW (window); | |
675 | |
676 orig = selected ? BUF_PT (XBUFFER (w->buffer)) | |
677 : marker_position (w->pointm[CURRENT_DISP]); | |
678 | |
679 vpos = pixels ? NULL : &value; | |
680 vpix = pixels ? &value : NULL; | |
681 | |
682 bufpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix); | |
683 | |
684 /* Note that the buffer's point is set, not the window's point. */ | |
685 if (selected) | |
686 BUF_SET_PT (XBUFFER (w->buffer), bufpos); | |
687 else | |
688 set_marker_restricted (w->pointm[CURRENT_DISP], | |
689 make_int(bufpos), | |
690 w->buffer); | |
691 | |
692 return make_int (value); | |
693 } | |
694 | |
652 DEFUN ("vertical-motion", Fvertical_motion, 1, 2, 0, /* | 695 DEFUN ("vertical-motion", Fvertical_motion, 1, 2, 0, /* |
653 Move to start of frame line LINES lines down. | 696 Move to start of frame line LINES lines down. |
654 If LINES is negative, this is moving up. | 697 If LINES is negative, this is moving up. |
655 | 698 Optional second argument is WINDOW to move in, |
656 The optional second argument WINDOW specifies the window to use for | |
657 parameters such as width, horizontal scrolling, and so on. | |
658 the default is the selected window. | 699 the default is the selected window. |
700 | |
701 Sets point to position found; this may be start of line | |
702 or just the start of a continuation line. | |
703 Returns number of lines moved; may be closer to zero than LINES | |
704 if beginning or end of buffer was reached. | |
705 | |
659 Note that `vertical-motion' sets WINDOW's buffer's point, not | 706 Note that `vertical-motion' sets WINDOW's buffer's point, not |
660 WINDOW's point. (This differs from FSF Emacs, which buggily always | 707 WINDOW's point. (This differs from FSF Emacs, which buggily always |
661 sets current buffer's point, regardless of WINDOW.) | 708 sets current buffer's point, regardless of WINDOW.) |
662 | |
663 Sets point to position found; this may be start of line | |
664 or just the start of a continuation line. | |
665 Returns number of lines moved; may be closer to zero than LINES | |
666 if beginning or end of buffer was reached. | |
667 Optional second argument is WINDOW to move in. | |
668 */ | 709 */ |
669 (lines, window)) | 710 (lines, window)) |
670 { | 711 { |
671 if (NILP (window)) | 712 return vertical_motion_1 (lines, window, /* pixels = */ 0); |
672 window = Fselected_window (Qnil); | |
673 CHECK_WINDOW (window); | |
674 { | |
675 Bufpos bufpos; | |
676 int vpos; | |
677 struct window *w = XWINDOW (window); | |
678 | |
679 CHECK_INT (lines); | |
680 | |
681 bufpos = vmotion (XWINDOW (window), BUF_PT (XBUFFER (w->buffer)), | |
682 XINT (lines), &vpos); | |
683 | |
684 /* Note that the buffer's point is set, not the window's point. */ | |
685 BUF_SET_PT (XBUFFER (w->buffer), bufpos); | |
686 | |
687 return make_int (vpos); | |
688 } | |
689 } | 713 } |
690 | 714 |
691 DEFUN ("vertical-motion-pixels", Fvertical_motion_pixels, 1, 2, 0, /* | 715 DEFUN ("vertical-motion-pixels", Fvertical_motion_pixels, 1, 2, 0, /* |
692 Move to start of frame line LINES lines down. | 716 Move to start of frame line LINES lines down. |
693 If LINES is negative, this is moving up. | 717 If LINES is negative, this is moving up. |
718 Optional second argument is WINDOW to move in, | |
719 the default is the selected window. | |
694 | 720 |
695 This function is identical in behavior to `vertical-motion' | 721 This function is identical in behavior to `vertical-motion' |
696 except that the vertical pixel height of the motion which | 722 except that the vertical pixel height of the motion which |
697 took place is returned instead of the actual number of lines | 723 took place is returned instead of the actual number of lines |
698 moved. A motion of zero lines returns the height of the | 724 moved. A motion of zero lines returns the height of the |
699 current line. | 725 current line. |
700 | |
701 The optional second argument WINDOW specifies the window to use | |
702 for parameters such as width, horizontal scrolling, and so on. | |
703 The default is the selected window. Note that this function | |
704 sets WINDOW's buffer's point, not WINDOW's point. | |
705 */ | 726 */ |
706 (lines, window)) | 727 (lines, window)) |
707 { | 728 { |
708 if (NILP (window)) | 729 return vertical_motion_1 (lines, window, /* pixels = */ 1); |
709 window = Fselected_window (Qnil); | |
710 CHECK_WINDOW (window); | |
711 { | |
712 Bufpos bufpos; | |
713 int vpix; | |
714 struct window *w = XWINDOW (window); | |
715 | |
716 CHECK_INT (lines); | |
717 | |
718 bufpos = vmotion_1 (XWINDOW (window), BUF_PT (XBUFFER (w->buffer)), | |
719 XINT (lines), NULL, &vpix); | |
720 | |
721 /* Note that the buffer's point is set, not the window's point. */ | |
722 BUF_SET_PT (XBUFFER (w->buffer), bufpos); | |
723 | |
724 return make_int (vpix); | |
725 } | |
726 } | 730 } |
727 | 731 |
728 | 732 |
729 void | 733 void |
730 syms_of_indent (void) | 734 syms_of_indent (void) |