Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top