On 4/18/2010 2:47 PM, Stas Boukarev wrote:
I don't see an easy way to restrict that number in defcustom.
As far as I can tell from the Emacs Lisp manual, I cannot see one either. Someone on the mailing list may have a suggestion. But, given that any user can mistakenly set the value of the variable using `setq', the (often overlooked) *Customize* buffer cannot be relied on to identify all user-entered data errors in any case.
And it's clear from the backtrace where the negative value is coming from. If the user is willing to shoot himslef in the foot, let him do it.
OK.
Consider a web interface that asks for a telephone number, but then allows non-numeric characters to be accepted without complaint when the user moves to the next field or when the user submits the form. The web application could pass the invalid data on to other code and, possibly, end up displaying a backtrace in the web browser for the user. Many would consider this to be a sub-optimal solution.
The web application won't necessarily verify that a digits-only telephone number is the correct number for the person entering it, but it can (and should) verify that it is a valid telephone number.