Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Getting the Alt key to work in Emacs?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
gentsquash
l33t
l33t


Joined: 03 Nov 2004
Posts: 753
Location: Still a Gentoo beginner.

PostPosted: Mon May 16, 2005 7:09 am    Post subject: Getting the Alt key to work in Emacs? Reply with quote

The original title was "Asking KDE to not trap keys over Emacs"
and that was mostly solved. I then changed the title when the
thread shifted topic in the 3rd post.


Is there a way to politely ask KDE, when the mouse is over my
Emacs window, to not trap keys (such as C-tab) but to pass them
on to Emacs?

Naturally, some keys are trapped at a very low level, e.g
Code:
C-A-Backspace

for rebooting; I'm not trying to stop those from being trapped.

And I'm not trying to disable the KDE shortcuts when the mouse is
over the desktop, or over some other window. It is just my
friend Emacs that I am trying to protect...
_________________
Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida


Last edited by gentsquash on Fri May 20, 2005 9:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Mon May 16, 2005 5:04 pm    Post subject: Reply with quote

I always stop KDE from catching certain keyboard shortcuts globally. More precise I remove the whole desktop switches, CTRL-F[1-9] and friends for some custom function I have added in emacs and for my IDE too. Next I replace CTRL-TAB with nothing to enable switching to the other frame/buffer in emacs instead of walking through my desktop list in KDE.

The last functionality I've replaced by Ctrl-ALT-Left or Ctrl-ALT-Right to switch to the current desktop right or left. Other keybindings in emacs are not affected by KDE as far as I have noticed or I have removed these settings without conscious. ;)

You find the keyboard shortcuts in the
Code:
ControlCenter -> Regional & Accessibility -> Keyboard Shortcuts ->Global Shortcuts


If you find an option to do this for one application, here for emacs, let me know, but actually I'm fine as I have configured it.
_________________
-- erol
Back to top
View user's profile Send private message
gentsquash
l33t
l33t


Joined: 03 Nov 2004
Posts: 753
Location: Still a Gentoo beginner.

PostPosted: Mon May 16, 2005 7:42 pm    Post subject: Reply with quote

Thanks ekutay --I've done as you suggested. I saved these
changes and called the new scheme "Emacs-scheme"; I can get
back to the old scheme by selecting the built-in "UNIX scheme".

ekutay wrote:
If you find an option to do this for one
application, here for emacs ...


Alas, I haven't. At work we use Solaris and, IIRC, it does
select its shortcut-keys depending on which window the mouse
hovers.

====
Here is a related Emacs+KDE kbd problem that I have never figured
out. KDE sees the Alt key as Alt, but Emacs sees it as Meta, and
I have been unsuccessful getting Emacs to see Alt.

A long time ago, I tried to solve this using xmodmap
and my xmodmap file from Solaris
(where it works fine), but it did not work here. IIRC, KDE no
longer saw an Alt key, and I could no longer access virtual
consoles.

Could I trouble you to say how you have things set up for your
Emacs with Alt,Meta,Control? If this is better by PM or email,
that is fine.
_________________
Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Mon May 16, 2005 8:18 pm    Post subject: Reply with quote

gentsquash wrote:
Could I trouble you to say how you have things set up for your
Emacs with Alt,Meta,Control?
I can only guess, as it is working in my setups as expected, but I remember my struggles with ALT and ESC/META maybe good enough to help you here. If you are used to use ALT, META is just horrible emulated with ESC. :|

I assume that CTRL is not of concern, is it?

What keyboard layout is set in your xorg.conf and do you have already some settings in your .emacs files which could have influence?
_________________
-- erol
Back to top
View user's profile Send private message
gentsquash
l33t
l33t


Joined: 03 Nov 2004
Posts: 753
Location: Still a Gentoo beginner.

PostPosted: Tue May 17, 2005 4:26 am    Post subject: Reply with quote

ekutay wrote:
I assume that CTRL is not of concern, is it?

Correct; CTRL works.
ekutay wrote:
...some settings in your .emacs files which could have influence?

The problem still occurs with
Code:
emacs -q      (and)    emacs -q --no-site-file

I tested it under GNOME and KDE.

ekutay wrote:
What keyboard layout is set in your xorg.conf ...

Is this what you mean?
Code:
Section "ServerLayout"
   Identifier     "X.org Configured"
   Screen      0  "Screen0" 0 0
   InputDevice    "Mouse0" "CorePointer"
   InputDevice    "Keyboard0" "CoreKeyboard"
EndSection
...
Section "InputDevice"
   Identifier  "Keyboard0"
   Driver      "kbd"
EndSection


Note that the
Code:
xev

program shows that my Alt key sends keysym Alt_L. Yet
Code:
emacs -q

shows it as Meta.
_________________
Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Tue May 17, 2005 7:47 am    Post subject: Reply with quote

Try to set your Xkblayout and your Xkbmodel.
Quote:

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbLayout" "us"
Option "XkbModel" "pc105"
EndSection

You could count the number of buttons on your keyboard, but instead you could also try to guess :)
I think the default is pc102, what maybe cause your issue.
_________________
-- erol
Back to top
View user's profile Send private message
gentsquash
l33t
l33t


Joined: 03 Nov 2004
Posts: 753
Location: Still a Gentoo beginner.

PostPosted: Fri May 20, 2005 9:32 pm    Post subject: Reply with quote

ekutay thanks --I will eventually try playing with xorg, but I'm
not confident: What confuses me is that Alt is indeed sending
the Alt keysym, yet emacs (even `emacs -q') sees it as Meta.

Would you, or anyone who has Alt working correctly with Emacs,
be willing to post the output of the following experiment?

In Emacs, type

Code:
C-h k   A-s


where here I am using Emacs' notation A-s for "hold down Alt and
press s". Could you post the top line of the *Help* buffer (does
Emacs see the key as Alt)?

Could you do the same, but in an `emacs -q', to see if your emacs
init-files are influencing the situation.

Finally, if you have the energy and the `xev' program, could you
run it and tell me if the left&right keys labeled "Alt" on your
keyboard actually produce the keysym Alt_L and Alt_R?
_________________
Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Fri May 20, 2005 9:42 pm    Post subject: Reply with quote

gentsquash wrote:
ekutay thanks --I will eventually try playing with xorg, but I'm
not confident: What confuses me is that Alt is indeed sending
the Alt keysym, yet emacs (even `emacs -q') sees it as Meta.
this is from my point of view correct, you should try it out, its 5 minutes for pc10[2-5]. for all of them.
gentsquash wrote:

Code:
C-h k   A-s

both are working as M-s (as said above, I want meta as alt, not to hit Esc for this)

xev delivers ALT_L - keycode 64 - for left alt and ISO_SHIFT_3 - keycode 113 - for the right hand.
_________________
-- erol
Back to top
View user's profile Send private message
gentsquash
l33t
l33t


Joined: 03 Nov 2004
Posts: 753
Location: Still a Gentoo beginner.

PostPosted: Fri May 20, 2005 9:50 pm    Post subject: Reply with quote

Ah --so I misunderstood. What key do you press to get "A-" (Alt)
in Emacs? Some Emacs packages use "A-" bindings (in particular,
one of the pkgs for typing accented characters).

My particular need is to have a working "A-" "M-" and "C-" in
Emacs.

Weirdly, my "Win" key sends "H-s" (Hyper, followed by "s") into
Emacs. And when, many months ago, I tried to rebind the keys
with xmodmap, the result was that even KDE no longer recognized
Alt (even though xev still showed the keysym as Alt).

ekutay or others; do any of you have all three prefixes "A-",
"M-" and "C-" working in Emacs?
_________________
Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum