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: "James K. Lowden" <email@hidden>
- Date: Sun, 9 Jan 2011 14:53:56 -0500
Jeremy Huddleston wrote:
> >>> 1. move-by-word to work by pressing alt-f and alt-b
> >>
> >> That's not really an X11 issue. That's a bash issue. You should
> >> create/edit /etc/inputrc or ~/.inputrc
> >
> > I now know I cannot solve this with .inputrc alone. Why? Because
> > neither command-b nor option-b emit anything! Only command-option-b
> > does.
>
> Weird... I just verified that alt-left and alt-right work in xterm to
> change by-word with the attached /etc/inputrc (note that I can't take
> credit from it. I got it from somewhere, which got it from somewhere,
> ... and made my own changes to it... some of which I understand, some of
> which I don't).
Jeremey,
Thanks again for your answer. I have it working now: option-b moves back
by word in bash. Hurrah!
The question is, Why?
I didn't need .inputrc. I needed to undo something in .Xmodmap. Recall:
$ cat ~/.Xmodmap
keycode 84 = Multi_key
keycode 66 = Meta_L
That second line is a killer. This was the fix:
$ xmodmap -e 'clear Mod2'
That leaves me with no Mod2 defined, which seems to be a good thing:
$ xmodmap -p
xmodmap: up to 2 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x40), Shift_R (0x44)
lock Caps_Lock (0x41)
control Control_L (0x43), Control_R (0x46)
mod1 Meta_L (0x42), Mode_switch (0x45)
mod2
mod3
mod4
mod5
and xev shows a new state for option-b, 0x08 instead of 0x10:
KeyPress event, serial 29, synthetic NO, window 0xe00001,
root 0x67d, subw 0x0, time 1812095816, (136,472), root:(180,534),
state 0x8, keycode 19 (keysym 0x62, b), same_screen YES,
XLookupString gives 1 bytes: (62) "b"
XmbLookupString gives 1 bytes: (62) "b"
XFilterEvent returns: False
and xterm emits 0xe2 for option-b:
$ hexdump
รข
0000000 e2 0a
0000002
What I still don't understand is OT for this list: how does readline(3)
decide that e2 is "M-B" in its lingo?
You also referred to something I don't understand:
> It should work with no ~/.Xmodmap and the checkbox enabled to use Alt
> rather than Mode_switch.
"checkbox"?
For me, the hardest thing to understand in all this is the concept of
modifier keys, and how they influence what xtrerm does. I think I get it,
though: X11 has a notion of a Platonic keyboard with some "modifier keys".
These keys could have various labels on different physical keyboards e.g.
control, option, command, alt. ("fn" is not one; it produces no KeyPress
event.) Each such key produces KeyPress events, a keycode, and a keysym,
and can be mapped to one of X11's modifier keys. The combined state of
the modifier keys -- which ones are pressed -- is conveyed by XEvent
state, which programs such as xterm can interpret.
In setting up X11 on a Mac, the user can (maybe not "should" but can)
alter the keysym mapped to a key's keycode, and/or which keysym is mapped
to which modifier key. In fact, there's nothing restricting the modifier
key to be one of the ones I mentioned. The mechanism allows e.g. the "G"
key to be mapped to Mod1. It just wouldn't make for very intuitive
policy!
Have I got that right, professor?
Other than that, thanks very much for your patience and for the detailed
explanation of the sequence of keypress events. It gives me a clearer
understanding of the relationship of X11 and OS X, about which I was
thoroughly confused at the outset.
Regards,
--jkl
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden