Mercurial > emacs
comparison src/keyboard.c @ 5194:85a1088ca765
(kbd_buffer_get_event): If user destroys the last frame,
exit before calling Fdelete_frame.
(read_avail_input): Undo Nov 18 change.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 26 Nov 1993 21:54:39 +0000 |
parents | e2ebd4e12279 |
children | 5831f83a0afe |
comparison
equal
deleted
inserted
replaced
5193:2696563f32ba | 5194:85a1088ca765 |
---|---|
1942 #ifdef HAVE_X11 | 1942 #ifdef HAVE_X11 |
1943 else if (event->kind == delete_window_event) | 1943 else if (event->kind == delete_window_event) |
1944 { | 1944 { |
1945 Lisp_Object value; | 1945 Lisp_Object value; |
1946 | 1946 |
1947 /* If the user destroys the only frame, Emacs should exit. */ | |
1948 value = Fvisible_frame_list (); | |
1949 if (! CONSP (value) || ! CONSP (XCONS (value)->cdr)) | |
1950 kill (getpid (), SIGHUP); | |
1951 | |
1947 Fdelete_frame (event->frame_or_window, Qt); | 1952 Fdelete_frame (event->frame_or_window, Qt); |
1948 kbd_fetch_ptr = event + 1; | 1953 kbd_fetch_ptr = event + 1; |
1949 | |
1950 value = Fvisible_frame_list (); | |
1951 if (! CONSP (value)) | |
1952 kill (getpid (), SIGHUP); | |
1953 } | 1954 } |
1954 #endif | 1955 #endif |
1955 /* Just discard these, by returning nil. | 1956 /* Just discard these, by returning nil. |
1956 (They shouldn't be found in the buffer, | 1957 (They shouldn't be found in the buffer, |
1957 but on some machines it appears they do show up.) */ | 1958 but on some machines it appears they do show up.) */ |
3070 #endif | 3071 #endif |
3071 | 3072 |
3072 /* Now read; for one reason or another, this will not block. */ | 3073 /* Now read; for one reason or another, this will not block. */ |
3073 while (1) | 3074 while (1) |
3074 { | 3075 { |
3075 int value = read (fileno (stdin), cbuf, nread); | 3076 nread = read (fileno (stdin), cbuf, nread); |
3076 #ifdef AIX | 3077 #ifdef AIX |
3077 /* The kernel sometimes fails to deliver SIGHUP for ptys. | 3078 /* The kernel sometimes fails to deliver SIGHUP for ptys. |
3078 This looks incorrect, but it isn't, because _BSD causes | 3079 This looks incorrect, but it isn't, because _BSD causes |
3079 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, | 3080 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, |
3080 and that causes a value other than 0 when there is no input. */ | 3081 and that causes a value other than 0 when there is no input. */ |
3081 if (value == 0) | 3082 if (nread == 0) |
3082 kill (SIGHUP, 0); | 3083 kill (SIGHUP, 0); |
3083 #endif | 3084 #endif |
3085 /* This code is wrong, but at least it gets the right results. | |
3086 Fix it for 19.23. */ | |
3084 /* Retry the read if it is interrupted. */ | 3087 /* Retry the read if it is interrupted. */ |
3085 if (value >= 0 | 3088 if (nread >= 0 |
3086 || ! (errno == EAGAIN || errno == EFAULT | 3089 || ! (errno == EAGAIN || errno == EFAULT |
3087 #ifdef EBADSLT | 3090 #ifdef EBADSLT |
3088 || errno == EBADSLT | 3091 || errno == EBADSLT |
3089 #endif | 3092 #endif |
3090 )) | 3093 )) |
3091 { | 3094 break; |
3092 nread = value; | |
3093 break; | |
3094 } | |
3095 } | 3095 } |
3096 | 3096 |
3097 #ifndef FIONREAD | 3097 #ifndef FIONREAD |
3098 #ifdef USG | 3098 #ifdef USG |
3099 fcntl (fileno (stdin), F_SETFL, 0); | 3099 fcntl (fileno (stdin), F_SETFL, 0); |