comparison src/insdel.c @ 8647:d66b80e5bc77

(insert_1): New arg INHERIT. (insert_and_inherit): New function.
author Richard M. Stallman <rms@gnu.org>
date Sun, 28 Aug 1994 06:07:37 +0000
parents d4842450463c
children 011660f7aae9
comparison
equal deleted inserted replaced
8646:0f05e3e89f87 8647:d66b80e5bc77
307 register unsigned char *string; 307 register unsigned char *string;
308 register length; 308 register length;
309 { 309 {
310 if (length > 0) 310 if (length > 0)
311 { 311 {
312 insert_1 (string, length); 312 insert_1 (string, length, 0);
313 signal_after_change (PT-length, 0, length); 313 signal_after_change (PT-length, 0, length);
314 } 314 }
315 } 315 }
316 316
317 static void 317 insert_and_inherit (string, length)
318 insert_1 (string, length)
319 register unsigned char *string; 318 register unsigned char *string;
320 register length; 319 register length;
320 {
321 if (length > 0)
322 {
323 insert_1 (string, length, 1);
324 signal_after_change (PT-length, 0, length);
325 }
326 }
327
328 static void
329 insert_1 (string, length, inherit)
330 register unsigned char *string;
331 register length;
332 int inherit;
321 { 333 {
322 register Lisp_Object temp; 334 register Lisp_Object temp;
323 335
324 /* Make sure point-max won't overflow after this insertion. */ 336 /* Make sure point-max won't overflow after this insertion. */
325 XSET (temp, Lisp_Int, length + Z); 337 XSET (temp, Lisp_Int, length + Z);
344 GAP_SIZE -= length; 356 GAP_SIZE -= length;
345 GPT += length; 357 GPT += length;
346 ZV += length; 358 ZV += length;
347 Z += length; 359 Z += length;
348 adjust_point (length); 360 adjust_point (length);
361
362 if (!inherit)
363 Fset_text_properties (make_number (PT - length), make_number (PT),
364 Qnil, Qnil);
349 } 365 }
350 366
351 /* Insert the part of the text of STRING, a Lisp object assumed to be 367 /* Insert the part of the text of STRING, a Lisp object assumed to be
352 of type string, consisting of the LENGTH characters starting at 368 of type string, consisting of the LENGTH characters starting at
353 position POS. If the text of STRING has properties, they are absorbed 369 position POS. If the text of STRING has properties, they are absorbed
440 register int length; 456 register int length;
441 { 457 {
442 if (length > 0) 458 if (length > 0)
443 { 459 {
444 register int opoint = PT; 460 register int opoint = PT;
445 insert_1 (string, length); 461 insert_1 (string, length, 1);
446 adjust_markers (opoint - 1, opoint, length); 462 adjust_markers (opoint - 1, opoint, length);
447 signal_after_change (PT-length, 0, length); 463 signal_after_change (PT-length, 0, length);
448 } 464 }
449 } 465 }
450 466