changeset 27043:b5ce0c450409

(Fexpand_abbrev): If expanding an abbrev which has only a hook, and the hook has a non-nil `no-self-insert' property, let the return value of the hook specify whether an expansion took place. If it returns nil, no expansion has been performed.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 30 Dec 1999 12:26:53 +0000
parents fe88ae65ed75
children b36644e0e875
files src/abbrev.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/abbrev.c	Thu Dec 30 12:25:22 1999 +0000
+++ b/src/abbrev.c	Thu Dec 30 12:26:53 1999 +0000
@@ -364,7 +364,20 @@
 
   hook = XSYMBOL (sym)->function;
   if (!NILP (hook))
-    call0 (hook);
+    {
+      Lisp_Object expanded, prop;
+
+      /* If expanding an abbrev which has only a hook, and the hook
+	 has a non-nil `no-self-insert' property, let the return value
+	 of the hook specify whether an expansion took place.  If it
+	 returns nil, no expansion has been done.  */
+      expanded = call0 (hook);
+      if (SYMBOLP (hook)
+	  && NILP (expanded)
+	  && (prop = Fget (hook, intern ("no-self-insert")),
+	      !NILP (prop)))
+	value = Qnil;
+    }
 
   return value;
 }