unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: usenet@heslin.eclipse.co.uk (Peter Heslin)
Subject: Re: can't global-set-key in emacs -nw
Date: 2 Feb 2004 13:04:07 -0800	[thread overview]
Message-ID: <f1ff9348.0402021304.7f8696ee@posting.google.com> (raw)
In-Reply-To: jwvwu7648no.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca

Stefan Monnier <monnier@iro.umontreal.ca> wrote in message news:<jwvwu7648no.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca>...
> >> 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  http://dickey.his.com/xterm/xterm.html, and there is a
document with it called ctlseqs.ms, which confirms that the behavior I
am seeing on my system is the documented, correct behavior of current
xterm.  It has the following statement::

<quote>
In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource
is
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.
</quote>

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
behavior.

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.

Peter

      reply	other threads:[~2004-02-02 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-01  0:27 can't global-set-key in emacs -nw Joel Smith
2004-02-01  6:33 ` Eli Zaretskii
2004-02-01 16:56 ` Stefan Monnier
2004-02-01 22:57   ` Peter Heslin
2004-02-02  0:44     ` Stefan Monnier
2004-02-02 21:04       ` Peter Heslin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1ff9348.0402021304.7f8696ee@posting.google.com \
    --to=usenet@heslin.eclipse.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).