rc lint: More code-review comments.

Don't ask Kakoune to quote values we know can never contain shell-sensitive
characters, and flatten the kakquote() function to a single line for ease
of copy/pasting.
This commit is contained in:
Tim Allen 2020-02-09 14:01:35 +11:00
parent 673d081823
commit 09f067d585

View File

@ -37,11 +37,7 @@ define-command \
# Create a temporary directory to keep all our state. # Create a temporary directory to keep all our state.
evaluate-commands %sh{ evaluate-commands %sh{
# This is going to come in handy later. # This is going to come in handy later.
kakquote() { kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
printf "'"
printf "%s" "$*" | sed "s/'/''/g"
printf "'"
}
# Before we clobber our arguments, # Before we clobber our arguments,
# let's record the lintcmd we were given. # let's record the lintcmd we were given.
@ -65,7 +61,7 @@ define-command \
}" }"
# Write all the selection descriptions to files. # Write all the selection descriptions to files.
eval set -- "$kak_quoted_selections_desc" eval set -- "$kak_selections_desc"
i=0 i=0
for desc; do for desc; do
mkdir -p "$dir"/sel-"$i" mkdir -p "$dir"/sel-"$i"
@ -260,11 +256,7 @@ define-command \
evaluate-commands %sh{ evaluate-commands %sh{
# This is going to come in handy later. # This is going to come in handy later.
kakquote() { kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
printf "'"
printf "%s" "$*" | sed "s/'/''/g"
printf "'"
}
if [ "$1" = "-command" ]; then if [ "$1" = "-command" ]; then
if [ -z "$2" ]; then if [ -z "$2" ]; then
@ -307,11 +299,7 @@ define-command -hidden lint-show %{
update-option buffer lint_messages update-option buffer lint_messages
evaluate-commands %sh{ evaluate-commands %sh{
# This is going to come in handy later. # This is going to come in handy later.
kakquote() { kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
printf "'"
printf "%s" "$*" | sed "s/'/''/g"
printf "'"
}
eval set -- "${kak_quoted_opt_lint_messages}" eval set -- "${kak_quoted_opt_lint_messages}"
shift # skip the timestamp shift # skip the timestamp