void
insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail)
{
- int ins_charpos = GPT;
- int ins_bytepos = GPT_BYTE;
+ ptrdiff_t ins_charpos = GPT, ins_bytepos = GPT_BYTE;
if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
nchars = nbytes;
ptrdiff_t outgoing_nbytes = incoming_nbytes;
INTERVAL intervals;
+ if (nchars == 0)
+ return;
+
/* Make OUTGOING_NBYTES describe the text
as it will be inserted in this buffer. */
bset_point_before_scroll (current_buffer, Qnil);
}
+Lisp_Object Qregion_extract_function;
+
/* Check that it is okay to modify the buffer between START and END,
which are char positions.
#endif /* not CLASH_DETECTION */
/* If `select-active-regions' is non-nil, save the region text. */
+ /* FIXME: Move this to Elisp (via before-change-functions). */
if (!NILP (BVAR (current_buffer, mark_active))
&& !inhibit_modification_hooks
&& XMARKER (BVAR (current_buffer, mark))->buffer
{
ptrdiff_t b = marker_position (BVAR (current_buffer, mark));
ptrdiff_t e = PT;
- if (b < e)
- Vsaved_region_selection = make_buffer_string (b, e, 0);
- else if (b > e)
- Vsaved_region_selection = make_buffer_string (e, b, 0);
+ Vsaved_region_selection
+ = call1 (Fsymbol_value (Qregion_extract_function), Qnil);
}
signal_before_change (start, end, preserve_ptr);
inhibit_modification_hooks = 0;
DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks");
+ DEFSYM (Qregion_extract_function, "region-extract-function");
+
defsubr (&Scombine_after_change_execute);
}