1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-26 10:49:33 +00:00

(read-number): Catch errors.

This commit is contained in:
Richard M. Stallman 2007-04-22 16:56:19 +00:00
parent 00b7c149fe
commit 219f06f7b8

View File

@ -1735,9 +1735,11 @@ The value of DEFAULT is inserted into PROMPT."
(let ((str (read-from-minibuffer prompt nil nil nil nil
(and default
(number-to-string default)))))
(setq n (cond
((zerop (length str)) default)
((stringp str) (read str)))))
(condition-case nil
(setq n (cond
((zerop (length str)) default)
((stringp str) (read str))))
(error nil)))
(unless (numberp n)
(message "Please enter a number.")
(sit-for 1)