Re: [PATCH] fix bind -X quoting

2023-07-31 Thread Chet Ramey
On 7/31/23 11:51 AM, G. Branden Robinson wrote: At 2023-07-31T09:30:30-0400, Chet Ramey wrote: 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 bindi

Re: [PATCH] fix bind -X quoting

2023-07-31 Thread G. Branden Robinson
At 2023-07-31T09:30:30-0400, Chet Ramey wrote: > 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. [...] > This would allow us, for

Re: [PATCH] fix bind -X quoting

2023-07-31 Thread Chet Ramey
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

Re: [PATCH] fix bind -X quoting

2023-07-31 Thread Chet Ramey
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 th

Re: [PATCH] fix bind -X quoting

2023-07-26 Thread Grisha Levit
On Wed, Jul 26, 2023, 16:06 Chet Ramey wrote: > > On 7/24/23 1:13 PM, Chet Ramey wrote: > > > You could do it if you allowed, say > > > > bind -x '"\eX": \"command with spaces\" \"x\"' > > > > and then stripped the backslashes before calling rl_generic_bind, but > > that's not exactly backwards co

Re: [PATCH] fix bind -X quoting

2023-07-26 Thread Chet Ramey
On 7/24/23 1:13 PM, Chet Ramey wrote: You could do it if you allowed, say bind -x '"\eX": \"command with spaces\" \"x\"' and then stripped the backslashes before calling rl_generic_bind, but that's not exactly backwards compatible either. Thinking about it some more, you can do it like this:

Re: [PATCH] fix bind -X quoting

2023-07-24 Thread alex xmb ratchev
On Mon, Jul 24, 2023, 7:13 PM Chet Ramey wrote: > On 7/19/23 12:47 PM, Grisha Levit wrote: > > On Wed, Jul 19, 2023 at 10:47 AM Chet Ramey wrote: > >> Thanks for the report. It seems like your patch is incomplete, though. > >> After applying it: > >> > >> $ bind -x '"\eX": echo "x"' > >> $ bind

Re: [PATCH] fix bind -X quoting

2023-07-24 Thread Chet Ramey
On 7/19/23 12:47 PM, Grisha Levit wrote: On Wed, Jul 19, 2023 at 10:47 AM Chet Ramey wrote: Thanks for the report. It seems like your patch is incomplete, though. After applying it: $ bind -x '"\eX": echo "x"' $ bind -X "\eX": "echo "x"" We probably need to suppress printing the double quotes

Re: [PATCH] fix bind -X quoting

2023-07-19 Thread Grisha Levit
On Wed, Jul 19, 2023 at 10:47 AM Chet Ramey wrote: > Thanks for the report. It seems like your patch is incomplete, though. > After applying it: > > $ bind -x '"\eX": echo "x"' > $ bind -X > "\eX": "echo "x"" > > We probably need to suppress printing the double quotes around `out' if > print_reada

Re: [PATCH] fix bind -X quoting

2023-07-19 Thread alex xmb ratchev
On Wed, Jul 19, 2023, 4:48 PM Chet Ramey wrote: > On 7/18/23 2:22 AM, Grisha Levit wrote: > > > This patch changes rl_macro_dumper to not untranslate the macro body > > when passed a negative print_readably argument. This is technically an > > API change, so maybe not the best fix, though I doub

Re: [PATCH] fix bind -X quoting

2023-07-19 Thread Chet Ramey
On 7/18/23 2:22 AM, Grisha Levit wrote: This patch changes rl_macro_dumper to not untranslate the macro body when passed a negative print_readably argument. This is technically an API change, so maybe not the best fix, though I doubt it will impact any real usage. Thanks for the report. It se

[PATCH] fix bind -X quoting

2023-07-17 Thread Grisha Levit
The output of `bind -X' is not reusable if the bound command has quotes, backslashes, etc. $ bind -x '"\eX": echo "x"' $ bind -X "\eX": "echo \"x\"" $ bind -x "$(bind -X)" $ bind -X "\eX": "echo \\\"x\\\"" This patch changes rl_macro_dumper to not untranslate the macro body when passed a negative