thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
pogonyshev at gmx.net
Sat Nov 26 18:01:55 EST 2005
Aidan Kehoe wrote:
> [CCing XEmacs Beta, because despite it originating at emacs-devel at gnu.org,
> this isn’t directly relevant to the FSF’s Emacs any more, but there’s more
> value in keeping it visible than in keeping it in private mail.]
OK, I'll also CC it back to GNU Emacs' list for the same reason.
> > Sorry, I'm on dial-up and I don't think I want to download megabytes just
> > to test it. I use GNU Emacs normally.
> Sure. I hope you don’t mind if I ask you a few specific questions then --
> -- If you see M-; listed as a key binding, is the first thing that occurs to
> you to type Alt+Shift+8? Or would you go for Alt+ж, since ж is where ; is on
> the US keyboard? Should we accept both?
I can't say which would be the most natural thing to hit, because few apps
but Emacs use such extravagant shortcuts.
Maybe I'd say like this: if an application uses _localized shortucts_ (i.e.
is filled with things like `Ctrl-Щ' and stuff), I'd go for `Alt-Shift-8', else
`Alt-ж' i.e. `Alt-;' on English layout. Since Emacs is not localized in this
way (and cannot and mustn't be, I think), typing `M-ж' for `M-;' is probably
Localized key bindings are impossible for Emacs, since you cannot type say ']'
with the Russian keyboard layout. So, the only option is to type `C-]' as
it is on English layout, which implies you must type all the other shortcuts
like this, for UI consistency and to avoid clashes.
> -- More generally, does this need to be done just for the alphabetic
> characters, or does punctuation need to be handled too? Looking at the
> Russian key layout, there’s no way to type `, ^, $, so I suspect you’re
> going to answer “yes” to me on that.
I cannot answer `yes' to an `or' question ;) Based on what I stated above,
I'd say that all shortcuts, in Emacs at least, must be invariant to physical
keys, not to logical characters the keys produce with the current input
This is probably also better ergonomically, since for power users (like me ;)
key binding combos slip into subconsciousness. I don't think my internal
autopilot performs a ``hold the Meta key and type the semicolon, wherever it
is'' command, rather a ``press the key here with the left thumb, and another
one there with the third right finger.'' If it indeed works like that,
shortcuts staying at the same physical keys require less effort to memorize/
push into subconsciousness.
> -- When I switch to the Russian layout in software, and type C-ч и to call
> “switch-to-buffer” , I then need to switch the keyboard layout back if I am
> to type *scratch*, which I frequently want to do. Is there a reasonable
> thing we can do there that doesn’t make it necessary to switch layout?
> Accepting “;ыскфеср;” as an equivalent buffer name for “*scratch*” doesn’t
> really seem like a great idea to me; maybe you _wanted_ to create a buffer
> with that name. I frequently create buffers named fdlsfdsfds and variations
> on that, for example.
Accepting `;ыскфеср;' as `*scratch*' won't work as a generic solution for
the reason you mentioned. It may be an optional heuristic, turned off by
default. There were some interesting programs for Windows that would
automagically switch the layout for you once you had started typing gibberish
in the current layout. I.e. if you typed ``Heccrbq'', it would consider it
too weird an English word, backspace it and retype in Russian layout as
``Русский''. Likewise, it would automagically switch to English layout if
you typed ``щчньщкщт'' instead of ``oxymoron''. However, such heuristical
things often work incorrectly with artificial languages, like programming
ones, and must never be forced on the user.
The only plausible generic solution I can think of is to track the layout for
each buffer separately. This may be very difficult to impossible to
implement with external layout switching. And that's precisely the reason
why I prefer to use Emacs' own input methods switched by `C-\'. This means
that I have to use different layout switching methods in Emacs and elsewhere,
but the advantages are more important for me.
Another, less important, superiority of Emacs input methods for me is the
ability to easily activate an otherwise not used input method. I
occasionally activate Greek and German input methods. With Emacs it is
relatively simple, while with say KDE it would mean that I'd have to either
constantly scroll through 4 layouts or go into the Conrol Center each time
I need one of the rarely used layouts.
More information about the XEmacs-Beta