bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#15433: 24.3.50; wrong-type-argument wholenump -3


From: Drew Adams
Subject: bug#15433: 24.3.50; wrong-type-argument wholenump -3
Date: Sat, 21 Sep 2013 18:20:23 -0700 (PDT)

> > This regression is from Emacs 24.1 onward.  No such problem before that.
> 
> You forget to say what the problem is.  It isn't obvious.

I didn't forget that.  It should be obvious.

The problem is that Emacs gives the user a wrong-type-argument error
in this context.  That's a low-level error and message.  If the
command raises an error at all in this context then it should show
a user-friendly msg - a message specific to the command.

> > emacs -Q
> > M-x set-variable debug-on-error t
> > M-x M-- 3 f
> 
> It appears you are trying to enter -3 f's.  This is nonsensical.

Yes.  Yes.

> If this isn't what you're trying to do, what is it?  Why is that
> error message not the right thing to do?

This is the user providing a prefix arg, which is perfectly normal.
This is not faulty code somewhere providing an arg of the wrong type.
It is a user error to provide a negative prefix arg here.

In Emacs before 24.1, this particular user error was simply ignored.
A better behavior is to raise a reasonable, helpful error for the user.

Pretty much *any* command that does things based on a numeric prefix
arg (or any prefix arg, for that matter), should check whether the
prefix arg value provided by the user makes sense for that command.
The command itself should check.  It should not just fall back on
some low-level error handling.

If a numeric prefix arg N is required by some command to be
non-negative, or an odd number, or a power of seven, or whatever,
then any other N that a user provides should result in a reasonable
error message from that command.

Preferably the message would help the user by saying what the command
expects/requires (e.g., N must be a power of seven that is a power of
two).

A user should never, or at least almost never, see a wrong-type-arg msg.

At a minimum, s?he should not see such a msg for cases where it is
easy for Emacs to DTRT and be helpful, i.e., command-specific, with
its message.





reply via email to

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