On 7/29/22 6:44 PM, Robert E. Griffith wrote:
Thanks Koichi Murase, This opens up a whole new set of possibilities
for me. For some reason I thought -x only executed external commands
and I would not be able to change the environment.
Is there a way to get readline to return from inside the
rl_print_line_and_clear function? Like simulating a \n? I tried
appending a \n to READLINE_LINE but that did not cause it to return
That has the same effect as if you had entered ^V^M. Adding a
character to
the line buffer does not make it appear in readline's input.
If not, I think I can use a macro that invokes a shell function and
then has a \C-m to tell readline to return.
That is the most common idiom. You use a macro that contains the key
sequences you want to appear on readline's input, exactly as if they had
been read from the keyboard. If you bind a key sequence to a shell
command using `bind -x', you need to put that key sequence in the macro.
I can only invoke a readline function from within a macro string if
that function has a keyseq bound to it?
Yes, there is no other way to invoke a bindable readline command.
$ bind -x '"<someObscureKey>": fooFn'
$ bind '"\eOP": "<someObscureKey>\C-m"'
Exactly.