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

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

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


From: Josh
Subject: bug#13599: 24.2; (max-char) is too low (and hard to change)
Date: Thu, 31 Jan 2013 13:22:20 -0800

On Thu, Jan 31, 2013 at 11:08 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Magnar Sveen <magnars@gmail.com>
[...]
>> 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
[...]
>> So, is this a bug?
>
> No.

At a minimum the fact that (characterp (read-char)) can ever return
nil indicates disagreement between the two functions about exactly
what a "character" is.  It would be good to reconcile this
disagreement in their documentation if nothing else.

Given the existence of read-key, is it necessary for read-char to be
able to return values greater than MAX_CHAR?  If it's indeed
necessary, would it be reasonable to add an optional parameter to
read-char for callers such as quoted-insert to specify that read-char
should return only values <= MAX_CHAR?

Josh

On Thu, Jan 31, 2013 at 11:08 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Magnar Sveen <magnars@gmail.com>
>> 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.
>
>
>





reply via email to

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