Mercurial > emacs
comparison src/intervals.c @ 5169:d040c1a8ccbe
(graft_intervals_into_buffer): New arg LENGTH.
If source has no intervals, set dest properties to nil.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 25 Nov 1993 06:28:03 +0000 |
parents | 99edf052bfa0 |
children | d48ba25b35bf |
comparison
equal
deleted
inserted
replaced
5168:b30763a185e9 | 5169:d040c1a8ccbe |
---|---|
1219 return slot; | 1219 return slot; |
1220 } | 1220 } |
1221 #endif | 1221 #endif |
1222 | 1222 |
1223 /* Insert the intervals of SOURCE into BUFFER at POSITION. | 1223 /* Insert the intervals of SOURCE into BUFFER at POSITION. |
1224 LENGTH is the length of the text in SOURCE. | |
1224 | 1225 |
1225 This is used in insdel.c when inserting Lisp_Strings into the | 1226 This is used in insdel.c when inserting Lisp_Strings into the |
1226 buffer. The text corresponding to SOURCE is already in the buffer | 1227 buffer. The text corresponding to SOURCE is already in the buffer |
1227 when this is called. The intervals of new tree are a copy of those | 1228 when this is called. The intervals of new tree are a copy of those |
1228 belonging to the string being inserted; intervals are never | 1229 belonging to the string being inserted; intervals are never |
1229 shared. | 1230 shared. |
1230 | 1231 |
1231 If the inserted text had no intervals associated, this function | 1232 If the inserted text had no intervals associated, and we don't |
1233 want to inherit the surrounding text's properties, this function | |
1232 simply returns -- offset_intervals should handle placing the | 1234 simply returns -- offset_intervals should handle placing the |
1233 text in the correct interval, depending on the sticky bits. | 1235 text in the correct interval, depending on the sticky bits. |
1234 | 1236 |
1235 If the inserted text had properties (intervals), then there are two | 1237 If the inserted text had properties (intervals), then there are two |
1236 cases -- either insertion happened in the middle of some interval, | 1238 cases -- either insertion happened in the middle of some interval, |
1251 only its properties, as if neither sticky property were set. Perhaps | 1253 only its properties, as if neither sticky property were set. Perhaps |
1252 we should consider merging all three sets of properties onto the new | 1254 we should consider merging all three sets of properties onto the new |
1253 text... */ | 1255 text... */ |
1254 | 1256 |
1255 void | 1257 void |
1256 graft_intervals_into_buffer (source, position, buffer, inherit) | 1258 graft_intervals_into_buffer (source, position, length, buffer, inherit) |
1257 INTERVAL source; | 1259 INTERVAL source; |
1258 int position; | 1260 int position, length; |
1259 struct buffer *buffer; | 1261 struct buffer *buffer; |
1260 int inherit; | 1262 int inherit; |
1261 { | 1263 { |
1262 register INTERVAL under, over, this, prev; | 1264 register INTERVAL under, over, this, prev; |
1263 register INTERVAL tree = buffer->intervals; | 1265 register INTERVAL tree = buffer->intervals; |
1264 int middle; | 1266 int middle; |
1265 | 1267 |
1266 /* If the new text has no properties, it becomes part of whatever | 1268 /* If the new text has no properties, it becomes part of whatever |
1267 interval it was inserted into. */ | 1269 interval it was inserted into. */ |
1268 if (NULL_INTERVAL_P (source)) | 1270 if (NULL_INTERVAL_P (source)) |
1269 return; | 1271 { |
1272 Lisp_Object buf; | |
1273 if (!inherit) | |
1274 { | |
1275 XSET (buf, Lisp_Buffer, buffer); | |
1276 Fset_text_properties (make_number (position), | |
1277 make_number (position + length), | |
1278 Qnil, buf); | |
1279 } | |
1280 return; | |
1281 } | |
1270 | 1282 |
1271 if (NULL_INTERVAL_P (tree)) | 1283 if (NULL_INTERVAL_P (tree)) |
1272 { | 1284 { |
1273 /* The inserted text constitutes the whole buffer, so | 1285 /* The inserted text constitutes the whole buffer, so |
1274 simply copy over the interval structure. */ | 1286 simply copy over the interval structure. */ |