[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14479: [PATCH] Infinite loop when error in auto-save-hook

From: Kelly Dean
Subject: bug#14479: [PATCH] Infinite loop when error in auto-save-hook
Date: Sun, 26 May 2013 18:21:32 -0700 (PDT)

Put in init.el:
(setq inhibit-startup-screen t)
(add-hook 'auto-save-hook (lambda () (error "Foo")))
(setq auto-save-interval 30)
(switch-to-buffer "*Messages*")

Start Emacs 24.3, then press any key 31 times. It prints "Foo" and begins 
benchmarking an autosave retry loop, on my system about 300 retries/second, 
because Fdo_auto_save fails when it tries to run auto-save-hook, so it never 
gets to record_auto_save which updates last_auto_save, which is what's supposed 
to prevent the retries via keyboard.c line 2608.

The patch below fixes it. Unlike the case for post-command-hook, removing the 
offending auto-save hook isn't vital, but I think it's the best thing to do. 
Anyway, continuing the autosave despite the error is vital, and safe_run_hooks 
is the easiest way to accomplish both.

--- emacs-24.3/src/fileio.c
+++ emacs-24.3/src/fileio.c
@@ -5445,7 +5445,7 @@
      point to non-strings reached from Vbuffer_alist.  */
   hook = intern ("auto-save-hook");
-  Frun_hooks (1, &hook);
+  safe_run_hooks (hook);
   if (STRINGP (Vauto_save_list_file_name))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]