expansion". */
value = (MODIFF != oldmodiff ? Qt : Qnil);
- if (XBUFFER (Vabbrev_start_location_buffer) != current_buffer)
+ wordstart = 0;
+ if (!(BUFFERP (Vabbrev_start_location_buffer) &&
+ XBUFFER (Vabbrev_start_location_buffer) == current_buffer))
Vabbrev_start_location = Qnil;
if (!NILP (Vabbrev_start_location))
{
CHECK_NUMBER_COERCE_MARKER (tem, 0);
wordstart = XINT (tem);
Vabbrev_start_location = Qnil;
- if (FETCH_CHAR (wordstart) == '-')
+ if (wordstart < BEGV || wordstart > ZV)
+ wordstart = 0;
+ if (wordstart && wordstart != ZV && FETCH_CHAR (wordstart) == '-')
del_range (wordstart, wordstart + 1);
}
- else
+ if (!wordstart)
wordstart = scan_words (point, -1);
if (!wordstart)
if (VECTORP (current_buffer->abbrev_table))
sym = oblookup (current_buffer->abbrev_table, buffer, p - buffer);
else
- XFASTINT (sym) = 0;
+ XSETFASTINT (sym, 0);
if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))
sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer);
if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))
if (INTERACTIVE && !EQ (minibuf_window, selected_window))
{
+ /* Add an undo boundary, in case we are doing this for
+ a self-inserting command which has avoided making one so far. */
SET_PT (wordend);
Fundo_boundary ();
}
if (!abbrev_all_caps)
if (scan_words (point, -1) > scan_words (wordstart, 1))
{
- upcase_initials_region (make_number (wordstart),
- make_number (point));
+ Fupcase_initials_region (make_number (wordstart),
+ make_number (point));
goto caped;
}
/* If expansion is one word, or if user says so, upcase it all. */