aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-10 05:12:42 +0000
committerRichard M. Stallman1993-03-10 05:12:42 +0000
commit5cae0ec66cab39c4fe1655845707a412b433275a (patch)
treed341b5cedd572e5df57e01e4b40151ef9fac56d2 /src
parent330fba95d271993666bf03d2ce4cf7250178feb2 (diff)
downloademacs-5cae0ec66cab39c4fe1655845707a412b433275a.tar.gz
emacs-5cae0ec66cab39c4fe1655845707a412b433275a.zip
(set_point): Check invisibility of following character, not previous character.
(textget): Handle categories. (get_local_map): New function. (verify_interval_modification): Call textget correctly.
Diffstat (limited to 'src')
-rw-r--r--src/intervals.c75
1 files changed, 60 insertions, 15 deletions
diff --git a/src/intervals.c b/src/intervals.c
index ce682b9adbf..5f4998789ad 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1210,11 +1210,17 @@ graft_intervals_into_buffer (source, position, buffer)
1210 return; 1210 return;
1211} 1211}
1212 1212
1213/* Get the value of property PROP from PLIST,
1214 which is the plist of an interval.
1215 We check for direct properties and for categories with property PROP. */
1216
1217Lisp_Object
1213textget (plist, prop) 1218textget (plist, prop)
1214 Lisp_Object plist; 1219 Lisp_Object plist;
1215 register Lisp_Object prop; 1220 register Lisp_Object prop;
1216{ 1221{
1217 register Lisp_Object tail; 1222 register Lisp_Object tail, fallback;
1223 fallback = Qnil;
1218 1224
1219 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) 1225 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
1220 { 1226 {
@@ -1222,12 +1228,15 @@ textget (plist, prop)
1222 tem = Fcar (tail); 1228 tem = Fcar (tail);
1223 if (EQ (prop, tem)) 1229 if (EQ (prop, tem))
1224 return Fcar (Fcdr (tail)); 1230 return Fcar (Fcdr (tail));
1231 if (EQ (tem, Qcategory))
1232 fallback = Fget (Fcar (Fcdr (tail)), prop);
1225 } 1233 }
1226 return Qnil; 1234
1235 return fallback;
1227} 1236}
1228 1237
1229/* Set point in BUFFER to POSITION. If the target position is in 1238/* Set point in BUFFER to POSITION. If the target position is
1230 after an invisible character which is not displayed with a special glyph, 1239 before an invisible character which is not displayed with a special glyph,
1231 move back to an ok place to display. */ 1240 move back to an ok place to display. */
1232 1241
1233void 1242void
@@ -1297,14 +1306,14 @@ set_point (position, buffer)
1297 return; 1306 return;
1298 } 1307 }
1299 1308
1300 /* If the new position is after an invisible character, 1309 /* If the new position is before an invisible character,
1301 move back over all such. */ 1310 move forward over all such. */
1302 while (! NULL_INTERVAL_P (toprev) 1311 while (! NULL_INTERVAL_P (to)
1303 && ! INTERVAL_VISIBLE_P (toprev) 1312 && ! INTERVAL_VISIBLE_P (to)
1304 && ! DISPLAY_INVISIBLE_GLYPH (toprev)) 1313 && ! DISPLAY_INVISIBLE_GLYPH (to))
1305 { 1314 {
1306 to = toprev; 1315 toprev = to;
1307 toprev = previous_interval (toprev); 1316 to = next_interval (to);
1308 position = to->position; 1317 position = to->position;
1309 } 1318 }
1310 1319
@@ -1358,6 +1367,42 @@ temp_set_point (position, buffer)
1358 buffer->text.pt = position; 1367 buffer->text.pt = position;
1359} 1368}
1360 1369
1370/* Return the proper local map for position POSITION in BUFFER.
1371 Use the map specified by the local-map property, if any.
1372 Otherwise, use BUFFER's local map. */
1373
1374Lisp_Object
1375get_local_map (position, buffer)
1376 register int position;
1377 register struct buffer *buffer;
1378{
1379 register INTERVAL interval;
1380 Lisp_Object prop, tem;
1381
1382 if (NULL_INTERVAL_P (buffer->intervals))
1383 return current_buffer->keymap;
1384
1385 /* Perhaps we should just change `position' to the limit. */
1386 if (position > BUF_Z (buffer) || position < BUF_BEG (buffer))
1387 abort ();
1388
1389 /* Position Z is really one past the last char in the buffer. */
1390 if (position == BUF_ZV (buffer))
1391 return current_buffer->keymap;
1392
1393 interval = find_interval (buffer->intervals, position);
1394 prop = textget (interval->plist, Qlocal_map);
1395 if (NILP (prop))
1396 return current_buffer->keymap;
1397
1398 /* Use the local map only if it is valid. */
1399 tem = Fkeymapp (prop);
1400 if (!NILP (tem))
1401 return prop;
1402
1403 return current_buffer->keymap;
1404}
1405
1361/* Call the modification hook functions in LIST, each with START and END. */ 1406/* Call the modification hook functions in LIST, each with START and END. */
1362 1407
1363static void 1408static void
@@ -1430,20 +1475,20 @@ verify_interval_modification (buf, start, end)
1430 1475
1431 if (NULL_INTERVAL_P (prev)) 1476 if (NULL_INTERVAL_P (prev))
1432 { 1477 {
1433 after = textget (i, Qread_only); 1478 after = textget (i->plist, Qread_only);
1434 if (! NILP (after)) 1479 if (! NILP (after))
1435 error ("Attempt to insert within read-only text"); 1480 error ("Attempt to insert within read-only text");
1436 } 1481 }
1437 else if (NULL_INTERVAL_P (i)) 1482 else if (NULL_INTERVAL_P (i))
1438 { 1483 {
1439 before = textget (prev, Qread_only); 1484 before = textget (prev->plist, Qread_only);
1440 if (! NILP (before)) 1485 if (! NILP (before))
1441 error ("Attempt to insert within read-only text"); 1486 error ("Attempt to insert within read-only text");
1442 } 1487 }
1443 else 1488 else
1444 { 1489 {
1445 before = textget (prev, Qread_only); 1490 before = textget (prev->plist, Qread_only);
1446 after = textget (i, Qread_only); 1491 after = textget (i->plist, Qread_only);
1447 if (! NILP (before) && EQ (before, after)) 1492 if (! NILP (before) && EQ (before, after))
1448 error ("Attempt to insert within read-only text"); 1493 error ("Attempt to insert within read-only text");
1449 } 1494 }