EMACS_INT, EMACS_INT, EMACS_INT);
static void adjust_point (EMACS_INT nchars, EMACS_INT nbytes);
-Lisp_Object Fcombine_after_change_execute ();
+Lisp_Object Fcombine_after_change_execute (void);
/* Non-nil means don't call the after-change-functions right away,
- just record an element in Vcombine_after_change_calls_list. */
+ just record an element in combine_after_change_list. */
Lisp_Object Vcombine_after_change_calls;
/* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT)
Lisp_Object combine_after_change_buffer;
Lisp_Object Qinhibit_modification_hooks;
-
\f
/* Check all markers in the current buffer, looking for something invalid. */
else
void
-check_markers ()
+check_markers (void)
{
register struct Lisp_Marker *tail;
int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
/* 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,
}
/* Adjusting only markers whose insertion-type is t may result in
- - disordered start and end in overlays, and
+ - disordered start and end in overlays, and
- disordered overlays in the slot `overlays_before' of current_buffer. */
if (adjusted)
{
/* 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)
len = 1;
p = BYTE_POS_ADDR (pos_byte - 1);
while (! CHAR_HEAD_P (*p)) p--, len++;
- if (! BASE_LEADING_CODE_P (*p)) /* case (3) */
+ if (! LEADING_CODE_P (*p)) /* case (3) */
return 0;
combining_bytes = BYTES_BY_CHAR_HEAD (*p) - len;
i = pos_byte - 2;
while (i >= 0 && ! CHAR_HEAD_P (p[i]))
i--;
- if (i < 0 || !BASE_LEADING_CODE_P (p[i]))
+ if (i < 0 || !LEADING_CODE_P (p[i]))
return 0;
bytes = BYTES_BY_CHAR_HEAD (p[i]);
? 0
: bytes - (pos_byte - 1 - i + length));
}
- if (!BASE_LEADING_CODE_P (string[i]))
+ if (!LEADING_CODE_P (string[i]))
return 0;
bytes = BYTES_BY_CHAR_HEAD (string[i]) - (length - i);
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)
NO-ERROR-FLAG is nil if there was an error,
anything else meaning no error (so this function does nothing). */
Lisp_Object
-reset_var_on_error (val)
- Lisp_Object val;
+reset_var_on_error (Lisp_Object val)
{
if (NILP (XCDR (val)))
Fset (XCAR (val), Qnil);
}
Lisp_Object
-Fcombine_after_change_execute_1 (val)
- Lisp_Object val;
+Fcombine_after_change_execute_1 (Lisp_Object val)
{
Vcombine_after_change_calls = val;
return val;
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;
}
\f
void
-syms_of_insdel ()
+syms_of_insdel (void)
{
staticpro (&combine_after_change_list);
staticpro (&combine_after_change_buffer);
defsubr (&Scombine_after_change_execute);
}
-/* arch-tag: 9b34b886-47d7-465e-a234-299af411b23d
- (do not change this comment) */