summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-11-24 13:28:33 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-11-24 13:28:33 -0500
commit740bcff0c1de06859c8139dd8e23e82aa28401a0 (patch)
tree66c858ec57977e7990229fee72af43a96d5bcbb1 /src
parent450533b07a9adf8a1d19d3ce7142f946f04e76ac (diff)
downloademacs-740bcff0c1de06859c8139dd8e23e82aa28401a0.tar.gz
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')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/editfns.c34
-rw-r--r--src/intervals.c2
-rw-r--r--src/intervals.h2
-rw-r--r--src/keyboard.c18
-rw-r--r--src/xterm.c2
6 files changed, 33 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c3062d0fc0a..0818cb01156 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2013-11-24 Stefan Monnier <monnier@iro.umontreal.ca>
+ Export get_pos_property to Elisp.
+ * editfns.c (Fget_pos_property): Rename from get_pos_property.
+ (syms_of_editfns): Export it to Elisp.
+
* data.c (Fmake_variable_buffer_local): Mention `permanent-local'.
2013-11-23 Romain Francoise <romain@orebokech.com>
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)
return idx;
}
-/* Return the value of property PROP, in OBJECT at POSITION.
- It's the value of PROP that a char inserted at POSITION would get.
- OBJECT is optional and defaults to the current buffer.
- If OBJECT is a buffer, then overlay properties are considered as well as
- text properties.
- If OBJECT is a window, then that window's buffer is used, but
- window-specific overlays are considered only if they are associated
- with OBJECT. */
-Lisp_Object
-get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object object)
+DEFUN ("get-pos-property", Fget_pos_property, Sget_pos_property, 2, 3, 0,
+ doc: /* Return the value of POSITION's property PROP, in OBJECT.
+Almost identical to `get-char-property' except for the following difference:
+Whereas `get-char-property' returns the property of the char at (i.e. right
+after) POSITION, this pays attention to properties's stickiness and overlays's
+advancement settings, in order to find the property of POSITION itself,
+i.e. the property that a char would inherit if it were inserted
+at POSITION. */)
+ (Lisp_Object position, register Lisp_Object prop, Lisp_Object object)
{
CHECK_NUMBER_COERCE_MARKER (position);
@@ -484,7 +483,7 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
specially. */
if (NILP (merge_at_boundary))
{
- Lisp_Object field = get_pos_property (pos, Qfield, Qnil);
+ Lisp_Object field = Fget_pos_property (pos, Qfield, Qnil);
if (!EQ (field, after_field))
at_field_end = 1;
if (!EQ (field, before_field))
@@ -683,7 +682,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
&& (!NILP (Fget_char_property (new_pos, Qfield, Qnil))
|| !NILP (Fget_char_property (old_pos, Qfield, Qnil))
/* To recognize field boundaries, we must also look at the
- previous positions; we could use `get_pos_property'
+ previous positions; we could use `Fget_pos_property'
instead, but in itself that would fail inside non-sticky
fields (like comint prompts). */
|| (XFASTINT (new_pos) > BEGV
@@ -694,10 +693,12 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
/* Field boundaries are again a problem; but now we must
decide the case exactly, so we need to call
`get_pos_property' as well. */
- || (NILP (get_pos_property (old_pos, inhibit_capture_property, Qnil))
+ || (NILP (Fget_pos_property (old_pos, inhibit_capture_property, Qnil))
&& (XFASTINT (old_pos) <= BEGV
- || NILP (Fget_char_property (old_pos, inhibit_capture_property, Qnil))
- || NILP (Fget_char_property (prev_old, inhibit_capture_property, Qnil))))))
+ || NILP (Fget_char_property
+ (old_pos, inhibit_capture_property, Qnil))
+ || NILP (Fget_char_property
+ (prev_old, inhibit_capture_property, Qnil))))))
/* It is possible that NEW_POS is not within the same field as
OLD_POS; try to move NEW_POS so that it is. */
{
@@ -717,7 +718,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
/* NEW_POS should be constrained, but only if either
ONLY_IN_LINE is nil (in which case any constraint is OK),
or NEW_POS and FIELD_BOUND are on the same line (in which
- case the constraint is OK even if ONLY_IN_LINE is non-nil). */
+ case the constraint is OK even if ONLY_IN_LINE is non-nil). */
&& (NILP (only_in_line)
/* This is the ONLY_IN_LINE case, check that NEW_POS and
FIELD_BOUND are on the same line by seeing whether
@@ -4836,6 +4837,7 @@ functions if all the text being accessed has this property. */);
defsubr (&Sbuffer_substring);
defsubr (&Sbuffer_substring_no_properties);
defsubr (&Sbuffer_string);
+ defsubr (&Sget_pos_property);
defsubr (&Spoint_marker);
defsubr (&Smark_marker);
diff --git a/src/intervals.c b/src/intervals.c
index 5aa68a359d6..0e3b684f570 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -2232,7 +2232,7 @@ get_local_map (ptrdiff_t position, struct buffer *buffer, Lisp_Object type)
editing a field with a `local-map' property, we want insertion at the end
to obey the `local-map' property. */
if (NILP (prop))
- prop = get_pos_property (lispy_position, type, lispy_buffer);
+ prop = Fget_pos_property (lispy_position, type, lispy_buffer);
SET_BUF_BEGV_BOTH (buffer, old_begv, old_begv_byte);
SET_BUF_ZV_BOTH (buffer, old_zv, old_zv_byte);
diff --git a/src/intervals.h b/src/intervals.h
index 51dfa09c5c4..40f32645ba0 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -296,8 +296,6 @@ Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object*);
extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos,
Lisp_Object buffer);
-extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop,
- Lisp_Object object);
extern void syms_of_textprop (void);
diff --git a/src/keyboard.c b/src/keyboard.c
index 450592a07b6..be863adcb96 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1771,8 +1771,8 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
than skip both boundaries. However, this code
also stops anywhere in a non-sticky text-property,
which breaks (e.g.) Org mode. */
- && (val = get_pos_property (make_number (end),
- Qinvisible, Qnil),
+ && (val = Fget_pos_property (make_number (end),
+ Qinvisible, Qnil),
TEXT_PROP_MEANS_INVISIBLE (val))
#endif
&& !NILP (val = get_char_property_and_overlay
@@ -1789,8 +1789,8 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
}
while (beg > BEGV
#if 0
- && (val = get_pos_property (make_number (beg),
- Qinvisible, Qnil),
+ && (val = Fget_pos_property (make_number (beg),
+ Qinvisible, Qnil),
TEXT_PROP_MEANS_INVISIBLE (val))
#endif
&& !NILP (val = get_char_property_and_overlay
@@ -1843,12 +1843,12 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
to the other end would mean moving backwards and thus
could lead to an infinite loop. */
;
- else if (val = get_pos_property (make_number (PT),
- Qinvisible, Qnil),
+ else if (val = Fget_pos_property (make_number (PT),
+ Qinvisible, Qnil),
TEXT_PROP_MEANS_INVISIBLE (val)
- && (val = get_pos_property
- (make_number (PT == beg ? end : beg),
- Qinvisible, Qnil),
+ && (val = (Fget_pos_property
+ (make_number (PT == beg ? end : beg),
+ Qinvisible, Qnil)),
!TEXT_PROP_MEANS_INVISIBLE (val)))
(check_composition = check_display = 1,
SET_PT (PT == beg ? end : beg));
diff --git a/src/xterm.c b/src/xterm.c
index 446b2cf1e45..8be25646577 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5774,7 +5774,7 @@ static void xembed_send_message (struct frame *f, Time,
*FINISH is X_EVENT_DROP if event should not be passed to the toolkit.
*EVENT is unchanged unless we're processing KeyPress event.
- We return the number of characters stored into the buffer. */
+ We return the number of characters stored into the buffer. */
static int
handle_one_xevent (struct x_display_info *dpyinfo,