On 7/26/23 5:57 PM, Grisha Levit wrote:
It's just not transitive.
Another issue I didn't think of with printing the unquoted translated
command is that it can include newlines, which is a problem since you
have to read the `bind -X' output one line at a time to reuse it with
`bind -x'.
If there isn't a backwards compatible way to produce output that is
reusable given the current input format, I wonder if we can leverage a
format that's not currently valid as input.
Rather than embed more and more shell-specific output formats that readline
doesn't parse into readline itself, I'm more inclined to add a hook to
allow an application to print the value of a key binding itself. I don't
know if it makes sense to let the application display anything but macro
values, but something like
typedef void rl_macro_display_hook (const char *kseq, const char *value,
int ptype);
where kseq is the key sequence, value is the `raw' macro value, and ptype
is a flag saying whether or not to print in a reusable way would be a
start at printing macro values. It's backwards compatible with other
versions of readline, since we're adding to the API and no application will
have this variable set currently.
This would allow us, for instance, to really go wild and make `bind -X'
display a series of `bind -x' commands to recreate the macro bindings.
That would also allow your proposal to have the display hook to use
whitespace separators with only `bind -x' having to understand how to read
them.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/