aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-12-17 07:25:35 +0000
committerRichard M. Stallman1996-12-17 07:25:35 +0000
commit4ab19eb30d8d6b1228fceb689226328e5d559442 (patch)
tree28b0c7ff729a737694fea358021066dacc18b666 /src
parent92976f6765ee5787a015a88be51faa7b150eca69 (diff)
downloademacs-4ab19eb30d8d6b1228fceb689226328e5d559442.tar.gz
emacs-4ab19eb30d8d6b1228fceb689226328e5d559442.zip
(merge_properties_sticky): Don't discard explicit nil
properties. Don't put on a front-sticky property if we inherit one from the category that does the job.
Diffstat (limited to 'src')
-rw-r--r--src/intervals.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/intervals.c b/src/intervals.c
index cdfbc5a7e69..1e5a3782ef9 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -898,8 +898,9 @@ merge_properties_sticky (pleft, pright)
898{ 898{
899 register Lisp_Object props, front, rear; 899 register Lisp_Object props, front, rear;
900 Lisp_Object lfront, lrear, rfront, rrear; 900 Lisp_Object lfront, lrear, rfront, rrear;
901 register Lisp_Object tail1, tail2, sym, lval, rval; 901 register Lisp_Object tail1, tail2, sym, lval, rval, cat;
902 int use_left, use_right; 902 int use_left, use_right;
903 int lpresent;
903 904
904 props = Qnil; 905 props = Qnil;
905 front = Qnil; 906 front = Qnil;
@@ -922,21 +923,27 @@ merge_properties_sticky (pleft, pright)
922 for (tail2 = pleft; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) 923 for (tail2 = pleft; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2)))
923 if (EQ (sym, Fcar (tail2))) 924 if (EQ (sym, Fcar (tail2)))
924 break; 925 break;
925 lval = (NILP (tail2) ? Qnil : Fcar( Fcdr (tail2)));
926 926
927 use_left = ! TMEM (sym, lrear); 927 /* Indicate whether the property is explicitly defined on the left.
928 (We know it is defined explicitly on the right
929 because otherwise we don't get here.) */
930 lpresent = ! NILP (tail2);
931 lval = (NILP (tail2) ? Qnil : Fcar (Fcdr (tail2)));
932
933 use_left = ! TMEM (sym, lrear) && lpresent;
928 use_right = TMEM (sym, rfront); 934 use_right = TMEM (sym, rfront);
929 if (use_left && use_right) 935 if (use_left && use_right)
930 { 936 {
931 use_left = ! NILP (lval); 937 if (NILP (lval))
932 use_right = ! NILP (rval); 938 use_left = 0;
939 else if (NILP (rval))
940 use_right = 0;
933 } 941 }
934 if (use_left) 942 if (use_left)
935 { 943 {
936 /* We build props as (value sym ...) rather than (sym value ...) 944 /* We build props as (value sym ...) rather than (sym value ...)
937 because we plan to nreverse it when we're done. */ 945 because we plan to nreverse it when we're done. */
938 if (! NILP (lval)) 946 props = Fcons (lval, Fcons (sym, props));
939 props = Fcons (lval, Fcons (sym, props));
940 if (TMEM (sym, lfront)) 947 if (TMEM (sym, lfront))
941 front = Fcons (sym, front); 948 front = Fcons (sym, front);
942 if (TMEM (sym, lrear)) 949 if (TMEM (sym, lrear))
@@ -944,8 +951,7 @@ merge_properties_sticky (pleft, pright)
944 } 951 }
945 else if (use_right) 952 else if (use_right)
946 { 953 {
947 if (! NILP (rval)) 954 props = Fcons (rval, Fcons (sym, props));
948 props = Fcons (rval, Fcons (sym, props));
949 if (TMEM (sym, rfront)) 955 if (TMEM (sym, rfront))
950 front = Fcons (sym, front); 956 front = Fcons (sym, front);
951 if (TMEM (sym, rrear)) 957 if (TMEM (sym, rrear))
@@ -974,8 +980,7 @@ merge_properties_sticky (pleft, pright)
974 /* Since rval is known to be nil in this loop, the test simplifies. */ 980 /* Since rval is known to be nil in this loop, the test simplifies. */
975 if (! TMEM (sym, lrear)) 981 if (! TMEM (sym, lrear))
976 { 982 {
977 if (! NILP (lval)) 983 props = Fcons (lval, Fcons (sym, props));
978 props = Fcons (lval, Fcons (sym, props));
979 if (TMEM (sym, lfront)) 984 if (TMEM (sym, lfront))
980 front = Fcons (sym, front); 985 front = Fcons (sym, front);
981 } 986 }
@@ -991,7 +996,14 @@ merge_properties_sticky (pleft, pright)
991 props = Fnreverse (props); 996 props = Fnreverse (props);
992 if (! NILP (rear)) 997 if (! NILP (rear))
993 props = Fcons (Qrear_nonsticky, Fcons (Fnreverse (rear), props)); 998 props = Fcons (Qrear_nonsticky, Fcons (Fnreverse (rear), props));
994 if (! NILP (front)) 999
1000 cat = textget (props, Qcategory);
1001 if (! NILP (front)
1002 &&
1003 /* If we have inherited a front-stick category property that is t,
1004 we don't need to set up a detailed one. */
1005 ! (! NILP (cat) && SYMBOLP (cat)
1006 && EQ (Fget (cat, Qfront_sticky), Qt)))
995 props = Fcons (Qfront_sticky, Fcons (Fnreverse (front), props)); 1007 props = Fcons (Qfront_sticky, Fcons (Fnreverse (front), props));
996 return props; 1008 return props;
997} 1009}