emacs-devel
[Top][All Lists]
Advanced

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

Re: printing most-negative-fixnum fails


From: Kenichi Handa
Subject: Re: printing most-negative-fixnum fails
Date: Tue, 11 May 2004 13:26:18 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Luc Teirlinck <address@hidden> writes:

> Stefan Monnier wrote:
>    I can't reproduce your problem: I did

>>  emacs -q --no-site-file
>        most-negative-fixnum
>        C-x C-e

>    and it returned "-268435456 = ?\C-@".  The right hand side of the return
>    value is indeed incorrect (that's a bug), but it's still not the problem
>    you're experiencing.
>    Could you give a recipe to reproduce your problem?

> I can reproduce the problem.  I do exactly what you did above and get:

I can reproduce it simply by:
  (prin1-char most-negative-fixnum)

The reason of this bug is that prin1-char checks if the arg
CHAR is a valid character or not by:
  (char-valid-p (event-basic-type char))
and
  (event-basic-type most-negative-fixnum)
returns 64.

But I'm not sure at which level to fix it.  I at first
thought this will work:
  (char-valid-p (and (eventp char) (event-basic-type char)))
But eventp returns non-nil for any integer.  Isn't it a bug?

Perhaps, eventp should be changed to something like this:

(defsubst eventp (obj)
  "True if the argument is an event object."
  (or (and (integerp obj)
           (char-valid-p
            (logand obj (lognot (logior ?\M-\^@ ?\C-\^@ ?\S-\^@
                                        ?\H-\^@ ?\s-\^@ ?\A-\^@)))))
      (and (symbolp obj)
           (get obj 'event-symbol-elements))
      (and (consp obj)
           (symbolp (car obj))
           (get (car obj) 'event-symbol-elements))))

---
Ken'ichi HANDA
address@hidden




reply via email to

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