1

I regularly use the backspace key to delete whole words at a time to the left of the cursor, but this would be a MUCH easier keystroke if it could be done one-handed. For that to happen - I would need to use the right key. But when I do this from EMACS' response it is clearly interpreting this key as being different form the left key.

In this answer the poster identifies a method to achieve this outcome of changing the keymap: https://stackoverflow.com/questions/10257352/right-alt-key-not-working-as-meta-key-in-emacs

I would like to do this by "tweaking" emacs rather than change my keymap in the OS.

Does anybody know how to tell emacs that right alt is the same as left alt?

I am using Windows 10 as my OS

I am accessing EMACS through PUTTY: Release 0.70

onto a Red Hat Enterprise Linux Workstation release 7.6 (Maipo)

EMACS Version: GNU Emacs 24.3.1

This is on my Universities linux Lab - so I am not likely to have a lot of ability to edit config files for EMACS either...

5
  • If Emacs thinks right-alt and left-alt are different, it means the OS passes different information to Emacs depending on which one you use. How to change how Emacs reacts, and whether it is at all possible to do what you want, depends on exactly what the OS is doing. So: what operating system is this? What keyboard layout and settings? And what version of Emacs? Feb 6, 2019 at 17:52
  • You can get the version with M-x emacs-version.
    – NickD
    Feb 7, 2019 at 1:41
  • @NickD - Thx - I'e edited in the EMACS & Red Hat versions as well.
    – kiltannen
    Feb 7, 2019 at 2:21
  • This isn't normal. Some more info would help. First: if the xev program is available on your RedHat computer, run it in a terminal and see what keycode the OS provides for the right and left alt keys. For me I see Alt_R and Alt_L. Then check to see what key codes are passed to Emacs when you press those keys: C-h k M-backspace, using the right and left keys for M.
    – Tyler
    Feb 7, 2019 at 17:25
  • @Tyler sadly I couldn't get xev. When I followed emacs commands you suggested - I could see the alt_L BUT the right Alt gave nothing at all! I am suspecting a slightly nonstandard scan code that is not being interpreted at all by Emacs :(( So I ended up using keytweak and remapping the key. Not my 1st or even 2nd preference - but it's what got it to work in the end.
    – kiltannen
    Feb 19, 2019 at 9:55

2 Answers 2

2

in init.el,

(setq w32-recognize-altgr nil)

Please find it in G.6 Keyboard Usage on MS-Windows (https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-Keyboard.html)

Best Wish, SY

0

for fedora (34+), at least, the incantation is:

  • settings .. keyboard
  • special characters entry .. alternate characters key default is right alt.
    change it to something else, maybe something you don't have, like right super.

.. unless you need to type some fancy characters... :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.