Lisp_Object Qinhibit_modification_hooks;
static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
-\f
-#define CHECK_MARKERS() \
- do \
- { \
- if (check_markers_debug_flag) \
- check_markers (); \
- } \
- while (0)
+
+/* Also used in marker.c to enable expensive marker checks. */
+
+#ifdef MARKER_DEBUG
static void
check_markers (void)
abort ();
}
}
-\f
+
+#else /* not MARKER_DEBUG */
+
+#define check_markers() do { } while (0)
+
+#endif /* MARKER_DEBUG */
+
/* Move gap to position CHARPOS.
Note that this can quit! */
was specified or may be where a quit was detected. */
GPT_BYTE = bytepos;
GPT = charpos;
- if (bytepos < charpos)
- abort ();
+ eassert (charpos <= bytepos);
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
QUIT;
}
GPT = charpos;
GPT_BYTE = bytepos;
- if (bytepos < charpos)
- abort ();
+ eassert (charpos <= bytepos);
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
QUIT;
}
for (m = BUF_MARKERS (current_buffer); m; m = m->next)
{
charpos = m->charpos;
-
- if (charpos > Z)
- abort ();
+ eassert (charpos <= Z);
/* If the marker is after the deletion,
relocate by number of chars / bytes deleted. */
}
}
- CHECK_MARKERS ();
+ check_markers ();
}
\f
Z_BYTE += nbytes;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
/* The insert may have been in the unchanged region, so check again. */
if (Z - GPT < END_UNCHANGED)
adjust_point (nchars, nbytes);
- CHECK_MARKERS ();
+ check_markers ();
}
\f
/* Insert the part of the text of STRING, a Lisp object assumed to be
Z_BYTE += outgoing_nbytes;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
/* The insert may have been in the unchanged region, so check again. */
if (Z - GPT < END_UNCHANGED)
adjust_point (nchars, outgoing_nbytes);
- CHECK_MARKERS ();
+ check_markers ();
}
\f
/* Insert a sequence of NCHARS chars which occupy NBYTES bytes
Z_BYTE += nbytes;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
adjust_overlays_for_insert (GPT - nchars, nchars);
adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes,
if (GPT - nchars < PT)
adjust_point (nchars, nbytes);
- CHECK_MARKERS ();
+ check_markers ();
}
\f
/* Insert text from BUF, NCHARS characters starting at CHARPOS, into the
Z_BYTE += outgoing_nbytes;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
/* The insert may have been in the unchanged region, so check again. */
if (Z - GPT < END_UNCHANGED)
if (Z - GPT < END_UNCHANGED)
END_UNCHANGED = Z - GPT;
- CHECK_MARKERS ();
+ check_markers ();
if (len == 0)
evaporate_overlays (from);
ptrdiff_t outgoing_insbytes = insbytes;
Lisp_Object deletion;
- CHECK_MARKERS ();
+ check_markers ();
GCPRO1 (new);
deletion = Qnil;
GPT_BYTE = from_byte;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
if (GPT - BEG < BEG_UNCHANGED)
BEG_UNCHANGED = GPT - BEG;
Z_BYTE += outgoing_insbytes;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
/* Adjust the overlay center as needed. This must be done after
adjusting the markers that bound the overlays. */
if (outgoing_insbytes == 0)
evaporate_overlays (from);
- CHECK_MARKERS ();
+ check_markers ();
MODIFF++;
CHARS_MODIFF = MODIFF;
{
ptrdiff_t nbytes_del, nchars_del;
- CHECK_MARKERS ();
+ check_markers ();
nchars_del = to - from;
nbytes_del = to_byte - from_byte;
GPT_BYTE = from_byte;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
if (GPT - BEG < BEG_UNCHANGED)
BEG_UNCHANGED = GPT - BEG;
Z_BYTE += insbytes;
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
/* Adjust the overlay center as needed. This must be done after
adjusting the markers that bound the overlays. */
if (insbytes == 0)
evaporate_overlays (from);
- CHECK_MARKERS ();
+ check_markers ();
MODIFF++;
CHARS_MODIFF = MODIFF;
register ptrdiff_t nbytes_del, nchars_del;
Lisp_Object deletion;
- CHECK_MARKERS ();
+ check_markers ();
nchars_del = to - from;
nbytes_del = to_byte - from_byte;
needs to access the previous gap contents. */
*(GPT_ADDR) = 0;
- if (GPT_BYTE < GPT)
- abort ();
+ eassert (GPT <= GPT_BYTE);
if (GPT - BEG < BEG_UNCHANGED)
BEG_UNCHANGED = GPT - BEG;
if (Z - GPT < END_UNCHANGED)
END_UNCHANGED = Z - GPT;
- CHECK_MARKERS ();
+ check_markers ();
evaporate_overlays (from);
combine_after_change_list = Qnil;
combine_after_change_buffer = Qnil;
- DEFVAR_BOOL ("check-markers-debug-flag", check_markers_debug_flag,
- doc: /* Non-nil means enable debugging checks for invalid marker positions. */);
- check_markers_debug_flag = 0;
DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls,
doc: /* Used internally by the `combine-after-change-calls' macro. */);
Vcombine_after_change_calls = Qnil;