[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: with-demoted-errors
From: |
Glenn Morris |
Subject: |
Re: with-demoted-errors |
Date: |
Tue, 10 Sep 2013 12:07:22 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
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.