changeset 1021:22f807391bec

(Fexpand_abbrev): If pre-expand hook changes the buffer, assume that means we "did an expansion".
author Richard M. Stallman <rms@gnu.org>
date Wed, 19 Aug 1992 07:00:25 +0000
parents 7c2565dd644c
children f7e3bac23a06
files src/abbrev.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/abbrev.c	Wed Aug 19 06:51:44 1992 +0000
+++ b/src/abbrev.c	Wed Aug 19 07:00:25 1992 +0000
@@ -219,9 +219,14 @@
   int uccount = 0, lccount = 0;
   register Lisp_Object sym;
   Lisp_Object expansion, hook, tem;
+  int oldmodiff = MODIFF;
+  Lisp_Object value;
 
   if (!NILP (Vrun_hooks))
     call1 (Vrun_hooks, Qpre_abbrev_expand_hook);
+  /* If the hook changes the buffer, treat that as
+     having "done an expansion".  */
+  value = (MODIFF != oldmodiff ? Qt : Qnil);
 
   if (XBUFFER (Vabbrev_start_location_buffer) != current_buffer)
     Vabbrev_start_location = Qnil;
@@ -238,17 +243,17 @@
     wordstart = scan_words (point, -1);
 
   if (!wordstart)
-    return Qnil;
+    return value;
 
   wordend = scan_words (wordstart, 1);
   if (!wordend)
-    return Qnil;
+    return value;
 
   if (wordend > point)
     wordend = point;
   whitecnt = point - wordend;
   if (wordend <= wordstart)
-    return Qnil;
+    return value;
 
   p = buffer = (char *) alloca (wordend - wordstart);
 
@@ -269,7 +274,7 @@
   if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value))
     sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer);
   if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value))
-    return Qnil;
+    return value;
 
   if (INTERACTIVE && !EQ (minibuf_window, selected_window))
     {