On Tue, Feb 06, 2024 at 02:59:21PM -0500, Chet Ramey wrote:
> On 2/4/24 2:35 AM, Martin D Kealey wrote:
> 
> > PS: Sadly M-C-r seems to be already taken, so I can't just hop one key over.
> 
> You can rebind it, you know. Anyway, let's assume the existence of a new
> bindable command that (shell) quotes the (shell? readline?) words on a
> line. Let's assume that this new command is bound to some sequence like
> \C-xq. Then you can use a macro to create something like what you want:
> 
> "\M-\C-w":"\M-\C-e\C-xq"
> 
> with each command being separately undoable.

Assuming you want M-C-e, C-xq, Return to be a equivalent to a verbose Return.
I don't think it is doable that way, please consider:

$ printf "<%s>\n" x\ y
<x y>

$ printf "<%s>\n" x\ y ## M-C-e

$ printf <%s>\n x y ## C-xq (let's assume it quotes the redirections)

$ printf "<%s>\n" x y
<x>
<y>


The original words before quote removal should be requoted.

Also when expansion introduces quotes:
$ x=\"
$ printf "$x\n" ## M-C-e-new (shell-expand-quoted?)
$ printf "\"\n"

$ printf $x\\n ## M-C-e-new
$ printf \"\\n


Oh well, I am happy with the undo :)

-- 
Regards, Mike Jonkmans

Reply via email to