all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using AltGr as standard modifier key in emacs
@ 2015-10-13 13:11 Shahab Shahsavari Alavidjeh
  2015-10-14  6:05 ` Yuri Khan
       [not found] ` <mailman.289.1444802784.7904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: Shahab Shahsavari Alavidjeh @ 2015-10-13 13:11 UTC (permalink / raw)
  To: help-gnu-emacs


Hi there

While that's my first post here, I'm going to introduce myself a little
bit, and I think this introduction might be relevant to my question
here, I'm Shahab Shahsavari Alavidjeh (simply everyone can call me Shibi
if that's too hard to pronounce) and I'm using emacs for my day to day
tasks (as a writer and translator) for writing and organizing my
tasks. Well I'm not a software developer or an emacs expert by any
means, therefor my questions or requests may seems dumb.

Well I'm an Iranian and a Persian speaker, which leads us right to the
problem, while emacs has great support for UTF-8 and complex script
languages (like Persian) and there is a well maintained quail input
method package for farsi (thanks to Mohsen Banan
http://mohsen.1.banan.byname.net/) there's a huge problem with that (and
as I already reviewed the code for hebrew, arabic and even latin-alt
input methods this problem exists there too) There is no implementation
for AltGr key or ISO_Level3_Shift key in elisp. So every input method
re-implemented a different modifier key and bind the third or forth
level modification to that. (in persian that key is "\" in hebrew that
key is "`" in latin-alt that key seems to be "_" in latin-post the key
is ",") which IMO is a very inconsistent way of implementation.

But waht is my question?

is there any way to work around this problem and assign a modifier key
to "Right Alt Key" on keyboard which is accessible through elisp
customization? something which I can assign a character (for example á
to (kbd rightalt-a))?

Why I don't simply use my D.E. input method support and keyboard layout
switcher instead?

I'm currently using it, that's my best option right now, but then I
should switch keyboard layouts whenever I want to run a command in emacs
or even when I want to save a file to disk.

I appreciate any answer which can help me to get it working.

What I'm using right now is

GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.16.6) of
2015-09-14 on buildvm-10.phx2.fedoraproject.org

Thank You
Shahab




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

* Re: Using AltGr as standard modifier key in emacs
       [not found] <mailman.229.1444746928.7904.help-gnu-emacs@gnu.org>
@ 2015-10-13 16:57 ` Rusi
  2015-10-13 17:05   ` Rusi
  0 siblings, 1 reply; 17+ messages in thread
From: Rusi @ 2015-10-13 16:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, October 13, 2015 at 8:05:33 PM UTC+5:30, Shahab Shahsavari Alavidjeh wrote:
> Hi there
> 
> While that's my first post here, I'm going to introduce myself a little
> bit, and I think this introduction might be relevant to my question
> here, I'm Shahab Shahsavari Alavidjeh (simply everyone can call me Shibi
> if that's too hard to pronounce) and I'm using emacs for my day to day
> tasks (as a writer and translator) for writing and organizing my
> tasks. Well I'm not a software developer or an emacs expert by any
> means, therefor my questions or requests may seems dumb.
> 
> Well I'm an Iranian and a Persian speaker, which leads us right to the
> problem, while emacs has great support for UTF-8 and complex script
> languages (like Persian) and there is a well maintained quail input
> method package for farsi (thanks to Mohsen Banan
> http://mohsen.1.banan.byname.net/) there's a huge problem with that (and
> as I already reviewed the code for hebrew, arabic and even latin-alt
> input methods this problem exists there too) There is no implementation
> for AltGr key or ISO_Level3_Shift key in elisp. So every input method
> re-implemented a different modifier key and bind the third or forth
> level modification to that. (in persian that key is "\" in hebrew that
> key is "`" in latin-alt that key seems to be "_" in latin-post the key
> is ",") which IMO is a very inconsistent way of implementation.
> 
> But waht is my question?
> 
> is there any way to work around this problem and assign a modifier key
> to "Right Alt Key" on keyboard which is accessible through elisp
> customization? something which I can assign a character (for example á
> to (kbd rightalt-a))?
> 
> Why I don't simply use my D.E. input method support and keyboard layout
> switcher instead?
> 
> I'm currently using it, that's my best option right now, but then I
> should switch keyboard layouts whenever I want to run a command in emacs
> or even when I want to save a file to disk.
> 
> I appreciate any answer which can help me to get it working.
> 
> What I'm using right now is
> 
> GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.16.6) of
> 2015-09-14 on buildvm-10.phx2.fedoraproject.org
> 
> Thank You
> Shahab

Hi Shibi
Welcome to emacs!

Does this work for you (outside of and independent of emacs)?

$ setxkbmap -layout "us,ir" -option "grp:lalt_lshift_toggle,grp_led:scroll" 

If yes then you can see how to arrange for emacs to call that based on mode (switching)?


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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 16:57 ` Using AltGr as standard modifier key in emacs Rusi
@ 2015-10-13 17:05   ` Rusi
  2015-10-13 17:44     ` Shahab Shahsavari Alavidjeh
       [not found]     ` <mailman.256.1444758367.7904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: Rusi @ 2015-10-13 17:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, October 13, 2015 at 10:27:52 PM UTC+5:30, Rusi wrote:
> On Tuesday, October 13, 2015 at 8:05:33 PM UTC+5:30, Shahab Shahsavari Alavidjeh wrote:
> > Hi there
> > 
> > While that's my first post here, I'm going to introduce myself a little
> > bit, and I think this introduction might be relevant to my question
> > here, I'm Shahab Shahsavari Alavidjeh (simply everyone can call me Shibi
> > if that's too hard to pronounce) and I'm using emacs for my day to day
> > tasks (as a writer and translator) for writing and organizing my
> > tasks. Well I'm not a software developer or an emacs expert by any
> > means, therefor my questions or requests may seems dumb.
> > 
> > Well I'm an Iranian and a Persian speaker, which leads us right to the
> > problem, while emacs has great support for UTF-8 and complex script
> > languages (like Persian) and there is a well maintained quail input
> > method package for farsi (thanks to Mohsen Banan
> > http://mohsen.1.banan.byname.net/) there's a huge problem with that (and
> > as I already reviewed the code for hebrew, arabic and even latin-alt
> > input methods this problem exists there too) There is no implementation
> > for AltGr key or ISO_Level3_Shift key in elisp. So every input method
> > re-implemented a different modifier key and bind the third or forth
> > level modification to that. (in persian that key is "\" in hebrew that
> > key is "`" in latin-alt that key seems to be "_" in latin-post the key
> > is ",") which IMO is a very inconsistent way of implementation.
> > 
> > But waht is my question?
> > 
> > is there any way to work around this problem and assign a modifier key
> > to "Right Alt Key" on keyboard which is accessible through elisp
> > customization? something which I can assign a character (for example á
> > to (kbd rightalt-a))?
> > 
> > Why I don't simply use my D.E. input method support and keyboard layout
> > switcher instead?
> > 
> > I'm currently using it, that's my best option right now, but then I
> > should switch keyboard layouts whenever I want to run a command in emacs
> > or even when I want to save a file to disk.
> > 
> > I appreciate any answer which can help me to get it working.
> > 
> > What I'm using right now is
> > 
> > GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.16.6) of
> > 2015-09-14 on buildvm-10.phx2.fedoraproject.org
> > 
> > Thank You
> > Shahab
> 
> Hi Shibi
> Welcome to emacs!
> 
> Does this work for you (outside of and independent of emacs)?
> 
> $ setxkbmap -layout "us,ir" -option "grp:lalt_lshift_toggle,grp_led:scroll" 
> 
> If yes then you can see how to arrange for emacs to call that based on mode (switching)?

Just to clarify:
That command (on my ubuntu 15.4 box) switches from us to ir(ani)¹ when given
a l-alt, l-shift chord. Same switches back ie its a toggle

¹ Well actually not sure about the Irani! Emacs says its Arabic!


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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 17:05   ` Rusi
@ 2015-10-13 17:44     ` Shahab Shahsavari Alavidjeh
       [not found]     ` <mailman.256.1444758367.7904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Shahab Shahsavari Alavidjeh @ 2015-10-13 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

Rusi <rustompmody@gmail.com> writes:

> On Tuesday, October 13, 2015 at 10:27:52 PM UTC+5:30, Rusi wrote:
>> On Tuesday, October 13, 2015 at 8:05:33 PM UTC+5:30, Shahab Shahsavari Alavidjeh wrote:

>> > 
>> > Why I don't simply use my D.E. input method support and keyboard layout
>> > switcher instead?
>> > 
>> > I'm currently using it, that's my best option right now, but then I
>> > should switch keyboard layouts whenever I want to run a command in emacs
>> > or even when I want to save a file to disk.


>> Does this work for you (outside of and independent of emacs)?
>> 
>> $ setxkbmap -layout "us,ir" -option "grp:lalt_lshift_toggle,grp_led:scroll" 
>> 
>> If yes then you can see how to arrange for emacs to call that based on mode (switching)?
>
> Just to clarify:
> That command (on my ubuntu 15.4 box) switches from us to ir(ani)¹ when given
> a l-alt, l-shift chord. Same switches back ie its a toggle
>
> ¹ Well actually not sure about the Irani! Emacs says its Arabic!

Thanks for reply,

There's no problem with keyboard switcher, the problem is I want to use
built-in input method in Emacs (Which I can switch it with `(kbd
"\C-\\")'),

Why? because in Emacs everything is keyboard driven and when
I want to copy or kill or save I have to switch back to en layout, press
shortcuts and again switch the layout. By Emacs quail input methods I
can easily use keybindings and shortcuts without switching layout (It's
smart).

Keyboard layouts works fine outside of Emacs, I have my AltGr key
working outside of Emacs and inside of it both correctly working out of
the box and I layout switcher works perfect (though I'm using gnome-3.??
and the keybinding is Super-Space) I can use ir or any other keyboard
layout even inside Emacs (ir stands for Iran, the name of the language
is Farsi or Persian which makes the codename fa_IR just like United
States and English which makes the codename en_US)

So my problem is not that I can not switch keyboard layout, the problem
is that I want to have a working state which I can use 3rd level shift
from inside Emacs input method or a workaround which give me ability to
use Emacs keybindings (C- M- stuff) without changing keyboard layouts.



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

* Re: Using AltGr as standard modifier key in emacs
       [not found]     ` <mailman.256.1444758367.7904.help-gnu-emacs@gnu.org>
@ 2015-10-13 18:19       ` Javier
  2015-10-13 18:43         ` Javier
  2015-10-13 19:20         ` Shahab Shahsavari Alavidjeh
  0 siblings, 2 replies; 17+ messages in thread
From: Javier @ 2015-10-13 18:19 UTC (permalink / raw)
  To: help-gnu-emacs

> So my problem is not that I can not switch keyboard layout, the problem
> is that I want to have a working state which I can use 3rd level shift
> from inside Emacs input method or a workaround which give me ability to
> use Emacs keybindings (C- M- stuff) without changing keyboard layouts.

From the elisp manual, you can use several modifiers keys: alt,
meta, hyper and super

http://www.gnu.org/software/emacs/manual/html_node/elisp/X11-Keysyms.html
http://www.gnu.org/software/emacs/manual/html_node/elisp/Other-Char-Bits.html

          The X Window System defines three other modifier bits that can be
          set in a character: hyper, super and alt. The syntaxes for these
          bits are ???\H-???, ???\s-??? and ???\A-???.

So, for your question

> is there any way to work around this problem and assign a modifier key
> to "Right Alt Key" on keyboard which is accessible through elisp
> customization? something which I can assign a character (for example á
> to (kbd rightalt-a))?

you can play with xmodmap to do this and remap rightAlt to Hyper or super

Typing this in a terminal should do the trick

xmodmap -e "keycode 108 = Hyper_L" ; xmodmap -e  "add mod4 = Hyper_L"

You can check inside emacs that things are working by using C-h l (view lossage)
If it is mapped ok, pressing RighAlt-a you should see

 H-a C-h l
 
Once this works you can customize RightAlt-a in elisp as

(kbd "H-a")
(kbd "s-b")

For hyper is a capital 'H' and for super it would be lower case 's'.

This might have some problems, like the desktop capturing the Hyper-a combination.
What desktop are you using? gnome? kde?

Another problem would be that applications outside emacs might not be
able to use rightAlt anymore.  That might still be solved running
emacs inside an X-server of its own.




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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 18:19       ` Javier
@ 2015-10-13 18:43         ` Javier
  2015-10-13 19:42           ` Shahab Shahsavari Alavidjeh
       [not found]           ` <mailman.265.1444765466.7904.help-gnu-emacs@gnu.org>
  2015-10-13 19:20         ` Shahab Shahsavari Alavidjeh
  1 sibling, 2 replies; 17+ messages in thread
From: Javier @ 2015-10-13 18:43 UTC (permalink / raw)
  To: help-gnu-emacs

> Typing this in a terminal should do the trick
> 
> xmodmap -e "keycode 108 = Hyper_L" ; xmodmap -e  "add mod4 = Hyper_L"
> 

Oops, it turns out to remap rightAlt the sequence is

xmodmap -e "clear mod1" ; xmodmap -e "add mod1 = Alt_L Meta_L" ; xmodmap -e "keycode 108 = Hyper_R" ; xmodmap -e "add mod3 = Hyper_R"

http://stackoverflow.com/questions/28527938/xkb-configuration-for-emacs

I assumed keycode 108 is the keycode for right alt, which should
be ok for a modern pc-keyboard.  You can check the keycode number with xev.



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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 18:19       ` Javier
  2015-10-13 18:43         ` Javier
@ 2015-10-13 19:20         ` Shahab Shahsavari Alavidjeh
  1 sibling, 0 replies; 17+ messages in thread
From: Shahab Shahsavari Alavidjeh @ 2015-10-13 19:20 UTC (permalink / raw)
  To: help-gnu-emacs

Javier <nospam@nospam.com> writes:

> you can play with xmodmap to do this and remap rightAlt to Hyper or super
>
> Typing this in a terminal should do the trick
>
> xmodmap -e "keycode 108 = Hyper_L" ; xmodmap -e  "add mod4 = Hyper_L"
>
> You can check inside emacs that things are working by using C-h l (view lossage)
> If it is mapped ok, pressing RighAlt-a you should see
>
>  H-a C-h l
>  
> Once this works you can customize RightAlt-a in elisp as
>
> (kbd "H-a")
> (kbd "s-b")
>
> For hyper is a capital 'H' and for super it would be lower case 's'.
>
> This might have some problems, like the desktop capturing the Hyper-a combination.
> What desktop are you using? gnome? kde?
>


I use Gnome 3 desktop environment, which heavily relies on Super key as
modifier.

My xmodmap -pm out put is as follow

    $ xmodmap -pm
    
    xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):
    
    shift       Shift_L (0x32),  Shift_R (0x3e)
    lock        Caps_Lock (0x42)
    control     Control_L (0x25),  Control_R (0x69)
    mod1        Alt_L (0x40),  Meta_L (0xcd)
    mod2        Num_Lock (0x4d)
    mod3      
    mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
    mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)


so I think I prefer to map it to hyper and remove so I have to
remove it from mod4 keymap and set it to mod5 beside AltGr. I'm no aware
of any usage for hyper key in my current workflow.

> Another problem would be that applications outside emacs might not be
> able to use rightAlt anymore.  That might still be solved running
> emacs inside an X-server of its own.

I didn't know that it is possible, can you explain more? is it
completely isolate my Emacs frame from other windows? and both
environments can run simultaneously?

>
> From the elisp manual, you can use several modifiers keys: alt,
> meta, hyper and super
>
> http://www.gnu.org/software/emacs/manual/html_node/elisp/X11-Keysyms.html
> http://www.gnu.org/software/emacs/manual/html_node/elisp/Other-Char-Bits.html
>
>           The X Window System defines three other modifier bits that can be
>           set in a character: hyper, super and alt. The syntaxes for these
>           bits are ???\H-???, ???\s-??? and ???\A-???.
>

An let me ask a meta question, don't you think of it as a unresolved
bug? AltGr works as defacto standard (or even constituted standard, I
don't know for sure) for 3rd and forth level shift characters, while
Emacs uses bindings to extinct keys like hyper and Meta and even knows
about things like Pause/Break, why it doesn't support this key? Do you
think I should report it as a bug? (or is it reported?)

And one of the reasons I sent this email (beside my own problem) was
that I wanted to know if anybody else suffers from this shortcoming?



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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 18:43         ` Javier
@ 2015-10-13 19:42           ` Shahab Shahsavari Alavidjeh
       [not found]           ` <mailman.265.1444765466.7904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Shahab Shahsavari Alavidjeh @ 2015-10-13 19:42 UTC (permalink / raw)
  To: help-gnu-emacs

Javier <nospam@nospam.com> writes:


>
> Oops, it turns out to remap rightAlt the sequence is
>
> xmodmap -e "clear mod1" ; xmodmap -e "add mod1 = Alt_L Meta_L" ; xmodmap -e "keycode 108 = Hyper_R" ; xmodmap -e "add mod3 = Hyper_R"
>
> http://stackoverflow.com/questions/28527938/xkb-configuration-for-emacs
>
> I assumed keycode 108 is the keycode for right alt, which should
> be ok for a modern pc-keyboard.  You can check the keycode number with xev.

xev reports it key 108, thanks for suggestion, but would you please instruct
me about setting a separate X server for Emacs, or at least tell me where
can I find information.



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

* Re: Using AltGr as standard modifier key in emacs
       [not found]           ` <mailman.265.1444765466.7904.help-gnu-emacs@gnu.org>
@ 2015-10-13 20:17             ` Javier
  2015-10-14  5:18               ` Shahab Shahsavari Alavidjeh
  0 siblings, 1 reply; 17+ messages in thread
From: Javier @ 2015-10-13 20:17 UTC (permalink / raw)
  To: help-gnu-emacs

> but would you please instruct
> me about setting a separate X server for Emacs, or at least tell me where
> can I find information.

You can run an Xserver inside an existing Xserver

https://en.wikipedia.org/wiki/Xnest
https://en.wikipedia.org/wiki/Xephyr

export DISPLAY=:0
Xnest :1 -geometry 900x900+0+0 &
sleep 2
export DISPLAY=:1
emacs &

It was just an idea, but it looks you cannot define an indepent
keyboard map inside Xnest

http://linuxgazette.net/114/tag/1.html

You can try luck with Xephyr, but it's going to be another headache

http://superuser.com/questions/70428/how-can-i-sort-out-xephyrs-keyboard-mapping








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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 20:17             ` Javier
@ 2015-10-14  5:18               ` Shahab Shahsavari Alavidjeh
  0 siblings, 0 replies; 17+ messages in thread
From: Shahab Shahsavari Alavidjeh @ 2015-10-14  5:18 UTC (permalink / raw)
  To: help-gnu-emacs

Javier <nospam@nospam.com> writes:


>
> You can run an Xserver inside an existing Xserver
>
> https://en.wikipedia.org/wiki/Xnest
> https://en.wikipedia.org/wiki/Xephyr
>
> export DISPLAY=:0
> Xnest :1 -geometry 900x900+0+0 &
> sleep 2
> export DISPLAY=:1
> emacs &
>
> It was just an idea, but it looks you cannot define an indepent
> keyboard map inside Xnest
>
> http://linuxgazette.net/114/tag/1.html
>
> You can try luck with Xephyr, but it's going to be another headache
>
> http://superuser.com/questions/70428/how-can-i-sort-out-xephyrs-keyboard-mapping

Thank you, I'll try to dive into that, wish me luck.



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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-13 13:11 Shahab Shahsavari Alavidjeh
@ 2015-10-14  6:05 ` Yuri Khan
  2015-10-14  6:47   ` Shahab Shahsavari Alavidjeh
  2015-10-14  9:54   ` tomas
       [not found] ` <mailman.289.1444802784.7904.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 17+ messages in thread
From: Yuri Khan @ 2015-10-14  6:05 UTC (permalink / raw)
  To: Shahab Shahsavari Alavidjeh; +Cc: help-gnu-emacs@gnu.org

On Tue, Oct 13, 2015 at 7:11 PM, Shahab Shahsavari Alavidjeh
<zzgraph@gmail.com> wrote:
> Why I don't simply use my D.E. input method support and keyboard layout
> switcher instead?
>
> I'm currently using it, that's my best option right now, but then I
> should switch keyboard layouts whenever I want to run a command in emacs
> or even when I want to save a file to disk.

I want to expand on Shahab’s description of the problem.

1. Assume a user who works with more than one script (e.g. Latin and
Arabic, or Latin and Cyrillic, or Latin and Greek.) Not just
occasionally entering non-Latin characters, but actually writing whole
words, sentences, paragraphs and chapters in a language using a script
other than Latin.

2. Assume also that Emacs is used as an application in a desktop
environment, rather than as a desktop environment in and of itself.
Assume multiple other applications.


(1) is typically facilitated by providing multiple keyboard layouts,
called groups in X parlance. Groups are modal, that is, after one
group is activated, it remains active until the next switch. It is a
matter of user preference whether the active group is global to the
desktop or local to each application window. The set of groups is
typically kept constant.

Emacs provides a similar facility, called input methods. Input methods
are typically switched with C-\\, are local to Emacs, and never affect
other applications on the desktop.

In light of (2), it is desirable that (a) the layouts in Emacs and the
desktop environment are identical, (b) the keys to switch layouts are
identical, and (c) the scope of layout switching is consistent. All
three conditions are easiest satisfied by exclusively using the
desktop-provided keyboard layout mechanism and ignoring Emacs input
methods completely. (Shahab is asking for a way to emulate the
desktop’s layouts using Emacs input methods, but I believe that is a
dead end approach. There should be one, and preferably only one,
implementation of keyboard layout mechanism over the whole desktop.)

However, this comes at a cost. Because of the way modifiers work in
Emacs when running as a GUI application, the user has no way of
pressing e.g. C-c or C-x or M-x when a non-Latin layout is active.
Instead, Emacs interprets the keypresses as being C- or M-modified
letters of the active layout.


It would be a great help if modifiers and certain prefixes caused
Emacs to ignore the active layout and interpret the base keys
according to the primary layout, which will be one of Latin layouts in
most cases. (Which exact Latin layout will vary from user to user — US
QWERTY, German QWERTZ, French AZERTY, Dvorak, Colemak, etc.)

There are workarounds involving key-translation-map to make Emacs
pretend that it got C-q when it gets C-й, but they are ugly,
unreliable, and incomplete. Ideally, it should happen at the
underlying OS integration boundary.



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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-14  6:05 ` Yuri Khan
@ 2015-10-14  6:47   ` Shahab Shahsavari Alavidjeh
  2015-10-14  9:54   ` tomas
  1 sibling, 0 replies; 17+ messages in thread
From: Shahab Shahsavari Alavidjeh @ 2015-10-14  6:47 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs@gnu.org

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Tue, Oct 13, 2015 at 7:11 PM, Shahab Shahsavari Alavidjeh
> <zzgraph@gmail.com> wrote:
>> Why I don't simply use my D.E. input method support and keyboard layout
>> switcher instead?
>>
>> I'm currently using it, that's my best option right now, but then I
>> should switch keyboard layouts whenever I want to run a command in emacs
>> or even when I want to save a file to disk.
>

>
>
> It would be a great help if modifiers and certain prefixes caused
> Emacs to ignore the active layout and interpret the base keys
> according to the primary layout, which will be one of Latin layouts in
> most cases. (Which exact Latin layout will vary from user to user — US
> QWERTY, German QWERTZ, French AZERTY, Dvorak, Colemak, etc.)
>

Thanks Yuri

I completely agree with you on that, this approach is way better and
more practical. And it can completely solve my problem.

> There are workarounds involving key-translation-map to make Emacs
> pretend that it got C-q when it gets C-й, but they are ugly,
> unreliable, and incomplete. Ideally, it should happen at the
> underlying OS integration boundary.

While it's bound to C-q to pass non-ASCII characters to Emacs as
keybindings, which is briefly documented here

   https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Non_002dASCII.html#Init-Non_002dASCII

There should be no problem for Emacs to accept other combinations of
M- C- with non-ASCII characters as ASCII equivalent to the key pressed
on relevant primary keyboard layout.

But I think the problem with AltGr still is a valid problem, because it
makes huge inconsistency between Emacs's own quail layouts, where many
of them already standardized with AltGr as modifier in graphical
environment layouts.

IMO what you proposed is a very good and practical feature to get
implemented in Emacs. And it will make life a lot easier for people
using non-Latin scripts to use Emacs. But I think of AltGr problem as a
bug, which if get resolved can temporarily solve the problem for these
people (if there's any besides me!) before the feature you proposed get
implemented.



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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-14  6:05 ` Yuri Khan
  2015-10-14  6:47   ` Shahab Shahsavari Alavidjeh
@ 2015-10-14  9:54   ` tomas
  1 sibling, 0 replies; 17+ messages in thread
From: tomas @ 2015-10-14  9:54 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs@gnu.org, Shahab Shahsavari Alavidjeh

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Oct 14, 2015 at 12:05:18PM +0600, Yuri Khan wrote:

[...]

Thanks for your lucid exposition of the problem.

> In light of (2), it is desirable that (a) the layouts in Emacs and the
> desktop environment are identical, (b) the keys to switch layouts are
> identical, and (c) the scope of layout switching is consistent. All
> three conditions are easiest satisfied by exclusively using the
> desktop-provided keyboard layout mechanism and ignoring Emacs input
> methods completely [...]
> desktop’s layouts using Emacs input methods, but I believe that is a
> dead end approach. There should be one, and preferably only one,
> implementation of keyboard layout mechanism over the whole desktop.)
> 
> However, this comes at a cost. Because of the way modifiers work in
> Emacs when running as a GUI application, the user has no way of
> pressing e.g. C-c or C-x or M-x when a non-Latin layout is active.
> Instead, Emacs interprets the keypresses as being C- or M-modified
> letters of the active layout.

There are other costs -- among them that Emacs' input methods are usually
more advanced (and better integrated in Emacs) that whatever the desktop
can offer.

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlYeJkYACgkQBcgs9XrR2kZ/KQCcDO0x28sKujYfhoDEzGgFtLOt
YB4AmwSHs2Vc8SOlBK18H23F0FUVt3OY
=PCU8
-----END PGP SIGNATURE-----



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

* Re: Using AltGr as standard modifier key in emacs
       [not found] ` <mailman.289.1444802784.7904.help-gnu-emacs@gnu.org>
@ 2015-10-14 12:17   ` Rusi
  2015-10-15  1:47     ` Rusi
  0 siblings, 1 reply; 17+ messages in thread
From: Rusi @ 2015-10-14 12:17 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, October 14, 2015 at 11:36:26 AM UTC+5:30, Yuri Khan wrote:
> However, this comes at a cost. Because of the way modifiers work in
> Emacs when running as a GUI application, the user has no way of
> pressing e.g. C-c or C-x or M-x when a non-Latin layout is active.
> Instead, Emacs interprets the keypresses as being C- or M-modified
> letters of the active layout.

I find this behavior at least anomalous, maybe a bug.

$ setxkbmap -layout "us,gr" -option "grp:lalt_lshift_toggle,grp_led:scroll"

gets a greek keyboard after lshift-lalt

Now inside emacs the normal keys produce greek thus:
abcdefghijkl produces αβψδεφγηιξκλ

So far so good

C-a produces a 
C-α is undefined
message

However M-x (ie Alt-x) works alright

So why does C- go through the current layout
Whereas M- stays within us/Ascii?


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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-14 12:17   ` Rusi
@ 2015-10-15  1:47     ` Rusi
  2015-10-15  2:23       ` Yuri Khan
       [not found]       ` <mailman.347.1444875907.7904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: Rusi @ 2015-10-15  1:47 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, October 14, 2015 at 5:47:26 PM UTC+5:30, Rusi wrote:
> On Wednesday, October 14, 2015 at 11:36:26 AM UTC+5:30, Yuri Khan wrote:
> > However, this comes at a cost. Because of the way modifiers work in
> > Emacs when running as a GUI application, the user has no way of
> > pressing e.g. C-c or C-x or M-x when a non-Latin layout is active.
> > Instead, Emacs interprets the keypresses as being C- or M-modified
> > letters of the active layout.
> 
> I find this behavior at least anomalous, maybe a bug.
> 
> $ setxkbmap -layout "us,gr" -option "grp:lalt_lshift_toggle,grp_led:scroll"
> 
> gets a greek keyboard after lshift-lalt
> 
> Now inside emacs the normal keys produce greek thus:
> abcdefghijkl produces αβψδεφγηιξκλ
> 
> So far so good
> 
> C-a produces a 
> C-α is undefined
> message
> 
> However M-x (ie Alt-x) works alright
> 
> So why does C- go through the current layout
> Whereas M- stays within us/Ascii?

And with emacs -nw
its the other way round: M-x doesnt work, C-x does


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

* Re: Using AltGr as standard modifier key in emacs
  2015-10-15  1:47     ` Rusi
@ 2015-10-15  2:23       ` Yuri Khan
       [not found]       ` <mailman.347.1444875907.7904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Yuri Khan @ 2015-10-15  2:23 UTC (permalink / raw)
  To: Rusi; +Cc: help-gnu-emacs@gnu.org

On Thu, Oct 15, 2015 at 7:47 AM, Rusi <rustompmody@gmail.com> wrote:
>> So why does C- go through the current layout
>> Whereas M- stays within us/Ascii?

I do not see that. With us,ru in emacs -Q (24.4.1, GTK+) I get
layout-translated characters both with C- and M-.

> And with emacs -nw
> its the other way round: M-x doesnt work, C-x does

That case is completely out of reach for Emacs; rather, it depends on
the terminal emulator. Your particular terminal emulator sends C-x
according to the primary layout, but for M-x it (understandably) just
prefixes the character of the active layout with an ESC.



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

* Re: Using AltGr as standard modifier key in emacs
       [not found]       ` <mailman.347.1444875907.7904.help-gnu-emacs@gnu.org>
@ 2015-10-15  2:42         ` Rusi
  0 siblings, 0 replies; 17+ messages in thread
From: Rusi @ 2015-10-15  2:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, October 15, 2015 at 7:55:11 AM UTC+5:30, Yuri Khan wrote:
> On Thu, Oct 15, 2015 at 7:47 AM, Rusi  wrote:
> >> So why does C- go through the current layout
> >> Whereas M- stays within us/Ascii?
> 
> I do not see that. With us,ru in emacs -Q (24.4.1, GTK+) I get
> layout-translated characters both with C- and M-.


Not here.
Tried with emacs -Q
M- not translated
C- translated

Emacs-versions  25.0.50.2
and 24.4.1

Ubuntu 15.4 with default DE


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

end of thread, other threads:[~2015-10-15  2:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.229.1444746928.7904.help-gnu-emacs@gnu.org>
2015-10-13 16:57 ` Using AltGr as standard modifier key in emacs Rusi
2015-10-13 17:05   ` Rusi
2015-10-13 17:44     ` Shahab Shahsavari Alavidjeh
     [not found]     ` <mailman.256.1444758367.7904.help-gnu-emacs@gnu.org>
2015-10-13 18:19       ` Javier
2015-10-13 18:43         ` Javier
2015-10-13 19:42           ` Shahab Shahsavari Alavidjeh
     [not found]           ` <mailman.265.1444765466.7904.help-gnu-emacs@gnu.org>
2015-10-13 20:17             ` Javier
2015-10-14  5:18               ` Shahab Shahsavari Alavidjeh
2015-10-13 19:20         ` Shahab Shahsavari Alavidjeh
2015-10-13 13:11 Shahab Shahsavari Alavidjeh
2015-10-14  6:05 ` Yuri Khan
2015-10-14  6:47   ` Shahab Shahsavari Alavidjeh
2015-10-14  9:54   ` tomas
     [not found] ` <mailman.289.1444802784.7904.help-gnu-emacs@gnu.org>
2015-10-14 12:17   ` Rusi
2015-10-15  1:47     ` Rusi
2015-10-15  2:23       ` Yuri Khan
     [not found]       ` <mailman.347.1444875907.7904.help-gnu-emacs@gnu.org>
2015-10-15  2:42         ` Rusi

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.