summaryrefslogtreecommitdiff
path: root/src/abbrev.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1992-08-19 07:00:25 +0000
committerRichard M. Stallman <rms@gnu.org>1992-08-19 07:00:25 +0000
commit36fb1e49f9313167bac1f91c43aea294c969a69b (patch)
tree51ab01826e628a97ecf32c606d379692596a7c8a /src/abbrev.c
parent4174beab4e869d9adfcfe9528ddac9be66036dc4 (diff)
downloademacs-36fb1e49f9313167bac1f91c43aea294c969a69b.tar.gz
(Fexpand_abbrev): If pre-expand hook changes the buffer,
assume that means we "did an expansion".
Diffstat (limited to 'src/abbrev.c')
-rw-r--r--src/abbrev.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/abbrev.c b/src/abbrev.c
index 414a3e98b48..2fa55408008 100644
--- a/src/abbrev.c
+++ b/src/abbrev.c
@@ -219,9 +219,14 @@ Returns t if expansion took place.")
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 @@ Returns t if expansion took place.")
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 @@ Returns t if expansion took place.")
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))
{