emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extending the abbrev facility in elisp


From: Stefan Monnier
Subject: Extending the abbrev facility in elisp
Date: Thu, 22 May 2003 10:14:32 -0400

It seems that there is no easy way to extend the abbrev facility in elisp
because all the processing is done in C.  Any objection to the patch below
which makes it possible to redefine, advise, debug-on-entry, ...
`expand-abbrev' ?
Or should we introduce an `expand-abbrev-functions' hook instead ?


        Stefan


Index: cmds.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/cmds.c,v
retrieving revision 1.88
diff -u -r1.88 cmds.c
--- cmds.c      9 Nov 2002 12:46:25 -0000       1.88
+++ cmds.c      22 May 2003 14:07:47 -0000
@@ -368,12 +368,13 @@
    return 0.  A value of 1 indicates this *might* not have been simple.
    A value of 2 means this did things that call for an undo boundary.  */
 
+static Lisp_Object Qexpand_abbrev;
+
 int
 internal_self_insert (c, noautofill)
      int c;
      int noautofill;
 {
-  extern Lisp_Object Fexpand_abbrev ();
   int hairy = 0;
   Lisp_Object tem;
   register enum syntaxcode synt;
@@ -477,7 +478,7 @@
       int modiff = MODIFF;
       Lisp_Object sym;
 
-      sym = Fexpand_abbrev ();
+      sym = call0 (Qexpand_abbrev);
 
       /* If we expanded an abbrev which has a hook,
         and the hook has a non-nil `no-self-insert' property,
@@ -564,6 +565,9 @@
 
   Qoverwrite_mode_binary = intern ("overwrite-mode-binary");
   staticpro (&Qoverwrite_mode_binary);
+
+  Qexpand_abbrev = intern ("expand-abbrev");
+  staticpro (&Qexpand_abbrev);
 
   DEFVAR_LISP ("self-insert-face", &Vself_insert_face,
               doc: /* If non-nil, set the face of the next self-inserting 
character to this.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]