changeset 48635:2a9a1d761581

(Qucs_set_table_for_input): New. (Fget_buffer_create): Use it. (Qset_buffer_major_mode_hook): Deleted. (Fset_buffer_major_mode): Revert previous change. (init_buffer_once): Intern ucs-set-table-for-input. (syms_of_buffer): Delete Qset_buffer_major_mode_hook. Add &Qucs_set_table_for_input.
author Dave Love <fx@gnu.org>
date Tue, 03 Dec 2002 10:27:00 +0000
parents 9a074a6bcaab
children 7adcec33058c
files src/buffer.c
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Tue Dec 03 00:34:09 2002 +0000
+++ b/src/buffer.c	Tue Dec 03 10:27:00 2002 +0000
@@ -157,6 +157,7 @@
 Lisp_Object Qfirst_change_hook;
 Lisp_Object Qbefore_change_functions;
 Lisp_Object Qafter_change_functions;
+Lisp_Object Qucs_set_table_for_input;
 
 /* If nonzero, all modification hooks are suppressed.  */
 int inhibit_modification_hooks;
@@ -178,7 +179,6 @@
 Lisp_Object Qmodification_hooks;
 Lisp_Object Qinsert_in_front_hooks;
 Lisp_Object Qinsert_behind_hooks;
-Lisp_Object Qset_buffer_major_mode_hook;
 
 static void alloc_buffer_text P_ ((struct buffer *, size_t));
 static void free_buffer_text P_ ((struct buffer *b));
@@ -415,6 +415,12 @@
   XSETBUFFER (buf, b);
   Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
 
+  /* Fixme:  Protect against errors, which would trigger infinite
+     regress?  */
+  if (!NILP (Ffboundp (Qucs_set_table_for_input)))
+    /* buff is on buffer-alist, so no gcpro */
+    call1 (Qucs_set_table_for_input, buf);
+
   b->mark = Fmake_marker ();
   BUF_MARKERS (b) = Qnil;
   b->name = name;
@@ -1543,17 +1549,18 @@
 	function = current_buffer->major_mode;
     }
   
+  if (NILP (function) || EQ (function, Qfundamental_mode))
+    return Qnil;
+
   count = SPECPDL_INDEX ();
 
-  /* To select a nonfundamental mode, select the buffer temporarily
-     and then call the mode function.  Run the hook anyhow.  */
+  /* To select a nonfundamental mode,
+     select the buffer temporarily and then call the mode function. */
 
   record_unwind_protect (save_excursion_restore, save_excursion_save ());
 
   Fset_buffer (buffer);
-  if (!(NILP (function) || EQ (function, Qfundamental_mode)))
-    call0 (function);
-  Frun_hooks (1, &Qset_buffer_major_mode_hook);
+  call0 (function);
 
   return unbind_to (count, Qnil);
 }
@@ -5001,6 +5008,8 @@
 
   Qkill_buffer_hook = intern ("kill-buffer-hook");
 
+  Qucs_set_table_for_input = intern ("ucs-set-table-for-input");
+
   Vprin1_to_string_buffer = Fget_buffer_create (build_string (" prin1"));
 
   /* super-magic invisible buffer */
@@ -5128,8 +5137,7 @@
   staticpro (&Qbefore_change_functions);
   Qafter_change_functions = intern ("after-change-functions");
   staticpro (&Qafter_change_functions);
-  Qset_buffer_major_mode_hook = intern ("set-buffer-major-mode-hook");
-  staticpro (&Qset_buffer_major_mode_hook);
+  staticpro (&Qucs_set_table_for_input);
 
   Fput (Qprotected_field, Qerror_conditions,
 	Fcons (Qprotected_field, Fcons (Qerror, Qnil)));