diff options
| author | Joseph Arceneaux | 1992-10-01 00:56:11 +0000 |
|---|---|---|
| committer | Joseph Arceneaux | 1992-10-01 00:56:11 +0000 |
| commit | 679194a6a0e5f6002ddc2b554e2a4b15c39fc298 (patch) | |
| tree | 88abe24f788f3b61756e8e5d492e4e60032a8c90 | |
| parent | d7e3e52b6ebb938b5ef5935a41f33726eb8d9bff (diff) | |
| download | emacs-679194a6a0e5f6002ddc2b554e2a4b15c39fc298.tar.gz emacs-679194a6a0e5f6002ddc2b554e2a4b15c39fc298.zip | |
* insdel.c: #include "intervals.h"
(prepare_to_modify_buffer): Call verify_interval_modification().
(insert_from_string): Call offset_intervals() and
graft_intervals_into_buffer().
(del_range): Call offset_intervals().
(insert): Call offset_intervals().
| -rw-r--r-- | src/insdel.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/insdel.c b/src/insdel.c index 489f80f1ea3..256102dfe9d 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -20,6 +20,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 20 | 20 | ||
| 21 | #include "config.h" | 21 | #include "config.h" |
| 22 | #include "lisp.h" | 22 | #include "lisp.h" |
| 23 | #include "intervals.h" | ||
| 23 | #include "buffer.h" | 24 | #include "buffer.h" |
| 24 | #include "window.h" | 25 | #include "window.h" |
| 25 | 26 | ||
| @@ -305,6 +306,9 @@ insert (string, length) | |||
| 305 | 306 | ||
| 306 | bcopy (string, GPT_ADDR, length); | 307 | bcopy (string, GPT_ADDR, length); |
| 307 | 308 | ||
| 309 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | ||
| 310 | offset_intervals (current_buffer, point, length); | ||
| 311 | |||
| 308 | GAP_SIZE -= length; | 312 | GAP_SIZE -= length; |
| 309 | GPT += length; | 313 | GPT += length; |
| 310 | ZV += length; | 314 | ZV += length; |
| @@ -314,11 +318,15 @@ insert (string, length) | |||
| 314 | signal_after_change (point-length, 0, length); | 318 | signal_after_change (point-length, 0, length); |
| 315 | } | 319 | } |
| 316 | 320 | ||
| 317 | /* Function to insert part of the text of a string (STRING) consisting | 321 | /* Insert the part of the text of STRING, a Lisp object assumed to be |
| 318 | of LENGTH characters at position POS. | 322 | of type string, consisting of the LENGTH characters starting at |
| 319 | It does not work to use `insert' for this, becase a GC could happen | 323 | position POS. If the text of STRING has properties, they are absorbed |
| 324 | into the buffer. | ||
| 325 | |||
| 326 | It does not work to use `insert' for this, because a GC could happen | ||
| 320 | before we bcopy the stuff into the buffer, and relocate the string | 327 | before we bcopy the stuff into the buffer, and relocate the string |
| 321 | without insert noticing. */ | 328 | without insert noticing. */ |
| 329 | |||
| 322 | insert_from_string (string, pos, length) | 330 | insert_from_string (string, pos, length) |
| 323 | Lisp_Object string; | 331 | Lisp_Object string; |
| 324 | register int pos, length; | 332 | register int pos, length; |
| @@ -348,10 +356,18 @@ insert_from_string (string, pos, length) | |||
| 348 | 356 | ||
| 349 | bcopy (XSTRING (string)->data, GPT_ADDR, length); | 357 | bcopy (XSTRING (string)->data, GPT_ADDR, length); |
| 350 | 358 | ||
| 359 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | ||
| 360 | offset_intervals (current_buffer, point, length); | ||
| 361 | |||
| 351 | GAP_SIZE -= length; | 362 | GAP_SIZE -= length; |
| 352 | GPT += length; | 363 | GPT += length; |
| 353 | ZV += length; | 364 | ZV += length; |
| 354 | Z += length; | 365 | Z += length; |
| 366 | |||
| 367 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | ||
| 368 | graft_intervals_into_buffer (XSTRING (string)->intervals, point, | ||
| 369 | current_buffer); | ||
| 370 | |||
| 355 | SET_PT (point + length); | 371 | SET_PT (point + length); |
| 356 | 372 | ||
| 357 | signal_after_change (point-length, 0, length); | 373 | signal_after_change (point-length, 0, length); |
| @@ -428,6 +444,9 @@ del_range (from, to) | |||
| 428 | record_delete (from, numdel); | 444 | record_delete (from, numdel); |
| 429 | MODIFF++; | 445 | MODIFF++; |
| 430 | 446 | ||
| 447 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | ||
| 448 | offset_intervals (current_buffer, point, - numdel); | ||
| 449 | |||
| 431 | /* Relocate point as if it were a marker. */ | 450 | /* Relocate point as if it were a marker. */ |
| 432 | if (from < point) | 451 | if (from < point) |
| 433 | { | 452 | { |
| @@ -468,7 +487,9 @@ modify_region (start, end) | |||
| 468 | } | 487 | } |
| 469 | 488 | ||
| 470 | /* Check that it is okay to modify the buffer between START and END. | 489 | /* Check that it is okay to modify the buffer between START and END. |
| 471 | Run the before-change-function, if any. */ | 490 | Run the before-change-function, if any. If intervals are in use, |
| 491 | verify that the text to be modified is not read-only, and call | ||
| 492 | any modification properties the text may have. */ | ||
| 472 | 493 | ||
| 473 | prepare_to_modify_buffer (start, end) | 494 | prepare_to_modify_buffer (start, end) |
| 474 | Lisp_Object start, end; | 495 | Lisp_Object start, end; |
| @@ -476,8 +497,13 @@ prepare_to_modify_buffer (start, end) | |||
| 476 | if (!NILP (current_buffer->read_only)) | 497 | if (!NILP (current_buffer->read_only)) |
| 477 | Fbarf_if_buffer_read_only (); | 498 | Fbarf_if_buffer_read_only (); |
| 478 | 499 | ||
| 500 | #if 0 /* Superceded by interval code */ | ||
| 479 | if (check_protected_fields) | 501 | if (check_protected_fields) |
| 480 | Fregion_fields (start, end, Qnil, Qt); | 502 | Fregion_fields (start, end, Qnil, Qt); |
| 503 | #endif | ||
| 504 | |||
| 505 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | ||
| 506 | verify_interval_modification (current_buffer, start, end); | ||
| 481 | 507 | ||
| 482 | #ifdef CLASH_DETECTION | 508 | #ifdef CLASH_DETECTION |
| 483 | if (!NILP (current_buffer->filename) | 509 | if (!NILP (current_buffer->filename) |