LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 09-30-2005, 11:35 PM   #1
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
Question .Xmodmap and meta key


I use xmodmap to set my right alt key as a mode_switch key that allows me to type international characters. However, that means I don't have a meta key to use with emacs. What do I need to put in my .Xmodmap file to set my right control key to whatever emacs sees as the meta key (keeping my left control as is)?
 
Old 10-02-2005, 09:26 AM   #2
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
Code:
keycode #  =  Control_L
perhaps?
 
Old 10-02-2005, 09:46 AM   #3
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Isn't that setting some key to be control, not meta?
 
Old 10-02-2005, 10:06 AM   #4
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
Yes, but would emacs see a difference? It is the default value of what your emacs currently sees, I don't know if it will work but it is worth a try.

Edit: Nevermind me, I'm just a little slow today.

Code:
xmodmap -e "keysym Control_R = Control_R Meta_L"
something to that effect...I wouldn't recommend trying that code, read this instead. That appears to work for me. I got that code from the xmodmap listing, just typing xmodmap. I don't know, though, I'm in over my head, I don't use emacs (I use vi) so I can't test it

Code:
      % cat ~/.Xmodmap
      !Right Alt key is used to Meta key
      keysym Mode_switch = Escape
      keysym Meta_R = Escape
Just another option, since it might be easier to migrate to Alt on the same side, rather than Control on the other side. HTH

Last edited by flower.Hercules; 10-02-2005 at 12:22 PM.
 
Old 10-02-2005, 05:09 PM   #5
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Hmm, it gives errors when I try the lines above, but I looked through the documentation some more and tried something else. It looks like the key code for Control_R is 97. I put the following in .Xmodmap:

Code:
keycode 97 = Meta_L
However, Control_R continues to be treated as a control key. I tried playing with the values of mod1, mod4, etc., but nothing seemed to work. It seems like the problem is with what emacs will consider a Meta key, but I can't figure out anything that will make this work. Any other ideas?
 
Old 10-02-2005, 07:16 PM   #6
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
Well, you got me very interested in this problem, as a result, I installed emacs and I believe I have your solution.

Code:
xmodmap -e "remove control = Control_R"
xmodmap -e "add mod1 = Control_R"
I also added the line
Code:
Option    "RightCtl"    "Meta"
to the keyboard InputDevice section of my xorg.conf, I don't know if that made a difference.


Edit: I just realized you might have set Control_R to Meta_L, in which case, just switch it back to Control_R with
Code:
xmodmap -e "keycode 97 = Control_R"
I learned a lot about xmodmap, I thank you

Last edited by flower.Hercules; 10-02-2005 at 07:17 PM.
 
Old 10-02-2005, 07:50 PM   #7
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
You're welcome, and I'm inviting you to learn more

That solution accomplished more than I'd done before, but still doesn't quite work. The problem is, I have Fluxbox set up to have mod1 be the modifier used in most key bindings. If I make your changes and then do Ctrl-t, it is interpreted as what I normally do as Alt-t (also bound to mod1), which opens a terminal window. The way I understood it from poking around online, emacs just needs a key to be designated Meta without having any modifier bindings to work, but it doesn't seem to for me.
 
Old 10-02-2005, 08:14 PM   #8
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
Well, you could put the left alt key in mod3 (it is empty in my xmodmap) and replace all mod1's in your Fluxbox configuration with mod3, that shouldn't change any functionality, just how it works under the hood, it's a patch job; I haven't given up I will see what I can come up with.

Edit: However, you may like this solution better...I hope it doesn't bugger anything else, Emacs, when it came about, as you've probably read, heavily used meta-keys, some keyboards didn't have them, so the author added the ability to use the Escape key...so
Code:
xmodmap -e "remove mod1 = Control_R"
xmodmap -e "keysym Control_R = Escape"
Viola!

Last edited by flower.Hercules; 10-02-2005 at 08:21 PM.
 
Old 10-02-2005, 08:23 PM   #9
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
The problem with the escape solution is that, when using that method, you press and release escape, then press the key, rather than the normal method of doing keystrokes. I'll try rearranging all the modifiers though and see if that does the trick.
 
Old 10-02-2005, 08:29 PM   #10
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
I knew it couldn't be that simple However, the binding of Control_R to Escape does seem to work as a Keystroke pressing Control_R and A returns me to the first line of the working paragraph; this is as far as my Emacs knowledge goes, do you have a specific keystroke that you are using that gives you faulty behavior?

Last edited by flower.Hercules; 10-02-2005 at 08:36 PM.
 
Old 10-02-2005, 11:54 PM   #11
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
I moved all the modifiers around and Control_R now acts as escape. If I just press Control_R, "ESC-" appears at the bottom of the screen. I've been trying C-v and M-v, but M-v won't work unless I release Control_R before pressing v (that is, it's acting as escape, not meta).
 
Old 10-03-2005, 07:09 AM   #12
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
So as mod3 it is Escape or did you leave it as
Code:
xmodmap -e "keysym Control_R = Escape"
because, that would should be
Code:
xmodmap -e "keycode 97 = Control_R"
 
  


Reply


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
Changing the Meta key from Esc to Alt primo *BSD 0 08-27-2005 05:18 PM
Emacs Trouble, Meta key not working chandru.in Slackware 6 07-18-2005 04:53 AM
Best way to map Windows key to Meta in Terminal eltecolote Linux - General 1 06-15-2005 09:09 AM
xterm meta key bob66 Linux - Software 0 03-25-2005 09:26 AM
Emacs 8-bit input as meta key cilantro Linux - Software 5 12-11-2003 11:21 PM


All times are GMT -5. The time now is 12:05 PM.

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