diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-08-02 11:00:46 +0200 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-08-02 11:00:46 +0200 |
commit | 0798a8d85cbb4c6d5948243869bfb137782eaeeb (patch) | |
tree | 320b2978be6c40d9598da2ade6de2e2e94a68a54 /lisp/emacs-lisp | |
parent | 9a747ba6507e64e26f87c5173d25428c99b70adb (diff) | |
download | emacs-0798a8d85cbb4c6d5948243869bfb137782eaeeb.tar.gz emacs-0798a8d85cbb4c6d5948243869bfb137782eaeeb.tar.bz2 emacs-0798a8d85cbb4c6d5948243869bfb137782eaeeb.zip |
* lisp/emacs-lisp/timer.el (timer-event-handler): Protect against timers
that change current buffer.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/timer.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index f3b8ddcd123..94f39940b66 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -321,7 +321,11 @@ This function is called, by name, directly by the C code." ;; We do this after rescheduling so that the handler function ;; can cancel its own timer successfully with cancel-timer. (condition-case nil - (apply (timer--function timer) (timer--args timer)) + ;; Timer functions should not change the current buffer. + ;; If they do, all kinds of nasty surprises can happen, + ;; and it can be hellish to track down their source. + (save-current-buffer + (apply (timer--function timer) (timer--args timer))) (error nil)) (if retrigger (setf (timer--triggered timer) nil))) |