comparison src/keyboard.c @ 83009:b2b37c85b00a

Numerous bugfixes and small improvements. lisp/bindings.el (mode-line-frame-identification): Use %T, not %F. lisp/faces.el (x-create-frame-with-faces): Added frame-creation-function parameter. (tty-create-frame-with-faces): Ditto. lisp/frame.el (frame-creation-function): Make it frame-local. (select-frame-set-input-focus): Use the window-system function, not the variable. lisp/server.el (server-handle-delete-tty): Make sure the client process is removed from server-clients after the delete-process call. It seems that the sentinel is not called. Added docs. (server-process-filter): Immediately add the client to server-clients when a new termcap frame is created. Fixed a case of `not' called with two parameters. Ignore errors while sending the evaluation result back to the client. (server-kill-buffer-query-function): Don't ask the user if the server process is already dead. lisp/term/x-win.el: Don't change mode-line-frame-identification. src/buffer.c (syms_of_buffer): Added %T to the docs of mode-line-format. src/dispnew.c (init_display): Increment the reference count of the new termcap display. src/frame.c (make_terminal_frame): Set the old top frame's visibility to `obscured'. (Fmake_terminal_frame): Look at the current termcap display's name, not just the similar frame parameter. Try to get the type from the current display first, and only then from Vdefault_frame_alist. src/keyboard.c (handle_interrupt): New function to separate the signal handling from C-g processing. (interrupt_signal): Call handle_interrupt to do the real work. (kbd_buffer_store_event): Use handle_interrupt instead of interrupt_signal. (cmd_error_internal): Use FRAME_INITIAL_P instead of ugly hacks. src/termhooks.h (initial_display): New declaration. src/xdisp.c (decode_mode_spec): Added '%T' (termcap-only frame name). git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-49
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 10 Jan 2004 12:56:22 +0000
parents 040dd41ed7d0
children 82554ed1aed8
comparison
equal deleted inserted replaced
83008:040dd41ed7d0 83009:b2b37c85b00a
690 static void restore_getcjmp P_ ((jmp_buf)); 690 static void restore_getcjmp P_ ((jmp_buf));
691 static Lisp_Object apply_modifiers P_ ((int, Lisp_Object)); 691 static Lisp_Object apply_modifiers P_ ((int, Lisp_Object));
692 static void clear_event P_ ((struct input_event *)); 692 static void clear_event P_ ((struct input_event *));
693 static void any_kboard_state P_ ((void)); 693 static void any_kboard_state P_ ((void));
694 static SIGTYPE interrupt_signal P_ ((int signalnum)); 694 static SIGTYPE interrupt_signal P_ ((int signalnum));
695 static void handle_interrupt P_ ((void));
695 696
696 /* Nonzero means don't try to suspend even if the operating system seems 697 /* Nonzero means don't try to suspend even if the operating system seems
697 to support it. */ 698 to support it. */
698 static int cannot_suspend; 699 static int cannot_suspend;
699 700
1200 yet, or we're not interactive, it's best to dump this message out 1201 yet, or we're not interactive, it's best to dump this message out
1201 to stderr and exit. */ 1202 to stderr and exit. */
1202 if (!sf->glyphs_initialized_p 1203 if (!sf->glyphs_initialized_p
1203 /* This is the case of the frame dumped with Emacs, when we're 1204 /* This is the case of the frame dumped with Emacs, when we're
1204 running under a window system. */ 1205 running under a window system. */
1205 || (!NILP (Vwindow_system) 1206 || FRAME_INITIAL_P (sf)
1206 && !inhibit_window_system
1207 && FRAME_TERMCAP_P (sf)
1208 && !FRAME_TTY (sf)->type) /* XXX This is ugly. */
1209 || noninteractive) 1207 || noninteractive)
1210 { 1208 {
1211 stream = Qexternal_debugging_output; 1209 stream = Qexternal_debugging_output;
1212 kill_emacs_p = 1; 1210 kill_emacs_p = 1;
1213 } 1211 }
3604 internal_last_event_frame = focus; 3602 internal_last_event_frame = focus;
3605 Vlast_event_frame = focus; 3603 Vlast_event_frame = focus;
3606 } 3604 }
3607 3605
3608 last_event_timestamp = event->timestamp; 3606 last_event_timestamp = event->timestamp;
3609 interrupt_signal (0 /* dummy */); 3607 handle_interrupt ();
3610 return; 3608 return;
3611 } 3609 }
3612 3610
3613 if (c && c == stop_character) 3611 if (c && c == stop_character)
3614 { 3612 {
10233 set_waiting_for_input (time_to_clear) 10231 set_waiting_for_input (time_to_clear)
10234 EMACS_TIME *time_to_clear; 10232 EMACS_TIME *time_to_clear;
10235 { 10233 {
10236 input_available_clear_time = time_to_clear; 10234 input_available_clear_time = time_to_clear;
10237 10235
10238 /* Tell interrupt_signal to throw back to read_char, */ 10236 /* Tell handle_interrupt to throw back to read_char, */
10239 waiting_for_input = 1; 10237 waiting_for_input = 1;
10240 10238
10241 /* If interrupt_signal was called before and buffered a C-g, 10239 /* If handle_interrupt was called before and buffered a C-g,
10242 make it run again now, to avoid timing error. */ 10240 make it run again now, to avoid timing error. */
10243 if (!NILP (Vquit_flag)) 10241 if (!NILP (Vquit_flag))
10244 quit_throw_to_read_char (); 10242 quit_throw_to_read_char ();
10245 } 10243 }
10246 10244
10247 void 10245 void
10248 clear_waiting_for_input () 10246 clear_waiting_for_input ()
10249 { 10247 {
10250 /* Tell interrupt_signal not to throw back to read_char, */ 10248 /* Tell handle_interrupt not to throw back to read_char, */
10251 waiting_for_input = 0; 10249 waiting_for_input = 0;
10252 input_available_clear_time = 0; 10250 input_available_clear_time = 0;
10253 } 10251 }
10254 10252
10255 /* This routine is called at interrupt level in response to C-g. 10253 /* This routine is called at interrupt level in response to C-g.
10261 If `waiting_for_input' is non zero, then unless `echoing' is 10259 If `waiting_for_input' is non zero, then unless `echoing' is
10262 nonzero, immediately throw back to read_char. 10260 nonzero, immediately throw back to read_char.
10263 10261
10264 Otherwise it sets the Lisp variable quit-flag not-nil. This causes 10262 Otherwise it sets the Lisp variable quit-flag not-nil. This causes
10265 eval to throw, when it gets a chance. If quit-flag is already 10263 eval to throw, when it gets a chance. If quit-flag is already
10266 non-nil, it stops the job right away. */ 10264 non-nil, it stops the job right away.
10265
10266 XXX This comment needs to be updated. */
10267 10267
10268 static SIGTYPE 10268 static SIGTYPE
10269 interrupt_signal (signalnum) /* If we don't have an argument, */ 10269 interrupt_signal (signalnum) /* If we don't have an argument, */
10270 int signalnum; /* some compilers complain in signal calls. */ 10270 int signalnum; /* some compilers complain in signal calls. */
10271 { 10271 {
10272 char c;
10273 /* Must preserve main program's value of errno. */ 10272 /* Must preserve main program's value of errno. */
10274 int old_errno = errno; 10273 int old_errno = errno;
10275 struct frame *sf = SELECTED_FRAME ();
10276 10274
10277 #if defined (USG) && !defined (POSIX_SIGNALS) 10275 #if defined (USG) && !defined (POSIX_SIGNALS)
10278 /* USG systems forget handlers when they are used; 10276 /* USG systems forget handlers when they are used;
10279 must reestablish each time */ 10277 must reestablish each time */
10280 signal (SIGINT, interrupt_signal); 10278 signal (SIGINT, interrupt_signal);
10295 Fkill_emacs (Qnil); 10293 Fkill_emacs (Qnil);
10296 10294
10297 errno = old_errno; 10295 errno = old_errno;
10298 return; 10296 return;
10299 } 10297 }
10298
10299 handle_interrupt ();
10300
10301 errno = old_errno;
10302 }
10303
10304 /* C-g processing, signal independent code.
10305
10306 XXX Expand this comment. */
10307 static void
10308 handle_interrupt ()
10309 {
10310 char c;
10311 struct frame *sf = SELECTED_FRAME ();
10300 10312
10301 cancel_echoing (); 10313 cancel_echoing ();
10302 10314
10303 /* XXX This code needs to be revised for multi-tty support. */ 10315 /* XXX This code needs to be revised for multi-tty support. */
10304 if (!NILP (Vquit_flag) 10316 if (!NILP (Vquit_flag)
10416 Vquit_flag = Qt; 10428 Vquit_flag = Qt;
10417 } 10429 }
10418 10430
10419 if (waiting_for_input && !echoing) 10431 if (waiting_for_input && !echoing)
10420 quit_throw_to_read_char (); 10432 quit_throw_to_read_char ();
10421
10422 errno = old_errno;
10423 } 10433 }
10424 10434
10425 /* Handle a C-g by making read_char return C-g. */ 10435 /* Handle a C-g by making read_char return C-g. */
10426 10436
10427 void 10437 void