summaryrefslogtreecommitdiff
path: root/src/intervals.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-03-26 21:02:24 +0000
committerRichard M. Stallman <rms@gnu.org>1994-03-26 21:02:24 +0000
commit3953513b2947cfa29e0c5ca25b1c577a00e9266e (patch)
treeb5c930f45a738d9f5575f2c2dd37bf1202100f59 /src/intervals.c
parent0859fbf224ac7522dd10c4281c5cc0b96b3b8ddf (diff)
downloademacs-3953513b2947cfa29e0c5ca25b1c577a00e9266e.tar.gz
(verify_interval_modification): For insertion in
middle of an interval, use the same criterion as between intervals for whether read-only forbids it.
Diffstat (limited to 'src/intervals.c')
-rw-r--r--src/intervals.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/intervals.c b/src/intervals.c
index 6c7ce7ee898..597fcf07b30 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1847,8 +1847,7 @@ verify_interval_modification (buf, start, end)
error ("Attempt to insert within read-only text");
}
}
- else
- after = Qnil;
+
if (! NULL_INTERVAL_P (prev))
{
before = textget (prev->plist, Qread_only);
@@ -1868,18 +1867,30 @@ verify_interval_modification (buf, start, end)
error ("Attempt to insert within read-only text");
}
}
- else
- before = Qnil;
}
else if (! NULL_INTERVAL_P (i))
- before = after = textget (i->plist, Qread_only);
- if (! NULL_INTERVAL_P (i) && ! NULL_INTERVAL_P (prev))
{
- /* If I and PREV differ, neither of them has a sticky
- read-only property. It only remains to check, whether
- they have a common read-only property. */
- if (! NILP (before) && EQ (before, after))
- error ("Attempt to insert within read-only text");
+ after = textget (i->plist, Qread_only);
+
+ /* If interval I is read-only and read-only is
+ front-sticky, inhibit insertion.
+ Check for read-only as well as category. */
+ if (! NILP (after) && NILP (Fmemq (after, Vinhibit_read_only)))
+ {
+ Lisp_Object tem;
+
+ tem = textget (i->plist, Qfront_sticky);
+ if (TMEM (Qread_only, tem)
+ || (NILP (textget_direct (i->plist, Qread_only))
+ && TMEM (Qcategory, tem)))
+ error ("Attempt to insert within read-only text");
+
+ tem = textget (prev->plist, Qrear_nonsticky);
+ if (! TMEM (Qread_only, tem)
+ && (! NILP (textget_direct (prev->plist, Qread_only))
+ || ! TMEM (Qcategory, tem)))
+ error ("Attempt to insert within read-only text");
+ }
}
}