[Top][All Lists]

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

Re: can't global-set-key in emacs -nw

From: Peter Heslin
Subject: Re: can't global-set-key in emacs -nw
Date: 2 Feb 2004 13:04:07 -0800

Stefan Monnier <address@hidden> wrote in message news:<address@hidden>...
> >> Once your terminal emulator is properly configured you need to tell Emacs
> >> what that seuqnce is by appropriate (define-key function-key-map ...) 
> >> calls.
> >> See lisp/term/xterm.el for some default settings used if your terminal
> >> is xterm.  The same terminal emulator may send different sequences
> >> depending on the configuration, so there's no standard sadly.
> > Assuming the user has not changed any escape sequences via resources
> > settings, is this still really the case?
> Well, yes, it seems.

Hi Stefan,

I decided to check on this.  I went and downloaded the current source
of xterm from, and there is a
document with it called, which confirms that the behavior I
am seeing on my system is the documented, correct behavior of current
xterm.  It has the following statement::

In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource
false, xterm recognizes function key modifiers which are parameters
appended before the final character of the control sequence.

                      Code     Modifiers
                       2       Shift
                       3       Alt
                       4       Shift + Alt
                       5       Control
                       6       Shift + Control
                       7       Alt + Control
                       8       Shift + Alt + Control

For example, shift-F5 would be sent as CSI 1 5 ; 2 ~

If the alwaysUseMods resource is set, the Meta modifier also is recogĀ­
nized, making parameters 9 through 16.

In other words, all of these combinations of modifiers on function
keys send distinct and documented escape sequences that Emacs could
and should interpret correctly.

So I think we should regard systems on which xterm behaves differently
as broken.  I think it's more likely that it's just that some
distributions have older versions of xterm stuck in them out of
inertia, rather than that they are deliberately wanting different

I would be happy to work on adding these escape sequences to
term/xterm.el, if you think such a patch would be acceptable in
principle.  My only question would be the Alt/Meta issue.  Xterm
clearly regards Alt as the more important key, with Meta available
additionally on some systems where the alwaysUseMods resource is set. 
This might be taken to imply that the Alt combinations that xterm sees
ought to be translated to Emacs Meta, which is the more important key
for Emacs.  But then people who have and use both Alt and Meta keys
would probably not like to see them switched around when using xterm.

Is there a way that we could have the best of both worlds?  In other
words, can we send Alt to Emacs as Alt and Meta as Meta, but have it
easy for users who just use the Alt key as a Meta key not to have to
duplicate all of their Meta-Fx bindings as Alt-Fx also, just to work
under xterm?  I suspect that I'm not the only one who would like to
have it so that Emacs just treats my Alt key as Meta both under X and
in xterm.


reply via email to

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