Commit cfaf18a2 authored by Eli Zaretskii's avatar Eli Zaretskii

Treat SIGINT correctly in GUI sessions on MS-Windows

* src/w32proc.c (sys_signal): Don't reject SIGINT, as it is
supported by MS runtime.
* src/term.c (DEV_TTY): Move from here ...
* src/conf_post.h (DEV_TTY): ... to here.  Separate definitions
for WINDOWSNT and for the rest.
* src/keyboard.c (handle_interrupt_signal): Use DEV_TTY instead of
a literal "/dev/tty".

* etc/NEWS: Mention the behavior change.
parent 62e4dc46
...@@ -607,6 +607,13 @@ still apply.) ...@@ -607,6 +607,13 @@ still apply.)
Previously, on MS-Windows this function converted slash characters in Previously, on MS-Windows this function converted slash characters in
file names into backslashes. It no longer does that. file names into backslashes. It no longer does that.
** GUI sessions now treat SIGINT like Posix platforms do.
The effect of delivering a Ctrl-C (SIGINT) signal to a GUI Emacs on
MS-Windows is now the same as on Posix platforms -- Emacs saves the
session and exits. In particular, this will happen if you start
emacs.exe from the Windows shell, then type Ctrl-C into that shell's
window.
* Installation Changes in Emacs 25.1 * Installation Changes in Emacs 25.1
......
...@@ -140,6 +140,10 @@ typedef bool bool_bf; ...@@ -140,6 +140,10 @@ typedef bool bool_bf;
#undef HAVE_RINT #undef HAVE_RINT
#endif /* HPUX */ #endif /* HPUX */
#ifdef WINDOWSNT
# define DEV_TTY "CONOUT$"
#endif
#ifdef MSDOS #ifdef MSDOS
#ifndef __DJGPP__ #ifndef __DJGPP__
You lose; /* Emacs for DOS must be compiled with DJGPP */ You lose; /* Emacs for DOS must be compiled with DJGPP */
...@@ -242,6 +246,11 @@ extern int emacs_setenv_TZ (char const *); ...@@ -242,6 +246,11 @@ extern int emacs_setenv_TZ (char const *);
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef DEV_TTY
# define DEV_TTY "/dev/tty"
#endif
#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
#define NO_INLINE __attribute__((noinline)) #define NO_INLINE __attribute__((noinline))
#else #else
......
...@@ -10241,7 +10241,7 @@ static void ...@@ -10241,7 +10241,7 @@ static void
handle_interrupt_signal (int sig) handle_interrupt_signal (int sig)
{ {
/* See if we have an active terminal on our controlling tty. */ /* See if we have an active terminal on our controlling tty. */
struct terminal *terminal = get_named_terminal ("/dev/tty"); struct terminal *terminal = get_named_terminal (DEV_TTY);
if (!terminal) if (!terminal)
{ {
/* If there are no frames there, let's pretend that we are a /* If there are no frames there, let's pretend that we are a
......
...@@ -58,10 +58,7 @@ static int been_here = -1; ...@@ -58,10 +58,7 @@ static int been_here = -1;
/* The name of the default console device. */ /* The name of the default console device. */
#ifdef WINDOWSNT #ifdef WINDOWSNT
#define DEV_TTY "CONOUT$"
#include "w32term.h" #include "w32term.h"
#else
#define DEV_TTY "/dev/tty"
#endif #endif
static void tty_set_scroll_region (struct frame *f, int start, int stop); static void tty_set_scroll_region (struct frame *f, int start, int stop);
......
...@@ -86,9 +86,9 @@ sys_signal (int sig, signal_handler handler) ...@@ -86,9 +86,9 @@ sys_signal (int sig, signal_handler handler)
/* SIGCHLD is needed for supporting subprocesses, see sys_kill /* SIGCHLD is needed for supporting subprocesses, see sys_kill
below. SIGALRM and SIGPROF are used by setitimer. All the below. SIGALRM and SIGPROF are used by setitimer. All the
others are the only ones supported by the MS runtime. */ others are the only ones supported by the MS runtime. */
if (!(sig == SIGCHLD || sig == SIGSEGV || sig == SIGILL if (!(sig == SIGINT || sig == SIGSEGV || sig == SIGILL
|| sig == SIGFPE || sig == SIGABRT || sig == SIGTERM || sig == SIGFPE || sig == SIGABRT || sig == SIGTERM
|| sig == SIGALRM || sig == SIGPROF)) || sig == SIGCHLD || sig == SIGALRM || sig == SIGPROF))
{ {
errno = EINVAL; errno = EINVAL;
return SIG_ERR; return SIG_ERR;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment