[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bind does not modify key bindings
From: |
Chet Ramey |
Subject: |
Re: bind does not modify key bindings |
Date: |
Mon, 13 Feb 2006 16:28:30 -0500 |
User-agent: |
Thunderbird 1.5 (Macintosh/20051201) |
address@hidden wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: /usr/local/bin/gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr1/local/bash/share/locale'
> -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
> -I/usr/local/include -L/usr/local/lib -g -O2
> uname output: Linux gs3091.sp.cs.cmu.edu 2.4.25-001-P4+4GB+SMP #1 SMP Fri Mar
> 26 22:57:11 EST 2004 i686 i686 i386 GNU/Linux
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 3.1
> Patch Level: 7
> Release Status: release
>
> Description:
> `bind` does not modify key bindings.
>
> Repeat-By:
> $ bind -r '\M-p'
> $ bind '"\M-p":history-search-backward'
It does, actually. Bash-3.1 key bindings interpret the "\M-" prefix the
same way that the dispatch code does: if the convert-meta flag has been
set, the sequence is converted into an escape-prefixed sequence and
bound accordingly. If that variable is off, the eighth bit is turned
on (`metafying' the following character).
What bash-3.1/readline-5.1 did not do (and has been changed since) is
change the code that bind -p calls to list key bindings to not use
the \M- prefix for escape-prefixed key sequences when convert-meta is
off.
The following sequence of commands should illustrate the difference.
The cat -v is in there to make the M-p visible.
caleb.ins.cwru.edu(2)$ echo $BASH_VERSION
3.1.7(3)-release
caleb.ins.cwru.edu(2)$ bind 'set convert-meta off'
caleb.ins.cwru.edu(2)$ bind -p | cat -v | grep 'M-p'
"\M-p": non-incremental-reverse-search-history
"M-p": self-insert
caleb.ins.cwru.edu(2)$ bind -r '\M-p'
caleb.ins.cwru.edu(2)$ bind -p | cat -v | grep 'M-p'
"\M-p": non-incremental-reverse-search-history
caleb.ins.cwru.edu(2)$ bind '"\M-p":history-search-backward'
caleb.ins.cwru.edu(2)$ bind -p | cat -v | grep 'M-p'
"M-p": history-search-backward
"\M-p": non-incremental-reverse-search-history
caleb.ins.cwru.edu(2)$ bind 'set convert-meta on'
caleb.ins.cwru.edu(2)$ bind -p | cat -v | grep 'M-p'
"M-p": history-search-backward
"\M-p": non-incremental-reverse-search-history
caleb.ins.cwru.edu(2)$ bind -r '\M-p'
caleb.ins.cwru.edu(2)$ bind -p | cat -v | grep 'M-p'
"M-p": history-search-backward
caleb.ins.cwru.edu(2)$ bind '"\M-p":history-search-backward'
caleb.ins.cwru.edu(2)$ bind -p | cat -v | grep 'M-p'
"\M-p": history-search-backward
"M-p": history-search-backward
This should be cleaner in the next release.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live Strong. No day but today.
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/