aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2010-10-01 19:30:11 -0700
committerGlenn Morris2010-10-01 19:30:11 -0700
commit9c524fcb89871b321844de7297a1baee0bde0376 (patch)
tree8be5dae3c4db4410ab1be600696164b7a5bfb020 /src
parent08b8ba9fae180c04036b748d5838a5768b013c1d (diff)
downloademacs-9c524fcb89871b321844de7297a1baee0bde0376.tar.gz
emacs-9c524fcb89871b321844de7297a1baee0bde0376.zip
Run kill-emacs-hook in batch mode, and on SIGINT in batch mode.
See thread http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg00795.html * src/emacs.c (fatal_error_signal): Also run Fkill_emacs on SIGINT. (main) [!WINDOWSNT]: Handle SIGINT with fatal_error_signal in batch-mode. (Fkill_emacs): Doc fix. Also run the hook in batch mode. (kill-emacs-hook): Doc fix. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Use kill-emacs-hook to delete tempfile if interrupted during compilation. * doc/lispref/os.texi (Killing Emacs): Hook now runs in batch mode. * etc/NEWS: Mention these changes.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/emacs.c18
2 files changed, 23 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 70a7d43c320..a87b0bc49c2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12010-10-02 Glenn Morris <rgm@gnu.org>
2
3 * emacs.c (fatal_error_signal): Also run Fkill_emacs on SIGINT.
4 (main) [!WINDOWSNT]: Handle SIGINT with fatal_error_signal
5 in batch-mode.
6 (Fkill_emacs): Doc fix. Also run the hook in batch mode.
7 (kill-emacs-hook): Doc fix.
8
12010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org> 92010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 10
3 * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region) 11 * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region)
diff --git a/src/emacs.c b/src/emacs.c
index 397b6d1ce88..7eba690cb8a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -378,7 +378,7 @@ fatal_error_signal (int sig)
378 { 378 {
379 fatal_error_in_progress = 1; 379 fatal_error_in_progress = 1;
380 380
381 if (sig == SIGTERM || sig == SIGHUP) 381 if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
382 Fkill_emacs (make_number (sig)); 382 Fkill_emacs (make_number (sig));
383 383
384 shut_down_emacs (sig, 0, Qnil); 384 shut_down_emacs (sig, 0, Qnil);
@@ -1240,6 +1240,14 @@ main (int argc, char **argv)
1240#ifdef SIGSYS 1240#ifdef SIGSYS
1241 signal (SIGSYS, fatal_error_signal); 1241 signal (SIGSYS, fatal_error_signal);
1242#endif 1242#endif
1243#ifndef WINDOWSNT
1244 /* May need special treatment on MS-Windows. See
1245 http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
1246 Please update the doc of kill-emacs, kill-emacs-hook, and
1247 NEWS if you change this.
1248 */
1249 if ( noninteractive ) signal (SIGINT, fatal_error_signal);
1250#endif
1243 signal (SIGTERM, fatal_error_signal); 1251 signal (SIGTERM, fatal_error_signal);
1244#ifdef SIGXCPU 1252#ifdef SIGXCPU
1245 signal (SIGXCPU, fatal_error_signal); 1253 signal (SIGXCPU, fatal_error_signal);
@@ -1988,6 +1996,9 @@ DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
1988If ARG is an integer, return ARG as the exit program code. 1996If ARG is an integer, return ARG as the exit program code.
1989If ARG is a string, stuff it as keyboard input. 1997If ARG is a string, stuff it as keyboard input.
1990 1998
1999This function is called upon receipt of the signals SIGTERM
2000or SIGHUP, and (except on MS-Windows) SIGINT in batch mode.
2001
1991The value of `kill-emacs-hook', if not void, 2002The value of `kill-emacs-hook', if not void,
1992is a list of functions (of no args), 2003is a list of functions (of no args),
1993all of which are called before Emacs is actually killed. */) 2004all of which are called before Emacs is actually killed. */)
@@ -2000,7 +2011,7 @@ all of which are called before Emacs is actually killed. */)
2000 if (feof (stdin)) 2011 if (feof (stdin))
2001 arg = Qt; 2012 arg = Qt;
2002 2013
2003 if (!NILP (Vrun_hooks) && !noninteractive) 2014 if (!NILP (Vrun_hooks))
2004 call1 (Vrun_hooks, intern ("kill-emacs-hook")); 2015 call1 (Vrun_hooks, intern ("kill-emacs-hook"));
2005 2016
2006 UNGCPRO; 2017 UNGCPRO;
@@ -2421,7 +2432,8 @@ in other similar situations), functions placed on this hook should not
2421expect to be able to interact with the user. To ask for confirmation, 2432expect to be able to interact with the user. To ask for confirmation,
2422see `kill-emacs-query-functions' instead. 2433see `kill-emacs-query-functions' instead.
2423 2434
2424The hook is not run in batch mode, i.e., if `noninteractive' is non-nil. */); 2435Before Emacs 24.1, the hook was not run in batch mode, i.e., if
2436`noninteractive' was non-nil. */);
2425 Vkill_emacs_hook = Qnil; 2437 Vkill_emacs_hook = Qnil;
2426 2438
2427 DEFVAR_INT ("emacs-priority", &emacs_priority, 2439 DEFVAR_INT ("emacs-priority", &emacs_priority,