unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* wish: right alt/meta to switch keyboard layout while pressed
@ 2005-11-22 19:50 Paul Pogonyshev
  2005-11-22 22:31 ` Andreas Schwab
                   ` (5 more replies)
  0 siblings, 6 replies; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-22 19:50 UTC (permalink / raw)


Hi,

It is probably a bit too late now for wishes, but maybe it is trivial
to implement in Emacs, so I'll ask just in case.

There is a useful feature to switch keyboard layout temporary while
the right alt (meta) key is pressed.  In xkb you can turn it on with
`-option grp:switch'.  It is useful, because some characters are
absent from some non-English layouts and `normal' switching back and
forth is quite annoying for a mere character or two.  For instance,
you cannot type `[', `]', `{', `}', the apostrophe and some other
characters while using Russian layout.

So, if I want to type an apostrophe from Russian keyboard layout, I
have to type `C-\ ' C-\'.  If, however, the temporary-switching was
implemented, I could do with `press-right-alt ' release-right-alt',
which is obviously much easier.

As far as I can tell, Emacs currently just ignores the right Alt.

Can this be implemented easily?

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-22 19:50 wish: right alt/meta to switch keyboard layout while pressed Paul Pogonyshev
@ 2005-11-22 22:31 ` Andreas Schwab
  2005-11-23  5:14 ` Richard M. Stallman
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 43+ messages in thread
From: Andreas Schwab @ 2005-11-22 22:31 UTC (permalink / raw)
  Cc: emacs-devel

Paul Pogonyshev <pogonyshev@gmx.net> writes:

> As far as I can tell, Emacs currently just ignores the right Alt.

Depends on how you assign it.  On my keyboard I have bound it to
Multi_key, which is used to trigger the compose feature of the X server.
Ie, I can type R-Alt a e to get the æ character.  This feature is
completely transparent to the application.

Another option for the R-Alt key is to use it as the Level3 shift
("AltGr").

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-22 19:50 wish: right alt/meta to switch keyboard layout while pressed Paul Pogonyshev
  2005-11-22 22:31 ` Andreas Schwab
@ 2005-11-23  5:14 ` Richard M. Stallman
  2005-11-23 19:52   ` Paul Pogonyshev
  2005-11-23  6:07 ` Juri Linkov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 43+ messages in thread
From: Richard M. Stallman @ 2005-11-23  5:14 UTC (permalink / raw)
  Cc: emacs-devel

    As far as I can tell, Emacs currently just ignores the right Alt.

Why does Emacs ignore the right Alt key?  It seems to me that
(at least normally) it should be equivalent to the left Alt key.

I would not mind if some other feature were optionally added to it,
but we should not think about that now.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-22 19:50 wish: right alt/meta to switch keyboard layout while pressed Paul Pogonyshev
  2005-11-22 22:31 ` Andreas Schwab
  2005-11-23  5:14 ` Richard M. Stallman
@ 2005-11-23  6:07 ` Juri Linkov
  2005-11-24 17:18 ` Stefan Monnier
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 43+ messages in thread
From: Juri Linkov @ 2005-11-23  6:07 UTC (permalink / raw)
  Cc: emacs-devel

> So, if I want to type an apostrophe from Russian keyboard layout, I
> have to type `C-\ ' C-\'.  If, however, the temporary-switching was
> implemented, I could do with `press-right-alt ' release-right-alt',
> which is obviously much easier.
>
> As far as I can tell, Emacs currently just ignores the right Alt.
>
> Can this be implemented easily?

I think the most natural way to do this in Emacs is to use C-q.
So to quote ' in an input method and not to translate it, you could
use C-q '.

However, this currently doesn't work.  C-q inserts a translated
character, and while C-q together with an input method read an input
sequence, the intermediate display in the echo area is quite messy.

It seems `quoted-insert' (C-q) attempts to do something with this
situation, and it let-binds `translation-table-for-input' to nil
before reading a quoted character, but this doesn't work for quoting
characters in input methods.  I propose the following patch to let-bind
`input-method-function' to nil as well.

Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.769
diff -c -r1.769 simple.el
*** lisp/simple.el	20 Nov 2005 18:08:55 -0000	1.769
--- lisp/simple.el	23 Nov 2005 06:04:04 -0000
***************
*** 609,615 ****
  digits are interpreted as a character code.  This is intended to be
  useful for editing binary files."
    (interactive "*p")
!   (let* ((char (let (translation-table-for-input)
  		 (if (or (not overwrite-mode)
  			 (eq overwrite-mode 'overwrite-mode-binary))
  		     (read-quoted-char)
--- 610,616 ----
  digits are interpreted as a character code.  This is intended to be
  useful for editing binary files."
    (interactive "*p")
!   (let* ((char (let (translation-table-for-input input-method-function)
  		 (if (or (not overwrite-mode)
  			 (eq overwrite-mode 'overwrite-mode-binary))
  		     (read-quoted-char)

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-23  5:14 ` Richard M. Stallman
@ 2005-11-23 19:52   ` Paul Pogonyshev
  2005-11-25 15:50     ` Richard M. Stallman
  0 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-23 19:52 UTC (permalink / raw)


Richard M. Stallman wrote:
>     As far as I can tell, Emacs currently just ignores the right Alt.
> 
> Why does Emacs ignore the right Alt key?  It seems to me that
> (at least normally) it should be equivalent to the left Alt key.

Probably because X distinguishes between the two Alts (I don't know
the details) and Emacs only considers the left Alt as Meta key.  It
may also depend on how X is configured.

> I would not mind if some other feature were optionally added to it,
> but we should not think about that now.

OK.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-22 19:50 wish: right alt/meta to switch keyboard layout while pressed Paul Pogonyshev
                   ` (2 preceding siblings ...)
  2005-11-23  6:07 ` Juri Linkov
@ 2005-11-24 17:18 ` Stefan Monnier
  2005-11-24 19:45   ` Paul Pogonyshev
       [not found] ` <200511261925.20191.pogonyshev@gmx.net>
  2005-11-28  2:39 ` wish: right alt/meta to switch keyboard layout while pressed Stefan Monnier
  5 siblings, 1 reply; 43+ messages in thread
From: Stefan Monnier @ 2005-11-24 17:18 UTC (permalink / raw)
  Cc: emacs-devel

> As far as I can tell, Emacs currently just ignores the right Alt.

>From your description you seem to say that your right Alt key is already
configured for other apps to do some kind of keyboard switch.  So it seems
that it's an X11 feature, in which case the problem may simply be a bug in
Emacs which doesn't handle this feature correctly.  Can you check with `xev'
to see what events your right Alt key generates?


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-24 17:18 ` Stefan Monnier
@ 2005-11-24 19:45   ` Paul Pogonyshev
  2005-11-24 20:56     ` Stefan Monnier
  0 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-24 19:45 UTC (permalink / raw)
  Cc: Stefan Monnier

Stefan Monnier wrote:
> > As far as I can tell, Emacs currently just ignores the right Alt.
> 
> From your description you seem to say that your right Alt key is already
> configured for other apps to do some kind of keyboard switch.  So it seems
> that it's an X11 feature, in which case the problem may simply be a bug in
> Emacs which doesn't handle this feature correctly.

Emacs has no way of handling it correctly out-of-the-box, since it uses
internal input methods, which are a completely separate from `xkb'.

> Can you check with `xev' to see what events your right Alt key generates?

It shows up as `Super_R', while the left Alt is `Alt_L'.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-24 19:45   ` Paul Pogonyshev
@ 2005-11-24 20:56     ` Stefan Monnier
  2005-11-25 19:37       ` Paul Pogonyshev
  2005-11-26  4:22       ` Richard M. Stallman
  0 siblings, 2 replies; 43+ messages in thread
From: Stefan Monnier @ 2005-11-24 20:56 UTC (permalink / raw)
  Cc: emacs-devel

> Emacs has no way of handling it correctly out-of-the-box, since it uses
> internal input methods, which are a completely separate from `xkb'.

You mean you use Emacs's internal input methods.  I occasionally use them as
well, but I mostly use XIM input methods and they work just fine with Emacs.

>> Can you check with `xev' to see what events your right Alt key generates?
> It shows up as `Super_R', while the left Alt is `Alt_L'.

So maybe the physical key is located on the right side of the space bar and
it has a little bit of text on it that says "alt", so *you* think of it as
a "right alt key".
But as far as X clients are concerned this is not a "right alt key".

        Stefan



> Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-23 19:52   ` Paul Pogonyshev
@ 2005-11-25 15:50     ` Richard M. Stallman
  2005-11-25 18:00       ` Andreas Schwab
  0 siblings, 1 reply; 43+ messages in thread
From: Richard M. Stallman @ 2005-11-25 15:50 UTC (permalink / raw)
  Cc: emacs-devel

    Probably because X distinguishes between the two Alts (I don't know
    the details) and Emacs only considers the left Alt as Meta key.  It
    may also depend on how X is configured.

Is there an Xpert on the list who could discuss how--and whether--to
make left Alt work like right Alt, in usual X configurations?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 15:50     ` Richard M. Stallman
@ 2005-11-25 18:00       ` Andreas Schwab
  0 siblings, 0 replies; 43+ messages in thread
From: Andreas Schwab @ 2005-11-25 18:00 UTC (permalink / raw)
  Cc: emacs-devel, Paul Pogonyshev

"Richard M. Stallman" <rms@gnu.org> writes:

> Is there an Xpert on the list who could discuss how--and whether--to
> make left Alt work like right Alt, in usual X configurations?

I don't think Emacs should override the User's choice of key mapping, even
if it is some system default.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-24 20:56     ` Stefan Monnier
@ 2005-11-25 19:37       ` Paul Pogonyshev
  2005-11-25 22:17         ` Stefan Monnier
  2005-11-26  4:22       ` Richard M. Stallman
  1 sibling, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-25 19:37 UTC (permalink / raw)
  Cc: Stefan Monnier

Stefan Monnier wrote:
> > Emacs has no way of handling it correctly out-of-the-box, since it uses
> > internal input methods, which are a completely separate from `xkb'.
> 
> You mean you use Emacs's internal input methods.  I occasionally use them as
> well, but I mostly use XIM input methods and they work just fine with Emacs.

You could put it that way, yes.  However, with Russian layout, it is almost
impossible to do otherwise.  If I switch my `global' layout (handled by KDE,
which AFAIK falls back to `xkb'), I get this on response to `M-d':

  M-в is undefined

Working with Emacs with essentially all commands except `self-insert-command'
disabled is not something I like.  I guess your second layout also works with
Latin alphabet, so it's not a problem for you.

> >> Can you check with `xev' to see what events your right Alt key generates?
> > It shows up as `Super_R', while the left Alt is `Alt_L'.
> 
> So maybe the physical key is located on the right side of the space bar and
> it has a little bit of text on it that says "alt", so *you* think of it as
> a "right alt key".
> But as far as X clients are concerned this is not a "right alt key".

Uh, I just checked again, it is actually `Mode_switch' for X, I must have
pressed the right key with the Windows logo the previous time.

So yes, let me rephrase.  I wish `Mode_switch' would deactivate the current
input method while pressed in Emacs.  Or so that I could turn such feature
on with something as simple as `setq ... t'.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 19:37       ` Paul Pogonyshev
@ 2005-11-25 22:17         ` Stefan Monnier
  2005-11-25 22:33           ` Paul Pogonyshev
  0 siblings, 1 reply; 43+ messages in thread
From: Stefan Monnier @ 2005-11-25 22:17 UTC (permalink / raw)
  Cc: emacs-devel

>> > Emacs has no way of handling it correctly out-of-the-box, since it uses
>> > internal input methods, which are a completely separate from `xkb'.
>> You mean you use Emacs's internal input methods.  I occasionally use them as
>> well, but I mostly use XIM input methods and they work just fine with Emacs.
> You could put it that way, yes.  However, with Russian layout, it is almost
> impossible to do otherwise.  If I switch my `global' layout (handled by KDE,
> which AFAIK falls back to `xkb'), I get this on response to `M-d':

>   M-в is undefined

Interesting.  I guess that could be considered as a bug.
How do other X apps handle this problem?

> Working with Emacs with essentially all commands except `self-insert-command'
> disabled is not something I like.  I guess your second layout also works with
> Latin alphabet, so it's not a problem for you.

It's not a second layout: the XIM method just provides some key-combos to
enter accented chars.  So, yes, I don't see any of those problems.

>> >> Can you check with `xev' to see what events your right Alt key generates?
>> > It shows up as `Super_R', while the left Alt is `Alt_L'.
>> So maybe the physical key is located on the right side of the space bar and
>> it has a little bit of text on it that says "alt", so *you* think of it as
>> a "right alt key".
>> But as far as X clients are concerned this is not a "right alt key".

> Uh, I just checked again, it is actually `Mode_switch' for X, I must have
> pressed the right key with the Windows logo the previous time.

That makes more sense.  xterm.c recognizes the Mode_switch key as something
special.

> So yes, let me rephrase.  I wish `Mode_switch' would deactivate the current
> input method while pressed in Emacs.  Or so that I could turn such feature
> on with something as simple as `setq ... t'.

Is that what the Mode_switch key does in other X apps?  I.e. what does the
Mode_switch key do, "normally"?
The question is mostly to figure out whether it's a bug in our X event
handling or whether you're asking for an Emacs-only feature (the
implementation would most likely be different).


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 22:17         ` Stefan Monnier
@ 2005-11-25 22:33           ` Paul Pogonyshev
  2005-11-25 22:44             ` Aidan Kehoe
                               ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-25 22:33 UTC (permalink / raw)
  Cc: Stefan Monnier

Stefan Monnier wrote:
> >> > Emacs has no way of handling it correctly out-of-the-box, since it uses
> >> > internal input methods, which are a completely separate from `xkb'.
> >> You mean you use Emacs's internal input methods.  I occasionally use them as
> >> well, but I mostly use XIM input methods and they work just fine with Emacs.
> > You could put it that way, yes.  However, with Russian layout, it is almost
> > impossible to do otherwise.  If I switch my `global' layout (handled by KDE,
> > which AFAIK falls back to `xkb'), I get this on response to `M-d':
> 
> >   M-в is undefined
> 
> Interesting.  I guess that could be considered as a bug.
> How do other X apps handle this problem?

I use KDE.  There I have the Russian (winkeys) layout added with "Include latin
layout" option turned on.  This gives this command line:

	setxkbmap -model pc104 -layout us,ru -variant ,winkeys

After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W' (`Ц' and
`W' are on the same key.)  However, Firefox doesn't, for some reason (which pisses
me off a lot, BTW) and so doesn't Emacs...  No idea why.

> > So yes, let me rephrase.  I wish `Mode_switch' would deactivate the current
> > input method while pressed in Emacs.  Or so that I could turn such feature
> > on with something as simple as `setq ... t'.
> 
> Is that what the Mode_switch key does in other X apps?  I.e. what does the
> Mode_switch key do, "normally"?

Yes, if you use `setxkbmap -option grp:switch'.  In KDE Control Center this
option is called ``Right Alt key switches group while pressed.''  There is a
lot of similar options, though.  Somehow, I think this one is `standard' in
some way (I vaguelly recall some old DOS drivers behaving this way), but I may
be wrong.

> The question is mostly to figure out whether it's a bug in our X event
> handling or whether you're asking for an Emacs-only feature (the
> implementation would most likely be different).

Maybe if you could make it behave like most other apps do (and unlike Firefox),
that is enough.  Than I would be able to just use global layout switching and
not internal Emacs input methods.  However, making it work with internal methods
would be even better for me, since I like separate input methods for each buffer
etc., which is impossible with global layout switching.  (Well, there are some
horrible hacks I was privately given links to, but I'm not diving into something
as complicated as that.)

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 22:33           ` Paul Pogonyshev
@ 2005-11-25 22:44             ` Aidan Kehoe
  2005-11-26 16:43               ` Paul Pogonyshev
  2005-11-26  8:15             ` Eugene Vlasov
  2005-11-26 15:10             ` Stefan Monnier
  2 siblings, 1 reply; 43+ messages in thread
From: Aidan Kehoe @ 2005-11-25 22:44 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel


 Ar an séú lá is fiche de mí na Samhain, scríobh Paul Pogonyshev: 

 > I use KDE. There I have the Russian (winkeys) layout added with "Include
 > latin layout" option turned on. This gives this command line:
 > 
 > 	setxkbmap -model pc104 -layout us,ru -variant ,winkeys
 > 
 > After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W'
 > (`Ц' and `W' are on the same key.) However, Firefox doesn't, for some
 > reason (which pisses me off a lot, BTW) and so doesn't Emacs... No idea
 > why.

Recent betas of XEmacs do. Not to do it is expected behaviour, when you
think of it; it would be reasonable to bind M-Cyrillic_tse to something
different to M-x, if both were available on the keyboard. 

-- 
I AM IN JAIL AND ALLOWED SEND ONLY ONE CABLE SINCE WAS ARRESTED WHILE
MEASURING FIFTEEN FOOT WALL OUTSIDE PALACE AND HAVE JUST FINISHED COUNTING
THIRTY EIGHT THOUSAND FIVE HUNDERED TWENTY TWO NAMES WHOS WHO IN MIDEAST.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-24 20:56     ` Stefan Monnier
  2005-11-25 19:37       ` Paul Pogonyshev
@ 2005-11-26  4:22       ` Richard M. Stallman
  1 sibling, 0 replies; 43+ messages in thread
From: Richard M. Stallman @ 2005-11-26  4:22 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

    > It shows up as `Super_R', while the left Alt is `Alt_L'.

Is that a common way for the default X configuration to be set up
by default?

If so, we might want to include something in etc/PROBLEMS to advise
users what they should do if they have this kind of configuration
and they want left-Alt to "work" as Meta.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 22:33           ` Paul Pogonyshev
  2005-11-25 22:44             ` Aidan Kehoe
@ 2005-11-26  8:15             ` Eugene Vlasov
  2005-11-26 19:44               ` Paul Pogonyshev
  2005-11-26 15:10             ` Stefan Monnier
  2 siblings, 1 reply; 43+ messages in thread
From: Eugene Vlasov @ 2005-11-26  8:15 UTC (permalink / raw)


On Sat, Nov 26, 2005 at 12:33:23AM +0200 Paul Pogonyshev wrote:

> After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W' (`Ц' and
> `W' are on the same key.)  However, Firefox doesn't, for some reason (which pisses
> me off a lot, BTW) and so doesn't Emacs...  No idea why.

With this patch from ALTLinux distribution keybindings with Ctrl and
Meta works for me in russian keyboard map:

diff -Naur emacs/src/xterm.c emacs.build/src/xterm.c
--- emacs/src/xterm.c   2005-11-16 23:44:07 +0500
+++ emacs.build/src/xterm.c     2005-11-26 12:50:23 +0500
@@ -6141,11 +6141,20 @@
 
           /* make_lispy_event turns chars into control chars.
              Don't do it here because XLookupString is too eager.  */
-          event.xkey.state &= ~ControlMask;
-          event.xkey.state &= ~(dpyinfo->meta_mod_mask
-                                | dpyinfo->super_mod_mask
-                                | dpyinfo->hyper_mod_mask
-                                | dpyinfo->alt_mod_mask);
+          /* make CMsHA behave the same no matter what the rest of the 
+             state is (particularly important for multilingual XKBmaps
+             when we still want the latin letters appear in the "control"
+             sequences; would be nice if we also could choose an independent
+             map for each buffer like xxkb does for windows: the the problem with
+             smth like C-h f in Russian mode would be solved); discard
+             all mods save shift. (imz@altlinux.ru, 2002 Nov 8,
+             fixing #852 at bugs.altlinux.ru) */
+          if (event.xkey.state & ( ControlMask
+                                  | dpyinfo->meta_mod_mask
+                                  | dpyinfo->super_mod_mask
+                                  | dpyinfo->hyper_mod_mask
+                                  | dpyinfo->alt_mod_mask))
+            event.xkey.state &= (ShiftMask | dpyinfo->shift_lock_mask);
 
           /* In case Meta is ComposeCharacter,
              clear its status.  According to Markus Ehrnsperger



-- 
WBR, Eugene Vlasov        mailto:eugvv at altlinux.ru
                          JID: eugvv@jabber.ru

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 22:33           ` Paul Pogonyshev
  2005-11-25 22:44             ` Aidan Kehoe
  2005-11-26  8:15             ` Eugene Vlasov
@ 2005-11-26 15:10             ` Stefan Monnier
  2005-11-26 16:46               ` Paul Pogonyshev
  2005-11-28 20:27               ` wish: right alt/meta to switch keyboard layout while pressed Juri Linkov
  2 siblings, 2 replies; 43+ messages in thread
From: Stefan Monnier @ 2005-11-26 15:10 UTC (permalink / raw)
  Cc: emacs-devel

>> Interesting.  I guess that could be considered as a bug.
>> How do other X apps handle this problem?

> I use KDE.  There I have the Russian (winkeys) layout added with "Include
> latin layout" option turned on.  This gives this command line:

> 	setxkbmap -model pc104 -layout us,ru -variant ,winkeys

> After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W' (`Ц'
> and `W' are on the same key.)  However, Firefox doesn't, for some reason
> (which pisses me off a lot, BTW) and so doesn't Emacs...  No idea why.

When you say "most applications" does that only include KDE (Qt) apps,
or does it also include apps that use completely different toolkits?
I guess it also includes other apps, right?

If so, I think this behavior of Emacs should be considered as a bug.

>> > So yes, let me rephrase.  I wish `Mode_switch' would deactivate the current
>> > input method while pressed in Emacs.  Or so that I could turn such feature
>> > on with something as simple as `setq ... t'.
>> Is that what the Mode_switch key does in other X apps?  I.e. what does the
>> Mode_switch key do, "normally"?
> Yes, if you use `setxkbmap -option grp:switch'.

Then Emacs should do the same.  I suspect it's the same bug.

> Maybe if you could make it behave like most other apps do (and unlike
> Firefox), that is enough.  Than I would be able to just use global layout
> switching and not internal Emacs input methods.  However, making it work
> with internal methods would be even better for me, since I like separate
> input methods for each buffer etc., which is impossible with global layout
> switching.  (Well, there are some horrible hacks I was privately given
> links to, but I'm not diving into something as complicated as that.)

Yes, that makes sense as well.
So you'd want hitting Mode_switch to toggle the LEIM input method or would
you want pressing to turn it off and releasing to turn it back on?


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-25 22:44             ` Aidan Kehoe
@ 2005-11-26 16:43               ` Paul Pogonyshev
  2005-11-27  5:26                 ` Tomas Zerolo
  0 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-26 16:43 UTC (permalink / raw)
  Cc: Aidan Kehoe, Stefan Monnier

Aidan Kehoe wrote:
> 
>  Ar an séú lá is fiche de mí na Samhain, scríobh Paul Pogonyshev: 
> 
>  > I use KDE. There I have the Russian (winkeys) layout added with "Include
>  > latin layout" option turned on. This gives this command line:
>  > 
>  > 	setxkbmap -model pc104 -layout us,ru -variant ,winkeys
>  > 
>  > After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W'
>  > (`Ц' and `W' are on the same key.) However, Firefox doesn't, for some
>  > reason (which pisses me off a lot, BTW) and so doesn't Emacs... No idea
>  > why.
> 
> Recent betas of XEmacs do. Not to do it is expected behaviour, when you
> think of it; it would be reasonable to bind M-Cyrillic_tse to something
> different to M-x, if both were available on the keyboard. 

Yeah, and then I'd have to remember if I'm typing in Russian or in English
and press different key combos in different layouts to say delete a word.

I don't mind if they are configurable in different layouts even if I consider
it an overkill.  But Emacs has some hundreds of actively used key combinations,
do you suggest I rebind all of them separately for Russian layout too?  Should
I do this in every single one application I use besides Emacs (and which
probably doesn't even have the facility to rebind keys.)

Non-self-inserting keys _absolutely_ must work independently of the layout,
at least by default.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-26 15:10             ` Stefan Monnier
@ 2005-11-26 16:46               ` Paul Pogonyshev
  2005-11-27 18:19                 ` Stefan Monnier
  2005-11-28 20:27               ` wish: right alt/meta to switch keyboard layout while pressed Juri Linkov
  1 sibling, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-26 16:46 UTC (permalink / raw)
  Cc: Stefan Monnier

Stefan Monnier wrote:
> >> Interesting.  I guess that could be considered as a bug.
> >> How do other X apps handle this problem?
> 
> > I use KDE.  There I have the Russian (winkeys) layout added with "Include
> > latin layout" option turned on.  This gives this command line:
> 
> > 	setxkbmap -model pc104 -layout us,ru -variant ,winkeys
> 
> > After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W' (`Ц'
> > and `W' are on the same key.)  However, Firefox doesn't, for some reason
> > (which pisses me off a lot, BTW) and so doesn't Emacs...  No idea why.
> 
> When you say "most applications" does that only include KDE (Qt) apps,
> or does it also include apps that use completely different toolkits?
> I guess it also includes other apps, right?
> 
> If so, I think this behavior of Emacs should be considered as a bug.

Not only KDE applications, no.  For instance, it works in Gaim (pure GTK+,
AFAIK) and Galeon (GNOME.)

> >> > So yes, let me rephrase.  I wish `Mode_switch' would deactivate the current
> >> > input method while pressed in Emacs.  Or so that I could turn such feature
> >> > on with something as simple as `setq ... t'.
> >> Is that what the Mode_switch key does in other X apps?  I.e. what does the
> >> Mode_switch key do, "normally"?
> > Yes, if you use `setxkbmap -option grp:switch'.
> 
> Then Emacs should do the same.  I suspect it's the same bug.

Yes, if not for internal input methods, it at least must honor my global settings
for `xkb' behavior.

> > Maybe if you could make it behave like most other apps do (and unlike
> > Firefox), that is enough.  Than I would be able to just use global layout
> > switching and not internal Emacs input methods.  However, making it work
> > with internal methods would be even better for me, since I like separate
> > input methods for each buffer etc., which is impossible with global layout
> > switching.  (Well, there are some horrible hacks I was privately given
> > links to, but I'm not diving into something as complicated as that.)
> 
> Yes, that makes sense as well.
> So you'd want hitting Mode_switch to toggle the LEIM input method or would
> you want pressing to turn it off and releasing to turn it back on?

It seems in `xkb' Mode_switch disables alternative groups only, i.e. it won't
start typing in Russian if I hold Mode_switch while using the English layout.
So, if you manage to implement something similar in Emacs, it should probably
behave like this (i.e. deactivate any non-default input method) for consistency.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-26  8:15             ` Eugene Vlasov
@ 2005-11-26 19:44               ` Paul Pogonyshev
  2005-11-28 20:33                 ` Juri Linkov
  0 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-26 19:44 UTC (permalink / raw)
  Cc: Eugene Vlasov

Eugene Vlasov wrote:
> On Sat, Nov 26, 2005 at 12:33:23AM +0200 Paul Pogonyshev wrote:
> 
> > After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W' (`Ц' and
> > `W' are on the same key.)  However, Firefox doesn't, for some reason (which pisses
> > me off a lot, BTW) and so doesn't Emacs...  No idea why.
> 
> With this patch from ALTLinux distribution keybindings with Ctrl and
> Meta works for me in russian keyboard map:
> 
> [patch]

Works here.  I'm not qualified to say if it is correct, but I think something
like this should be installed in the trunk.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
       [not found]   ` <17288.41589.506361.323637@parhasard.net>
@ 2005-11-26 23:01     ` Paul Pogonyshev
  2005-11-27  1:48       ` Ben Wing
  0 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-26 23:01 UTC (permalink / raw)
  Cc: emacs-devel, XEmacs Beta

Aidan Kehoe wrote:
> 
> [CCing XEmacs Beta, because despite it originating at emacs-devel@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 --

Sure.

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

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
method/layout.

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.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-26 23:01     ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed) Paul Pogonyshev
@ 2005-11-27  1:48       ` Ben Wing
  2005-11-27  5:35         ` Tomas Zerolo
                           ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Ben Wing @ 2005-11-27  1:48 UTC (permalink / raw)
  Cc: Aidan Kehoe, XEmacs Beta, emacs-devel

this is what i call the "russian c-x problem".  at one point i had 
worked out what the correct thing to do is, and there are various 
comments to this effect in XEmacs; but i never finished it.  it looks 
like aidan went ahead and implemented it, though, right, aidan?

in events.h we have:

enum alternative_key_chars
{
  KEYCHAR_CURRENT_LANGENV,
  KEYCHAR_DEFAULT_USER,
  KEYCHAR_DEFAULT_SYSTEM,
  KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV,
  KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER,
  KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM,
  KEYCHAR_QWERTY,
  KEYCHAR_LAST
};

struct Lisp_Key_Data
{
#ifdef EVENT_DATA_AS_OBJECTS
  struct lrecord_header lheader;
#endif /* EVENT_DATA_AS_OBJECTS */
  /* What keysym this is; a character or a symbol. */
  Lisp_Object keysym;
  /* Modifiers held down when key was pressed: control, meta, etc.
     Also includes buttons.  For many keys, Shift is not a bit; that
     is implicit in the keyboard layout. */
  int modifiers;
  /* Alternate character interpretations for this key in different
     keyboard layouts.  This deals with the problem of pressing C-x in
     the Russian layout (the so-called "Russian C-x problem"), for
     example: `x' gets mapped to a Cyrillic character, so what do we
     do?  For that matter, what about `C-x b'?  What we do is look the
     key up in the default locales (current language environment, user
     default, system default), then check to see if the underlying
     virtual key is alphabetic in the same three defaults, then
     finally check US ASCII.  We ignore the underlying virtual key for
     the current layout to avoid the problem of a French speaker
     (AZERTY layout) who temporarily switches to Russian: The virtual
     keys underlying Russian are US-ASCII, so what the French speaker
     things of as C-a (the key just to the right of TAB) appears as
     C-q.

         I've just implemented this in event-stream.c, and I really want to
         see feedback from actual Russians about it, and whether it needs to
         be much more complete than what I've done. E.g, the mapping back to
         US Qwerty is hardcoded on the X11 side of things, and only deals
         with the alphabetic characters.

     Also, I think it's downright confusing for people with Roman
     letters on their keyboard to have random other letters than are
     described as calling some command, call that command. So I want to
     consider enabling it by language environment.

     [[ (#### We should probably ignore the current char and look
     *ONLY* in alt_keychars for all control keys.  What about the
     English speaker who temporarily switches to the French layout and
     finds C-q mapped to C-a?) ]]

         No, we shouldn't. People who use the French layout expect that
         pressing control with the key to the right of tab passes C-a to
         emacs; English speakers (more exactly, Qwerty users) who
         temporarily switch to the French layout encounter that issue in
         every other app too, and they normally remap the keyboard in
         software as soon as they can, or learn to live with Azerty. That
         applies for all the Roman-alphabet keyboard layouts. Aidan Kehoe,
         2005-05-15

         I've taken out the dependency on MULE for this feature because it's
         also useful in a non-Mule XEmacs where the user has set their font
         to something ending in iso8859-5. How many of those users there
         are, is another question. */
  Ichar alt_keychars[KEYCHAR_LAST];
};

the first level of indenting in the comments is from me; stuff i wrote 
back in 2001 or so.  the second level is from aidan.  what i wrote is 
heavily based on microsoft's ui style guide, as they have a long 
discussion of this issue.

note also that this algorithm *does* use the locale of the current 
buffer; this is certainly possible under windows, where there is an 
explicit api to query both the physical and logical keyboard.

it also seems that alphabetic and non-alphabetic keys should (perhaps) 
behave differently.

now, from personal experience: i have had many times when i've been in 
foreign countries and had to log on to the internet.  typically, the 
punctuation is in a completely different place.  i always switched to us 
layout, and found it nearly impossible to use any other layouts.  i 
*definitely* would expect in such a case that keyboard shortcuts 
involving punctuation should follow the logical, not physical, layout -- 
but with the physical layout as a backup, so when i temporarily switch 
to russian, i can still type C-x. (with alphabetic keys, it is 
semi-feasible to search the keyboard in front of me to find the keys, 
but this is just impossible for punctuation.)

ben

Paul Pogonyshev wrote:

>Aidan Kehoe wrote:
>  
>
>>[CCing XEmacs Beta, because despite it originating at emacs-devel@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 --
>>    
>>
>
>Sure.
>
>  
>
>>-- 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
>more natural.
>
>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
>method/layout.
>
>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.
>
>Paul
>
>  
>





^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-26 16:43               ` Paul Pogonyshev
@ 2005-11-27  5:26                 ` Tomas Zerolo
  0 siblings, 0 replies; 43+ messages in thread
From: Tomas Zerolo @ 2005-11-27  5:26 UTC (permalink / raw)
  Cc: Aidan Kehoe, Stefan Monnier, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1312 bytes --]

On Sat, Nov 26, 2005 at 06:43:06PM +0200, Paul Pogonyshev wrote:
> Aidan Kehoe wrote:
[...]
> > Recent betas of XEmacs do. Not to do it is expected behaviour, when you
> > think of it; it would be reasonable to bind M-Cyrillic_tse to something
> > different to M-x, if both were available on the keyboard. 
> 
> Yeah, and then I'd have to remember if I'm typing in Russian or in English
> and press different key combos in different layouts to say delete a word.
> 
> I don't mind if they are configurable in different layouts even if I consider
> it an overkill.  But Emacs has some hundreds of actively used key combinations,
> do you suggest I rebind all of them separately for Russian layout too?  Should
> I do this in every single one application I use besides Emacs (and which
> probably doesn't even have the facility to rebind keys.)
> 
> Non-self-inserting keys _absolutely_ must work independently of the layout,
> at least by default.

This is interesting. I think it's actually a problem deserving more
thought, not all-black or all-white. For an example, I expeckt C-y to
yank, although I'm using sometimes a German, sometimes an US keyboard
(where the Y and Z keys exchange places relatively to each other). OTOH,
I definitely see your point.

Hmmm.

Regards
-- tomas

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-27  1:48       ` Ben Wing
@ 2005-11-27  5:35         ` Tomas Zerolo
  2005-11-27 11:29         ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed ) Paul Pogonyshev
  2005-11-27 18:35         ` Aidan Kehoe
  2 siblings, 0 replies; 43+ messages in thread
From: Tomas Zerolo @ 2005-11-27  5:35 UTC (permalink / raw)
  Cc: Aidan Kehoe, XEmacs Beta, emacs-devel, Paul Pogonyshev


[-- Attachment #1.1: Type: text/plain, Size: 248 bytes --]

On Sat, Nov 26, 2005 at 07:48:16PM -0600, Ben Wing wrote:
> this is what i call the "russian c-x problem" [...]

Thanks, Ben. I was calling for 'more thought' and got a boatload full of
it, nearly more than I'm able to digest :-)

Regards
-- tomas

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed )
  2005-11-27  1:48       ` Ben Wing
  2005-11-27  5:35         ` Tomas Zerolo
@ 2005-11-27 11:29         ` Paul Pogonyshev
  2005-11-28  5:25           ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed) Ben Wing
  2005-11-27 18:35         ` Aidan Kehoe
  2 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-27 11:29 UTC (permalink / raw)
  Cc: Aidan Kehoe, XEmacs Beta, Ben Wing

Ben Wing wrote:
> now, from personal experience: i have had many times when i've been in 
> foreign countries and had to log on to the internet.  typically, the 
> punctuation is in a completely different place.  i always switched to us 
> layout, and found it nearly impossible to use any other layouts.  i 
> *definitely* would expect in such a case that keyboard shortcuts 
> involving punctuation should follow the logical, not physical, layout -- 
> but with the physical layout as a backup, so when i temporarily switch 
> to russian, i can still type C-x. (with alphabetic keys, it is 
> semi-feasible to search the keyboard in front of me to find the keys, 
> but this is just impossible for punctuation.)

I fail to see while it is impossible for punctuation, but here is my
reasoning.  (I'm constantly referring to Russian layout since that's what
I use; I agree I'm somewhat biased because of this, since Russian uses a
different alphabet.)

Let's say we have punctuation following the logical layout, while the
alphabetical key bindings remain on physically the same keys.  I won't
stress the consistency objection here, just the practical consequences
for a Russian layout users (must also apply to any layout with an
alphabet with more than 26 letters.)

According to your proposal, key binding for command `M-.' (find-tag)
will be on logical `M-.' in Russian layout, physically corresponding to
English `M-/'.  Now, many variants of the Russian layout (including
Emacs' `russian-computer') don't have any way to type in the slash
except by using the keypad.  So, the command `dabbrev-expand' (M-/)
becomes unavailable in Russian layout: there is no way to type that
logically.  And if you type that as-in-English, it invokes `find-tag',
according to your proposal.

This is just one example.  There are certainly more, involving such
key combinations like `M-^', `M-$' (which I use quite often) and others.
All these cannot be typed with Russian layout and their physical keys
clash with placement of punctuation on the Russian layout.

Physical correspondence with English layout (which, I think, is marked
on all keyboards, may be wrong here) is something all layouts have in
common.  In all other aspects they have lots of differences, including
the location of keys corresponding to punctuation characters.

One not-yet-discussed possibility is to distinguish between layouts
for latin alphabet-based languages and all the rest (Cyrillic, Greek,
...)  Since I only regularly use Russian and English layouts, maybe
someone using, say German or Swedish layouts, could comment on this.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-26 16:46               ` Paul Pogonyshev
@ 2005-11-27 18:19                 ` Stefan Monnier
  2005-11-27 21:39                   ` Paul Pogonyshev
  0 siblings, 1 reply; 43+ messages in thread
From: Stefan Monnier @ 2005-11-27 18:19 UTC (permalink / raw)
  Cc: emacs-devel

>> Yes, that makes sense as well.
>> So you'd want hitting Mode_switch to toggle the LEIM input method or would
>> you want pressing to turn it off and releasing to turn it back on?

> It seems in `xkb' Mode_switch disables alternative groups only, i.e. it
> won't start typing in Russian if I hold Mode_switch while using the
> English layout.  So, if you manage to implement something similar in
> Emacs, it should probably behave like this (i.e. deactivate any
> non-default input method) for consistency.

I believe you misunderstood the question.  The question is whether the
deactivation should be done while Mode_switch is pressed (as if it were
some kind of modifier), or between two presses of Mode_switch, or yet
something else.


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-27  1:48       ` Ben Wing
  2005-11-27  5:35         ` Tomas Zerolo
  2005-11-27 11:29         ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed ) Paul Pogonyshev
@ 2005-11-27 18:35         ` Aidan Kehoe
  2 siblings, 0 replies; 43+ messages in thread
From: Aidan Kehoe @ 2005-11-27 18:35 UTC (permalink / raw)
  Cc: XEmacs Beta, emacs-devel, Paul Pogonyshev


 Ar an séú lá is fiche de mí na Samhain, scríobh Ben Wing: 

 > this is what i call the "russian c-x problem".  at one point i had 
 > worked out what the correct thing to do is, and there are various 
 > comments to this effect in XEmacs; but i never finished it.  it looks 
 > like aidan went ahead and implemented it, though, right, aidan?

Yes. I’ve never tested the the Win32 support, though--it looks like your
implementation is complete, but I couldn’t say if it works or not. 

 > [...] note also that this algorithm *does* use the locale of the current 
 > buffer; this is certainly possible under windows, where there is an 
 > explicit api to query both the physical and logical keyboard.

The X11 side of things doesn’t. It just supplies Qwerty as an alternative. 
Win32 locale support in general is much superior, and providing the same
level of functionality in pure X11 is just impossible. There is no locale ->
key layout mapping available, for a start. 

 > it also seems that alphabetic and non-alphabetic keys should (perhaps) 
 > behave differently.

What I take from this response from Paul --

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

is that we have to support this processing for punctuation as well as for
alphanumeric characters. If he doesn’t know which would be the most natural
thing to hit, then people in general will hit both, and as well as that,
lots of ASCII punctuation just isn’t available on a Russian keyboard. (This
position is different from what I thought when I implemented the X11 support
in the first place, btw.) It’s not that reasonable to make forward-word
available by default but not ispell-word, just because ispell-word uses the
dollar sign.

 > [..] (with alphabetic keys, it is semi-feasible to search the keyboard in
 > front of me to find the keys, but this is just impossible for
 > punctuation.)

This is my experience too, strangely enough, since there’s no reasonable
ground for punctuation being much harder to find than letters. 

Okay, I’ve just posted code to xemacs-patches@xemacs.org that takes into
account what Paul said, and moves the fallback mapping from raw X11 keycodes
to the US layout to hardware-specific Lisp, which is where it should be. I’d
love to have some commentary on it. 

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

I get what you mean there; there are three or four input methods that I
regularly use, and being able to switch to a specific one with C-u C-\,
without messing around with character maps, makes my life significantly
easier. Indeed, I find myself typing IPA into XEmacs and pasting it into
other applications--admittedly I do use a local hack to get the glyphs to
display, so in general it’s not any better than GNU Emacs for this.

-- 
I AM IN JAIL AND ALLOWED SEND ONLY ONE CABLE SINCE WAS ARRESTED WHILE
MEASURING FIFTEEN FOOT WALL OUTSIDE PALACE AND HAVE JUST FINISHED COUNTING
THIRTY EIGHT THOUSAND FIVE HUNDERED TWENTY TWO NAMES WHOS WHO IN MIDEAST.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-27 18:19                 ` Stefan Monnier
@ 2005-11-27 21:39                   ` Paul Pogonyshev
  2005-11-28  2:39                     ` Mode_switch in Emacs (was: wish: right alt/meta to switch keyboard layout while pressed) Stefan Monnier
  0 siblings, 1 reply; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-27 21:39 UTC (permalink / raw)
  Cc: Stefan Monnier

Stefan Monnier wrote:
> >> Yes, that makes sense as well.
> >> So you'd want hitting Mode_switch to toggle the LEIM input method or would
> >> you want pressing to turn it off and releasing to turn it back on?
> 
> > It seems in `xkb' Mode_switch disables alternative groups only, i.e. it
> > won't start typing in Russian if I hold Mode_switch while using the
> > English layout.  So, if you manage to implement something similar in
> > Emacs, it should probably behave like this (i.e. deactivate any
> > non-default input method) for consistency.
> 
> I believe you misunderstood the question.  The question is whether the
> deactivation should be done while Mode_switch is pressed (as if it were
> some kind of modifier), or between two presses of Mode_switch, or yet
> something else.

Indeed, sorry.

It should be deactivated while the Mode_switch is hold.  I.e. it should
work like Shift, if you like.  Otherwise there's little point in it, since
I could just press `C-\' twice as well with not so much more trouble.  When
it works like a modifier, I can keep on typing as normal, while switching
to a different layout significantly disrupts the process.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-22 19:50 wish: right alt/meta to switch keyboard layout while pressed Paul Pogonyshev
                   ` (4 preceding siblings ...)
       [not found] ` <200511261925.20191.pogonyshev@gmx.net>
@ 2005-11-28  2:39 ` Stefan Monnier
  2005-11-28 20:28   ` Juri Linkov
  5 siblings, 1 reply; 43+ messages in thread
From: Stefan Monnier @ 2005-11-28  2:39 UTC (permalink / raw)
  Cc: emacs-devel

> So, if I want to type an apostrophe from Russian keyboard layout, I
> have to type `C-\ ' C-\'.  If, however, the temporary-switching was
> implemented, I could do with press-Mode_switch ' release-Mode_switch,
> which is obviously much easier.

Instead of C-\ ' C-\ you can do C-q ' which is shorter.


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Mode_switch in Emacs (was: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-27 21:39                   ` Paul Pogonyshev
@ 2005-11-28  2:39                     ` Stefan Monnier
  2005-11-28 20:27                       ` Juri Linkov
  0 siblings, 1 reply; 43+ messages in thread
From: Stefan Monnier @ 2005-11-28  2:39 UTC (permalink / raw)
  Cc: emacs-devel

Regarding the XKB feature, I hope someone here will know what should be done
so the bug can be fixed.  Also I hope Richard can tell us if it should be
considered as a bug to be fixed before the release.  I.e. should I apply the
patch below?

> It should be deactivated while the Mode_switch is hold.  I.e. it should
> work like Shift, if you like.  Otherwise there's little point in it, since
> I could just press `C-\' twice as well with not so much more trouble.  When
> it works like a modifier, I can keep on typing as normal, while switching
> to a different layout significantly disrupts the process.

This requires several changes at the C level (at the very least so as to
get and process (mostly, ignore) key-release events).  But you may be able
to simulate the behavior as follows:

- set your xmodmap such that Mode_switch is assigned to an unused modifier
  (e.g. Hyper).
- add bindings in your .emacs of the form
  (global-set-key [?\H-\[] "[")
  (global-set-key [?\H-\'] "'")
  ...


        Stefan


--- FOR-RELEASE	19 nov 2005 10:48:53 -0500	1.174
+++ FOR-RELEASE	27 nov 2005 21:26:55 -0500	
@@ -49,6 +49,21 @@
 
 * BUGS
 
+** When using a russian+latin layout with
+
+   setxkbmap -model pc104 -layout us,ru -variant ,winkeys
+
+pressing the W key while control is held generates a С-Ц rather than C-W.
+A probably related bug is that if you use
+
+   setxkbmap -option grp:switch
+
+the russian layout should temporarily be disabled while the Mode_switch key
+is held.
+
+Qt and Gdk apps seem to do it right, and supposedly XEmacs now handles it
+right as well.
+
 ** Fix window resizing bug:
 C-x 2, C-x 3, C-x 2. Now try to move the bottom of the 
 second window to the left.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-27 11:29         ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed ) Paul Pogonyshev
@ 2005-11-28  5:25           ` Ben Wing
  2005-11-28 19:09             ` Paul Pogonyshev
  0 siblings, 1 reply; 43+ messages in thread
From: Ben Wing @ 2005-11-28  5:25 UTC (permalink / raw)
  Cc: Aidan Kehoe, XEmacs Beta, emacs-devel

Paul Pogonyshev wrote:

>Ben Wing wrote:
>  
>
>>now, from personal experience: i have had many times when i've been in 
>>foreign countries and had to log on to the internet.  typically, the 
>>punctuation is in a completely different place.  i always switched to us 
>>layout, and found it nearly impossible to use any other layouts.  i 
>>*definitely* would expect in such a case that keyboard shortcuts 
>>involving punctuation should follow the logical, not physical, layout -- 
>>but with the physical layout as a backup, so when i temporarily switch 
>>to russian, i can still type C-x. (with alphabetic keys, it is 
>>semi-feasible to search the keyboard in front of me to find the keys, 
>>but this is just impossible for punctuation.)
>>    
>>
>
>I fail to see while it is impossible for punctuation
>

my experience was being in, e.g., thailand or morocco and trying to type 
url's and passwords and such with punctuation in them.  places like this 
often type latin characters using the british or french or some other 
european layout.  the location of the punctuation was completely random 
(from my perspective).  characters like '@' can often be typed only 
using an AltGr combination.  the keyboards often had multiple 
punctuation labels on each key, in different colors, corresponding to 
the different layouts that were most common.  all of this made it just 
impossible to locate punctuation using an unfamiliar layout.

it seems that we want to have some notion of "default" layout.  in my 
case, i want the default layout to be us, no matter what the physical 
layout, but in your case you don't want things changing just because you 
temporarily switched the layout to russian.  but i don't know if there 
is an easy solution for both cases.

ben

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-28  5:25           ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed) Ben Wing
@ 2005-11-28 19:09             ` Paul Pogonyshev
  0 siblings, 0 replies; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-28 19:09 UTC (permalink / raw)
  Cc: Aidan Kehoe, XEmacs Beta, Ben Wing

Ben Wing wrote:
> it seems that we want to have some notion of "default" layout.  in my 
> case, i want the default layout to be us, no matter what the physical 
> layout, but in your case you don't want things changing just because you 
> temporarily switched the layout to russian.  but i don't know if there 
> is an easy solution for both cases.

There must be a misunderstanding.  I'd like the keys (with modifiers) work
as if the current layout was English (US), no matter what the current
layout is.  Without modifiers, they would of course insert the
corresponding character based on the current layout.  Seems like we speak
of the same thing in different words, or, alternatively, I misunderstood
you this time :)

In fact, the internal Emacs input methods do just what I described.  I
just checked that.  As it was mentioned here, in German layout keys for
`z' and `y' are swapped relatively to the English layout.  So, the key
labelled `z' on my keyboard would type `y' after `C-x RET C-\ german RET'.
However, combination `C-z' would still invoke `iconify-or-deiconify-frame',
not `yank'.

That's what I mean by physical vs. logical.  It may blurry with different
alphabets, like Cyrillic.  But with German it should be more
understandable: the key labelled `z' remains at physically the same
position no matter what layout I use.  However, with German layout, the
logical key `z' swaps with logical key `y'.

So, to finally clarify my position: I want layouts switched with external
methods (`xkb') work just like Emacs internal input methods with regard
to key bindings.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Mode_switch in Emacs (was: wish: right alt/meta to switch keyboard layout while pressed)
  2005-11-28  2:39                     ` Mode_switch in Emacs (was: wish: right alt/meta to switch keyboard layout while pressed) Stefan Monnier
@ 2005-11-28 20:27                       ` Juri Linkov
  2005-11-28 22:14                         ` Mode_switch in Emacs Stefan Monnier
  0 siblings, 1 reply; 43+ messages in thread
From: Juri Linkov @ 2005-11-28 20:27 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

> Regarding the XKB feature, I hope someone here will know what should be done
> so the bug can be fixed.
>
>> It should be deactivated while the Mode_switch is hold.  I.e. it should
>> work like Shift, if you like.  Otherwise there's little point in it, since
>> I could just press `C-\' twice as well with not so much more trouble.  When
>> it works like a modifier, I can keep on typing as normal, while switching
>> to a different layout significantly disrupts the process.

As I can see, everything works fine in CVS Emacs already.  The Mode_switch
key temporarily disables the russian layout while it is held in Emacs.
Perhaps something is wrong in Paul's configuration where Mode_switch
doesn't work correctly.

> This requires several changes at the C level (at the very least so as to
> get and process (mostly, ignore) key-release events).  But you may be able
> to simulate the behavior as follows:
>
> - set your xmodmap such that Mode_switch is assigned to an unused modifier
>   (e.g. Hyper).
> - add bindings in your .emacs of the form
>   (global-set-key [?\H-\[] "[")
>   (global-set-key [?\H-\'] "'")

I tried to assign Mode_switch to Hyper, and it works too, without the need
to add Emacs bindings to translate [?\H-\'] to "'".

>  * BUGS
>  
> +** When using a russian+latin layout with
> +
> +   setxkbmap -model pc104 -layout us,ru -variant ,winkeys
> +
> +pressing the W key while control is held generates a С-Ц rather than C-W.

This is not a bug, but quite a useless feature.  It enables only
a small subset of standard Emacs keybindings in the russian layout.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-26 15:10             ` Stefan Monnier
  2005-11-26 16:46               ` Paul Pogonyshev
@ 2005-11-28 20:27               ` Juri Linkov
  2005-11-28 23:14                 ` Juri Linkov
  1 sibling, 1 reply; 43+ messages in thread
From: Juri Linkov @ 2005-11-28 20:27 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

> So you'd want hitting Mode_switch to toggle the LEIM input method or would
> you want pressing to turn it off and releasing to turn it back on?

I think hitting Mode_switch to toggle the LEIM input method would be
very useful feature, since it allows using the same key to switch
Emacs input methods and X layouts in non-Emacs applications.
But perhaps it is not easy to implement.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-28  2:39 ` wish: right alt/meta to switch keyboard layout while pressed Stefan Monnier
@ 2005-11-28 20:28   ` Juri Linkov
  2005-11-28 22:16     ` Stefan Monnier
  0 siblings, 1 reply; 43+ messages in thread
From: Juri Linkov @ 2005-11-28 20:28 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

>> So, if I want to type an apostrophe from Russian keyboard layout, I
>> have to type `C-\ ' C-\'.  If, however, the temporary-switching was
>> implemented, I could do with press-Mode_switch ' release-Mode_switch,
>> which is obviously much easier.
>
> Instead of C-\ ' C-\ you can do C-q ' which is shorter.

This should be possible with the patch I just installed.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-26 19:44               ` Paul Pogonyshev
@ 2005-11-28 20:33                 ` Juri Linkov
  0 siblings, 0 replies; 43+ messages in thread
From: Juri Linkov @ 2005-11-28 20:33 UTC (permalink / raw)
  Cc: eugene, emacs-devel

>> > After this, most applications handle, say `Сtrl-Ц' just like `Ctrl-W' (`Ц' and
>> > `W' are on the same key.)  However, Firefox doesn't, for some reason (which pisses
>> > me off a lot, BTW) and so doesn't Emacs...  No idea why.
>> 
>> With this patch from ALTLinux distribution keybindings with Ctrl and
>> Meta works for me in russian keyboard map:
>> 
>> [patch]
>
> Works here.  I'm not qualified to say if it is correct, but I think something
> like this should be installed in the trunk.

This patch has an unfortunate side-effect of disabling AltGr keys.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Mode_switch in Emacs
  2005-11-28 20:27                       ` Juri Linkov
@ 2005-11-28 22:14                         ` Stefan Monnier
  2005-11-28 23:08                           ` Juri Linkov
  0 siblings, 1 reply; 43+ messages in thread
From: Stefan Monnier @ 2005-11-28 22:14 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

>> Regarding the XKB feature, I hope someone here will know what should be done
>> so the bug can be fixed.
>> 
>>> It should be deactivated while the Mode_switch is hold.  I.e. it should
>>> work like Shift, if you like.  Otherwise there's little point in it, since
>>> I could just press `C-\' twice as well with not so much more trouble.  When
>>> it works like a modifier, I can keep on typing as normal, while switching
>>> to a different layout significantly disrupts the process.

> As I can see, everything works fine in CVS Emacs already.  The Mode_switch
> key temporarily disables the russian layout while it is held in Emacs.
> Perhaps something is wrong in Paul's configuration where Mode_switch
> doesn't work correctly.

Does that hold for XIM russian layout or for LEIM russian layout or for both?

>> * BUGS
>> 
>> +** When using a russian+latin layout with
>> +
>> +   setxkbmap -model pc104 -layout us,ru -variant ,winkeys
>> +
>> +pressing the W key while control is held generates a С-Ц rather than C-W.

> This is not a bug, but quite a useless feature.  It enables only
> a small subset of standard Emacs keybindings in the russian layout.

The way I understand the situation it is a bug because the above setting
exlpicitly asks for it not to happen.  If you want to get С-Ц rather than
C-W than you'd use a different config.
In any case if it's a feature, it should be possible to turn it off since in
such a situation it can be a really annoying feature.


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-28 20:28   ` Juri Linkov
@ 2005-11-28 22:16     ` Stefan Monnier
  0 siblings, 0 replies; 43+ messages in thread
From: Stefan Monnier @ 2005-11-28 22:16 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

>>> So, if I want to type an apostrophe from Russian keyboard layout, I
>>> have to type `C-\ ' C-\'.  If, however, the temporary-switching was
>>> implemented, I could do with press-Mode_switch ' release-Mode_switch,
>>> which is obviously much easier.
>> 
>> Instead of C-\ ' C-\ you can do C-q ' which is shorter.

> This should be possible with the patch I just installed.

I tried it before posting, so either I was already using your patch or your
patch fixes a different situation.


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Mode_switch in Emacs
  2005-11-28 22:14                         ` Mode_switch in Emacs Stefan Monnier
@ 2005-11-28 23:08                           ` Juri Linkov
  2005-11-29 16:24                             ` Stefan Monnier
  0 siblings, 1 reply; 43+ messages in thread
From: Juri Linkov @ 2005-11-28 23:08 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

>> As I can see, everything works fine in CVS Emacs already.  The Mode_switch
>> key temporarily disables the russian layout while it is held in Emacs.
>> Perhaps something is wrong in Paul's configuration where Mode_switch
>> doesn't work correctly.
>
> Does that hold for XIM russian layout or for LEIM russian layout or
> for both?

For XIM russian layout.  If the LEIM russian input method is enabled
in Emacs, I think it is too much to ask Emacs to temporarily disable
the input method while Mode_switch is held.  As I understand even
XEmacs doesn't try to do this.

I see no reason to activate both XIM russian layout and LEIM russian
input method in Emacs.  But using them separately, to disable the russian
layout in each of them is easy.  With XIM russian layout, this can be
done with Mode_switch configured with `setxkbmap -option grp:switch'.
With LEIM, C-q does the job.

>>> +** When using a russian+latin layout with
>>> +
>>> +   setxkbmap -model pc104 -layout us,ru -variant ,winkeys
>>> +
>>> +pressing the W key while control is held generates a С-Ц rather than C-W.
>
>> This is not a bug, but quite a useless feature.  It enables only
>> a small subset of standard Emacs keybindings in the russian layout.
>
> The way I understand the situation it is a bug because the above setting
> exlpicitly asks for it not to happen.

It doesn't specify what to do with key combinations.  It is up to the
application to translate raw key combinations to something else.

> If you want to get С-Ц rather than C-W than you'd use a different
> config.  In any case if it's a feature, it should be possible to
> turn it off since in such a situation it can be a really
> annoying feature.

Somewhere С-ц may be preferable to C-w, but at least in Emacs I think
interpreting С-ц as C-w is more natural.  However, this is still not
very useful in Emacs because it will enable only key sequences with
control/meta modifiers, but not with raw letters.  I.e. what good is
to process С-ц as C-w, if `C-x b' will produce useless `C-x и'?

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: wish: right alt/meta to switch keyboard layout while pressed
  2005-11-28 20:27               ` wish: right alt/meta to switch keyboard layout while pressed Juri Linkov
@ 2005-11-28 23:14                 ` Juri Linkov
  0 siblings, 0 replies; 43+ messages in thread
From: Juri Linkov @ 2005-11-28 23:14 UTC (permalink / raw)
  Cc: pogonyshev, emacs-devel

>> So you'd want hitting Mode_switch to toggle the LEIM input method or would
>> you want pressing to turn it off and releasing to turn it back on?
>
> I think hitting Mode_switch to toggle the LEIM input method would be
> very useful feature, since it allows using the same key to switch
> Emacs input methods and X layouts in non-Emacs applications.
> But perhaps it is not easy to implement.

I just noticed that emacs/lisp/term/w32-win.el contains the following lines:

  ;; Keyboard layout/language change events
  ;; For now ignore language-change events; in the future
  ;; we should switch the Emacs Input Method to match the
  ;; new layout/language selected by the user.
  (global-set-key [language-change] 'ignore)

It is interesting that Windows generates `language-change' key event.
I guess it is currently ignored because it is not trivial to process it
in Emacs.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Mode_switch in Emacs
  2005-11-28 23:08                           ` Juri Linkov
@ 2005-11-29 16:24                             ` Stefan Monnier
  2005-11-29 19:54                               ` Paul Pogonyshev
  2005-11-30  2:43                               ` Juri Linkov
  0 siblings, 2 replies; 43+ messages in thread
From: Stefan Monnier @ 2005-11-29 16:24 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

>>> As I can see, everything works fine in CVS Emacs already.  The Mode_switch
>>> key temporarily disables the russian layout while it is held in Emacs.
>>> Perhaps something is wrong in Paul's configuration where Mode_switch
>>> doesn't work correctly.
>> 
>> Does that hold for XIM russian layout or for LEIM russian layout or
>> for both?

> For XIM russian layout.

OK.  So I guess I misunderstood Paul (or he has a different config
in which this doesn't work, in which case he should clarify).

> If the LEIM russian input method is enabled in Emacs, I think it is too
> much to ask Emacs to temporarily disable the input method while
> Mode_switch is held.

It's not high-priority, but I think it would be good if it could be made
to work.

> As I understand even XEmacs doesn't try to do this.

XEmacs doesn't always do "more".

> I see no reason to activate both XIM russian layout and LEIM russian
> input method in Emacs.

I hope we indeed all agree on this one ;-)

Tho now that you mention it, I'm wondering: how do people deal with the
situation where their keyboard is cyrillic and they want to use one of
Emacs's input methods (which are all based on latin chars)?

> Somewhere С-ц may be preferable to C-w, but at least in Emacs I think
> interpreting С-ц as C-w is more natural.  However, this is still not
> very useful in Emacs because it will enable only key sequences with
> control/meta modifiers, but not with raw letters.  I.e. what good is
> to process С-ц as C-w, if `C-x b' will produce useless `C-x и'?

Oh boy! that's a very good point indeed.  It basically means we should
postpone the decision whether to translate b into и to much later.

Now how does all the above look in the case of XIM input methods that map
multi-key sequences to chars (typically for asian scripts)?


        Stefan

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Mode_switch in Emacs
  2005-11-29 16:24                             ` Stefan Monnier
@ 2005-11-29 19:54                               ` Paul Pogonyshev
  2005-11-30  2:43                               ` Juri Linkov
  1 sibling, 0 replies; 43+ messages in thread
From: Paul Pogonyshev @ 2005-11-29 19:54 UTC (permalink / raw)
  Cc: Juri Linkov, Stefan Monnier

Stefan Monnier wrote:
> >>> As I can see, everything works fine in CVS Emacs already.  The Mode_switch
> >>> key temporarily disables the russian layout while it is held in Emacs.
> >>> Perhaps something is wrong in Paul's configuration where Mode_switch
> >>> doesn't work correctly.
> >> 
> >> Does that hold for XIM russian layout or for LEIM russian layout or
> >> for both?
> 
> > For XIM russian layout.
> 
> OK.  So I guess I misunderstood Paul (or he has a different config
> in which this doesn't work, in which case he should clarify).

Yes, things got pretty messed with in this thread.  I first started talking
about my wishing for Mode_switch to switch LEIM input methods (which I use
currently.)  Then it forked off into discussion of how to treat those `C-ц'
shortcuts with XIM layouts and I have always been in favor of mapping them
to `C-w', just like LEIM does.

So, Mode_switch works with XIM, but not with LEIM.  Remapping of shortcuts
to English (US) layout works in LEIM, but not in XIM.  Of course, the
second is way more important and using XIM for Russian layout is currently
impossible because of it.

> > If the LEIM russian input method is enabled in Emacs, I think it is too
> > much to ask Emacs to temporarily disable the input method while
> > Mode_switch is held.
> 
> It's not high-priority, but I think it would be good if it could be made
> to work.

That's what I wished in the original post.  It is a wish, yes, not a bug-
report.

> > I see no reason to activate both XIM russian layout and LEIM russian
> > input method in Emacs.
> 
> I hope we indeed all agree on this one ;-)

Yeah :)

> Tho now that you mention it, I'm wondering: how do people deal with the
> situation where their keyboard is cyrillic and they want to use one of
> Emacs's input methods (which are all based on latin chars)?
> 
> > Somewhere С-ц may be preferable to C-w, but at least in Emacs I think
> > interpreting С-ц as C-w is more natural.  However, this is still not
> > very useful in Emacs because it will enable only key sequences with
> > control/meta modifiers, but not with raw letters.  I.e. what good is
> > to process С-ц as C-w, if `C-x b' will produce useless `C-x и'?
> 
> Oh boy! that's a very good point indeed.  It basically means we should
> postpone the decision whether to translate b into и to much later.

LEIM input methods works just fine here.  Not sure how it does so, but it
works seamlessly.  If Emacs could somehow receieve `switch-layout' signals
from XIM and then do all the work itself, that would have basically solved
the problem.  I'm not sure how difficult if at all possible that is to
implement.

> Now how does all the above look in the case of XIM input methods that map
> multi-key sequences to chars (typically for asian scripts)?

As far as I'm concerned, using Emacs with any XIM layouts that is not based
on latin alphabet is impossible.  I assume people use LEIM, like me.  May
be wrong.

Paul

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Mode_switch in Emacs
  2005-11-29 16:24                             ` Stefan Monnier
  2005-11-29 19:54                               ` Paul Pogonyshev
@ 2005-11-30  2:43                               ` Juri Linkov
  1 sibling, 0 replies; 43+ messages in thread
From: Juri Linkov @ 2005-11-30  2:43 UTC (permalink / raw)
  Cc: emacs-devel, pogonyshev

>> I see no reason to activate both XIM russian layout and LEIM russian
>> input method in Emacs.
>
> I hope we indeed all agree on this one ;-)
>
> Tho now that you mention it, I'm wondering: how do people deal with the
> situation where their keyboard is cyrillic and they want to use one of
> Emacs's input methods (which are all based on latin chars)?

All Cyrillic keyboards have Latin chars too, i.e. each of the most
physical keys has two labels: one for a Latin character, and one
for a Cyrillic character.  So after switching XIM to a Latin layout
(not necessarily English, any Latin-based language layout will work)
it is possible to use Emacs's input methods on Cyrillic keyboards.

>> Somewhere С-ц may be preferable to C-w, but at least in Emacs I think
>> interpreting С-ц as C-w is more natural.  However, this is still not
>> very useful in Emacs because it will enable only key sequences with
>> control/meta modifiers, but not with raw letters.  I.e. what good is
>> to process С-ц as C-w, if `C-x b' will produce useless `C-x и'?
>
> That's a very good point indeed.  It basically means we should
> postpone the decision whether to translate b into и to much later.

This would be nice.  Ideally, all keys should be translated except
self-inserting keys.  I.e. this translation should be opposite to
LEIM input methods: LEIM input methods translate self-inserting
ASCII characters to the target language, but with an active non-Latin
XIM layout, Emacs should translate non-ASCII components of non-self-inserting
key combinations to their ASCII equivalents.

> Now how does all the above look in the case of XIM input methods that map
> multi-key sequences to chars (typically for asian scripts)?

I guess this may not work with other XIM input methods.  So instead of
blindly converting non-ASCII characters to ASCII for all XIM input methods,
perhaps Emacs should use a new variable with "non-ASCII to ASCII" mappings.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2005-11-30  2:43 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-22 19:50 wish: right alt/meta to switch keyboard layout while pressed Paul Pogonyshev
2005-11-22 22:31 ` Andreas Schwab
2005-11-23  5:14 ` Richard M. Stallman
2005-11-23 19:52   ` Paul Pogonyshev
2005-11-25 15:50     ` Richard M. Stallman
2005-11-25 18:00       ` Andreas Schwab
2005-11-23  6:07 ` Juri Linkov
2005-11-24 17:18 ` Stefan Monnier
2005-11-24 19:45   ` Paul Pogonyshev
2005-11-24 20:56     ` Stefan Monnier
2005-11-25 19:37       ` Paul Pogonyshev
2005-11-25 22:17         ` Stefan Monnier
2005-11-25 22:33           ` Paul Pogonyshev
2005-11-25 22:44             ` Aidan Kehoe
2005-11-26 16:43               ` Paul Pogonyshev
2005-11-27  5:26                 ` Tomas Zerolo
2005-11-26  8:15             ` Eugene Vlasov
2005-11-26 19:44               ` Paul Pogonyshev
2005-11-28 20:33                 ` Juri Linkov
2005-11-26 15:10             ` Stefan Monnier
2005-11-26 16:46               ` Paul Pogonyshev
2005-11-27 18:19                 ` Stefan Monnier
2005-11-27 21:39                   ` Paul Pogonyshev
2005-11-28  2:39                     ` Mode_switch in Emacs (was: wish: right alt/meta to switch keyboard layout while pressed) Stefan Monnier
2005-11-28 20:27                       ` Juri Linkov
2005-11-28 22:14                         ` Mode_switch in Emacs Stefan Monnier
2005-11-28 23:08                           ` Juri Linkov
2005-11-29 16:24                             ` Stefan Monnier
2005-11-29 19:54                               ` Paul Pogonyshev
2005-11-30  2:43                               ` Juri Linkov
2005-11-28 20:27               ` wish: right alt/meta to switch keyboard layout while pressed Juri Linkov
2005-11-28 23:14                 ` Juri Linkov
2005-11-26  4:22       ` Richard M. Stallman
     [not found] ` <200511261925.20191.pogonyshev@gmx.net>
     [not found]   ` <17288.41589.506361.323637@parhasard.net>
2005-11-26 23:01     ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed) Paul Pogonyshev
2005-11-27  1:48       ` Ben Wing
2005-11-27  5:35         ` Tomas Zerolo
2005-11-27 11:29         ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed ) Paul Pogonyshev
2005-11-28  5:25           ` thoughts on interaction of key bindings and input methods (was Re: wish: right alt/meta to switch keyboard layout while pressed) Ben Wing
2005-11-28 19:09             ` Paul Pogonyshev
2005-11-27 18:35         ` Aidan Kehoe
2005-11-28  2:39 ` wish: right alt/meta to switch keyboard layout while pressed Stefan Monnier
2005-11-28 20:28   ` Juri Linkov
2005-11-28 22:16     ` Stefan Monnier

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