emacs-devel
[Top][All Lists]
Advanced

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

Re: How to recognize keyboard insertion?


From: David De La Harpe Golden
Subject: Re: How to recognize keyboard insertion?
Date: Sat, 31 Oct 2009 19:26:02 +0000
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701)

Eli Zaretskii wrote:


My understanding is that Shift-9 generates `(' or `)' depending on
whether the current keyboard is Latin or Arabic, not depending on the
characters surrounding the parenthesis.  All your examples show that
(and I see the same on my Windows box if I switch the keyboard to
Hebrew).  Do you agree?


Probably - Shift-9 generates parenleft (#x28) or parenright (#x29) depending on current keyboard layout. #x28 is then displayed as ( in ltr context, or ) in rtl context.



For example, try typing "9*(4+5)" after switching to Arabic keyboard.
What do you get?


9*)4+5(

Which is wrong, don't you think?


It's clearly not a valid arithmetical expression... It is however how mature bidi capable apps I tried behave, for better or worse. I don't think this is an area where emacs, bidi latecomer, should diverge from established practice, especially not by default - rtl-native users presumably by now expect to press the key labelled ")" to get "(" when using their native keymap but in an ltr context. Maybe they regard that as an annoyance, I dunno, or maybe it's a semantic-map feature, since the same shift-0 keypress still makes an opening paren (modern hebrew text, at least, seems to sometimes use () in text, not just arithmetic much like english, at least judging by wikipedia hebrew texts).

But therefore it's not necessary to track whether the character was entered by keyboard unless you want to provide a further unusual "smart"
layer that doesn't work like typical bidi apps.

I suspect an arabic person might type

ثثث(5+4)*9ثثث

- i.e. hitting ")" first when transcribing "9*(4+5)".

Maybe if the digits are Arabic digits.  I don't know enough Arabic to
judge this example.

Note that western "arabic numerals" vs. eastern arabic numerals is apparently a matter of font+bidi display (again for better or worse) - i.e. if I then copy just the expression above from within the rtl string and paste it into a ltr context, I get:

(5+4)*9













reply via email to

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