-
- combined_before_bytes
- = count_combining_before (GPT_ADDR, outgoing_insbytes, from, from_byte);
- combined_after_bytes
- = count_combining_after (GPT_ADDR, outgoing_insbytes, from, from_byte);
-
- if (combined_before_bytes && from == BEGV
- || combined_after_bytes && from == ZV)
- {
- /* Bytes are being combined across the region boundary. We
- should avoid it. We recover the original contents before
- signaling an error. */
- bcopy (XSTRING (deletion)->data, GPT_ADDR, nbytes_del);
- GAP_SIZE -= nbytes_del;
- ZV += nchars_del;
- Z += nchars_del;
- ZV_BYTE += nbytes_del;
- Z_BYTE += nbytes_del;
- GPT = from + nchars_del;
- GPT_BYTE = from_byte + nbytes_del;
- *(GPT_ADDR) = 0; /* Put an anchor. */
- if (markers)
- adjust_markers_for_insert (from, from_byte, to, to_byte, 0, 0, 0);
- UNGCPRO;
- byte_combining_error ();
- GCPRO1 (new);
- }
-
- /* Record deletion of the surrounding text that combines with
- the insertion. This, together with recording the insertion,
- will add up to the right stuff in the undo list.
-
- But there is no need to actually delete the combining bytes
- from the buffer and reinsert them. */
-
- if (combined_after_bytes)
- {
- Lisp_Object deletion;
- deletion = Qnil;
-
- if (! EQ (current_buffer->undo_list, Qt))
- deletion = make_buffer_string_both (from, from_byte,
- from + combined_after_bytes,
- from_byte + combined_after_bytes,
- 1);
-
- adjust_markers_for_record_delete (from, from_byte,
- from + combined_after_bytes,
- from_byte + combined_after_bytes);
- if (! EQ (current_buffer->undo_list, Qt))
- record_delete (from + nchars_del, deletion);
- }
-
- if (combined_before_bytes)
- {
- Lisp_Object deletion;
- deletion = Qnil;
-
- if (! EQ (current_buffer->undo_list, Qt))
- deletion = make_buffer_string_both (from - 1, CHAR_TO_BYTE (from - 1),
- from, from_byte, 1);
- adjust_markers_for_record_delete (from - 1, CHAR_TO_BYTE (from - 1),
- from, from_byte);
- if (! EQ (current_buffer->undo_list, Qt))
- record_delete (from - 1, deletion);
- }