Re: bind allows "impossible" key bindings without warning

2025-01-03 Thread Hauke Laging

Am 03.01.25 um 17:29 schrieb Koichi Murase:


If Bash starts to output warning messages, it would be annoying for
the users who intentionally set up keybindings with a timeout.


Do you agree that this is not a relevant problem for commands which are
read in an interactive shell?

An additional safe approach would be to add an option (--warnings) to
bind; not to deactivate but to activate such warnings. Would be less
obvious but I guess many people have a look at the documentation when
using bind so that information would at least reach a reasonable share
of the target audience.


Hauke



bind allows "impossible" key bindings without warning

2025-01-03 Thread Hauke Laging

Hello,

I suggest a modification to the bind builtin.

Currently you can bind key sequences which (in that situation) cannot be
activated. This may be useful in very special circumstances so I do not
suggest to make this impossible. Instead I suggest to print a warning
(and maybe change the exit code and an option for configuring this
behaviour).

This happened to me:
I defined a key binding consisting of a control key and a regular key
(C-h IIRC but that does not matter). The problem which took me quite
some time to understand (because I never use C-h) was that a key binding
for the first key already existed. That prevented the longer key
sequence from being recognized.

I suggest that bind detects this kind of problem (which should be very
easy), does configure the new key binding (compatibility) but tells the
user what the problem is (e.g. prints the conflicting binding).

A similar and useful modification to bind would be an option which shows
all control and meta keys which do not have a binding for themselves
alone so that it would be very easy to know the available start keys for
new key sequences.


Hauke