emacs-devel
[Top][All Lists]
Advanced

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

Re: capslock changes control characters?


From: Stefan Monnier
Subject: Re: capslock changes control characters?
Date: Sun, 09 Mar 2008 23:26:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> > I think the current Emacs doesn't have a clear view about
>> > when and how to resolve modifiers.  For instance, S-i is
>> > resolved to `I' by XLookupString, C-i is resolved to 9 in
>> > make_ctrl_char.  Then I think C-S-i should also be resolved
>> > somewher before it's given to Lisp, at least before it's
>> > given to Lisp as character.

>> It should still be possible to distinguish key-bindings to C-i
>> (i.e. TAB) and C-S-i (i.e. S-TAB), provided the underlying terminal
>> allows it, obviously.
>> Does your code still allow this distinction?

> No.  If one needs such distinction, he should use
> read-event.

I mean, can we usefully handle

  (define-key map [?\t] 'foo)
  (define-key map [?\S-\t] 'bar)

because I think it's important that we can distinguish them.
But now that I look at it, the matter is more complex than that: on X11
hitting shift+tab send something like S-iso-lefttab which is then
mapped to `backtab'.  Under an xterm I get an escape sequence that gets
decoded directly into `backtab'.  So I guess it's not that important to
preserve the ?\S-\t key.

>> > Resolving of M-i is surely questionable, but as Emacs has
>> > accepeted M-i upon (insert (read-char)) for long, I resolved
>> > them too for backward compatibility.

>> I think this was just an accidental misfeature and would should not
>> preserve this kind of backward compatibility.  I can't imagine how it
>> could break any existing elisp package, and if a user used that in the
>> past, there are plenty of alternative ways to get the same result in
>> a saner way.

> Ok.  But, currently Emacs allows this kind of string "\M-i"
> (same as "\351", note that "\H-i" signales the error
> "Invalid modifier in string").

Again, this is just an old feature that made sense back in the 7/8bit
tty days.  It's still accepted because a fair amount of code passes such
strings to define-key.  Any other use would count as a bug for me.

> It seems that this is also a misfeature.

Yes.  But one that's still used.

> If we disallow M-i upon (insert (read-char)), shouldn't we disallow
> "\M-i" too?

I don't think so.  One is used in elisp code, the other is used by
manual typing only.  So removing one will break elisp packages, while
removing the other will only make previously working key presses not
work as before, but with various alternative key-presses available.


        Stefan




reply via email to

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