zsh-users
 help / color / mirror / code / Atom feed
* xterm meta and bindkey
@ 2008-11-10  8:06 lord_fleg
  2008-11-10 13:46 ` Stephane Chazelas
  0 siblings, 1 reply; 3+ messages in thread
From: lord_fleg @ 2008-11-10  8:06 UTC (permalink / raw)
  To: zsh-users




hi all,

zsh 4.2.6 (i686-redhat-linux-gnu)

i want to be able to do...

bindkey -s '\M-d' 'dirs -v'

but i cant get my meta key to work.

i've setup xmodmap so it redfines the alt key as the meta-key and checked
using xev that i get what i expect.  i've also set bindkey -me and stty pass8.

when i do...

bindkey '\C-g' describe-key-briefly

then hit CTRL-g and then when it prompts me hit META-d
the response is "\M-C" is capitalize-word.

if i hit CTRL-g and META-<any key at all> i get the same (\M-C) response.

if i type 'read' and META-d i get the 8 bit character i expect echo'd.

if i type 'bash' and hit META-d i get the 8 bit character i expect echo'd.

i'm confused.  anyone got any ideas?

thanks,
fleg


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: xterm meta and bindkey
  2008-11-10  8:06 xterm meta and bindkey lord_fleg
@ 2008-11-10 13:46 ` Stephane Chazelas
  0 siblings, 0 replies; 3+ messages in thread
From: Stephane Chazelas @ 2008-11-10 13:46 UTC (permalink / raw)
  To: lord_fleg; +Cc: zsh-users

On Mon, Nov 10, 2008 at 05:06:58PM +0900, lord_fleg@iinet.net.au wrote:
[...]
> bindkey '\C-g' describe-key-briefly
> 
> then hit CTRL-g and then when it prompts me hit META-d
> the response is "\M-C" is capitalize-word.
> 
> if i hit CTRL-g and META-<any key at all> i get the same (\M-C) response.
> 
> if i type 'read' and META-d i get the 8 bit character i expect echo'd.
> 
> if i type 'bash' and hit META-d i get the 8 bit character i expect echo'd.
> 
> i'm confused.  anyone got any ideas?
[...]

What do you get if you run

od -tx1

then type <Meta-d> and then <Ctrl-D><Ctrl-D>

What do the "locale" and "locale charmap" commands output for
you?

What do you get if you type: <Meta-d> after having run
strace -p $$ &

My suspicion is that upon <Meta-d>, your terminal doesn't send
the <Meta-d> byte (d | 0x80 == 0xc4) but the utf8 sequence that
corresponds to the unicode character <Meta-d>.

~$ echo -n '\xc4' | recode ..u8 | od -tx1
0000000 c3 84
0000002

And c3 being the <Meta-c> byte.

I wouldn't use Meta this way. I would tell xterm to send <Esc>x
upon <Meta-x> instead of sending the character <meta-x> (or its
utf8 representation). <Meta-i> is the é character in the
iso8859-1 charset but in utf8 does not correspond to any valid
character by itself which is probably why xterm chose to send
the utf8 sequence.

I suspect newer versions of zsh with multibyte charset support
would decode that c3 84 correctly into the <Meta-i> character as
long as you tell it that your terminal talks utf8 (by making
sure locale charmap returns utf8). So it may work as you expect
in newer zsh versions.

-- 
Stéphane


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: xterm meta and bindkey
@ 2008-11-11  2:13 lord_fleg
  0 siblings, 0 replies; 3+ messages in thread
From: lord_fleg @ 2008-11-11  2:13 UTC (permalink / raw)
  To: Stephane Chazelas; +Cc: zsh-users

hi Stephane,
thanks for the reply.
short answer...downloading the latest zsh made it work :)  d'oh! what a newbie
mistake!

longer answer...

1/ yes you where correct, my setup was using LANG=en_US.UTF-8
   however when i set it to just en_US it still didnt work.

2/ when i upgraded to the latest version i had to change my bindkey to...
   bindkey -s 'ä' 'dirs -v'
   to get it to work, ie bindkey -s '\M-d' 'dirs -v' does not work, but that may 
   just be my lack of understanding of what multibyte support means, and anyway i
dont
   really care because i now have the functionality i want.

thanks again,
fleg.

On Mon Nov 10 21:46 , Stephane Chazelas  sent:

>On Mon, Nov 10, 2008 at 05:06:58PM +0900, lord_fleg@iinet.net.au wrote:
>[...]
>> bindkey '\C-g' describe-key-briefly
>> 
>> then hit CTRL-g and then when it prompts me hit META-d
>> the response is "\M-C" is capitalize-word.
>> 
>> if i hit CTRL-g and META- i get the same (\M-C) response.
>> 
>> if i type 'read' and META-d i get the 8 bit character i expect echo'd.
>> 
>> if i type 'bash' and hit META-d i get the 8 bit character i expect echo'd.
>> 
>> i'm confused.  anyone got any ideas?
>[...]
>
>What do you get if you run
>
>od -tx1
>
>then type  and then 
>
>What do the "locale" and "locale charmap" commands output for
>you?
>
>What do you get if you type:  after having run
>strace -p $$ &
>
>My suspicion is that upon , your terminal doesn't send
>the  byte (d | 0x80 == 0xc4) but the utf8 sequence that
>corresponds to the unicode character .
>
>~$ echo -n '\xc4' | recode ..u8 | od -tx1
>0000000 c3 84
>0000002
>
>And c3 being the  byte.
>
>I wouldn't use Meta this way. I would tell xterm to send x
>upon  instead of sending the character  (or its
>utf8 representation).  is the é character in the
>iso8859-1 charset but in utf8 does not correspond to any valid
>character by itself which is probably why xterm chose to send
>the utf8 sequence.
>
>I suspect newer versions of zsh with multibyte charset support
>would decode that c3 84 correctly into the  character as
>long as you tell it that your terminal talks utf8 (by making
>sure locale charmap returns utf8). So it may work as you expect
>in newer zsh versions.
>
>-- 
>Stéphane
>)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-11  2:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-10  8:06 xterm meta and bindkey lord_fleg
2008-11-10 13:46 ` Stephane Chazelas
2008-11-11  2:13 lord_fleg

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).