help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: could there be a bash built-in that allows executing readline functi


From: Christoph Anton Mitterer
Subject: Re: could there be a bash built-in that allows executing readline functions?
Date: Sat, 21 Oct 2023 02:30:30 +0200
User-agent: Evolution 3.50.0-1

Hey.


I hope thinking loudly about such an idea isn't considered heresy and I
get banned or worse. ;-)


>From the main thread:

On Fri, 2023-10-20 at 15:56 +0900, Koichi Murase wrote:
> Even if there was no sequence issue, utilizing the terminal's
> response
> doesn't seem right to me.

It's not that I'd be such a super fan of this. It just doesn't feel
right to me, to statically set some arbitrary keyseqs and hope for the
best that this breaks nothing else and that nothing else breaks my
stuff.
But yes, I can very well see your points, that "my" approach has also
it's drawbacks and is also a hack.


Maybe all this is wrong... both approaches seem fragile in one or
another.



Would it be feasible to get functionality in bash, to call some
readline function via a special built in, as if a bound key would have
been pressed?



I mean that would make things super easy, wouldn't it?

   bind -x '"\ec": dir="$(find) | fzf)"; store_current_readline;
READLINE_LINE="$dir"; magic_built_in accept-line; restore_old_readline'


No more voodoo with terminal sequences, no more juggling with binds, no
risk for collisions, no need to store stuff in global variables.

The worst thing that could happen is that the bash version was too old,
and one would need to abort.
[And perhaps getting unpopular with the friendly bash-maintainers who
one would ask for such feature.]


Cheers,
Chris.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]