bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] fix bind -X quoting


From: Chet Ramey
Subject: Re: [PATCH] fix bind -X quoting
Date: Mon, 31 Jul 2023 09:30:30 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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