[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug: bind -u shell-backward-word does not unbind the binding
From: |
Chet Ramey |
Subject: |
Re: Bug: bind -u shell-backward-word does not unbind the binding |
Date: |
Thu, 27 Feb 2020 14:19:51 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 2/27/20 8:40 AM, lockywolf@gmail.com wrote:
> --text follows this line--
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Description:
> It is possible to bind shell-backward-word, but not possible to unbind.
>
> Bash Version: 5.0
> Patch Level: 16
> Release Status: release
>
> Repeat-By:
> 1) bind '"\e\C-b": shell-backward-word' # make binding
> 2) bind -P # to check that the binding appeared
> 3) bind -u shell-backward-word # to unbind the binding
> 4) bind -P # to check that unbinding didn't work
>
> Fix:
> I don't know how to fix the problem.
Well, it's maybe non-obvious. The binding string begins with ESC, which
is by default the meta-prefix for emacs mode. That means you do the key
binding in the `emacs-meta' keymap.
The `-u' option to bind operates on the default keymap, which in emacs
mode is `emacs'.
If you add the `-m emacs-meta' option to your `bind -u' command, you'll
get the results you want.
It might be better if the underlying readline function descended into
keymaps such as emacs-meta rather than operating on a single keymap, but
it doesn't do that right now.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/