On 7/31/23 9:30 AM, Chet Ramey wrote:
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);

So you end up with

typedef void rl_macro_print_func_t (const char *, const char *, int);

rl_macro_print_func_t *rl_macro_display_hook = (rl_macro_print_func_t *)NULL;

and have rl_macro_dumper call

(*rl_macro_display_hook) (keyname, (const char *)map[key].function, print_readably);

if it's non-NULL, and let the hook function determine how to print the
binding.

--
``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/


Reply via email to