Mercurial > emacs
comparison src/abbrev.c @ 9140:3e7833a8e16f
(Fdefine_abbrev, Fexpand_abbrev, Funexpand_abbrev): Use type test macros.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 27 Sep 1994 03:12:28 +0000 |
parents | ddb22c22a80d |
children | 945ddb4e9e24 |
comparison
equal
deleted
inserted
replaced
9139:127823d9444d | 9140:3e7833a8e16f |
---|---|
123 sym = Fintern (name, table); | 123 sym = Fintern (name, table); |
124 | 124 |
125 oexp = XSYMBOL (sym)->value; | 125 oexp = XSYMBOL (sym)->value; |
126 ohook = XSYMBOL (sym)->function; | 126 ohook = XSYMBOL (sym)->function; |
127 if (!((EQ (oexp, expansion) | 127 if (!((EQ (oexp, expansion) |
128 || (XTYPE (oexp) == Lisp_String && XTYPE (expansion) == Lisp_String | 128 || (STRINGP (oexp) && STRINGP (expansion) |
129 && (tem = Fstring_equal (oexp, expansion), !NILP (tem)))) | 129 && (tem = Fstring_equal (oexp, expansion), !NILP (tem)))) |
130 && | 130 && |
131 (EQ (ohook, hook) | 131 (EQ (ohook, hook) |
132 || (tem = Fequal (ohook, hook), !NILP (tem))))) | 132 || (tem = Fequal (ohook, hook), !NILP (tem))))) |
133 abbrevs_changed = 1; | 133 abbrevs_changed = 1; |
266 else if (! NOCASEP (c)) | 266 else if (! NOCASEP (c)) |
267 lccount++; | 267 lccount++; |
268 *p++ = c; | 268 *p++ = c; |
269 } | 269 } |
270 | 270 |
271 if (XTYPE (current_buffer->abbrev_table) == Lisp_Vector) | 271 if (VECTORP (current_buffer->abbrev_table)) |
272 sym = oblookup (current_buffer->abbrev_table, buffer, p - buffer); | 272 sym = oblookup (current_buffer->abbrev_table, buffer, p - buffer); |
273 else | 273 else |
274 XFASTINT (sym) = 0; | 274 XFASTINT (sym) = 0; |
275 if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value)) | 275 if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value)) |
276 sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer); | 276 sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer); |
277 if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value)) | 277 if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value)) |
278 return value; | 278 return value; |
279 | 279 |
280 if (INTERACTIVE && !EQ (minibuf_window, selected_window)) | 280 if (INTERACTIVE && !EQ (minibuf_window, selected_window)) |
281 { | 281 { |
282 SET_PT (wordend); | 282 SET_PT (wordend); |
289 | 289 |
290 /* Now sym is the abbrev symbol. */ | 290 /* Now sym is the abbrev symbol. */ |
291 Vlast_abbrev = sym; | 291 Vlast_abbrev = sym; |
292 last_abbrev_point = wordstart; | 292 last_abbrev_point = wordstart; |
293 | 293 |
294 if (XTYPE (XSYMBOL (sym)->plist) == Lisp_Int) | 294 if (INTEGERP (XSYMBOL (sym)->plist)) |
295 XSETINT (XSYMBOL (sym)->plist, | 295 XSETINT (XSYMBOL (sym)->plist, |
296 XINT (XSYMBOL (sym)->plist) + 1); /* Increment use count */ | 296 XINT (XSYMBOL (sym)->plist) + 1); /* Increment use count */ |
297 | 297 |
298 expansion = XSYMBOL (sym)->value; | 298 expansion = XSYMBOL (sym)->value; |
299 insert_from_string (expansion, 0, XSTRING (expansion)->size, 1); | 299 insert_from_string (expansion, 0, XSTRING (expansion)->size, 1); |
347 int adjust = 0; | 347 int adjust = 0; |
348 if (last_abbrev_point < BEGV | 348 if (last_abbrev_point < BEGV |
349 || last_abbrev_point > ZV) | 349 || last_abbrev_point > ZV) |
350 return Qnil; | 350 return Qnil; |
351 SET_PT (last_abbrev_point); | 351 SET_PT (last_abbrev_point); |
352 if (XTYPE (Vlast_abbrev_text) == Lisp_String) | 352 if (STRINGP (Vlast_abbrev_text)) |
353 { | 353 { |
354 /* This isn't correct if Vlast_abbrev->function was used | 354 /* This isn't correct if Vlast_abbrev->function was used |
355 to do the expansion */ | 355 to do the expansion */ |
356 Lisp_Object val; | 356 Lisp_Object val; |
357 val = XSYMBOL (Vlast_abbrev)->value; | 357 val = XSYMBOL (Vlast_abbrev)->value; |
358 if (XTYPE (val) != Lisp_String) | 358 if (!STRINGP (val)) |
359 error ("value of abbrev-symbol must be a string"); | 359 error ("value of abbrev-symbol must be a string"); |
360 adjust = XSTRING (val)->size; | 360 adjust = XSTRING (val)->size; |
361 del_range (point, point + adjust); | 361 del_range (point, point + adjust); |
362 /* Don't inherit properties here; just copy from old contents. */ | 362 /* Don't inherit properties here; just copy from old contents. */ |
363 insert_from_string (Vlast_abbrev_text, 0, | 363 insert_from_string (Vlast_abbrev_text, 0, |