unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Josh <josh@foxtail.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Magnar Sveen <magnars@gmail.com>, 13599@debbugs.gnu.org
Subject: bug#13599: 24.2; (max-char) is too low (and hard to change)
Date: Thu, 31 Jan 2013 13:22:20 -0800	[thread overview]
Message-ID: <CANdFEAFaWddHcHuZNd8gz-W1Ym=_N2pYMytAxExRFawdaS8PUA@mail.gmail.com> (raw)
In-Reply-To: <83k3qtcgro.fsf@gnu.org>

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





  parent reply	other threads:[~2013-01-31 21:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 18:42 bug#13599: 24.2; (max-char) is too low (and hard to change) Magnar Sveen
2013-01-31 19:08 ` Eli Zaretskii
2013-01-31 19:44   ` Magnar Sveen
2013-01-31 20:20     ` Eli Zaretskii
2013-02-01  6:13       ` Magnar Sveen
2013-02-01  7:41         ` Eli Zaretskii
2013-02-01  8:10           ` Magnar Sveen
2013-02-01 14:27           ` Stefan Monnier
2013-02-01 14:24         ` Stefan Monnier
2013-02-01 17:38           ` Magnar Sveen
2013-01-31 21:22   ` Josh [this message]
2013-02-01  7:43     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANdFEAFaWddHcHuZNd8gz-W1Ym=_N2pYMytAxExRFawdaS8PUA@mail.gmail.com' \
    --to=josh@foxtail.org \
    --cc=13599@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=magnars@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).