help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-snapshot keybinding problem


From: Peter Dyballa
Subject: Re: emacs-snapshot keybinding problem
Date: Sat, 31 Dec 2005 18:21:01 +0100


Am 31.12.2005 um 16:41 schrieb Angelina Carlton:

        keycode 115 = Hyper
        add Mod4 = Hyper
        keycode 115 = super
        add Mod5 = super

Ok, for this system it complains that Hyper and super are not valid
keysyms

Sorry! It has to be with _L or _R, and here in Mac OS X it's Super (with _L or _R), uppercase!


So my function keys now go all the way up to F16 :-) and I have OPTL set
to Hyper_L and OPTR set to Super_R, I now need to
learn the syntax to bind something to the Super and Hyper keys

(global-set-key [(hyper q)] 'some-function) does not work.

(global-set-key [s-f1]          'replace-string)
(global-set-key [H-f]           'end-of-defun)

S- is the Shift key
C- is the Control key
M- is the Meta key
A- is the Alt key
H- is the Hyper key
s- is the super key

A simple and looong text way to find out, is to invoke global-set-key interactively, press the key combination, and then invoke repeat-complex-command, which is C-x Esc Esc or C-x M-: or C-x M-ESC. In minibuffer the keybinding is listed. C-a: you're at the expression's beginning, C-k: you've killed the expression, C-g: minibuffer closes. Now enter ~/.emacs and yank that line near the other global-set-key's: finished!


Incidentally these function keys still get overwritten in emacs22, I have
not tried to address this yet because as you pointed out, my
key mappings were incorrect to begin with, even in emacs21 so one step at
a time I suppose :)


You have to make a difference between GNU Emacs running inside a terminal (emulation), or as an X client in its own window. The keys you set with xmodmap do not exist in nowindows mode. XTerm and other terminal emulations have kind of 'text bindings' to keys, particularly to function keys. The syntax to set up these X resources in ~/.Xdefaults is not easy, I presume I copied these lines from somewhere:

XTerm*vt220*VT100.translations: #override \n\
   ~Shift<Key>F1:       string(0x1b) string("OP") \n \
   ~Shift<Key>F2:       string(0x1b) string("OQ") \n \
   ~Shift<Key>F3:       string(0x1b) string("OR") \n \
   ~Shift<Key>F4:       string(0x1b) string("OS") \n \
   ~Shift<Key>F5:       string(0x1b) string("[16~") \n \
   ~Shift<Key>F6:       string(0x1b) string("[17~") \n \
   ~Shift<Key>F7:       string(0x1b) string("[18~") \n \
   ~Shift<Key>F8:       string(0x1b) string("[19~") \n \
   ~Shift<Key>F9:       string(0x1b) string("[20~") \n \
   ~Shift<Key>F10:      string(0x1b) string("[21~") \n \
   ~Shift<Key>F11:      string(0x1b) string("[28~") \n \
   ~Shift<Key>F12:      string(0x1b) string("[29~") \n \
    Shift<Key>F1:       string(0x1b) string("[23~") \n \
    Shift<Key>F2:       string(0x1b) string("[24~") \n \
    Shift<Key>F3:       string(0x1b) string("[25~") \n \
    Shift<Key>F4:       string(0x1b) string("[26~") \n \
    Shift<Key>F5:       string(0x1b) string("[K~")  \n \
    Shift<Key>F6:       string(0x1b) string("[31~") \n \
    Shift<Key>F7:       string(0x1b) string("[31~") \n \
    Shift<Key>F8:       string(0x1b) string("[32~") \n \
    Shift<Key>F9:       string(0x1b) string("[33~") \n \
    Shift<Key>F10:      string(0x1b) string("[34~") \n \
    Shift<Key>F11:      string(0x1b) string("[28~") \n \
    Shift<Key>F12:      string(0x1b) string("[29~") \n

!XTerm*VT100.translations: #override \
!       <Key>BackSpace:   string("\010") \n\
!   Shift<Key>Tab:        string("\033[Z") \n\
!    Ctrl<Key>minus:      string("\037") \n\
!       <Key>Home:        string("\033[1~") \n\
!       <Key>End:         string("\033[4~") \n\
!       <Key>Delete:      string("\033[3~") \n\
!   Shift<Key>Delete:     string("\177") \n\
!    Ctrl<Key>Delete:     string("\010") \n\
!     Alt<Key>Return:     string("\033\015") \n\
!     Alt<Key>space:      string("\033\040") \n

\033 is the same as 0x1b wrapped in a string() call solely. Some X clients understand the modifiers "Alt," "Ctrl," "Meta," or "Shift." If xterms does too, and maybe understands Hyper or Super too, you have the option to define your own extra set of key sequences these key produce when pressed with any of these modifiers, that should work without windows. In extending the xterm.el code you might get these extra layers.

To activate these X resources you can merge them via 'xrdb -merge < ~/.Xdefaults'.

--
Greetings

  Pete

Well done is better than well said.
   ---- Benjamin Franklin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]