/* Interface code for dealing with text properties.
- Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1993-1995, 1997, 1999-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
\f
/* Types of hooks. */
-Lisp_Object Qmouse_left;
-Lisp_Object Qmouse_entered;
+static Lisp_Object Qmouse_left;
+static Lisp_Object Qmouse_entered;
Lisp_Object Qpoint_left;
Lisp_Object Qpoint_entered;
Lisp_Object Qcategory;
Lisp_Object Qlocal_map;
/* Visual properties text (including strings) may have. */
-Lisp_Object Qforeground, Qbackground, Qfont, Qunderline, Qstipple;
-Lisp_Object Qinvisible, Qread_only, Qintangible, Qmouse_face;
+static Lisp_Object Qforeground, Qbackground, Qunderline;
+Lisp_Object Qfont;
+static Lisp_Object Qstipple;
+Lisp_Object Qinvisible, Qintangible, Qmouse_face;
+static Lisp_Object Qread_only;
Lisp_Object Qminibuffer_prompt;
/* Sticky properties */
traversing plists. */
#define PLIST_ELT_P(o1, o2) (CONSP (o1) && ((o2)=XCDR (o1), CONSP (o2)))
-Lisp_Object Vinhibit_point_motion_hooks;
-Lisp_Object Vdefault_text_properties;
-Lisp_Object Vchar_property_alias_alist;
-Lisp_Object Vtext_property_default_nonsticky;
-
/* verify_interval_modification saves insertion hooks here
to be run later by report_interval_modification. */
Lisp_Object interval_insert_behind_hooks;
Lisp_Object interval_insert_in_front_hooks;
static void text_read_only (Lisp_Object) NO_RETURN;
+INFUN (Fprevious_property_change, 3);
/* Signal a `text-read-only' error. This function makes it easier
if this changes the interval. */
static INLINE int
-erase_properties (i)
- INTERVAL i;
+erase_properties (INTERVAL i)
{
if (NILP (i->plist))
return 0;
return find_interval (i, position);
}
\f
-DEFUN ("text-properties-at", Ftext_properties_at,
+DEFUE ("text-properties-at", Ftext_properties_at,
Stext_properties_at, 1, 2, 0,
doc: /* Return the list of properties of the character at POSITION in OBJECT.
If the optional second argument OBJECT is a buffer (or nil, which means
return i->plist;
}
-DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0,
+DEFUE ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0,
doc: /* Return the value of POSITION's property PROP, in OBJECT.
OBJECT is optional and defaults to the current buffer.
If POSITION is at the end of OBJECT, the value is nil. */)
return Fget_text_property (position, prop, object);
}
-DEFUN ("get-char-property", Fget_char_property, Sget_char_property, 2, 3, 0,
+DEFUE ("get-char-property", Fget_char_property, Sget_char_property, 2, 3, 0,
doc: /* Return the value of POSITION's property PROP, in OBJECT.
Both overlay properties and text properties are checked.
OBJECT is optional and defaults to the current buffer.
}
\f
-DEFUN ("next-char-property-change", Fnext_char_property_change,
+DEFUE ("next-char-property-change", Fnext_char_property_change,
Snext_char_property_change, 1, 2, 0,
doc: /* Return the position of next text property or overlay change.
This scans characters forward in the current buffer from POSITION till
return Fnext_property_change (position, Qnil, temp);
}
-DEFUN ("previous-char-property-change", Fprevious_char_property_change,
+DEFUE ("previous-char-property-change", Fprevious_char_property_change,
Sprevious_char_property_change, 1, 2, 0,
doc: /* Return the position of previous text property or overlay change.
Scans characters backward in the current buffer from POSITION till it
}
-DEFUN ("next-single-char-property-change", Fnext_single_char_property_change,
+DEFUE ("next-single-char-property-change", Fnext_single_char_property_change,
Snext_single_char_property_change, 2, 4, 0,
doc: /* Return the position of next text property or overlay change for a specific property.
Scans characters forward from POSITION till it finds
return position;
}
-DEFUN ("previous-single-char-property-change",
+DEFUE ("previous-single-char-property-change",
Fprevious_single_char_property_change,
Sprevious_single_char_property_change, 2, 4, 0,
doc: /* Return the position of previous text property or overlay change for a specific property.
return position;
}
\f
-DEFUN ("next-property-change", Fnext_property_change,
+DEFUE ("next-property-change", Fnext_property_change,
Snext_property_change, 1, 3, 0,
doc: /* Return the position of next property change.
Scans characters forward from POSITION in OBJECT till it finds
return make_number (next->position);
}
-/* Return 1 if there's a change in some property between BEG and END. */
-
-int
-property_change_between_p (EMACS_INT beg, EMACS_INT end)
-{
- register INTERVAL i, next;
- Lisp_Object object, pos;
-
- XSETBUFFER (object, current_buffer);
- XSETFASTINT (pos, beg);
-
- i = validate_interval_range (object, &pos, &pos, soft);
- if (NULL_INTERVAL_P (i))
- return 0;
-
- next = next_interval (i);
- while (! NULL_INTERVAL_P (next) && intervals_equal (i, next))
- {
- next = next_interval (next);
- if (NULL_INTERVAL_P (next))
- return 0;
- if (next->position >= end)
- return 0;
- }
-
- if (NULL_INTERVAL_P (next))
- return 0;
-
- return 1;
-}
-
-DEFUN ("next-single-property-change", Fnext_single_property_change,
+DEFUE ("next-single-property-change", Fnext_single_property_change,
Snext_single_property_change, 2, 4, 0,
doc: /* Return the position of next property change for a specific property.
Scans characters forward from POSITION till it finds
return make_number (next->position);
}
-DEFUN ("previous-property-change", Fprevious_property_change,
+DEFUE ("previous-property-change", Fprevious_property_change,
Sprevious_property_change, 1, 3, 0,
doc: /* Return the position of previous property change.
Scans characters backwards from POSITION in OBJECT till it finds
return make_number (previous->position + LENGTH (previous));
}
-DEFUN ("previous-single-property-change", Fprevious_single_property_change,
+DEFUE ("previous-single-property-change", Fprevious_single_property_change,
Sprevious_single_property_change, 2, 4, 0,
doc: /* Return the position of previous property change for a specific property.
Scans characters backward from POSITION till it finds
\f
/* Callers note, this can GC when OBJECT is a buffer (or nil). */
-DEFUN ("add-text-properties", Fadd_text_properties,
+DEFUE ("add-text-properties", Fadd_text_properties,
Sadd_text_properties, 3, 4, 0,
doc: /* Add properties to the text from START to END.
The third argument PROPERTIES is a property list
/* Callers note, this can GC when OBJECT is a buffer (or nil). */
-DEFUN ("put-text-property", Fput_text_property,
+DEFUE ("put-text-property", Fput_text_property,
Sput_text_property, 4, 5, 0,
doc: /* Set one property of the text from START to END.
The third and fourth arguments PROPERTY and VALUE
return Qnil;
}
-DEFUN ("set-text-properties", Fset_text_properties,
+DEFUE ("set-text-properties", Fset_text_properties,
Sset_text_properties, 3, 4, 0,
doc: /* Completely replace properties of text from START to END.
The third argument PROPERTIES is the new property list.
i = next_interval (i);
}
- /* We are starting at the beginning of an interval, I */
- while (len > 0)
+ /* We are starting at the beginning of an interval I. LEN is positive. */
+ do
{
if (i == 0)
abort ();
i = next_interval (i);
}
+ while (len > 0);
}
-DEFUN ("remove-text-properties", Fremove_text_properties,
+DEFUE ("remove-text-properties", Fremove_text_properties,
Sremove_text_properties, 3, 4, 0,
doc: /* Remove some properties from text from START to END.
The third argument PROPERTIES is a property list
}
}
-DEFUN ("remove-list-of-text-properties", Fremove_list_of_text_properties,
+DEFUE ("remove-list-of-text-properties", Fremove_list_of_text_properties,
Sremove_list_of_text_properties, 3, 4, 0,
doc: /* Remove some properties from text from START to END.
The third argument LIST-OF-PROPERTIES is a list of property names to remove.
if (LENGTH (i) >= len)
{
if (! interval_has_some_properties_list (properties, i))
- if (modified)
- {
- if (BUFFERP (object))
- signal_after_change (XINT (start), XINT (end) - XINT (start),
- XINT (end) - XINT (start));
- return Qt;
- }
- else
- return Qnil;
-
- if (LENGTH (i) == len)
+ {
+ if (modified)
+ {
+ if (BUFFERP (object))
+ signal_after_change (XINT (start),
+ XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
+ return Qt;
+ }
+ else
+ return Qnil;
+ }
+ else if (LENGTH (i) == len)
{
if (!modified && BUFFERP (object))
modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
XINT (end) - XINT (start));
return Qt;
}
-
- /* i has the properties, and goes past the change limit */
- unchanged = i;
- i = split_interval_left (i, len);
- copy_properties (unchanged, i);
- if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
- remove_properties (Qnil, properties, i, object);
- if (BUFFERP (object))
- signal_after_change (XINT (start), XINT (end) - XINT (start),
- XINT (end) - XINT (start));
- return Qt;
+ else
+ { /* i has the properties, and goes past the change limit. */
+ unchanged = i;
+ i = split_interval_left (i, len);
+ copy_properties (unchanged, i);
+ if (!modified && BUFFERP (object))
+ modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ remove_properties (Qnil, properties, i, object);
+ if (BUFFERP (object))
+ signal_after_change (XINT (start), XINT (end) - XINT (start),
+ XINT (end) - XINT (start));
+ return Qt;
+ }
}
-
if (interval_has_some_properties_list (properties, i))
{
if (!modified && BUFFERP (object))
}
}
\f
-DEFUN ("text-property-any", Ftext_property_any,
+DEFUE ("text-property-any", Ftext_property_any,
Stext_property_any, 4, 5, 0,
doc: /* Check text from START to END for property PROPERTY equalling VALUE.
If so, return the position of the first character whose property PROPERTY
void
syms_of_textprop (void)
{
- DEFVAR_LISP ("default-text-properties", &Vdefault_text_properties,
+ DEFVAR_LISP ("default-text-properties", Vdefault_text_properties,
doc: /* Property-list used as default values.
The value of a property in this list is seen as the value for every
character that does not have its own value for that property. */);
Vdefault_text_properties = Qnil;
- DEFVAR_LISP ("char-property-alias-alist", &Vchar_property_alias_alist,
+ DEFVAR_LISP ("char-property-alias-alist", Vchar_property_alias_alist,
doc: /* Alist of alternative properties for properties without a value.
Each element should look like (PROPERTY ALTERNATIVE1 ALTERNATIVE2...).
If a piece of text has no direct value for a particular property, then
returned. */);
Vchar_property_alias_alist = Qnil;
- DEFVAR_LISP ("inhibit-point-motion-hooks", &Vinhibit_point_motion_hooks,
+ DEFVAR_LISP ("inhibit-point-motion-hooks", Vinhibit_point_motion_hooks,
doc: /* If non-nil, don't run `point-left' and `point-entered' text properties.
This also inhibits the use of the `intangible' text property. */);
Vinhibit_point_motion_hooks = Qnil;
DEFVAR_LISP ("text-property-default-nonsticky",
- &Vtext_property_default_nonsticky,
+ Vtext_property_default_nonsticky,
doc: /* Alist of properties vs the corresponding non-stickinesses.
Each element has the form (PROPERTY . NONSTICKINESS).
/* defsubr (&Serase_text_properties); */
/* defsubr (&Scopy_text_properties); */
}
-
-/* arch-tag: 454cdde8-5f86-4faa-a078-101e3625d479
- (do not change this comment) */