Commit 740bcff0 authored by Stefan Monnier's avatar Stefan Monnier

Export get_pos_property to Elisp.

* src/editfns.c (Fget_pos_property): Rename from get_pos_property.
(syms_of_editfns): Export it to Elisp.
parent 450533b0
......@@ -731,6 +731,8 @@ for something (not just adding elements to it), it ought not to affect you.
* Lisp Changes in Emacs 24.4
** New function get-pos-property.
** New hook `pre-redisplay-function'.
+++
......
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>
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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));
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment