# HG changeset patch # User Richard M. Stallman # Date 893809214 0 # Node ID 4dbf2af94988231d3e22c82599c5ec20a9281f77 # Parent 4229613c19822c57410f934049d8bd7f7bc4efcf (insert_1_both): Call prepare_to_modify_buffer before moving or making gap. (insert_from_string_1): Don't check max buffer size here. diff -r 4229613c1982 -r 4dbf2af94988 src/insdel.c --- a/src/insdel.c Tue Apr 28 23:41:15 1998 +0000 +++ b/src/insdel.c Wed Apr 29 00:20:14 1998 +0000 @@ -1020,14 +1020,17 @@ if (NILP (current_buffer->enable_multibyte_characters)) nchars = nbytes; + if (prepare) + /* Do this before moving and increasing the gap, + because the before-change hooks might move the gap + or make it smaller. */ + prepare_to_modify_buffer (PT, PT, NULL); + if (PT != GPT) move_gap_both (PT, PT_BYTE); if (GAP_SIZE < nbytes) make_gap (nbytes - GAP_SIZE); - if (prepare) - prepare_to_modify_buffer (PT, PT, NULL); - combined_before_bytes = count_combining_before (string, nbytes, PT, PT_BYTE); combined_after_bytes @@ -1179,12 +1182,10 @@ = count_size_as_multibyte (&XSTRING (string)->data[pos_byte], nbytes); - /* Make sure point-max won't overflow after this insertion. */ - XSETINT (temp, outgoing_nbytes + Z); - if (outgoing_nbytes + Z != XINT (temp)) - error ("Maximum buffer size exceeded"); - GCPRO1 (string); + /* Do this before moving and increasing the gap, + because the before-change hooks might move the gap + or make it smaller. */ prepare_to_modify_buffer (PT, PT, NULL); if (PT != GPT) @@ -1342,6 +1343,9 @@ if (outgoing_nbytes + Z != XINT (temp)) error ("Maximum buffer size exceeded"); + /* Do this before moving and increasing the gap, + because the before-change hooks might move the gap + or make it smaller. */ prepare_to_modify_buffer (PT, PT, NULL); if (PT != GPT)