unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14479: [PATCH] Infinite loop when error in auto-save-hook
@ 2013-05-27  1:21 Kelly Dean
  2013-06-13  5:13 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Kelly Dean @ 2013-05-27  1:21 UTC (permalink / raw)
  To: 14479

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))
     {






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#14479: [PATCH] Infinite loop when error in auto-save-hook
  2013-05-27  1:21 bug#14479: [PATCH] Infinite loop when error in auto-save-hook Kelly Dean
@ 2013-06-13  5:13 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2013-06-13  5:13 UTC (permalink / raw)
  To: 14479-done

Version: 24.4

Thanks; applied.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-13  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-27  1:21 bug#14479: [PATCH] Infinite loop when error in auto-save-hook Kelly Dean
2013-06-13  5:13 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).