bug-bash
[Top][All Lists]
Advanced

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

Re: How to call a bash-func from readline? && how to call rl-func from b


From: L A Walsh
Subject: Re: How to call a bash-func from readline? && how to call rl-func from bash?
Date: Sat, 13 May 2017 21:47:30 -0700
User-agent: Thunderbird



Eduardo Bustamante wrote:
For that, you'd use a combination of `bind -x', READLINE_LINE and
READLINE_POINT. For example, if you wanted a key sequence to uppercase
the whole rl_line_buffer (READLINE_LINE), then you'd:
....
You can do a lot of things with these two alone. I guess you can
emulate most of Readline's functions with these three alone.
----
    Looks convenient, but ....
Also, is it possible to define a readline
function, or only use predefined ones?

I have been wondering about that same thing today. i.e. a builtin that
allows you to call readline functions from shell functions, e.g. to
avoid re-implementing things like `tilde-expand'.

Ex:  On a keypress, I would like to be able to
redefine that key in ".bashrc" and have it call a
bash-function that could map the key to itself or
a sequence of keys based on the shell's current state.

I don't understand this part.
---
   So a key is pressed when there is no visible input on the current
display line (which isn't the same as position 0 in the current input line),
now say that key is the complete key.  Say I want to either insert the
the complete key OR call the complete function based on where the
input position is on the physical (screen) line and what came before
it.  (shell-state, current input, and current input column among other
things).

   bash used to not do complete on an empty physical line, but
it was pointed out that one could be on an empty physical line, and
still want complete, so one no longer has the ability to paste into
bash, cleanly.  It eats input chars.

   I prefer to be able to paste than to be able to press complete when
the physical line is in col 0 or only whitespace preceeds the complete
key.

Seemed like it might be a way to get this done if there was sufficient
flexibility between the rl & bash layers.





reply via email to

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