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

From: Andy Moreton <[email-masked]>
Date: Mon, 11 Apr 2011 23:10:12 +0100

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---

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

    AndyM