Mercurial > emacs
comparison src/editfns.c @ 70213:e9ea7c53ddc7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-245
(Ffield_beginning, find_field): Undo change of 2006-04-23.
2006-04-25 Miles Bader <miles@gnu.org>
* src/editfns.c (Ffield_beginning, find_field): Undo change of 2006-04-23.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 25 Apr 2006 08:18:01 +0000 |
parents | 6d253e1d0183 |
children | f5917c21d187 2ecafc6d5db7 |
comparison
equal
deleted
inserted
replaced
70212:4d2e0eb216a2 | 70213:e9ea7c53ddc7 |
---|---|
495 means don't store the beginning or end of the field. | 495 means don't store the beginning or end of the field. |
496 | 496 |
497 BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned | 497 BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned |
498 results; they do not effect boundary behavior. | 498 results; they do not effect boundary behavior. |
499 | 499 |
500 If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very last | 500 If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first |
501 position of a field, then the end of the next field is returned | 501 position of a field, then the beginning of the previous field is |
502 instead of the end of POS's field (since the end of a field is | 502 returned instead of the beginning of POS's field (since the end of a |
503 actually also the beginning of the next input field, this behavior | 503 field is actually also the beginning of the next input field, this |
504 is sometimes useful). Additionally in the MERGE_AT_BOUNDARY | 504 behavior is sometimes useful). Additionally in the MERGE_AT_BOUNDARY |
505 true case, if two fields are separated by a field with the special | 505 true case, if two fields are separated by a field with the special |
506 value `boundary', and POS lies within it, then the two separated | 506 value `boundary', and POS lies within it, then the two separated |
507 fields are considered to be adjacent, and POS between them, when | 507 fields are considered to be adjacent, and POS between them, when |
508 finding the beginning and ending of the "merged" field. */ | 508 finding the beginning and ending of the "merged" field. |
509 | |
510 Either BEG or END may be 0, in which case the corresponding value | |
511 is not stored. */ | |
509 | 512 |
510 static void | 513 static void |
511 find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end) | 514 find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end) |
512 Lisp_Object pos; | 515 Lisp_Object pos; |
513 Lisp_Object merge_at_boundary; | 516 Lisp_Object merge_at_boundary; |
669 If LIMIT is non-nil, it is a buffer position; if the beginning of the field | 672 If LIMIT is non-nil, it is a buffer position; if the beginning of the field |
670 is before LIMIT, then LIMIT will be returned instead. */) | 673 is before LIMIT, then LIMIT will be returned instead. */) |
671 (pos, escape_from_edge, limit) | 674 (pos, escape_from_edge, limit) |
672 Lisp_Object pos, escape_from_edge, limit; | 675 Lisp_Object pos, escape_from_edge, limit; |
673 { | 676 { |
674 int beg, end; | 677 int beg; |
675 find_field (pos, escape_from_edge, limit, &beg, Qnil, &end); | 678 find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); |
676 /* When pos is at a field boundary and escape_from_edge (merge_at_boundary) | 679 return make_number (beg); |
677 is nil, find_field returns the *previous* field. In this case we return | |
678 end instead of beg. */ | |
679 return make_number (NILP (escape_from_edge) | |
680 && XFASTINT (pos) == end | |
681 && end != ZV ? end : beg); | |
682 } | 680 } |
683 | 681 |
684 DEFUN ("field-end", Ffield_end, Sfield_end, 0, 3, 0, | 682 DEFUN ("field-end", Ffield_end, Sfield_end, 0, 3, 0, |
685 doc: /* Return the end of the field surrounding POS. | 683 doc: /* Return the end of the field surrounding POS. |
686 A field is a region of text with the same `field' property. | 684 A field is a region of text with the same `field' property. |