Mercurial > emacs
changeset 53342:201b17b0f2e5
Handle Ctl-G in emacsclient.
lib-src/emacsclient.c (quit_char): New variable.
(init_tty): Use it.
(interrupt_signal): Forward SIGINT to Emacs.
(init_signals): Install SIGINT handler.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-20
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 29 Dec 2003 07:24:41 +0000 |
parents | d4e6a050c9b1 |
children | 56e4b7166995 |
files | lib-src/emacsclient.c |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lib-src/emacsclient.c Mon Dec 29 07:16:26 2003 +0000 +++ b/lib-src/emacsclient.c Mon Dec 29 07:24:41 2003 +0000 @@ -381,6 +381,7 @@ int old_tty_valid; int tty_erase_char; +int quit_char = 'g' & 037; int flow_control = 0; int meta_key = 0; char _sobuf[BUFSIZ]; @@ -435,8 +436,11 @@ tty.c_cflag &= ~PARENB; /* Don't check parity */ } #endif - tty.c_cc[VINTR] = CDISABLE; - tty.c_cc[VQUIT] = CDISABLE; + tty.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ + /* Set up C-g for both SIGQUIT and SIGINT. + We don't know which we will get, but we handle both alike + so which one it really gives us does not matter. */ + tty.c_cc[VQUIT] = quit_char; tty.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ tty.c_cc[VTIME] = 0; /* no matter how long that takes. */ #ifdef VSWTCH @@ -642,13 +646,25 @@ errno = old_errno; } +SIGTYPE +interrupt_signal (int signalnum) +{ + int old_errno = errno; + + /* Forward it to Emacs. */ + if (emacs_pid) + kill (emacs_pid, SIGINT); + + errno = old_errno; +} + int init_signals () { /* Set up signal handlers. */ signal (SIGWINCH, window_change_signal); signal (SIGHUP, hang_up_signal); - + signal (SIGINT, interrupt_signal); return 1; }