From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Extending the abbrev facility in elisp Date: Thu, 22 May 2003 10:14:32 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305221414.h4MEEWIB004312@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053614516 9820 80.91.224.249 (22 May 2003 14:41:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 22 May 2003 14:41:56 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 22 16:41:54 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19IrEh-0002Rx-00 for ; Thu, 22 May 2003 16:40:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19IrQ0-0005Og-00 for ; Thu, 22 May 2003 16:51:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Iqyr-0003py-Bm for emacs-devel@quimby.gnus.org; Thu, 22 May 2003 10:23:41 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19IqyZ-0003p7-PJ for emacs-devel@gnu.org; Thu, 22 May 2003 10:23:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Iqy3-0003k6-7N for emacs-devel@gnu.org; Thu, 22 May 2003 10:23:23 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Iqq2-0001oW-RF for emacs-devel@gnu.org; Thu, 22 May 2003 10:14:34 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h4MEEWx6004315 for ; Thu, 22 May 2003 10:14:32 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h4MEEWIB004312; Thu, 22 May 2003 10:14:32 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:14092 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:14092 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.