diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/buffer.c | 14 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e4a0b96182e..a7387b66c0c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2002-11-06 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * buffer.c (Qset_buffer_major_mode_hook): New. | ||
| 4 | (Fset_buffer_major_mode): Use it. | ||
| 5 | |||
| 1 | 2002-11-06 Richard M. Stallman <rms@gnu.org> | 6 | 2002-11-06 Richard M. Stallman <rms@gnu.org> |
| 2 | 7 | ||
| 3 | * xterm.c (x_term_init): Use turn_on_atimers, not start_polling | 8 | * xterm.c (x_term_init): Use turn_on_atimers, not start_polling |
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; | |||
| 178 | Lisp_Object Qmodification_hooks; | 178 | Lisp_Object Qmodification_hooks; |
| 179 | Lisp_Object Qinsert_in_front_hooks; | 179 | Lisp_Object Qinsert_in_front_hooks; |
| 180 | Lisp_Object Qinsert_behind_hooks; | 180 | Lisp_Object Qinsert_behind_hooks; |
| 181 | Lisp_Object Qset_buffer_major_mode_hook; | ||
| 181 | 182 | ||
| 182 | static void alloc_buffer_text P_ ((struct buffer *, size_t)); | 183 | static void alloc_buffer_text P_ ((struct buffer *, size_t)); |
| 183 | static void free_buffer_text P_ ((struct buffer *b)); | 184 | static 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))); |