Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Oct 1996 10:21:46 +0200 (MET DST)
From:      cracauer@cons.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/1820: Enabling Emacs Meta-Key in non-window mode
Message-ID:  <199610160821.KAA17050@knight.cons.org>
Resent-Message-ID: <199610160830.BAA20844@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1820
>Category:       misc
>Synopsis:       Emacs Meta-Key doesn't work in non-x11-mode
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 16 01:30:02 PDT 1996
>Last-Modified:
>Originator:     Martin Cracauer
>Organization:
private
>Release:        FreeBSD 2.2-960801-SNAP i386
>Environment:

The problem is present in every version of FreeBSD, at least since
2.0. 

>Description:

When using emacs in on-window-mode, the Meta-Mey doesn't work when
$TTY is xterm or syscons (I tested these, but the problem is probably
present for other terminal types, too).

The problem with FreeBSD is that the termcap entry for xterm and
syscons doesn't include the "km" flag.

When emacs starts up, it does:

  emacs-19.34/src/term.c:
     meta_key = tgetflag ("km") || tgetflag ("MT");

Therefore, the Meta-Key will not be used when the termcap entry has no
"km". You can activate the meta Key in emacs after startup using
"(set-input-mode t nil t)". xterm generates the Meta key in every
case, so overriding emacs startup value is sufficient to activate the
key.

All version of xterm I am aware of send the Meta-Key. I am sure the
termcap entry should always include this flag for all versions of
xterm. It does for all other Unix-clones I tried (SunOS, Solaris,
NetBSD, Linux).

For syscons, things are more complicated. You first have to make
syscons generate the Meta-Key (which is not the default on FreeBSD)
and then change the termcap entry to include "km".


>How-To-Repeat:

Try to use the Meta key in "emacs -nw"-Mode in xterm and/or
syscons. It will be ignored, "Meta-v" will generate the character
"v".

>Fix:

XTERM:
	
Either:
- add the "km" flag to xterm's termcap entry.
- import NetBSD's version of the termcap entry for xterm.
- import it from Eric Raymond's termcap database, where the NetBSD
  entry is derived from.

I'd say one of the latter options is probably the better way, Eric
Raymond's database looks more polished than FreeBSD's in many ways.

SYSCONS:

You first have to use a keymap that includes support for the Meta
key. Then, change the termcap entry to include the "km" flag.

I'm not a syscons expert, but I assume the problem will be the number
fo different keymap layouts that are based on non-Meta-key-aware
versions. There's no way to make termcap's "km" key enabled based on
the keymap actually loaded into syscons by the user.

What will happen when "km" is set in the termcap database, but the
actual termincal will not generate the key (i.e., when "km" is
enabled, but the user uses a keymap without Meta-Key support)?

Obviously, Meta will not work, but it wouldn't anyway, so nothing is
lost. 

The only theroretical situation where having a "km" entry in termcap
for a terminal without actual Meta capability is worse than not having
"km" is: 

When an application asks for the presense of the Meta key, finds
support for it in termcap and then *disables* some other feature. An
example could be a program that uses Escape sequences as an alternate
way to using Meta-combination key sequences and *disables* these
alternate way when it thinks the Meta key is present.

I don't know of any program that does things this way. Either there is
*always* (no matter whether a Meta key is present or not) an alternate
way to call Meta-combinations (as in emacs) or no alternate support at
all is provided.

I actually tried out setting the Meta-Key anabled for a syscons
without Meta-Key support and nothing unexpencted happend.

So, I vote to include "km" in the termcap entry for syscons even with
the risk that the keymap actually loaded doesn't have support for it
(what we can't tell in advance).

This is a forwarded message including a keymap file with Meta-key
support. I tried it out and it worked.

~Date: Wed, 9 Oct 1996 08:27:47 -0700 (PDT)
~Message-Id: <199610091527.IAA01022@osprey.grizzly.com>
~From: Mark Diekhans <markd@Grizzly.COM>
~To: cracauer@wavehh.hanse.de
~In-Reply-To: <9610091039.AA13572@wavehh.hanse.de> (cracauer@wavehh.hanse.de)
~Subject: Re: Alt/Meta-Key problems/ pty problem?
~Status: RO


Here is the keyboard file.  Use:

kbdcontrol -l emacs.kbd

to enable it...

#                                                         alt
# scan                       cntrl          alt    alt   cntrl lock
# code  base   shift  cntrl  shift  alt    shift  cntrl  shift state
# ------------------------------------------------------------------
  000   nop    nop    nop    nop    nop    nop    nop    nop     O
  001   esc    esc    esc    esc    esc    esc    debug  esc     O
  002   '1'    '!'    nop    nop    0xb1   0xa1   nop    nop     O
  003   '2'    '@'    nul    nul    0xb2   0xc0   nul    nul     O
  004   '3'    '#'    nop    nop    0xb3   0xa3   nop    nop     O
  005   '4'    '$'    nop    nop    0xb4   0xa4   nop    nop     O
  006   '5'    '%'    nop    nop    0xb5   0xa5   nop    nop     O
  007   '6'    '^'    rs     rs     0xb6   0xde   rs     rs      O
  008   '7'    '&'    nop    nop    0xb7   0xa6   nop    nop     O
  009   '8'    '*'    nop    nop    0xb8   0xaa   nop    nop     O
  010   '9'    '('    nop    nop    0xb9   0xa8   nop    nop     O
  011   '0'    ')'    nop    nop    0xb0   0xa9   nop    nop     O
  012   '-'    '_'    ns     ns     0xad   0xdf   ns     ns      O
  013   '='    '+'    nop    nop    0xbd   0xab   nop    nop     O
  014   bs     bs     del    del    bs     bs     del    del     O
  015   ht     btab   nop    nop    ht     btab   nop    nop     O
  016   'q'    'Q'    dc1    dc1    0xf1   0xd1   dc1    dc1     C
  017   'w'    'W'    etb    etb    0xf7   0xd7   etb    etb     C
  018   'e'    'E'    enq    enq    0xe5   0xc5   enq    enq     C
  019   'r'    'R'    dc2    dc2    0xf2   0xd2   dc2    dc2     C
  020   't'    'T'    dc4    dc4    0xf4   0xd4   dc4    dc4     C
  021   'y'    'Y'    em     em     0xf9   0xd9   em     em      C
  022   'u'    'U'    nak    nak    0xf5   0xd5   nak    nak     C
  023   'i'    'I'    ht     ht     0xe9   0xc9   ht     ht      C
  024   'o'    'O'    si     si     0xef   0xcf   si     si      C
  025   'p'    'P'    dle    dle    0xf0   0xd0   dle    dle     C
  026   '['    '{'    esc    esc    0xdb   0xfb   esc    esc     O
  027   ']'    '}'    gs     gs     0xdd   0xfd   gs     gs      O
  028   cr     cr     nl     nl     cr     cr     nl     nl      O
  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
  030   'a'    'A'    soh    soh    0xe1   0xc1   soh    soh     C
  031   's'    'S'    dc3    dc3    0xf3   0xd3   dc3    dc3     C
  032   'd'    'D'    eot    eot    0xe4   0xc4   eot    eot     C
  033   'f'    'F'    ack    ack    0xe6   0xc6   ack    ack     C
  034   'g'    'G'    bel    bel    0xe7   0xc7   bel    bel     C
  035   'h'    'H'    bs     bs     0xe8   0xc8   bs     bs      C
  036   'j'    'J'    nl     nl     0xea   0xca   nl     nl      C
  037   'k'    'K'    vt     vt     0xeb   0xcb   vt     vt      C
  038   'l'    'L'    ff     ff     0xec   0xcc   ff     ff      C
  039   ';'    ':'    nop    nop    0xbb   0xba   nop    nop     O
  040   '''    '"'    nop    nop    0xa7   0xa2   nop    nop     O
  041   '`'    '~'    nop    nop    0xe0   0xfe   nop    nop     O
  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
  043   '\'    '|'    fs     fs     0xdc   0xfc   fs     fs      O
  044   'z'    'Z'    sub    sub    0xfa   0xda   sub    sub     C
  045   'x'    'X'    can    can    0xf8   0xd8   can    can     C
  046   'c'    'C'    etx    etx    0xe3   0xc3   etx    etx     C
  047   'v'    'V'    syn    syn    0xf6   0xd6   syn    syn     C
  048   'b'    'B'    stx    stx    0xe2   0xc2   stx    stx     C
  049   'n'    'N'    so     so     0xee   0xce   so     so      C
  050   'm'    'M'    cr     cr     0xed   0xcd   cr     cr      C
  051   ','    '<'    nop    nop    0xac   0xbc   nop    nop     O
  052   '.'    '>'    nop    nop    0xae   0xbe   nop    nop     O
  053   '/'    '?'    nop    nop    0xaf   0xbf   nop    nop     O
  054   rshift rshift rshift rshift rshift rshift rshift rshift  O
  055   '*'    '*'    nscr   nscr   0xaa   0xaa   nscr   nscr    O
  056   lalt   lalt   lalt   lalt   lalt   lalt   lalt   lalt    O
  057   ' '    ' '    nul    ' '    0xa0   0xa0   130    ' '     O
  058   clock  clock  clock  clock  clock  clock  clock  clock   O
  059   fkey01 fkey13 fkey25 fkey37 scr01  scr11  scr01  scr11   O
  060   fkey02 fkey14 fkey26 fkey38 scr02  scr12  scr02  scr12   O
  061   fkey03 fkey15 fkey27 fkey39 scr03  scr13  scr03  scr13   O
  062   fkey04 fkey16 fkey28 fkey40 scr04  scr14  scr04  scr14   O
  063   fkey05 fkey17 fkey29 fkey41 scr05  scr15  scr05  scr15   O
  064   fkey06 fkey18 fkey30 fkey42 scr06  scr16  scr06  scr16   O
  065   fkey07 fkey19 fkey31 fkey43 scr07  scr07  scr07  scr07   O
  066   fkey08 fkey20 fkey32 fkey44 scr08  scr08  scr08  scr08   O
  067   fkey09 fkey21 fkey33 fkey45 scr09  scr09  scr09  scr09   O
  068   fkey10 fkey22 fkey34 fkey46 scr10  scr10  scr10  scr10   O
  069   nlock  nlock  nlock  nlock  nlock  nlock  nlock  nlock   O
  070   slock  slock  slock  slock  slock  slock  slock  slock   O
  071   fkey49 '7'    '7'    '7'    0xb7   0xb7   '7'    '7'     N
  072   fkey50 '8'    '8'    '8'    0xb8   0xb8   '8'    '8'     N
  073   fkey51 '9'    '9'    '9'    0xb9   0xb9   '9'    '9'     N
  074   fkey52 '-'    '-'    '-'    0xad   0xad   '-'    '-'     N
  075   fkey53 '4'    '4'    '4'    0xb4   0xb4   '4'    '4'     N
  076   nop    '5'    '5'    '5'    0xb5   0xb5   '5'    '5'     N
  077   fkey55 '6'    '6'    '6'    0xb6   0xb6   '6'    '6'     N
  078   fkey56 '+'    '+'    '+'    0xab   0xab   '+'    '+'     N
  079   fkey57 '1'    '1'    '1'    0xb1   0xb1   '1'    '1'     N
  080   fkey58 '2'    '2'    '2'    0xb2   0xb2   '2'    '2'     N
  081   fkey59 '3'    '3'    '3'    0xb3   0xb3   '3'    '3'     N
  082   fkey60 '0'    '0'    '0'    0xb0   0xb0   '0'    '0'     N
  083   del    '.'    del    del    del    del    boot   del     N
  084   nop    nop    nop    nop    nop    nop    nop    nop     O
  085   nop    nop    nop    nop    nop    nop    nop    nop     O
  086   nop    nop    nop    nop    nop    nop    nop    nop     O
  087   fkey11 fkey23 fkey35 fkey47 scr11  scr11  scr11  scr11   O
  088   fkey12 fkey24 fkey36 fkey48 scr12  scr12  scr12  scr12   O
  089   cr     cr     cr     cr     cr     cr     cr     cr      O
  090   rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl   O
  091   '/'    '/'    '/'    '/'    0xaf   0xaf   '/'    '/'     O
  092   nscr   nop    debug  nop    nop    nop    nop    nop     O
  093   ralt   ralt   ralt   ralt   ralt   ralt   ralt   ralt    O
  094   fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49  O
  095   fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50  O
  096   fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51  O
  097   fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53  O
  098   fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55  O
  099   fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57  O
  100   fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58  O
  101   fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59  O
  102   fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60  O
  103   fkey54 fkey54 fkey54 fkey54 fkey54 fkey54 boot   fkey54  O
  104   slock  slock  slock  slock  slock  slock  slock  slock   O
  105   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61  O
  106   fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62  O
  107   fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63  O


>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610160821.KAA17050>