diff options
| author | Stefan Monnier | 2013-11-24 13:28:33 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-11-24 13:28:33 -0500 |
| commit | 740bcff0c1de06859c8139dd8e23e82aa28401a0 (patch) | |
| tree | 66c858ec57977e7990229fee72af43a96d5bcbb1 /src/editfns.c | |
| parent | 450533b07a9adf8a1d19d3ce7142f946f04e76ac (diff) | |
| download | emacs-740bcff0c1de06859c8139dd8e23e82aa28401a0.tar.gz emacs-740bcff0c1de06859c8139dd8e23e82aa28401a0.zip | |
Export get_pos_property to Elisp.
* src/editfns.c (Fget_pos_property): Rename from get_pos_property.
(syms_of_editfns): Export it to Elisp.
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/editfns.c b/src/editfns.c index 277e5b60704..c5267d1e038 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -343,16 +343,15 @@ overlays_around (EMACS_INT pos, Lisp_Object *vec, ptrdiff_t len) | |||
| 343 | return idx; | 343 | return idx; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | /* Return the value of property PROP, in OBJECT at POSITION. | 346 | DEFUN ("get-pos-property", Fget_pos_property, Sget_pos_property, 2, 3, 0, |
| 347 | It's the value of PROP that a char inserted at POSITION would get. | 347 | doc: /* Return the value of POSITION's property PROP, in OBJECT. |
| 348 | OBJECT is optional and defaults to the current buffer. | 348 | Almost identical to `get-char-property' except for the following difference: |
| 349 | If OBJECT is a buffer, then overlay properties are considered as well as | 349 | Whereas `get-char-property' returns the property of the char at (i.e. right |
| 350 | text properties. | 350 | after) POSITION, this pays attention to properties's stickiness and overlays's |
| 351 | If OBJECT is a window, then that window's buffer is used, but | 351 | advancement settings, in order to find the property of POSITION itself, |
| 352 | window-specific overlays are considered only if they are associated | 352 | i.e. the property that a char would inherit if it were inserted |
| 353 | with OBJECT. */ | 353 | at POSITION. */) |
| 354 | Lisp_Object | 354 | (Lisp_Object position, register Lisp_Object prop, Lisp_Object object) |
| 355 | get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object object) | ||
| 356 | { | 355 | { |
| 357 | CHECK_NUMBER_COERCE_MARKER (position); | 356 | CHECK_NUMBER_COERCE_MARKER (position); |
| 358 | 357 | ||
| @@ -484,7 +483,7 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, | |||
| 484 | specially. */ | 483 | specially. */ |
| 485 | if (NILP (merge_at_boundary)) | 484 | if (NILP (merge_at_boundary)) |
| 486 | { | 485 | { |
| 487 | Lisp_Object field = get_pos_property (pos, Qfield, Qnil); | 486 | Lisp_Object field = Fget_pos_property (pos, Qfield, Qnil); |
| 488 | if (!EQ (field, after_field)) | 487 | if (!EQ (field, after_field)) |
| 489 | at_field_end = 1; | 488 | at_field_end = 1; |
| 490 | if (!EQ (field, before_field)) | 489 | if (!EQ (field, before_field)) |
| @@ -683,7 +682,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) | |||
| 683 | && (!NILP (Fget_char_property (new_pos, Qfield, Qnil)) | 682 | && (!NILP (Fget_char_property (new_pos, Qfield, Qnil)) |
| 684 | || !NILP (Fget_char_property (old_pos, Qfield, Qnil)) | 683 | || !NILP (Fget_char_property (old_pos, Qfield, Qnil)) |
| 685 | /* To recognize field boundaries, we must also look at the | 684 | /* To recognize field boundaries, we must also look at the |
| 686 | previous positions; we could use `get_pos_property' | 685 | previous positions; we could use `Fget_pos_property' |
| 687 | instead, but in itself that would fail inside non-sticky | 686 | instead, but in itself that would fail inside non-sticky |
| 688 | fields (like comint prompts). */ | 687 | fields (like comint prompts). */ |
| 689 | || (XFASTINT (new_pos) > BEGV | 688 | || (XFASTINT (new_pos) > BEGV |
| @@ -694,10 +693,12 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) | |||
| 694 | /* Field boundaries are again a problem; but now we must | 693 | /* Field boundaries are again a problem; but now we must |
| 695 | decide the case exactly, so we need to call | 694 | decide the case exactly, so we need to call |
| 696 | `get_pos_property' as well. */ | 695 | `get_pos_property' as well. */ |
| 697 | || (NILP (get_pos_property (old_pos, inhibit_capture_property, Qnil)) | 696 | || (NILP (Fget_pos_property (old_pos, inhibit_capture_property, Qnil)) |
| 698 | && (XFASTINT (old_pos) <= BEGV | 697 | && (XFASTINT (old_pos) <= BEGV |
| 699 | || NILP (Fget_char_property (old_pos, inhibit_capture_property, Qnil)) | 698 | || NILP (Fget_char_property |
| 700 | || NILP (Fget_char_property (prev_old, inhibit_capture_property, Qnil)))))) | 699 | (old_pos, inhibit_capture_property, Qnil)) |
| 700 | || NILP (Fget_char_property | ||
| 701 | (prev_old, inhibit_capture_property, Qnil)))))) | ||
| 701 | /* It is possible that NEW_POS is not within the same field as | 702 | /* It is possible that NEW_POS is not within the same field as |
| 702 | OLD_POS; try to move NEW_POS so that it is. */ | 703 | OLD_POS; try to move NEW_POS so that it is. */ |
| 703 | { | 704 | { |
| @@ -717,7 +718,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) | |||
| 717 | /* NEW_POS should be constrained, but only if either | 718 | /* NEW_POS should be constrained, but only if either |
| 718 | ONLY_IN_LINE is nil (in which case any constraint is OK), | 719 | ONLY_IN_LINE is nil (in which case any constraint is OK), |
| 719 | or NEW_POS and FIELD_BOUND are on the same line (in which | 720 | or NEW_POS and FIELD_BOUND are on the same line (in which |
| 720 | case the constraint is OK even if ONLY_IN_LINE is non-nil). */ | 721 | case the constraint is OK even if ONLY_IN_LINE is non-nil). */ |
| 721 | && (NILP (only_in_line) | 722 | && (NILP (only_in_line) |
| 722 | /* This is the ONLY_IN_LINE case, check that NEW_POS and | 723 | /* This is the ONLY_IN_LINE case, check that NEW_POS and |
| 723 | FIELD_BOUND are on the same line by seeing whether | 724 | FIELD_BOUND are on the same line by seeing whether |
| @@ -4836,6 +4837,7 @@ functions if all the text being accessed has this property. */); | |||
| 4836 | defsubr (&Sbuffer_substring); | 4837 | defsubr (&Sbuffer_substring); |
| 4837 | defsubr (&Sbuffer_substring_no_properties); | 4838 | defsubr (&Sbuffer_substring_no_properties); |
| 4838 | defsubr (&Sbuffer_string); | 4839 | defsubr (&Sbuffer_string); |
| 4840 | defsubr (&Sget_pos_property); | ||
| 4839 | 4841 | ||
| 4840 | defsubr (&Spoint_marker); | 4842 | defsubr (&Spoint_marker); |
| 4841 | defsubr (&Smark_marker); | 4843 | defsubr (&Smark_marker); |