aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorDave Love2002-11-06 20:30:45 +0000
committerDave Love2002-11-06 20:30:45 +0000
commitb8b60362dba5e1a9ba9d6420899841cdfee8f3c5 (patch)
treeb6d76a88f5ebe197dd1486509081df87374b0520 /src/buffer.c
parent758830ba9348e367a69dc8a5cd872075bc2d1807 (diff)
downloademacs-b8b60362dba5e1a9ba9d6420899841cdfee8f3c5.tar.gz
emacs-b8b60362dba5e1a9ba9d6420899841cdfee8f3c5.zip
(Qset_buffer_major_mode_hook): New.
(Fset_buffer_major_mode): Use it.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index c0d053ee331..37ec0e44e2c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -178,6 +178,7 @@ Lisp_Object Qpriority, Qwindow, Qevaporate, Qbefore_string, Qafter_string;
178Lisp_Object Qmodification_hooks; 178Lisp_Object Qmodification_hooks;
179Lisp_Object Qinsert_in_front_hooks; 179Lisp_Object Qinsert_in_front_hooks;
180Lisp_Object Qinsert_behind_hooks; 180Lisp_Object Qinsert_behind_hooks;
181Lisp_Object Qset_buffer_major_mode_hook;
181 182
182static void alloc_buffer_text P_ ((struct buffer *, size_t)); 183static void alloc_buffer_text P_ ((struct buffer *, size_t));
183static void free_buffer_text P_ ((struct buffer *b)); 184static void free_buffer_text P_ ((struct buffer *b));
@@ -1542,18 +1543,17 @@ the current buffer's major mode. */)
1542 function = current_buffer->major_mode; 1543 function = current_buffer->major_mode;
1543 } 1544 }
1544 1545
1545 if (NILP (function) || EQ (function, Qfundamental_mode))
1546 return Qnil;
1547
1548 count = SPECPDL_INDEX (); 1546 count = SPECPDL_INDEX ();
1549 1547
1550 /* To select a nonfundamental mode, 1548 /* To select a nonfundamental mode, select the buffer temporarily
1551 select the buffer temporarily and then call the mode function. */ 1549 and then call the mode function. Run the hook anyhow. */
1552 1550
1553 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 1551 record_unwind_protect (save_excursion_restore, save_excursion_save ());
1554 1552
1555 Fset_buffer (buffer); 1553 Fset_buffer (buffer);
1556 call0 (function); 1554 if (NILP (function) || EQ (function, Qfundamental_mode))
1555 call0 (function);
1556 Frun_hooks (1, &Qset_buffer_major_mode_hook);
1557 1557
1558 return unbind_to (count, Qnil); 1558 return unbind_to (count, Qnil);
1559} 1559}
@@ -5128,6 +5128,8 @@ syms_of_buffer ()
5128 staticpro (&Qbefore_change_functions); 5128 staticpro (&Qbefore_change_functions);
5129 Qafter_change_functions = intern ("after-change-functions"); 5129 Qafter_change_functions = intern ("after-change-functions");
5130 staticpro (&Qafter_change_functions); 5130 staticpro (&Qafter_change_functions);
5131 Qset_buffer_major_mode_hook = intern ("set-buffer-major-mode-hook");
5132 staticpro (&Qset_buffer_major_mode_hook);
5131 5133
5132 Fput (Qprotected_field, Qerror_conditions, 5134 Fput (Qprotected_field, Qerror_conditions,
5133 Fcons (Qprotected_field, Fcons (Qerror, Qnil))); 5135 Fcons (Qprotected_field, Fcons (Qerror, Qnil)));