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

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

bug#8807: map-char-table alters cons cells used as events


From: Eli Zaretskii
Subject: bug#8807: map-char-table alters cons cells used as events
Date: Mon, 06 Jun 2011 02:57:40 -0400

> Date: Sun, 05 Jun 2011 23:50:19 -0500
> From: Jonathan Ganc <jonpublic2@gmail.com>
> 
> (let ((ct (make-char-table 'keymap)) permev)
>    (set-char-table-range ct '(1 . 2) 'binding)
>    (map-char-table
>     (lambda (event defn)
>       (setq permev event)
>       (insert (prin1-to-string permev)))
>     ct)
>    (insert (concat "\n" (prin1-to-string permev)))
>    )
> 
> This produces:
> (1 . 2)
> (3 . 4194303)
> , so that map-char-table alters the cons cell being used as an output 
> range than producing a new one.

The char-table produced by make-char-table is originally comprised of
a single range of characters with a single value of nil.  After the
call to set-char-table-range, that range is split in 2: character
codes 1 and 2 get the value of 'binding, the rest are left with nil.
Thus, map-char-table calls its 2nd argument twice, one each for every
range of characters in the table that share the same value.

> I would have expected:
> (1 . 2)
> (1 . 2)

??? Why?  And where do you see that map-char-table alters the cons
cell being used as output?  What output?





reply via email to

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