changeset 31610:29c6825c59a8

(handle_fontified_prop): While running fontification functions, bind `fontification-functions' and `after-change-functions' to nil.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 14 Sep 2000 19:17:22 +0000
parents f5c313af6821
children cc9735883a82
files src/xdisp.c
diffstat 1 files changed, 47 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Thu Sep 14 19:17:05 2000 +0000
+++ b/src/xdisp.c	Thu Sep 14 19:17:22 2000 +0000
@@ -1872,16 +1872,56 @@
   if (!STRINGP (it->string)
       && it->s == NULL
       && !NILP (Vfontification_functions)
+      && !NILP (Vrun_hooks)
       && (pos = make_number (IT_CHARPOS (*it)),
 	  prop = Fget_char_property (pos, Qfontified, Qnil),
 	  NILP (prop)))
     {
-      Lisp_Object args[2];
-
-      /* Run the hook functions.  */
-      args[0] = Qfontification_functions;
-      args[1] = pos;
-      Frun_hook_with_args (2, args);
+      int count = specpdl_ptr - specpdl;
+      Lisp_Object val;
+
+      val = Vfontification_functions;
+      specbind (Qfontification_functions, Qnil);
+      specbind (Qafter_change_functions, Qnil);
+  
+      if (!CONSP (val) || EQ (XCAR (val), Qlambda))
+	call1 (val, pos);
+      else
+	{
+	  Lisp_Object globals, fn;
+	  struct gcpro gcpro1, gcpro2;
+
+	  globals = Qnil;
+	  GCPRO2 (val, globals);
+	  
+	  for (; CONSP (val); val = XCDR (val))
+	    {
+	      fn = XCAR (val);
+	      
+	      if (EQ (fn, Qt))
+		{
+		  /* A value of t indicates this hook has a local
+		     binding; it means to run the global binding too.
+		     In a global value, t should not occur.  If it
+		     does, we must ignore it to avoid an endless
+		     loop.  */
+		  for (globals = Fdefault_value (Qfontification_functions);
+		       CONSP (globals);
+		       globals = XCDR (globals))
+		    {
+		      fn = XCAR (globals);
+		      if (!EQ (fn, Qt))
+			call1 (fn, pos);
+		    }
+		}
+	      else
+		call1 (fn, pos);
+	    }
+
+	  UNGCPRO;
+	}
+
+      unbind_to (count, Qnil);
 
       /* Return HANDLED_RECOMPUTE_PROPS only if function fontified
 	 something.  This avoids an endless loop if they failed to
@@ -12514,6 +12554,7 @@
   Lisp_Object eoltype;
 
   val = Fget (coding_system, Qcoding_system);
+  eoltype = Qnil;
 
   if (!VECTORP (val))		/* Not yet decided.  */
     {