Lisp_Object Qinhibit_modification_hooks;
+extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly;
+
\f
/* Check all markers in the current buffer, looking for something invalid. */
/* Move at most 32000 chars before checking again for a quit. */
if (i > 32000)
i = 32000;
-#ifdef GAP_USE_BCOPY
- if (i >= 128
- /* bcopy is safe if the two areas of memory do not overlap
- or on systems where bcopy is always safe for moving upward. */
- && (BCOPY_UPWARD_SAFE
- || to - from >= 128))
- {
- /* If overlap is not safe, avoid it by not moving too many
- characters at once. */
- if (!BCOPY_UPWARD_SAFE && i > to - from)
- i = to - from;
- new_s1 -= i;
- from -= i, to -= i;
- bcopy (from, to, i);
- }
- else
-#endif
- {
- new_s1 -= i;
- while (--i >= 0)
- *--to = *--from;
- }
+ new_s1 -= i;
+ from -= i, to -= i;
+ memmove (to, from, i);
}
/* Adjust markers, and buffer data structure, to put the gap at BYTEPOS.
/* Move at most 32000 chars before checking again for a quit. */
if (i > 32000)
i = 32000;
-#ifdef GAP_USE_BCOPY
- if (i >= 128
- /* bcopy is safe if the two areas of memory do not overlap
- or on systems where bcopy is always safe for moving downward. */
- && (BCOPY_DOWNWARD_SAFE
- || from - to >= 128))
- {
- /* If overlap is not safe, avoid it by not moving too many
- characters at once. */
- if (!BCOPY_DOWNWARD_SAFE && i > from - to)
- i = from - to;
- new_s1 += i;
- bcopy (from, to, i);
- from += i, to += i;
- }
- else
-#endif
- {
- new_s1 += i;
- while (--i >= 0)
- *to++ = *from++;
- }
+ new_s1 += i;
+ memmove (to, from, i);
+ from += i, to += i;
}
adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
/* Pretend that the last unwanted part of the gap is the entire gap,
and that the first desired part of the gap is part of the buffer
text. */
- bzero (GPT_ADDR, new_gap_size);
+ memset (GPT_ADDR, 0, new_gap_size);
GPT += new_gap_size;
GPT_BYTE += new_gap_size;
Z += new_gap_size;
{
if (from_multibyte == to_multibyte)
{
- bcopy (from_addr, to_addr, nbytes);
+ memcpy (to_addr, from_addr, nbytes);
return nbytes;
}
else if (from_multibyte)
MODIFF++;
CHARS_MODIFF = MODIFF;
- bcopy (string, GPT_ADDR, nbytes);
+ memcpy (GPT_ADDR, string, nbytes);
GAP_SIZE -= nbytes;
GPT += nchars;
copy them into the buffer.
It does not work to use `insert' for this, because a GC could happen
- before we bcopy the stuff into the buffer, and relocate the string
+ before we copy the stuff into the buffer, and relocate the string
without insert noticing. */
void
into the current buffer.
It does not work to use `insert' for this, because a malloc could happen
- and relocate BUF's text before the bcopy happens. */
+ and relocate BUF's text before the copy happens. */
void
insert_from_buffer (struct buffer *buf,
void
replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
EMACS_INT to, EMACS_INT to_byte,
- char *ins, EMACS_INT inschars, EMACS_INT insbytes,
+ const char *ins, EMACS_INT inschars, EMACS_INT insbytes,
int markers)
{
EMACS_INT nbytes_del, nchars_del;
make_gap (insbytes - GAP_SIZE);
/* Copy the replacement text into the buffer. */
- bcopy (ins, GPT_ADDR, insbytes);
+ memcpy (GPT_ADDR, ins, insbytes);
#ifdef BYTE_COMBINING_DEBUG
/* We have copied text into the gap, but we have not marked
base_buffer->filename);
#endif /* not CLASH_DETECTION */
+ /* If `select-active-regions' is non-nil, save the region text. */
+ if (!NILP (current_buffer->mark_active)
+ && !inhibit_modification_hooks
+ && XMARKER (current_buffer->mark)->buffer
+ && NILP (Vsaved_region_selection)
+ && (EQ (Vselect_active_regions, Qonly)
+ ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
+ : (!NILP (Vselect_active_regions)
+ && !NILP (Vtransient_mark_mode))))
+ {
+ EMACS_INT b = XMARKER (current_buffer->mark)->charpos;
+ EMACS_INT 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);
+ }
+
signal_before_change (start, end, preserve_ptr);
if (current_buffer->newline_cache)
DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
Scombine_after_change_execute, 0, 0, 0,
doc: /* This function is for use internally in `combine-after-change-calls'. */)
- ()
+ (void)
{
int count = SPECPDL_INDEX ();
EMACS_INT beg, end, change;