diff options
| author | Julien Danjou | 2011-03-23 11:06:57 +0100 |
|---|---|---|
| committer | Julien Danjou | 2011-03-23 11:06:57 +0100 |
| commit | dee091a37f6486dbbcf7bf00f6ee54d77033f997 (patch) | |
| tree | 922b3490e04f512f9664ca350102d57a18296680 /src | |
| parent | 904a432cf44c176fa3c88a975f046d0cf2992023 (diff) | |
| download | emacs-dee091a37f6486dbbcf7bf00f6ee54d77033f997.tar.gz emacs-dee091a37f6486dbbcf7bf00f6ee54d77033f997.zip | |
Use Frun_hooks rather than calling Vrun_hooks manually
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/buffer.c | 3 | ||||
| -rw-r--r-- | src/callint.c | 3 | ||||
| -rw-r--r-- | src/cmds.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 25 | ||||
| -rw-r--r-- | src/emacs.c | 5 | ||||
| -rw-r--r-- | src/fileio.c | 6 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/insdel.c | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 35 | ||||
| -rw-r--r-- | src/minibuf.c | 12 | ||||
| -rw-r--r-- | src/term.c | 26 | ||||
| -rw-r--r-- | src/window.c | 38 |
13 files changed, 91 insertions, 92 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4994aaa9fa8..f9766115042 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2011-03-23 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * term.c (Fsuspend_tty, Fresume_tty): | ||
| 4 | * minibuf.c (read_minibuf, run_exit_minibuf_hook): | ||
| 5 | * window.c (temp_output_buffer_show): | ||
| 6 | * insdel.c (signal_before_change): | ||
| 7 | * frame.c (Fhandle_switch_frame): | ||
| 8 | * fileio.c (Fdo_auto_save): | ||
| 9 | * emacs.c (Fkill_emacs): | ||
| 10 | * editfns.c (save_excursion_restore): | ||
| 11 | * cmds.c (internal_self_insert): | ||
| 12 | * callint.c (Fcall_interactively): | ||
| 13 | * buffer.c (Fkill_all_local_variables): | ||
| 14 | * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1): | ||
| 15 | Use Frun_hooks. | ||
| 16 | (command_loop_1): Use Frun_hooks. Call safe_run_hooks | ||
| 17 | unconditionnaly since it does the check itself. | ||
| 18 | |||
| 1 | 2011-03-23 Paul Eggert <eggert@cs.ucla.edu> | 19 | 2011-03-23 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 20 | ||
| 3 | Fix more problems found by GCC 4.5.2's static checks. | 21 | Fix more problems found by GCC 4.5.2's static checks. |
diff --git a/src/buffer.c b/src/buffer.c index c0e6866dee1..da2cc1573c8 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2520,8 +2520,7 @@ The first thing this function does is run | |||
| 2520 | the normal hook `change-major-mode-hook'. */) | 2520 | the normal hook `change-major-mode-hook'. */) |
| 2521 | (void) | 2521 | (void) |
| 2522 | { | 2522 | { |
| 2523 | if (!NILP (Vrun_hooks)) | 2523 | Frun_hooks (1, &Qchange_major_mode_hook); |
| 2524 | call1 (Vrun_hooks, Qchange_major_mode_hook); | ||
| 2525 | 2524 | ||
| 2526 | /* Make sure none of the bindings in local_var_alist | 2525 | /* Make sure none of the bindings in local_var_alist |
| 2527 | remain swapped in, in their symbols. */ | 2526 | remain swapped in, in their symbols. */ |
diff --git a/src/callint.c b/src/callint.c index 282d8a82aa7..bb815a5bd01 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -423,8 +423,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 423 | error ("Attempt to select inactive minibuffer window"); | 423 | error ("Attempt to select inactive minibuffer window"); |
| 424 | 424 | ||
| 425 | /* If the current buffer wants to clean up, let it. */ | 425 | /* If the current buffer wants to clean up, let it. */ |
| 426 | if (!NILP (Vmouse_leave_buffer_hook)) | 426 | Frun_hooks (1, &Qmouse_leave_buffer_hook); |
| 427 | call1 (Vrun_hooks, Qmouse_leave_buffer_hook); | ||
| 428 | 427 | ||
| 429 | Fselect_window (w, Qnil); | 428 | Fselect_window (w, Qnil); |
| 430 | } | 429 | } |
diff --git a/src/cmds.c b/src/cmds.c index fa1ac5028ae..ebbb223c2db 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -501,7 +501,7 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | /* Run hooks for electric keys. */ | 503 | /* Run hooks for electric keys. */ |
| 504 | call1 (Vrun_hooks, Qpost_self_insert_hook); | 504 | Frun_hooks (1, &Qpost_self_insert_hook); |
| 505 | 505 | ||
| 506 | return hairy; | 506 | return hairy; |
| 507 | } | 507 | } |
diff --git a/src/editfns.c b/src/editfns.c index 1f98ff040b3..009e1d34bde 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -928,18 +928,21 @@ save_excursion_restore (Lisp_Object info) | |||
| 928 | tem1 = BVAR (current_buffer, mark_active); | 928 | tem1 = BVAR (current_buffer, mark_active); |
| 929 | BVAR (current_buffer, mark_active) = tem; | 929 | BVAR (current_buffer, mark_active) = tem; |
| 930 | 930 | ||
| 931 | if (!NILP (Vrun_hooks)) | 931 | /* If mark is active now, and either was not active |
| 932 | or was at a different place, run the activate hook. */ | ||
| 933 | if (! NILP (tem)) | ||
| 932 | { | 934 | { |
| 933 | /* If mark is active now, and either was not active | 935 | if (! EQ (omark, nmark)) |
| 934 | or was at a different place, run the activate hook. */ | 936 | { |
| 935 | if (! NILP (BVAR (current_buffer, mark_active))) | 937 | tem = intern ("activate-mark-hook"); |
| 936 | { | 938 | Frun_hooks (1, &tem); |
| 937 | if (! EQ (omark, nmark)) | 939 | } |
| 938 | call1 (Vrun_hooks, intern ("activate-mark-hook")); | 940 | } |
| 939 | } | 941 | /* If mark has ceased to be active, run deactivate hook. */ |
| 940 | /* If mark has ceased to be active, run deactivate hook. */ | 942 | else if (! NILP (tem1)) |
| 941 | else if (! NILP (tem1)) | 943 | { |
| 942 | call1 (Vrun_hooks, intern ("deactivate-mark-hook")); | 944 | tem = intern ("deactivate-mark-hook"); |
| 945 | Frun_hooks (1, &tem); | ||
| 943 | } | 946 | } |
| 944 | 947 | ||
| 945 | /* If buffer was visible in a window, and a different window was | 948 | /* If buffer was visible in a window, and a different window was |
diff --git a/src/emacs.c b/src/emacs.c index bc7c07a9326..0382ade728d 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1972,14 +1972,15 @@ all of which are called before Emacs is actually killed. */) | |||
| 1972 | (Lisp_Object arg) | 1972 | (Lisp_Object arg) |
| 1973 | { | 1973 | { |
| 1974 | struct gcpro gcpro1; | 1974 | struct gcpro gcpro1; |
| 1975 | Lisp_Object hook; | ||
| 1975 | 1976 | ||
| 1976 | GCPRO1 (arg); | 1977 | GCPRO1 (arg); |
| 1977 | 1978 | ||
| 1978 | if (feof (stdin)) | 1979 | if (feof (stdin)) |
| 1979 | arg = Qt; | 1980 | arg = Qt; |
| 1980 | 1981 | ||
| 1981 | if (!NILP (Vrun_hooks)) | 1982 | hook = intern ("kill-emacs-hook"); |
| 1982 | call1 (Vrun_hooks, intern ("kill-emacs-hook")); | 1983 | Frun_hooks (1, &hook); |
| 1983 | 1984 | ||
| 1984 | UNGCPRO; | 1985 | UNGCPRO; |
| 1985 | 1986 | ||
diff --git a/src/fileio.c b/src/fileio.c index 7d2f10d517c..64dda0a78e4 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5180,7 +5180,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5180 | (Lisp_Object no_message, Lisp_Object current_only) | 5180 | (Lisp_Object no_message, Lisp_Object current_only) |
| 5181 | { | 5181 | { |
| 5182 | struct buffer *old = current_buffer, *b; | 5182 | struct buffer *old = current_buffer, *b; |
| 5183 | Lisp_Object tail, buf; | 5183 | Lisp_Object tail, buf, hook; |
| 5184 | int auto_saved = 0; | 5184 | int auto_saved = 0; |
| 5185 | int do_handled_files; | 5185 | int do_handled_files; |
| 5186 | Lisp_Object oquit; | 5186 | Lisp_Object oquit; |
| @@ -5210,8 +5210,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5210 | /* No GCPRO needed, because (when it matters) all Lisp_Object variables | 5210 | /* No GCPRO needed, because (when it matters) all Lisp_Object variables |
| 5211 | point to non-strings reached from Vbuffer_alist. */ | 5211 | point to non-strings reached from Vbuffer_alist. */ |
| 5212 | 5212 | ||
| 5213 | if (!NILP (Vrun_hooks)) | 5213 | hook = intern ("auto-save-hook"); |
| 5214 | call1 (Vrun_hooks, intern ("auto-save-hook")); | 5214 | Frun_hooks (1, &hook); |
| 5215 | 5215 | ||
| 5216 | if (STRINGP (Vauto_save_list_file_name)) | 5216 | if (STRINGP (Vauto_save_list_file_name)) |
| 5217 | { | 5217 | { |
diff --git a/src/frame.c b/src/frame.c index 3e00e1bf107..cdcb313280b 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -890,7 +890,7 @@ to that frame. */) | |||
| 890 | { | 890 | { |
| 891 | /* Preserve prefix arg that the command loop just cleared. */ | 891 | /* Preserve prefix arg that the command loop just cleared. */ |
| 892 | KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg; | 892 | KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg; |
| 893 | call1 (Vrun_hooks, Qmouse_leave_buffer_hook); | 893 | Frun_hooks (1, &Qmouse_leave_buffer_hook); |
| 894 | return do_switch_frame (event, 0, 0, Qnil); | 894 | return do_switch_frame (event, 0, 0, Qnil); |
| 895 | } | 895 | } |
| 896 | 896 | ||
diff --git a/src/insdel.c b/src/insdel.c index ad3460f9a64..1cbe3de20d2 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -2137,14 +2137,14 @@ signal_before_change (EMACS_INT start_int, EMACS_INT end_int, | |||
| 2137 | 2137 | ||
| 2138 | specbind (Qinhibit_modification_hooks, Qt); | 2138 | specbind (Qinhibit_modification_hooks, Qt); |
| 2139 | 2139 | ||
| 2140 | /* If buffer is unmodified, run a special hook for that case. */ | 2140 | /* If buffer is unmodified, run a special hook for that case. The |
| 2141 | check for Vfirst_change_hook is just a minor optimization. */ | ||
| 2141 | if (SAVE_MODIFF >= MODIFF | 2142 | if (SAVE_MODIFF >= MODIFF |
| 2142 | && !NILP (Vfirst_change_hook) | 2143 | && !NILP (Vfirst_change_hook)) |
| 2143 | && !NILP (Vrun_hooks)) | ||
| 2144 | { | 2144 | { |
| 2145 | PRESERVE_VALUE; | 2145 | PRESERVE_VALUE; |
| 2146 | PRESERVE_START_END; | 2146 | PRESERVE_START_END; |
| 2147 | call1 (Vrun_hooks, Qfirst_change_hook); | 2147 | Frun_hooks (1, &Qfirst_change_hook); |
| 2148 | } | 2148 | } |
| 2149 | 2149 | ||
| 2150 | /* Now run the before-change-functions if any. */ | 2150 | /* Now run the before-change-functions if any. */ |
diff --git a/src/keyboard.c b/src/keyboard.c index fc8622de0a1..39848ee490d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1492,10 +1492,7 @@ command_loop_1 (void) | |||
| 1492 | 1492 | ||
| 1493 | Vthis_command = cmd; | 1493 | Vthis_command = cmd; |
| 1494 | real_this_command = cmd; | 1494 | real_this_command = cmd; |
| 1495 | /* Note that the value cell will never directly contain nil | 1495 | safe_run_hooks (Qpre_command_hook); |
| 1496 | if the symbol is a local variable. */ | ||
| 1497 | if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks)) | ||
| 1498 | safe_run_hooks (Qpre_command_hook); | ||
| 1499 | 1496 | ||
| 1500 | already_adjusted = 0; | 1497 | already_adjusted = 0; |
| 1501 | 1498 | ||
| @@ -1541,18 +1538,14 @@ command_loop_1 (void) | |||
| 1541 | } | 1538 | } |
| 1542 | KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg; | 1539 | KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg; |
| 1543 | 1540 | ||
| 1544 | /* Note that the value cell will never directly contain nil | 1541 | safe_run_hooks (Qpost_command_hook); |
| 1545 | if the symbol is a local variable. */ | ||
| 1546 | if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks)) | ||
| 1547 | safe_run_hooks (Qpost_command_hook); | ||
| 1548 | 1542 | ||
| 1549 | /* If displaying a message, resize the echo area window to fit | 1543 | /* If displaying a message, resize the echo area window to fit |
| 1550 | that message's size exactly. */ | 1544 | that message's size exactly. */ |
| 1551 | if (!NILP (echo_area_buffer[0])) | 1545 | if (!NILP (echo_area_buffer[0])) |
| 1552 | resize_echo_area_exactly (); | 1546 | resize_echo_area_exactly (); |
| 1553 | 1547 | ||
| 1554 | if (!NILP (Vdeferred_action_list)) | 1548 | safe_run_hooks (Qdeferred_action_function); |
| 1555 | safe_run_hooks (Qdeferred_action_function); | ||
| 1556 | 1549 | ||
| 1557 | /* If there is a prefix argument, | 1550 | /* If there is a prefix argument, |
| 1558 | 1) We don't want Vlast_command to be ``universal-argument'' | 1551 | 1) We don't want Vlast_command to be ``universal-argument'' |
| @@ -1621,7 +1614,10 @@ command_loop_1 (void) | |||
| 1621 | } | 1614 | } |
| 1622 | 1615 | ||
| 1623 | if (current_buffer != prev_buffer || MODIFF != prev_modiff) | 1616 | if (current_buffer != prev_buffer || MODIFF != prev_modiff) |
| 1624 | call1 (Vrun_hooks, intern ("activate-mark-hook")); | 1617 | { |
| 1618 | Lisp_Object hook = intern ("activate-mark-hook"); | ||
| 1619 | Frun_hooks (1, &hook); | ||
| 1620 | } | ||
| 1625 | } | 1621 | } |
| 1626 | 1622 | ||
| 1627 | Vsaved_region_selection = Qnil; | 1623 | Vsaved_region_selection = Qnil; |
| @@ -1819,9 +1815,7 @@ adjust_point_for_property (EMACS_INT last_pt, int modified) | |||
| 1819 | static Lisp_Object | 1815 | static Lisp_Object |
| 1820 | safe_run_hooks_1 (void) | 1816 | safe_run_hooks_1 (void) |
| 1821 | { | 1817 | { |
| 1822 | if (NILP (Vrun_hooks)) | 1818 | return Frun_hooks (1, &Vinhibit_quit); |
| 1823 | return Qnil; | ||
| 1824 | return call1 (Vrun_hooks, Vinhibit_quit); | ||
| 1825 | } | 1819 | } |
| 1826 | 1820 | ||
| 1827 | /* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ | 1821 | /* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ |
| @@ -10129,11 +10123,11 @@ a special event, so ignore the prefix argument and don't clear it. */) | |||
| 10129 | if (SYMBOLP (cmd)) | 10123 | if (SYMBOLP (cmd)) |
| 10130 | { | 10124 | { |
| 10131 | tem = Fget (cmd, Qdisabled); | 10125 | tem = Fget (cmd, Qdisabled); |
| 10132 | if (!NILP (tem) && !NILP (Vrun_hooks)) | 10126 | if (!NILP (tem)) |
| 10133 | { | 10127 | { |
| 10134 | tem = Fsymbol_value (Qdisabled_command_function); | 10128 | tem = Fsymbol_value (Qdisabled_command_function); |
| 10135 | if (!NILP (tem)) | 10129 | if (!NILP (tem)) |
| 10136 | return call1 (Vrun_hooks, Qdisabled_command_function); | 10130 | return Frun_hooks (1, &Qdisabled_command_function); |
| 10137 | } | 10131 | } |
| 10138 | } | 10132 | } |
| 10139 | 10133 | ||
| @@ -10617,6 +10611,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10617 | int old_height, old_width; | 10611 | int old_height, old_width; |
| 10618 | int width, height; | 10612 | int width, height; |
| 10619 | struct gcpro gcpro1; | 10613 | struct gcpro gcpro1; |
| 10614 | Lisp_Object hook; | ||
| 10620 | 10615 | ||
| 10621 | if (tty_list && tty_list->next) | 10616 | if (tty_list && tty_list->next) |
| 10622 | error ("There are other tty frames open; close them before suspending Emacs"); | 10617 | error ("There are other tty frames open; close them before suspending Emacs"); |
| @@ -10625,8 +10620,8 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10625 | CHECK_STRING (stuffstring); | 10620 | CHECK_STRING (stuffstring); |
| 10626 | 10621 | ||
| 10627 | /* Run the functions in suspend-hook. */ | 10622 | /* Run the functions in suspend-hook. */ |
| 10628 | if (!NILP (Vrun_hooks)) | 10623 | hook = intern ("suspend-hook"); |
| 10629 | call1 (Vrun_hooks, intern ("suspend-hook")); | 10624 | Frun_hooks (1, &hook); |
| 10630 | 10625 | ||
| 10631 | GCPRO1 (stuffstring); | 10626 | GCPRO1 (stuffstring); |
| 10632 | get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height); | 10627 | get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height); |
| @@ -10650,8 +10645,8 @@ On such systems, Emacs starts a subshell instead of suspending. */) | |||
| 10650 | change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); | 10645 | change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); |
| 10651 | 10646 | ||
| 10652 | /* Run suspend-resume-hook. */ | 10647 | /* Run suspend-resume-hook. */ |
| 10653 | if (!NILP (Vrun_hooks)) | 10648 | hook = intern ("suspend-resume-hook"); |
| 10654 | call1 (Vrun_hooks, intern ("suspend-resume-hook")); | 10649 | Frun_hooks (1, &hook); |
| 10655 | 10650 | ||
| 10656 | UNGCPRO; | 10651 | UNGCPRO; |
| 10657 | return Qnil; | 10652 | return Qnil; |
diff --git a/src/minibuf.c b/src/minibuf.c index b6b79be9d3f..7bed9bb2f2d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -649,12 +649,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 649 | if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) | 649 | if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) |
| 650 | call1 (Qactivate_input_method, input_method); | 650 | call1 (Qactivate_input_method, input_method); |
| 651 | 651 | ||
| 652 | /* Run our hook, but not if it is empty. | 652 | Frun_hooks (1, &Qminibuffer_setup_hook); |
| 653 | (run-hooks would do nothing if it is empty, | ||
| 654 | but it's important to save time here in the usual case.) */ | ||
| 655 | if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound) | ||
| 656 | && !NILP (Vrun_hooks)) | ||
| 657 | call1 (Vrun_hooks, Qminibuffer_setup_hook); | ||
| 658 | 653 | ||
| 659 | /* Don't allow the user to undo past this point. */ | 654 | /* Don't allow the user to undo past this point. */ |
| 660 | BVAR (current_buffer, undo_list) = Qnil; | 655 | BVAR (current_buffer, undo_list) = Qnil; |
| @@ -806,10 +801,7 @@ get_minibuffer (int depth) | |||
| 806 | static Lisp_Object | 801 | static Lisp_Object |
| 807 | run_exit_minibuf_hook (Lisp_Object data) | 802 | run_exit_minibuf_hook (Lisp_Object data) |
| 808 | { | 803 | { |
| 809 | if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound) | 804 | safe_run_hooks (Qminibuffer_exit_hook); |
| 810 | && !NILP (Vrun_hooks)) | ||
| 811 | safe_run_hooks (Qminibuffer_exit_hook); | ||
| 812 | |||
| 813 | return Qnil; | 805 | return Qnil; |
| 814 | } | 806 | } |
| 815 | 807 | ||
diff --git a/src/term.c b/src/term.c index e84bbe125f8..b3392df76fd 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2500,13 +2500,10 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) | |||
| 2500 | /* First run `suspend-tty-functions' and then clean up the tty | 2500 | /* First run `suspend-tty-functions' and then clean up the tty |
| 2501 | state because `suspend-tty-functions' might need to change | 2501 | state because `suspend-tty-functions' might need to change |
| 2502 | the tty state. */ | 2502 | the tty state. */ |
| 2503 | if (!NILP (Vrun_hooks)) | 2503 | Lisp_Object args[2]; |
| 2504 | { | 2504 | args[0] = intern ("suspend-tty-functions"); |
| 2505 | Lisp_Object args[2]; | 2505 | XSETTERMINAL (args[1], t); |
| 2506 | args[0] = intern ("suspend-tty-functions"); | 2506 | Frun_hook_with_args (2, args); |
| 2507 | XSETTERMINAL (args[1], t); | ||
| 2508 | Frun_hook_with_args (2, args); | ||
| 2509 | } | ||
| 2510 | 2507 | ||
| 2511 | reset_sys_modes (t->display_info.tty); | 2508 | reset_sys_modes (t->display_info.tty); |
| 2512 | delete_keyboard_wait_descriptor (fileno (f)); | 2509 | delete_keyboard_wait_descriptor (fileno (f)); |
| @@ -2596,14 +2593,13 @@ frame's terminal). */) | |||
| 2596 | 2593 | ||
| 2597 | init_sys_modes (t->display_info.tty); | 2594 | init_sys_modes (t->display_info.tty); |
| 2598 | 2595 | ||
| 2599 | /* Run `resume-tty-functions'. */ | 2596 | { |
| 2600 | if (!NILP (Vrun_hooks)) | 2597 | /* Run `resume-tty-functions'. */ |
| 2601 | { | 2598 | Lisp_Object args[2]; |
| 2602 | Lisp_Object args[2]; | 2599 | args[0] = intern ("resume-tty-functions"); |
| 2603 | args[0] = intern ("resume-tty-functions"); | 2600 | XSETTERMINAL (args[1], t); |
| 2604 | XSETTERMINAL (args[1], t); | 2601 | Frun_hook_with_args (2, args); |
| 2605 | Frun_hook_with_args (2, args); | 2602 | } |
| 2606 | } | ||
| 2607 | } | 2603 | } |
| 2608 | 2604 | ||
| 2609 | set_tty_hooks (t); | 2605 | set_tty_hooks (t); |
diff --git a/src/window.c b/src/window.c index eaa910571e0..9ab9fab2c13 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3690,27 +3690,23 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3690 | 3690 | ||
| 3691 | /* Run temp-buffer-show-hook, with the chosen window selected | 3691 | /* Run temp-buffer-show-hook, with the chosen window selected |
| 3692 | and its buffer current. */ | 3692 | and its buffer current. */ |
| 3693 | 3693 | { | |
| 3694 | if (!NILP (Vrun_hooks) | 3694 | int count = SPECPDL_INDEX (); |
| 3695 | && !NILP (Fboundp (Qtemp_buffer_show_hook)) | 3695 | Lisp_Object prev_window, prev_buffer; |
| 3696 | && !NILP (Fsymbol_value (Qtemp_buffer_show_hook))) | 3696 | prev_window = selected_window; |
| 3697 | { | 3697 | XSETBUFFER (prev_buffer, old); |
| 3698 | int count = SPECPDL_INDEX (); | 3698 | |
| 3699 | Lisp_Object prev_window, prev_buffer; | 3699 | /* Select the window that was chosen, for running the hook. |
| 3700 | prev_window = selected_window; | 3700 | Note: Both Fselect_window and select_window_norecord may |
| 3701 | XSETBUFFER (prev_buffer, old); | 3701 | set-buffer to the buffer displayed in the window, |
| 3702 | 3702 | so we need to save the current buffer. --stef */ | |
| 3703 | /* Select the window that was chosen, for running the hook. | 3703 | record_unwind_protect (Fset_buffer, prev_buffer); |
| 3704 | Note: Both Fselect_window and select_window_norecord may | 3704 | record_unwind_protect (select_window_norecord, prev_window); |
| 3705 | set-buffer to the buffer displayed in the window, | 3705 | Fselect_window (window, Qt); |
| 3706 | so we need to save the current buffer. --stef */ | 3706 | Fset_buffer (w->buffer); |
| 3707 | record_unwind_protect (Fset_buffer, prev_buffer); | 3707 | Frun_hooks (1, &Qtemp_buffer_show_hook); |
| 3708 | record_unwind_protect (select_window_norecord, prev_window); | 3708 | unbind_to (count, Qnil); |
| 3709 | Fselect_window (window, Qt); | 3709 | } |
| 3710 | Fset_buffer (w->buffer); | ||
| 3711 | call1 (Vrun_hooks, Qtemp_buffer_show_hook); | ||
| 3712 | unbind_to (count, Qnil); | ||
| 3713 | } | ||
| 3714 | } | 3710 | } |
| 3715 | } | 3711 | } |
| 3716 | 3712 | ||