Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
6f716644
Commit
6f716644
authored
May 17, 2003
by
Stefan Monnier
Browse files
(text_property_stickiness): New arg `buffer'.
parent
4f9f637a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
src/intervals.h
src/intervals.h
+3
-3
src/textprop.c
src/textprop.c
+13
-9
No files found.
src/intervals.h
View file @
6f716644
/* Definitions and global variables for intervals.
/* Definitions and global variables for intervals.
Copyright (C) 1993, 1994, 2000, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 2000, 2002
, 2003
Free Software Foundation, Inc.
This file is part of GNU Emacs.
This file is part of GNU Emacs.
...
@@ -134,7 +134,7 @@ Boston, MA 02111-1307, USA. */
...
@@ -134,7 +134,7 @@ Boston, MA 02111-1307, USA. */
{ \
{ \
(i)->total_length = (i)->position = 0; \
(i)->total_length = (i)->position = 0; \
(i)->left = (i)->right = NULL_INTERVAL; \
(i)->left = (i)->right = NULL_INTERVAL; \
SET_INTERVAL_PARENT (i, NULL_INTERVAL);
\
SET_INTERVAL_PARENT (i, NULL_INTERVAL); \
(i)->write_protect = 0; \
(i)->write_protect = 0; \
(i)->visible = 0; \
(i)->visible = 0; \
(i)->front_sticky = (i)->rear_sticky = 0; \
(i)->front_sticky = (i)->rear_sticky = 0; \
...
@@ -304,7 +304,7 @@ int add_text_properties_from_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
...
@@ -304,7 +304,7 @@ int add_text_properties_from_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
void
extend_property_ranges
P_
((
Lisp_Object
,
Lisp_Object
,
Lisp_Object
));
void
extend_property_ranges
P_
((
Lisp_Object
,
Lisp_Object
,
Lisp_Object
));
Lisp_Object
get_char_property_and_overlay
P_
((
Lisp_Object
,
Lisp_Object
,
Lisp_Object
get_char_property_and_overlay
P_
((
Lisp_Object
,
Lisp_Object
,
Lisp_Object
,
Lisp_Object
*
));
Lisp_Object
,
Lisp_Object
*
));
extern
int
text_property_stickiness
P_
((
Lisp_Object
prop
,
Lisp_Object
pos
));
extern
int
text_property_stickiness
P_
((
Lisp_Object
prop
,
Lisp_Object
pos
,
Lisp_Object
buffer
));
extern
void
syms_of_textprop
();
extern
void
syms_of_textprop
();
...
...
src/textprop.c
View file @
6f716644
/* Interface code for dealing with text properties.
/* Interface code for dealing with text properties.
Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002
Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002
, 2003
Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of GNU Emacs.
This file is part of GNU Emacs.
...
@@ -1703,23 +1703,26 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
...
@@ -1703,23 +1703,26 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
/* Return the direction from which the text-property PROP would be
/* Return the direction from which the text-property PROP would be
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
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
the char before POS, and 0 if from neither. */
the char before POS, and 0 if from neither.
BUFFER can be either a buffer or nil (meaning current buffer). */
int
int
text_property_stickiness
(
prop
,
pos
)
text_property_stickiness
(
prop
,
pos
,
buffer
)
Lisp_Object
prop
;
Lisp_Object
prop
,
pos
,
buffer
;
Lisp_Object
pos
;
{
{
Lisp_Object
prev_pos
,
front_sticky
;
Lisp_Object
prev_pos
,
front_sticky
;
int
is_rear_sticky
=
1
,
is_front_sticky
=
0
;
/* defaults */
int
is_rear_sticky
=
1
,
is_front_sticky
=
0
;
/* defaults */
if
(
XINT
(
pos
)
>
BEGV
)
if
(
NILP
(
buffer
))
XSETBUFFER
(
buffer
,
current_buffer
);
if
(
XINT
(
pos
)
>
BUF_BEGV
(
XBUFFER
(
buffer
)))
/* Consider previous character. */
/* Consider previous character. */
{
{
Lisp_Object
rear_non_sticky
;
Lisp_Object
rear_non_sticky
;
prev_pos
=
make_number
(
XINT
(
pos
)
-
1
);
prev_pos
=
make_number
(
XINT
(
pos
)
-
1
);
rear_non_sticky
=
Fget_text_property
(
prev_pos
,
Qrear_nonsticky
,
Qnil
);
rear_non_sticky
=
Fget_text_property
(
prev_pos
,
Qrear_nonsticky
,
buffer
);
if
(
!
NILP
(
CONSP
(
rear_non_sticky
)
if
(
!
NILP
(
CONSP
(
rear_non_sticky
)
?
Fmemq
(
prop
,
rear_non_sticky
)
?
Fmemq
(
prop
,
rear_non_sticky
)
...
@@ -1729,7 +1732,7 @@ text_property_stickiness (prop, pos)
...
@@ -1729,7 +1732,7 @@ text_property_stickiness (prop, pos)
}
}
/* Consider following character. */
/* Consider following character. */
front_sticky
=
Fget_text_property
(
pos
,
Qfront_sticky
,
Qnil
);
front_sticky
=
Fget_text_property
(
pos
,
Qfront_sticky
,
buffer
);
if
(
EQ
(
front_sticky
,
Qt
)
if
(
EQ
(
front_sticky
,
Qt
)
||
(
CONSP
(
front_sticky
)
||
(
CONSP
(
front_sticky
)
...
@@ -1749,7 +1752,8 @@ text_property_stickiness (prop, pos)
...
@@ -1749,7 +1752,8 @@ text_property_stickiness (prop, pos)
disambiguate. Basically, rear-sticky wins, _except_ if the
disambiguate. Basically, rear-sticky wins, _except_ if the
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
front-sticky wins. */
front-sticky wins. */
if
(
XINT
(
pos
)
==
BEGV
||
NILP
(
Fget_text_property
(
prev_pos
,
prop
,
Qnil
)))
if
(
XINT
(
pos
)
==
BUF_BEGV
(
XBUFFER
(
buffer
))
||
NILP
(
Fget_text_property
(
prev_pos
,
prop
,
buffer
)))
return
1
;
return
1
;
else
else
return
-
1
;
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment