bthomas
Posts: 7
Joined: Tue Jul 07, 2020 2:16 pm

Mapping Left Alt to Meta for Emacs in Console

Tue Jul 07, 2020 10:05 pm

Hi

I am using the latest Raspberry Pi OS lite version . On the console and within Emacs also in the console, I find the Left Alt key has the behavior of the Alt-Gr (Alt graphics key i.e. Right Alt key). It produces alternative graphic characters when used in combination with other keys. I would like to disable this behavior, so that the Left Alt key can be used as the Meta key in Emacs. I would be grateful if you can point me to how I may go about doing this.

regards
Thomas

pidd
Posts: 230
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: Mapping Left Alt to Meta for Emacs in Console

Tue Jul 07, 2020 10:20 pm

If you run raspi-config and set up the keyboard it gives you options for the alt keys after the initial language/layout setting.

bthomas
Posts: 7
Joined: Tue Jul 07, 2020 2:16 pm

Re: Mapping Left Alt to Meta for Emacs in Console

Wed Jul 08, 2020 12:43 pm

Selecting "Localisation Options" and then "Change Keyboard Layout" in raspi-config does not seem to allow any manual changes. All it does is print "Reloading keymap. This may take a short while" and then return to the "Localisation Options" menu.

regards

pidd
Posts: 230
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: Mapping Left Alt to Meta for Emacs in Console

Wed Jul 08, 2020 1:14 pm

The command line raspi-config is more comprehensive iirc

bthomas
Posts: 7
Joined: Tue Jul 07, 2020 2:16 pm

Re: Mapping Left Alt to Meta for Emacs in Console

Wed Jul 08, 2020 2:15 pm

I am using the command line raspi-config . Since I am have installed the lite version of Raspberry Pi OS, I do not even have X server installed. I think this problem is specific to the virtual console, since I can reproduce it on a Debian virtual console on my desktop (which has an X server).

User avatar
scruss
Posts: 3148
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Mapping Left Alt to Meta for Emacs in Console

Wed Jul 08, 2020 2:43 pm

bthomas wrote:
Wed Jul 08, 2020 12:43 pm
Selecting "Localisation Options" and then "Change Keyboard Layout" in raspi-config does not seem to allow any manual changes. All it does is print "Reloading keymap. This may take a short while" and then return to the "Localisation Options" menu.
Do you have a keyboard attached? raspi-config will skip configuration if it can't find one. The underlying dpkg-reconfigure keyboard-configuration also just doesn't like some kinds of keyboards. If that doesn't work, there's lots of goodness in /etc/default/keyboard. TIL you're supposed to do sudo service keyboard-setup restart after changing anything to do with the keyboard.

If you're logging in via ssh or VNC, it may be the local computer configuration you need to worry about.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

bthomas
Posts: 7
Joined: Tue Jul 07, 2020 2:16 pm

Re: Mapping Left Alt to Meta for Emacs in Console

Wed Jul 08, 2020 3:02 pm

scruss wrote:
Wed Jul 08, 2020 2:43 pm
Do you have a keyboard attached? raspi-config will skip configuration if it can't find one. The underlying dpkg-reconfigure keyboard-configuration also just doesn't like some kinds of keyboards. If that doesn't work, there's lots of goodness in /etc/default/keyboard. TIL you're supposed to do sudo service keyboard-setup restart after changing anything to do with the keyboard.
Thank you very much. You make some good points. Indeed I have no keyboard attached to the Pi. I am logging in via SSH. I will dig further into keyboard configuration utilities you pointed out and see if I can find a solution. I will post it here if I do.
scruss wrote:
Wed Jul 08, 2020 2:43 pm
If you're logging in via ssh or VNC, it may be the local computer configuration you need to worry about.
You are probably right that this problem is not specific to the Pi. I can reproduce it on my desktop which is a Debian Buster. I am logging into the Pi through Debian. In Debian, Emacs when run as a GUI (X server) does not have a problem with the Alt key, which is correctly interpreted as Meta. However when run in a Debian virtual console (or in XTerm with using emacs -nw option) , Emacs does not see Left Alt as "Meta". Most likely this is not an Emacs issue but a consequence of the default console keymap.

regards

pidd
Posts: 230
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: Mapping Left Alt to Meta for Emacs in Console

Wed Jul 08, 2020 3:48 pm

If you have a keyboard dongle floating around, plug that in, they register as a keyboard even when not linked to one and draw very little current. Its a pathetic but tidy solution?

Return to “Advanced users”