From 2c944f64152c9c1a897d8deb8873ea594b084572 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 24 Jan 2024 23:57:06 +0100 Subject: [PATCH] rc patch.kak: fix quoting I learned that $ foo="'1 2'" $ echo $foo '1 2' Quote some variables to avoid this double unescaping. --- rc/filetype/diff.kak | 2 +- rc/tools/patch.kak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/diff.kak b/rc/filetype/diff.kak index 5be241f2..6d7ba695 100644 --- a/rc/filetype/diff.kak +++ b/rc/filetype/diff.kak @@ -43,7 +43,7 @@ define-command diff-jump -params .. -docstring %{ } set-register a %arg{@} set-register | %{ - [ -n "$kak_reg_a" ] && eval set -- $kak_quoted_reg_a + [ -n "$kak_reg_a" ] && eval set -- "$kak_quoted_reg_a" cmd=$(column=$kak_reg_c perl -we ' sub quote { $SQ = "'\''"; diff --git a/rc/tools/patch.kak b/rc/tools/patch.kak index a6bae1f6..2feb85b3 100644 --- a/rc/tools/patch.kak +++ b/rc/tools/patch.kak @@ -52,7 +52,7 @@ define-command patch -params .. -docstring %{ # Since registers are never empty, we get an empty arg even if # there were no args. This does no harm because we pass it to # a shell where it expands to nothing. - eval set -- $kak_quoted_reg_a + eval set -- "$kak_quoted_reg_a" perl "${kak_reg_f%/*}/patch-range.pl" $min_line $max_line "$@" || echo >$kak_command_fifo "set-register e fail 'patch: failed to apply selections, see *debug* buffer'"