How to separate alt and meta keys in emacs

China☆狼群 提交于 2019-12-07 09:07:29

问题


I would like to map a PgUp key on my keyboard to Alt modifier to produce A- key sequence in Emacs, so that I can map it to a whole new set of key bindings.

I was looking at my keyboard mappigs and currently my left Alt key works as both Meta_L and Alt_L modifier. This is the relevant output of xmodmap -pke:

keycode  64 = Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L

I'm not sure how to tell emacs to treat Alt and Meta totally separately,

I have looked at the x-alt-keysym and it is nil

Which keys Emacs uses for the alt modifier.
This should be one of the symbols `alt', `hyper', `meta', `super'.
For example, `alt' means use the Alt_L and Alt_R keysyms.  The default
is nil, which is the same as `alt'.

The same is for x-meta-keysym and it is also nil:

Which keys Emacs uses for the meta modifier.
This should be one of the symbols `alt', `hyper', `meta', `super'.
For example, `meta' means use the Meta_L and Meta_R keysyms.  The 
default is nil, which is the same as `meta'.

From this it implies that Alt_L should fire alt, however it always fires meta as it is indicated by the M- in the minibar


回答1:


Emacs does distinguish between Alt and Meta.

In your case your current combined Alt/Meta either appears as an Alt or as a Meta. If there's no Meta key, Emacs automatically treats the Alt key as a Meta. So in the end your combined Alt/Meta will behave as a Meta in Emacs.

But if you set your modifiers with separate keys for Alt and Meta, Emacs will readily distinguish them.



来源:https://stackoverflow.com/questions/23463415/how-to-separate-alt-and-meta-keys-in-emacs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!