[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read-number: Ask again if error reading input
From: |
Drew Adams |
Subject: |
read-number: Ask again if error reading input |
Date: |
Fri, 20 Apr 2007 10:20:31 -0700 |
emacs -Q
M-: (read-number ":" 5)
Type "(foo"
End of file during parsing
Minor patch to `read-number':
(cond ((zerop (length str)) default)
((stringp str) (read str)))
(unless (numberp n)...
Should be:
(cond ((zerop (length str)) default)
((stringp str) (condition-case nil (read str) (error nil))))
(unless (numberp n)...
That way, if the user inputs something that causes a read error, s?he
is just asked again, instead of getting an error message that s?he
might not understand.
In GNU Emacs 22.0.96.1 (i386-mingw-nt5.1.2600)
of 2007-03-21 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/g/include'
- read-number: Ask again if error reading input,
Drew Adams <=