changeset 458:8f18e7e89008

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 17 Dec 1991 03:36:07 +0000
parents e442bb589751
children a4742d1b81bc
files src/abbrev.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/abbrev.c	Fri Dec 13 18:50:18 1991 +0000
+++ b/src/abbrev.c	Tue Dec 17 03:36:07 1991 +0000
@@ -75,6 +75,9 @@
 
 int last_abbrev_point;
 
+/* Hook to run before expanding any abbrev.  */
+
+Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;
 
 DEFUN ("make-abbrev-table", Fmake_abbrev_table, Smake_abbrev_table, 0, 0, 0,
   "Create a new, empty abbrev table object.")
@@ -218,6 +221,9 @@
   register Lisp_Object sym;
   Lisp_Object expansion, hook, tem;
 
+  if (!NULL (Vrun_hooks))
+    call1 (Vrun_hooks, Qpre_abbrev_expand_hook);
+
   if (XBUFFER (Vabbrev_start_location_buffer) != current_buffer)
     Vabbrev_start_location = Qnil;
   if (!NULL (Vabbrev_start_location))
@@ -532,6 +538,14 @@
     "*Set non-nil means expand multi-word abbrevs all caps if abbrev was so.");
   abbrev_all_caps = 0;
 
+  DEFVAR_LISP ("pre-abbrev-expand-hook", &Vpre_abbrev_expand_hook,
+    "Function or functions to be called before abbrev expansion is done.\n\
+This is the first thing that `expand-abbrev' does, and so this may change\n\
+the current abbrev table before abbrev lookup happens.");
+  Vpre_abbrev_expand_hook = Qnil;
+  Qpre_abbrev_expand_hook = intern ("pre-abbrev-expand-hook");
+  staticpro (&Qpre_abbrev_expand_hook);
+
   defsubr (&Smake_abbrev_table);
   defsubr (&Sclear_abbrev_table);
   defsubr (&Sdefine_abbrev);