Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-10-2011, 12:23 PM   #1
LQ Newbie
Registered: Dec 2010
Posts: 4

Rep: Reputation: 0
Lightbulb emacs keymap: how to swap right alt and right control for virtual terminal ?

My emacs 23 is running on Ubuntu 10.04 and I am very a emacs primer. Please tell me:
in virtual terminals, how can I remap keys to swap the right alt key and the right ctrl key automatically every time the machine starts up? Thank you.

My current hack is as following:
When I start up my system every time, I run this bash script.
#!/bin/bash -

if [ -f ~/.xmodmaprc/xmodmaprc_R ];
xmodmap ~/.xmodmaprc/xmodmaprc_R
emacs -q -bg lightgreen -fg black -fh -fw 2> /dev/null

And my ~/.xmodmaprc/xmodmaprc_R file is like this.
! swap Alt_R and Control_R
remove mod1 = Alt_R
remove control = Control_R
keysym Control_R = Alt_R
keysym Alt_R = Control_R
add mod1 = Alt_R
add control = Control_R

By the way, I know how to swap CapsLK and Ctrl on the left side of keyboard in this way:
Open /etc/kdb/remap file in Ubuntu 10.04 and append below 2 lines to this file. And in this way I can swap Caps_Lock and Control in virtual terminal.
s/keycode *58 = Caps_Lock/keycode 58 = Control/;
s/keycode *29 = Control/keycode 29 = Caps_Lock/;

But how to swap Alt and Ctrl on the right side?

Last edited by hillgreen; 01-14-2011 at 07:48 AM. Reason: To specify it.
Old 01-11-2011, 10:06 AM   #2
Registered: Sep 2009
Posts: 125

Rep: Reputation: Disabled
Delete My account

Last edited by xandercage17; 04-22-2012 at 03:20 PM. Reason: Delete My account
Old 01-14-2011, 10:32 AM   #3
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234

Welcome to LQ.

I think you need to watch out for clicking the "Report" button instead of "Quote" the button. Your report of xandercage17's post only makes sense if it was an accident. Furthermore, I looked at the posted links & they seem appropriate. If they don't work for you, please be more specific about how & why they don't work for you, that would help us refine our suggestions for you.

Note & warning
I haven't used Emacs since the CP/M version on my Kaypro 10 in 1984.


What portion of your post did you want to make Silver?
Thanks for fixing the "silver thing"

Last edited by archtoad6; 01-16-2011 at 08:36 AM. Reason: no new post needed
Old 01-15-2011, 11:38 AM   #4
Registered: Sep 2009
Posts: 125

Rep: Reputation: Disabled
Delete My account

Last edited by xandercage17; 04-22-2012 at 03:20 PM. Reason: Delete My account


ctrl, emacs, keymapping, swap

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
control-alt-del and control f2? Romanus81 Slackware 1 03-11-2008 05:41 PM
Alt no longer META key when using in-terminal option of Emacs (emacs -nw) frznchckn Linux - Software 1 06-02-2007 03:41 AM
Emacs LISP - function and keymap? jantman Programming 5 09-28-2006 12:59 PM
uk keymap for Xorg.ccnf doesn't allow virtual terminal switching... Oholiab Linux - General 1 01-13-2006 09:37 AM
Right ALT key, 'agetty' on unused virtual terminal. Tarts Linux - Newbie 0 08-14-2003 05:47 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration