emacs-devel
[Top][All Lists]
Advanced

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

Re: Why timers are now catching errors


From: Thierry Volpiatto
Subject: Re: Why timers are now catching errors
Date: Sun, 13 Jan 2013 16:55:47 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Thierry Volpiatto <address@hidden> writes:

> Stefan Monnier <address@hidden> writes:
>
>>>>> This change will break many commands using timers.
>>> You should read "annoy", it break nothing, just send repeatedly an
>>> annoying message. (See eldoc-eval.el)
>>
>> Ah, so the problem is the `message' call?
>> If so, that's easy to fix: wrap the timer's code inside its own
>> condition-case to catch the error before timer.el does.
> Of course I can do that. (Already done locally)
>
>>> But maybe you are intoducing (temporarily) such code to improve some
>>> timer functions running in emacs ? 
>>
>> It's definitely not temporary, no.  Silently dropping such errors makes
>> tracking down bugs much harder, so it's here to stay.
> Hmm, I see, what about sending such messages only when `debug-on-error' is
> enabled ?
Like this (working fine here):

--8<---------------cut here---------------start------------->8---
(condition-case-unless-debug err
    ;; 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 (and debug-on-error (message "Error in timer: %S" err))))
--8<---------------cut here---------------end--------------->8---


-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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