]> git.eshelyaron.com Git - emacs.git/commitdiff
Make previous Fkill_emacs change safer
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Dec 2020 16:26:49 +0000 (17:26 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Dec 2020 16:26:53 +0000 (17:26 +0100)
* src/emacs.c (Fkill_emacs): Don't run `kill-emacs-hook' if it's nil.

src/emacs.c

index fe09c446c38fdc0c5e076ec94ef12dfc6ef78ebb..2a32083ba154c35fe11a43fa03b89328122f50c2 100644 (file)
@@ -2365,10 +2365,13 @@ all of which are called before Emacs is actually killed.  */
   /* Fsignal calls emacs_abort () if it sees that waiting_for_input is
      set.  */
   waiting_for_input = 0;
-  if (noninteractive)
-    safe_run_hooks (Qkill_emacs_hook);
-  else
-    call1 (Qrun_hook_query_error_with_timeout, Qkill_emacs_hook);
+  if (!NILP (find_symbol_value (Qkill_emacs_hook)))
+    {
+      if (noninteractive)
+       safe_run_hooks (Qkill_emacs_hook);
+      else
+       call1 (Qrun_hook_query_error_with_timeout, Qkill_emacs_hook);
+    }
 
 #ifdef HAVE_X_WINDOWS
   /* Transfer any clipboards we own to the clipboard manager.  */