Re: xmodmap, readline, and ye olde meta key
Re: xmodmap, readline, and ye olde meta key
- Subject: Re: xmodmap, readline, and ye olde meta key
- From: Richard Cobbe <email@hidden>
- Date: Fri, 31 Dec 2010 23:07:48 -0500
- Mail-followup-to: email@hidden
On Fri, Dec 31, 2010 at 12:25:14PM -0800, Jeremy Huddleston wrote:
>
> Well that's what you're limited to. All that bash knows about is TERM.
> It doesn't know that it's in Terminal.app or xterm.
Right, and that's why I said that readline isn't the best place to do
this. Depending on whether the OP runs bash outside an xterm, this
readline config could have undesired side effects.
> > For me, command = meta in X clients right out of the box, and I'm pretty
> > sure I'm not playing xmodmap games. However, note that if you run a uxterm
> > (or otherwise enable utf-8), command is no longer meta.
>
> Sure it is. It's sent as meta to the application (xterm), but its up to
> the terminal to determine how to send it to the shell. With urxvt, it
> works for me: meta-forward and meta-back cause the cursor to jump by
> words.
Ah, I see. I was being imprecise. Xterm reacts to meta in two different
ways, depending on whether LC_CTYPE=C or LC_CTYPE=en_US.UTF-8. Bash
doesn't have a thing to do with this, since I'm seeing the behavior in
Apple's emacs (running in an xterm) as well. When LC_CTYPE=en_US.UTF-8,
xterm responds to my hitting command-f as though I'd typed â, command-b as
æ, command-x as ø, and so on.
(As you've pointed out, there's a need to be precise with terminology here.
So, in this email, when I say "command", I'm referring not to an X key
event but rather to the plastic bump on the keyboard labeled "command ⌘".
And by "meta" I mean the X keysym. According to xev, under my current
configuration, left command generates keycode 63 and keysym 0xffe7, Meta_L,
and right command generates 71 and 0xffe8 Meta_R. This is indepenent of
LC_CTYPE, as it should be.)
When run under macports's urxvt, both bash and emacs respond to command in
the expected way -- command-x shows up as meta-x, etc. So it looks to me
as though there's some weirdness in how xterm deals with meta when running
in utf-8 mode (that is, when LC_CTYPE is "en_US.UTF-8"). And this is not
something I experience on Ubuntu.
Another interesting data point: when I ssh from the Mac into the Ubuntu
machine, the fact that the resulting shell comes up in utf-8 mode is
sufficient to screw up xterm running on the Mac, so I get the â/æ behavior
described above, even after I log out of the ssh session. I think
something similar happens when I ssh from the Ubuntu machine into the Mac,
but I don't have physical access to the Ubuntu machine at the moment, so I
can't check.
So serious terminal weirdness going on here, and I don't pretend to
understand the whole process.
> > I don't have time right now to look up the details, but there should
> > be a conversation involving me from a couple of years ago in the list
> > archives. Essentially, Jeremy said that this was the intended design
> > for X.org -- which is odd, because on my Ubuntu desktop at work, xterms
> > are unicode-enabled by default, and alt = meta without further
> > configuration. I haven't had time to explore this in detail, though,
> > so that's all I know on this point.
>
> Alt mapping to meta was justifiable with 101-key keyboards, and if that
> is how ubuntu handles 104/5-key keyboards with windows keys, I'd consider
> that a bug. The "windows key" should be mapped to meta in those cases.
> Command should be Meta just like it is on real UNIX keyboards
> (http://en.wikipedia.org/wiki/Meta_key).
Hm -- I may have gotten the details slightly wrong here, because it's been
so long since I've used a PC keyboard. I've forgotten whether Linux
typically maps Windows or Alt to meta. I actually have an Apple aluminum
keyboard (the big one, with the numeric keypad) plugged into this
particular Ubuntu machine. By default, Ubuntu interprets an Apple keyboard
by treating the plastic bump labeled "command" as, I think, alt and the
bump labeled "alt" and "option" as meta -- I think this is completely
backwards, but there you are. With some xmodmap hackery, I've switched the
two, because my thumb expects to find meta right next to the space bar.
But this is largely besides the point, I think.
Richard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden