aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-08-19 07:00:25 +0000
committerRichard M. Stallman1992-08-19 07:00:25 +0000
commitba70da8ff5f8a9387b977d4534a08ac3a577d9a6 (patch)
tree738827f01ae51c9111a39a09badfb5ff55f82ade
parent16bd92ea65af7b8db9e57009c7a46ffc004fbf7c (diff)
downloademacs-ba70da8ff5f8a9387b977d4534a08ac3a577d9a6.tar.gz
emacs-ba70da8ff5f8a9387b977d4534a08ac3a577d9a6.zip
(Fexpand_abbrev): If pre-expand hook changes the buffer,
assume that means we "did an expansion".
-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.")
219 int uccount = 0, lccount = 0; 219 int uccount = 0, lccount = 0;
220 register Lisp_Object sym; 220 register Lisp_Object sym;
221 Lisp_Object expansion, hook, tem; 221 Lisp_Object expansion, hook, tem;
222 int oldmodiff = MODIFF;
223 Lisp_Object value;
222 224
223 if (!NILP (Vrun_hooks)) 225 if (!NILP (Vrun_hooks))
224 call1 (Vrun_hooks, Qpre_abbrev_expand_hook); 226 call1 (Vrun_hooks, Qpre_abbrev_expand_hook);
227 /* If the hook changes the buffer, treat that as
228 having "done an expansion". */
229 value = (MODIFF != oldmodiff ? Qt : Qnil);
225 230
226 if (XBUFFER (Vabbrev_start_location_buffer) != current_buffer) 231 if (XBUFFER (Vabbrev_start_location_buffer) != current_buffer)
227 Vabbrev_start_location = Qnil; 232 Vabbrev_start_location = Qnil;
@@ -238,17 +243,17 @@ Returns t if expansion took place.")
238 wordstart = scan_words (point, -1); 243 wordstart = scan_words (point, -1);
239 244
240 if (!wordstart) 245 if (!wordstart)
241 return Qnil; 246 return value;
242 247
243 wordend = scan_words (wordstart, 1); 248 wordend = scan_words (wordstart, 1);
244 if (!wordend) 249 if (!wordend)
245 return Qnil; 250 return value;
246 251
247 if (wordend > point) 252 if (wordend > point)
248 wordend = point; 253 wordend = point;
249 whitecnt = point - wordend; 254 whitecnt = point - wordend;
250 if (wordend <= wordstart) 255 if (wordend <= wordstart)
251 return Qnil; 256 return value;
252 257
253 p = buffer = (char *) alloca (wordend - wordstart); 258 p = buffer = (char *) alloca (wordend - wordstart);
254 259
@@ -269,7 +274,7 @@ Returns t if expansion took place.")
269 if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value)) 274 if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value))
270 sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer); 275 sym = oblookup (Vglobal_abbrev_table, buffer, p - buffer);
271 if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value)) 276 if (XTYPE (sym) == Lisp_Int || NILP (XSYMBOL (sym)->value))
272 return Qnil; 277 return value;
273 278
274 if (INTERACTIVE && !EQ (minibuf_window, selected_window)) 279 if (INTERACTIVE && !EQ (minibuf_window, selected_window))
275 { 280 {