1 |
/* Interface code for dealing with text properties. |
/* Interface code for dealing with text properties. |
2 |
Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002 |
Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
1703 |
/* Return the direction from which the text-property PROP would be |
/* Return the direction from which the text-property PROP would be |
1704 |
inherited by any new text inserted at POS: 1 if it would be |
inherited by any new text inserted at POS: 1 if it would be |
1705 |
inherited from the char after POS, -1 if it would be inherited from |
inherited from the char after POS, -1 if it would be inherited from |
1706 |
the char before POS, and 0 if from neither. */ |
the char before POS, and 0 if from neither. |
1707 |
|
BUFFER can be either a buffer or nil (meaning current buffer). */ |
1708 |
|
|
1709 |
int |
int |
1710 |
text_property_stickiness (prop, pos) |
text_property_stickiness (prop, pos, buffer) |
1711 |
Lisp_Object prop; |
Lisp_Object prop, pos, buffer; |
|
Lisp_Object pos; |
|
1712 |
{ |
{ |
1713 |
Lisp_Object prev_pos, front_sticky; |
Lisp_Object prev_pos, front_sticky; |
1714 |
int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ |
int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ |
1715 |
|
|
1716 |
if (XINT (pos) > BEGV) |
if (NILP (buffer)) |
1717 |
|
XSETBUFFER (buffer, current_buffer); |
1718 |
|
|
1719 |
|
if (XINT (pos) > BUF_BEGV (XBUFFER (buffer))) |
1720 |
/* Consider previous character. */ |
/* Consider previous character. */ |
1721 |
{ |
{ |
1722 |
Lisp_Object rear_non_sticky; |
Lisp_Object rear_non_sticky; |
1723 |
|
|
1724 |
prev_pos = make_number (XINT (pos) - 1); |
prev_pos = make_number (XINT (pos) - 1); |
1725 |
rear_non_sticky = Fget_text_property (prev_pos, Qrear_nonsticky, Qnil); |
rear_non_sticky = Fget_text_property (prev_pos, Qrear_nonsticky, buffer); |
1726 |
|
|
1727 |
if (!NILP (CONSP (rear_non_sticky) |
if (!NILP (CONSP (rear_non_sticky) |
1728 |
? Fmemq (prop, rear_non_sticky) |
? Fmemq (prop, rear_non_sticky) |
1732 |
} |
} |
1733 |
|
|
1734 |
/* Consider following character. */ |
/* Consider following character. */ |
1735 |
front_sticky = Fget_text_property (pos, Qfront_sticky, Qnil); |
front_sticky = Fget_text_property (pos, Qfront_sticky, buffer); |
1736 |
|
|
1737 |
if (EQ (front_sticky, Qt) |
if (EQ (front_sticky, Qt) |
1738 |
|| (CONSP (front_sticky) |
|| (CONSP (front_sticky) |
1752 |
disambiguate. Basically, rear-sticky wins, _except_ if the |
disambiguate. Basically, rear-sticky wins, _except_ if the |
1753 |
property that would be inherited has a value of nil, in which case |
property that would be inherited has a value of nil, in which case |
1754 |
front-sticky wins. */ |
front-sticky wins. */ |
1755 |
if (XINT (pos) == BEGV || NILP (Fget_text_property (prev_pos, prop, Qnil))) |
if (XINT (pos) == BUF_BEGV (XBUFFER (buffer)) |
1756 |
|
|| NILP (Fget_text_property (prev_pos, prop, buffer))) |
1757 |
return 1; |
return 1; |
1758 |
else |
else |
1759 |
return -1; |
return -1; |
2295 |
/* defsubr (&Serase_text_properties); */ |
/* defsubr (&Serase_text_properties); */ |
2296 |
/* defsubr (&Scopy_text_properties); */ |
/* defsubr (&Scopy_text_properties); */ |
2297 |
} |
} |
2298 |
|
|
2299 |
|
/* arch-tag: 454cdde8-5f86-4faa-a078-101e3625d479 |
2300 |
|
(do not change this comment) */ |