oexp = XSYMBOL (sym)->value;
ohook = XSYMBOL (sym)->function;
if (!((EQ (oexp, expansion)
- || (XTYPE (oexp) == Lisp_String && XTYPE (expansion) == Lisp_String
+ || (STRINGP (oexp) && STRINGP (expansion)
&& (tem = Fstring_equal (oexp, expansion), !NILP (tem))))
&&
(EQ (ohook, hook)
DEFUN ("define-global-abbrev", Fdefine_global_abbrev, Sdefine_global_abbrev, 2, 2,
"sDefine global abbrev: \nsExpansion for %s: ",
"Define ABBREV as a global abbreviation for EXPANSION.")
- (name, expansion)
- Lisp_Object name, expansion;
+ (abbrev, expansion)
+ Lisp_Object abbrev, expansion;
{
- Fdefine_abbrev (Vglobal_abbrev_table, Fdowncase (name),
+ Fdefine_abbrev (Vglobal_abbrev_table, Fdowncase (abbrev),
expansion, Qnil, make_number (0));
- return name;
+ return abbrev;
}
DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, Sdefine_mode_abbrev, 2, 2,
"sDefine mode abbrev: \nsExpansion for %s: ",
"Define ABBREV as a mode-specific abbreviation for EXPANSION.")
- (name, expansion)
- Lisp_Object name, expansion;
+ (abbrev, expansion)
+ Lisp_Object abbrev, expansion;
{
if (NILP (current_buffer->abbrev_table))
error ("Major mode has no abbrev table");
- Fdefine_abbrev (current_buffer->abbrev_table, Fdowncase (name),
+ Fdefine_abbrev (current_buffer->abbrev_table, Fdowncase (abbrev),
expansion, Qnil, make_number (0));
- return name;
+ return abbrev;
}
DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_symbol, 1, 2, 0,
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)
*p++ = c;
}
- if (XTYPE (current_buffer->abbrev_table) == Lisp_Vector)
+ if (VECTORP (current_buffer->abbrev_table))
sym = oblookup (current_buffer->abbrev_table, buffer, p - buffer);
else
- XFASTINT (sym) = 0;
- if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value))
+ XSETFASTINT (sym, 0);
+ if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))
sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer);
- if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value))
+ if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))
return 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 ();
}
Vlast_abbrev = sym;
last_abbrev_point = wordstart;
- if (XTYPE (XSYMBOL (sym)->plist) == Lisp_Int)
+ if (INTEGERP (XSYMBOL (sym)->plist))
XSETINT (XSYMBOL (sym)->plist,
XINT (XSYMBOL (sym)->plist) + 1); /* Increment use count */
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. */
|| last_abbrev_point > ZV)
return Qnil;
SET_PT (last_abbrev_point);
- if (XTYPE (Vlast_abbrev_text) == Lisp_String)
+ if (STRINGP (Vlast_abbrev_text))
{
/* This isn't correct if Vlast_abbrev->function was used
to do the expansion */
Lisp_Object val;
val = XSYMBOL (Vlast_abbrev)->value;
- if (XTYPE (val) != Lisp_String)
+ if (!STRINGP (val))
error ("value of abbrev-symbol must be a string");
adjust = XSTRING (val)->size;
del_range (point, point + adjust);
if (NILP (XSYMBOL (sym)->value))
return;
insert (" (", 5);
- XSET (name, Lisp_String, XSYMBOL (sym)->name);
+ XSETSTRING (name, XSYMBOL (sym)->name);
Fprin1 (name, stream);
insert (" ", 1);
Fprin1 (XSYMBOL (sym)->value, stream);
1, 2, 0,
"Insert before point a full description of abbrev table named NAME.\n\
NAME is a symbol whose value is an abbrev table.\n\
-If optional 2nd arg HUMAN is non-nil, a human-readable description is inserted.\n\
-Otherwise the description is an expression,\n\
+If optional 2nd arg READABLE is non-nil, a human-readable description\n\
+is inserted. Otherwise the description is an expression,\n\
a call to `define-abbrev-table', which would\n\
define the abbrev table NAME exactly as it is currently defined.")
(name, readable)
table = Fsymbol_value (name);
CHECK_VECTOR (table, 0);
- XSET (stream, Lisp_Buffer, current_buffer);
+ XSETBUFFER (stream, current_buffer);
if (!NILP (readable))
{
\f
DEFUN ("define-abbrev-table", Fdefine_abbrev_table, Sdefine_abbrev_table,
2, 2, 0,
- "Define TABNAME (a symbol) as an abbrev table name.\n\
+ "Define TABLENAME (a symbol) as an abbrev table name.\n\
Define abbrevs in it according to DEFINITIONS, which is a list of elements\n\
of the form (ABBREVNAME EXPANSION HOOK USECOUNT).")
- (tabname, defns)
- Lisp_Object tabname, defns;
+ (tablename, defns)
+ Lisp_Object tablename, defns;
{
Lisp_Object name, exp, hook, count;
Lisp_Object table, elt;
- CHECK_SYMBOL (tabname, 0);
- table = Fboundp (tabname);
- if (NILP (table) || (table = Fsymbol_value (tabname), NILP (table)))
+ CHECK_SYMBOL (tablename, 0);
+ table = Fboundp (tablename);
+ if (NILP (table) || (table = Fsymbol_value (tablename), NILP (table)))
{
table = Fmake_abbrev_table ();
- Fset (tabname, table);
+ Fset (tablename, table);
Vabbrev_table_name_list =
- Fcons (tabname, Vabbrev_table_name_list);
+ Fcons (tablename, Vabbrev_table_name_list);
}
CHECK_VECTOR (table, 0);
- for (;!NILP (defns); defns = Fcdr (defns))
+ for (;!NILP (definitions); definitions = Fcdr (definitions))
{
- elt = Fcar (defns);
+ elt = Fcar (definitions);
name = Fcar (elt); elt = Fcdr (elt);
exp = Fcar (elt); elt = Fcdr (elt);
hook = Fcar (elt); elt = Fcdr (elt);