Subject: bug#13599: 24.2; (max-char) is too low (and hard to change)

From: Eli Zaretskii <[email-masked]>
Date: Thu, 31 Jan 2013 21:08:11 +0200

> From: Magnar Sveen <[email-masked]>
> Date: Thu, 31 Jan 2013 19:42:27 +0100
> 
> Due to my weird norwegian keyboard, I'm trying to map my s-8 to [.
> 
> Doing a M-: (read-char) s-8 gives me the key value of 8388664.

Which is 800038 in hex.  Rings any bells?  (Hint: 38 hex is the digit
8.)

> Following that up with (keyboard-translate 8388664 ?\[) does not work,
> since it fails the (characterp) test. Turns out that (max-char) is a C
> function that returns the highest allowed keycode. On my Emacs, that
> is 4194303.
> 
> Since (max-char) is a function and not a variable, and a C function at
> that (not advisable when called from another C function (characterp)) -
> I am left without options to rectify it. Or maybe I could use a hex
> editor. :-)

Your s-8 is a character with a modifier.  max-char returns the max
value of a character, excluding any modifiers.  So that value has
nothing to do with your difficulties in binding s-8 to insert [.
Something entirely different is at work here, probably some problem in
the code that you used to do the key binding.  But since you didn't
show that code, it's hard to help you.

> So, is this a bug?

No.

> Is it weird that max-char is a function? In C?

That's precisely so people will be unable to change the value.  It's
immutable.