emacs-devel
[Top][All Lists]
Advanced

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

Re: with-demoted-errors


From: Karl Fogel
Subject: Re: with-demoted-errors
Date: Wed, 11 Sep 2013 15:22:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Glenn Morris <address@hidden> writes:
>Karl Fogel wrote:
>> From: Stefan Monnier <address@hidden>
>>>> +                      ;; This is with-demoted-errors, but we want to
>>>> +                      ;; mention save-place in any error message.
>>>> +                      (condition-case err
>>>> +                        (car (read-from-string
>>>> +                              (buffer-substring (point-min) (point-max))))
>>>> +                        (error (message "Error reading save-place-file: 
>>>> %S" err)
>>>> +                               nil)))
>>> 
>>>I remember having similar desires in other places.  Should we add
>>>a "format" argument to with-demoted-errors?
>>
>> I'm not sure I understand the original comment in saveplace.el,
>> actually.  Does "mention save-place" mean something special there?
>>
>> The error string already says "save-place-file", and it will print `err'
>> too...  In other words, why couldn't one just use `with-demoted-errors'
>> in that spot right now?  Another way to say it is: the BODY argument to
>> `with-demoted-errors' can format anything in its error messages that it
>> want to, so I don't see why that code in saveplace.el isn't using
>> `with-demoted-errors' already.
>
>Because
>
>(with-demoted-errors 
>   (car (read-from-string
>      (buffer-substring (point-min) (point-max)))))
>
>just prints "end-of-file", which gives you no clue that the error is
>coming from save-place.

Oh I see it now; and the proposed solution obviously makes sense.
Thanks.

-K



reply via email to

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