** Miscellaneous
+---
+*** Errors in 'kill-emacs-hook' no longer prevents Emacs from shutting down.
+If a function in that hook signals an error in an interactive Emacs,
+the user will be prompted whether to continue or not. If the user
+doesn't answer within five seconds, Emacs will continue shutting down
+anyway.
+
---
*** iso-transl is now preloaded.
This means that keystrokes like 'Alt-[' are defined by default,
(defconst regexp-unmatchable "\\`a\\`"
"Standard regexp guaranteed not to match any string at all.")
+(defun run-hook-query-error-with-timeout (hook)
+ "Run HOOK, catching errors, and querying the user about whether to continue.
+If a function in HOOK signals an error, the user will be prompted
+whether to continue or not. If the user doesn't respond,
+evaluation will continue if the user doesn't respond within five
+seconds."
+ (run-hook-wrapped
+ hook
+ (lambda (fun)
+ (condition-case err
+ (funcall fun)
+ (error
+ (unless (y-or-n-p-with-timeout (format "Error %s; continue?" err)
+ 5 t)
+ (error err))))
+ ;; Continue running.
+ nil)))
+
;;; subr.el ends here
if (noninteractive)
safe_run_hooks (Qkill_emacs_hook);
else
- run_hook (Qkill_emacs_hook);
+ call1 (Qrun_hook_query_error_with_timeout, Qkill_emacs_hook);
#ifdef HAVE_X_WINDOWS
/* Transfer any clipboards we own to the clipboard manager. */
DEFSYM (Qrisky_local_variable, "risky-local-variable");
DEFSYM (Qkill_emacs, "kill-emacs");
DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
+ DEFSYM (Qrun_hook_query_error_with_timeout,
+ "run-hook-query-error-with-timeout");
#ifdef HAVE_UNEXEC
defsubr (&Sdump_emacs);