diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-11-25 09:30:09 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-11-25 09:30:09 -0800 |
commit | 4aaf6b615b41478b085c03f33831e0d72d0571e8 (patch) | |
tree | ab751e452a845672422cbec2283f383c4d9bddf6 /src/textprop.c | |
parent | f0ffd77d7ca6376ab94eb124af7fbfd624d61ce0 (diff) | |
download | emacs-4aaf6b615b41478b085c03f33831e0d72d0571e8.tar.gz |
Fix minor problems found by static checking.
* lread.c (load_path_default): Now static.
* textprop.c (text_property_stickiness): Be consistent about the
test used when deciding whether to consider the previous character.
This simplifies the code a bit.
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/textprop.c b/src/textprop.c index 6a750f1361f..5597a781a61 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1819,23 +1819,23 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ int text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) { - Lisp_Object prev_pos, front_sticky; + bool ignore_previous_character; + Lisp_Object prev_pos = make_number (XINT (pos) - 1); + Lisp_Object front_sticky; bool is_rear_sticky = true, is_front_sticky = false; /* defaults */ Lisp_Object defalt = Fassq (prop, Vtext_property_default_nonsticky); if (NILP (buffer)) XSETBUFFER (buffer, current_buffer); - if (CONSP (defalt) && !NILP (XCDR (defalt))) - is_rear_sticky = 0; + ignore_previous_character = XINT (pos) <= BUF_BEGV (XBUFFER (buffer)); - if (XINT (pos) > BUF_BEGV (XBUFFER (buffer))) - /* Consider previous character. */ + if (ignore_previous_character || (CONSP (defalt) && !NILP (XCDR (defalt)))) + is_rear_sticky = false; + else { - Lisp_Object rear_non_sticky; - - prev_pos = make_number (XINT (pos) - 1); - rear_non_sticky = Fget_text_property (prev_pos, Qrear_nonsticky, buffer); + Lisp_Object rear_non_sticky + = Fget_text_property (prev_pos, Qrear_nonsticky, buffer); if (!NILP (CONSP (rear_non_sticky) ? Fmemq (prop, rear_non_sticky) @@ -1843,8 +1843,6 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) /* PROP is rear-non-sticky. */ is_rear_sticky = false; } - else - is_rear_sticky = false; /* Consider following character. */ /* This signals an arg-out-of-range error if pos is outside the @@ -1869,7 +1867,7 @@ text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) disambiguate. Basically, rear-sticky wins, _except_ if the property that would be inherited has a value of nil, in which case front-sticky wins. */ - if (XINT (pos) == BUF_BEGV (XBUFFER (buffer)) + if (ignore_previous_character || NILP (Fget_text_property (prev_pos, prop, buffer))) return 1; else |