[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to save/restore (all?) bindings
From: |
Christoph Anton Mitterer |
Subject: |
Re: how to save/restore (all?) bindings |
Date: |
Thu, 19 Oct 2023 17:11:21 +0200 |
User-agent: |
Evolution 3.50.0-1 |
On Sat, 2023-10-07 at 12:44 +0900, Koichi Murase wrote:
> 2023年10月2日(月) 9:40 Christoph Anton Mitterer <calestyo@scientia.org>:
> > [...] the question on how one can save&restore the state of
> > (all?) bindings of a bash instance.
>
> Although I doubt these can be used to implement your mycdfunc, I have
> functions to save and restore keybindings in my project:[1]. I
> extracted the functions and modified them to be standalone [2].
>
> - [1]
> https://github.com/akinomyoga/ble.sh/blob/master/src/decode.sh#L2846-L2968
> - [2]
> https://github.com/akinomyoga/bug-report/blob/master/bash/reply20231007.sh
Wow, thanks for the effort you put into this.
It looks... complicated ^^
At first I wondered, what all that level of complexity was needed for,
when my much simpler version (or Grisha's) already seemed to work.
Some things in your code seem to handle issues with older versions of
bash:
Originally this would have indeed been interesting to get worked.
But since your reply fzf's upstream basically said that he doesn't want
any larger feature sets for his integration scripts and keep them
simple (apparently even if that means "broken" in some cases).
I personally don't really feel the need to support ancient versions. So
I wouldn't mind to just drop such workarounds.
But it seems there are things which might not work with Grisha's/my
version:
https://github.com/akinomyoga/bug-report/blob/427595fe0a7f02002d364a8299aadf72b83911ea/bash/reply20231007.sh#L132-L135
made me especially suspicious.
And indeed:
E.g. both:
$ bind -x '"\C-f": echo foo $(date) \$\(date\)'
$ bind -x '"\C-f": "echo foo $(date) \$\(date\)"'
give:
$ bind -X
"\C-f": "echo foo $(date) \\$\\(date\\)"
I already don't understand why both give the same. Shouldn't the "-
quoted one be one simple(!) command of the name `echo foo $(date)
\$\(date\)`?
Anyway, if one re-uses bind -X’s output with bind -x:
$ bind -x '"\C-f": "echo foo $(date) \\$\\(date\\)"'
$ bind -X
"\C-f": "echo foo $(date) \\\\$\\\\(date\\\\)"
one gets something actually different.
But isn't bind -X documented to use a "format that can be reused as
input."?
What is happening there?
Thanks,
Chris.
- how to save/restore (all?) bindings, Christoph Anton Mitterer, 2023/10/01
- Re: how to save/restore (all?) bindings, Chet Ramey, 2023/10/06
- Re: how to save/restore (all?) bindings, Grisha Levit, 2023/10/06
- Re: how to save/restore (all?) bindings, Koichi Murase, 2023/10/06
- Re: how to save/restore (all?) bindings,
Christoph Anton Mitterer <=
- Re: how to save/restore (all?) bindings, Christoph Anton Mitterer, 2023/10/19
- Re: how to save/restore (all?) bindings, Christoph Anton Mitterer, 2023/10/19
- Re: how to save/restore (all?) bindings, Christoph Anton Mitterer, 2023/10/20
- Re: how to save/restore (all?) bindings, Chet Ramey, 2023/10/20
- Re: how to save/restore (all?) bindings, Grisha Levit, 2023/10/20
- Re: how to save/restore (all?) bindings, Chet Ramey, 2023/10/20
- Re: how to save/restore (all?) bindings, Christoph Anton Mitterer, 2023/10/20
- Re: how to save/restore (all?) bindings, Chet Ramey, 2023/10/23