Subject: Re: bug#8479: 24.0.50; Strange error message upon M-z M-z

From: Kevin Rodgers <[email-masked]>
Date: Mon, 11 Apr 2011 23:15:50 -0600

On 4/11/11 4:10 PM, Andy Moreton wrote:
> On Mon 11 Apr 2011, David Kastrup wrote:
>
>> Type M-z M-z and you get the following error back trace and message:
>>
>> Debugger entered--Lisp error: (wrong-type-argument characterp 134217850)
>>    call-interactively(zap-to-char nil nil)
>
> `zap-to-char' (in simple.el) has interactive spec:
>
>     (interactive "p\ncZap to char: ")
>
> Looking at `call-interactively' (in callint.c):
>
> --8<---------------cut here---------------start------------->8---
>          case 'c':		/* Character */
> 	  /* Prompt in `minibuffer-prompt' face.  */
> 	  Fput_text_property (make_number (0),
> 			      make_number (SCHARS (callint_message)),
> 			      Qface, Qminibuffer_prompt, callint_message);
> 	  args[i] = Fread_char (callint_message, Qnil, Qnil);
> 	  message1_nolog ((char *) 0);
> 	  /* Passing args[i] directly stimulates compiler bug */
> 	  teml = args[i];
> 	  visargs[i] = Fchar_to_string (teml);
> 	  break;
> --8<---------------cut here---------------end--------------->8---
>
> Looking at the help for `read-char':
>
> --8<---------------cut here---------------start------------->8---
> If the user generates an event which is not a character (i.e. a mouse
> click or function key event), `read-char' signals an error.  As an
> exception, switch-frame events are put off until non-character events
> can be read.
> If you want to read non-character events, or ignore them, call
> `read-event' or `read-char-exclusive' instead.
> --8<---------------cut here---------------end--------------->8---

Yes, but why is M-z not a character?

?\M-z ⇒ 134217850
;; Which is greater than #x3FFF7F (4194175), but ...

"\M-z" ⇒ "\372"
;; ... strings can only have characters as elements, right?

(characterp ?\M-z) ⇒ nil
;; Puzzled am I.

> Perhaps `call-interactively' should be using `read-char-exclusive' so
> that the second M-z is ignored ?

-- 
Kevin Rodgers
Denver, Colorado, USA