summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emacs.c9
-rw-r--r--src/lisp.h1
-rw-r--r--src/xdisp.c9
3 files changed, 16 insertions, 3 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 172e4607694..d1b010ec7fe 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -386,7 +386,14 @@ terminate_due_to_signal (int sig, int backtrace_limit)
totally_unblock_input ();
if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
- Fkill_emacs (make_fixnum (sig));
+ {
+ /* Avoid abort in shut_down_emacs if we were interrupted
+ by SIGINT in noninteractive usage, as in that case we
+ don't care about the message stack. */
+ if (sig == SIGINT && noninteractive)
+ clear_message_stack ();
+ Fkill_emacs (make_fixnum (sig));
+ }
shut_down_emacs (sig, Qnil);
emacs_backtrace (backtrace_limit);
diff --git a/src/lisp.h b/src/lisp.h
index a95913c4efe..9901f80b51c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3715,6 +3715,7 @@ extern Lisp_Object echo_area_buffer[2];
extern void add_to_log (char const *, ...);
extern void vadd_to_log (char const *, va_list);
extern void check_message_stack (void);
+extern void clear_message_stack (void);
extern void setup_echo_area_for_printing (bool);
extern bool push_message (void);
extern void pop_message_unwind (void);
diff --git a/src/xdisp.c b/src/xdisp.c
index 76ef420a364..ed1d4761b95 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11929,8 +11929,8 @@ pop_message_unwind (void)
/* Check that Vmessage_stack is nil. Called from emacs.c when Emacs
- exits. If the stack is not empty, we have a missing pop_message
- somewhere. */
+ exits. If the stack is not empty, we have a missing
+ pop_message_unwind somewhere. */
void
check_message_stack (void)
@@ -11939,6 +11939,11 @@ check_message_stack (void)
emacs_abort ();
}
+void
+clear_message_stack (void)
+{
+ Vmessage_stack = Qnil;
+}
/* Truncate to NCHARS what will be displayed in the echo area the next
time we display it---but don't redisplay it now. */