aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorMiles Bader2006-02-01 10:07:17 +0000
committerMiles Bader2006-02-01 10:07:17 +0000
commit06eb776d8e80eaed0f6b04349dbd4df9292131d9 (patch)
treef8f308fcd75d052e99c7e176efc100c8488fda7f /src/editfns.c
parentdb856169c248b363fe3dc5ee4e8b1dd18c3a05a2 (diff)
parent46e8fe3d6ce114ae3ecd41f7add9ed7f0c13f4b6 (diff)
downloademacs-06eb776d8e80eaed0f6b04349dbd4df9292131d9.tar.gz
emacs-06eb776d8e80eaed0f6b04349dbd4df9292131d9.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-9
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 16-33) - Update from CVS - Install ERC. - Fix ERC compiler warnings. - Use utf-8 encoding in ERC ChangeLogs. - Merge ERC-related Viper hacks into Viper. - Merge from erc--main--0 - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 8-13) - Merge from emacs--devo--0 - Update from CVS
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/src/editfns.c b/src/editfns.c
index c2f73bdea6a..073ee4bff80 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -524,7 +524,9 @@ find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end)
524 = (XFASTINT (pos) > BEGV 524 = (XFASTINT (pos) > BEGV
525 ? get_char_property_and_overlay (make_number (XINT (pos) - 1), 525 ? get_char_property_and_overlay (make_number (XINT (pos) - 1),
526 Qfield, Qnil, NULL) 526 Qfield, Qnil, NULL)
527 : Qnil); 527 /* Using nil here would be a more obvious choice, but it would
528 fail when the buffer starts with a non-sticky field. */
529 : after_field);
528 530
529 /* See if we need to handle the case where MERGE_AT_BOUNDARY is nil 531 /* See if we need to handle the case where MERGE_AT_BOUNDARY is nil
530 and POS is at beginning of a field, which can also be interpreted 532 and POS is at beginning of a field, which can also be interpreted
@@ -715,7 +717,8 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
715{ 717{
716 /* If non-zero, then the original point, before re-positioning. */ 718 /* If non-zero, then the original point, before re-positioning. */
717 int orig_point = 0; 719 int orig_point = 0;
718 720 int fwd, prev_old, prev_new;
721
719 if (NILP (new_pos)) 722 if (NILP (new_pos))
720 /* Use the current point, and afterwards, set it. */ 723 /* Use the current point, and afterwards, set it. */
721 { 724 {
@@ -723,23 +726,40 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
723 XSETFASTINT (new_pos, PT); 726 XSETFASTINT (new_pos, PT);
724 } 727 }
725 728
729 CHECK_NUMBER_COERCE_MARKER (new_pos);
730 CHECK_NUMBER_COERCE_MARKER (old_pos);
731
732 fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
733
734 prev_old = make_number (XFASTINT (old_pos) - 1);
735 prev_new = make_number (XFASTINT (new_pos) - 1);
736
726 if (NILP (Vinhibit_field_text_motion) 737 if (NILP (Vinhibit_field_text_motion)
727 && !EQ (new_pos, old_pos) 738 && !EQ (new_pos, old_pos)
728 && (!NILP (Fget_char_property (new_pos, Qfield, Qnil)) 739 && (!NILP (Fget_text_property (new_pos, Qfield, Qnil))
729 || !NILP (Fget_char_property (old_pos, Qfield, Qnil))) 740 || !NILP (Fget_text_property (old_pos, Qfield, Qnil))
741 /* To recognize field boundaries, we must also look at the
742 previous positions; we could use `get_pos_property'
743 instead, but in itself that would fail inside non-sticky
744 fields (like comint prompts). */
745 || (XFASTINT (new_pos) > BEGV
746 && !NILP (Fget_text_property (prev_new, Qfield, Qnil)))
747 || (XFASTINT (old_pos) > BEGV
748 && !NILP (Fget_text_property (prev_old, Qfield, Qnil))))
730 && (NILP (inhibit_capture_property) 749 && (NILP (inhibit_capture_property)
731 || NILP (Fget_char_property(old_pos, inhibit_capture_property, Qnil)))) 750 /* Field boundaries are again a problem; but now we must
732 /* NEW_POS is not within the same field as OLD_POS; try to 751 decide the case exactly, so we need to call
733 move NEW_POS so that it is. */ 752 `get_pos_property' as well. */
753 || (NILP (get_pos_property (old_pos, inhibit_capture_property, Qnil))
754 && (XFASTINT (old_pos) <= BEGV
755 || NILP (Fget_text_property (old_pos, inhibit_capture_property, Qnil))
756 || NILP (Fget_text_property (prev_old, inhibit_capture_property, Qnil))))))
757 /* It is possible that NEW_POS is not within the same field as
758 OLD_POS; try to move NEW_POS so that it is. */
734 { 759 {
735 int fwd, shortage; 760 int shortage;
736 Lisp_Object field_bound; 761 Lisp_Object field_bound;
737 762
738 CHECK_NUMBER_COERCE_MARKER (new_pos);
739 CHECK_NUMBER_COERCE_MARKER (old_pos);
740
741 fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
742
743 if (fwd) 763 if (fwd)
744 field_bound = Ffield_end (old_pos, escape_from_edge, new_pos); 764 field_bound = Ffield_end (old_pos, escape_from_edge, new_pos);
745 else 765 else
@@ -780,9 +800,10 @@ DEFUN ("line-beginning-position",
780With argument N not nil or 1, move forward N - 1 lines first. 800With argument N not nil or 1, move forward N - 1 lines first.
781If scan reaches end of buffer, return that position. 801If scan reaches end of buffer, return that position.
782 802
783The scan does not cross a field boundary unless doing so would move 803This function constrains the returned position to the current field
784beyond there to a different line; if N is nil or 1, and scan starts at a 804unless that would be on a different line than the original,
785field boundary, the scan stops as soon as it starts. To ignore field 805unconstrained result. If N is nil or 1, and a front-sticky field
806starts at point, the scan stops as soon as it starts. To ignore field
786boundaries bind `inhibit-field-text-motion' to t. 807boundaries bind `inhibit-field-text-motion' to t.
787 808
788This function does not move point. */) 809This function does not move point. */)
@@ -814,9 +835,10 @@ DEFUN ("line-end-position", Fline_end_position, Sline_end_position, 0, 1, 0,
814With argument N not nil or 1, move forward N - 1 lines first. 835With argument N not nil or 1, move forward N - 1 lines first.
815If scan reaches end of buffer, return that position. 836If scan reaches end of buffer, return that position.
816 837
817The scan does not cross a field boundary unless doing so would move 838This function constrains the returned position to the current field
818beyond there to a different line; if N is nil or 1, and scan starts at a 839unless that would be on a different line than the original,
819field boundary, the scan stops as soon as it starts. To ignore field 840unconstrained result. If N is nil or 1, and a rear-sticky field ends
841at point, the scan stops as soon as it starts. To ignore field
820boundaries bind `inhibit-field-text-motion' to t. 842boundaries bind `inhibit-field-text-motion' to t.
821 843
822This function does not move point. */) 844This function does not move point. */)