aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 7bd2f1f2aea..d7e5d1752aa 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3770,14 +3770,15 @@ DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_emacs, 0, 1, "",
3770 "Stop Emacs and return to superior process. You can resume later.\n\ 3770 "Stop Emacs and return to superior process. You can resume later.\n\
3771On systems that don't have job control, run a subshell instead.\n\n\ 3771On systems that don't have job control, run a subshell instead.\n\n\
3772If optional arg STUFFSTRING is non-nil, its characters are stuffed\n\ 3772If optional arg STUFFSTRING is non-nil, its characters are stuffed\n\
3773to be read as terminal input by Emacs's superior shell.\n\ 3773to be read as terminal input by Emacs's parent, after suspension.\n\
3774Before suspending, if `suspend-hook' is bound and value is non-nil\n\ 3774\n\
3775call the value as a function of no args. Don't suspend if it returns non-nil.\n\ 3775Before suspending, call the functions in `suspend-hooks' with no args.\n\
3776Otherwise, suspend normally and after resumption call\n\ 3776If any of them returns nil, don't call the rest and don't suspend.\n\
3777Otherwise, suspend normally and after resumption run the normal hook\n\
3777`suspend-resume-hook' if that is bound and non-nil.\n\ 3778`suspend-resume-hook' if that is bound and non-nil.\n\
3778\n\ 3779\n\
3779Some operating systems cannot stop the Emacs process and resume it later.\n\ 3780Some operating systems cannot stop the Emacs process and resume it later.\n\
3780On such systems, Emacs will start a subshell and wait for it to exit.") 3781On such systems, Emacs starts a subshell instead of suspending.")
3781 (stuffstring) 3782 (stuffstring)
3782 Lisp_Object stuffstring; 3783 Lisp_Object stuffstring;
3783{ 3784{
@@ -3785,21 +3786,25 @@ On such systems, Emacs will start a subshell and wait for it to exit.")
3785 int count = specpdl_ptr - specpdl; 3786 int count = specpdl_ptr - specpdl;
3786 int old_height, old_width; 3787 int old_height, old_width;
3787 int width, height; 3788 int width, height;
3788 struct gcpro gcpro1; 3789 struct gcpro gcpro1, gcpro2;
3789 extern init_sys_modes (); 3790 extern init_sys_modes ();
3790 3791
3791 if (!NILP (stuffstring)) 3792 if (!NILP (stuffstring))
3792 CHECK_STRING (stuffstring, 0); 3793 CHECK_STRING (stuffstring, 0);
3793 GCPRO1 (stuffstring);
3794 3794
3795 /* Call value of suspend-hook 3795 /* Run the functions in suspend-hooks. */
3796 if it is bound and value is non-nil. */ 3796 tem = Fsymbol_value (intern ("suspend-hooks"));
3797 if (!NILP (Vrun_hooks)) 3797 while (CONSP (tem))
3798 { 3798 {
3799 tem = call1 (Vrun_hooks, intern ("suspend-hook")); 3799 Lisp_Object val;
3800 if (!EQ (tem, Qnil)) return Qnil; 3800 GCPRO2 (stuffstring, tem);
3801 val = call0 (Fcar (tem));
3802 UNGCPRO;
3803 tem = Fcdr (tem);
3804 if (!EQ (val, Qnil)) return Qnil;
3801 } 3805 }
3802 3806
3807 GCPRO1 (stuffstring);
3803 get_frame_size (&old_width, &old_height); 3808 get_frame_size (&old_width, &old_height);
3804 reset_sys_modes (); 3809 reset_sys_modes ();
3805 /* sys_suspend can get an error if it tries to fork a subshell 3810 /* sys_suspend can get an error if it tries to fork a subshell