Remove echo -color
support, superseeded by echo -markup
`echo -color Error "blah"` is the same as `echo -markup '{Error}blah'` Fixes #1512
This commit is contained in:
parent
15a3d39b79
commit
9c4448ac41
|
@ -697,7 +697,6 @@ command `q!` has to be used).
|
|||
* `rename-buffer <name>`: set current buffer name
|
||||
* `rename-session <name>`: set current session name
|
||||
* `echo [options] <text>`: show <text> in status line, with the following options:
|
||||
** `-color` <face>: print the given text with <face>, most commonly `Error` or `Information`
|
||||
** `-markup`: expand the markup strings in <text>
|
||||
** `-debug`: print the given text to the `\*debug*` buffer
|
||||
* `nop`: does nothing, but as with every other commands, arguments may be
|
||||
|
|
|
@ -73,9 +73,6 @@ command *q!* has to be used).
|
|||
*echo* [options] <text>::
|
||||
show *text* in status line, with the following *options*:
|
||||
|
||||
*-color* <face>:::
|
||||
print the given text with *face*, most commonly *Error* or *Information*
|
||||
|
||||
*-markup*:::
|
||||
expand the markup strings in *text* (c.f. the 'expansions' documentation page)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ If no symbol is passed then the current selection is used as symbol name} \
|
|||
out = out " %{" $2 " {MenuInfo}" re "} %{eval -collapse-jumps %{ try %{ edit %{" tagroot $2 "}; exec %{/\\Q" keys "<ret>vc} } catch %{ echo %{unable to find tag} } } }"
|
||||
}
|
||||
/[^\t]+\t[^\t]+\t[0-9]+/ { out = out " %{" $2 ":" $3 "} %{eval -collapse-jumps %{ edit %{" tagroot $2 "} %{" $3 "}}}" }
|
||||
END { print ( length(out) == 0 ? "echo -color Error no such tag " ENVIRON["tagname"] : "menu -markup -auto-single " out ) }'
|
||||
END { print ( length(out) == 0 ? "echo -markup %{{Error}no such tag " ENVIRON["tagname"] "}" : "menu -markup -auto-single " out ) }'
|
||||
}}
|
||||
|
||||
def ctags-complete -docstring "Insert completion candidates for the current selection into the buffer's local variables" %{ eval -draft %{
|
||||
|
@ -78,7 +78,7 @@ decl -docstring "options to pass to the `ctags` shell command" \
|
|||
decl -docstring "path to the directory in which the tags file will be generated" str ctagspaths "."
|
||||
|
||||
def ctags-generate -docstring 'Generate tag file asynchronously' %{
|
||||
echo -color Information "launching tag generation in the background"
|
||||
echo -markup "{Information}launching tag generation in the background"
|
||||
%sh{ {
|
||||
while ! mkdir .tags.kaklock 2>/dev/null; do sleep 1; done
|
||||
trap 'rmdir .tags.kaklock' EXIT
|
||||
|
@ -90,7 +90,7 @@ def ctags-generate -docstring 'Generate tag file asynchronously' %{
|
|||
msg="tags generation failed"
|
||||
fi
|
||||
|
||||
printf %s\\n "eval -client $kak_client echo -color Information '${msg}'" | kak -p ${kak_session}
|
||||
printf %s\\n "eval -client $kak_client echo -markup '{Information}${msg}'" | kak -p ${kak_session}
|
||||
} > /dev/null 2>&1 < /dev/null & }
|
||||
}
|
||||
|
||||
|
@ -110,6 +110,6 @@ def ctags-update-tags -docstring 'Update tags for the given file' %{
|
|||
msg="tags update failed for $kak_bufname"
|
||||
fi
|
||||
|
||||
printf %s\\n "eval -client $kak_client echo -color Information '${msg}'" | kak -p ${kak_session}
|
||||
printf %s\\n "eval -client $kak_client echo -markup '{Information}${msg}'" | kak -p ${kak_session}
|
||||
} > /dev/null 2>&1 < /dev/null & }
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ def lint-next-error -docstring "Jump to the next line that contains an error" %{
|
|||
if [ -n "$range" ]; then
|
||||
printf '%s\n' "select $range"
|
||||
else
|
||||
printf 'echo -color Error no lint diagnostics\n'
|
||||
printf 'echo -markup "{Error}no lint diagnostics"\n'
|
||||
fi
|
||||
}
|
||||
}}
|
||||
|
@ -118,7 +118,7 @@ def lint-previous-error -docstring "Jump to the previous line that contains an e
|
|||
if [ -n "$range" ]; then
|
||||
printf '%s\n' "select $range"
|
||||
else
|
||||
printf 'echo -color Error no lint diagnostics\n'
|
||||
printf 'echo -markup "{Error}no lint diagnostics"\n'
|
||||
fi
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -30,7 +30,7 @@ def lua-alternative-file -docstring 'Jump to the alternate file (implementation
|
|||
case $kak_buffile in
|
||||
*spec/*_spec.lua)
|
||||
altfile=$(eval printf %s\\n $(printf %s\\n $kak_buffile | sed s+spec/+'*'/+';'s/_spec//))
|
||||
[ ! -f $altfile ] && echo "echo -color Error 'implementation file not found'" && exit
|
||||
[ ! -f $altfile ] && echo "echo -markup '{Error}implementation file not found'" && exit
|
||||
;;
|
||||
*.lua)
|
||||
path=$kak_buffile
|
||||
|
@ -42,10 +42,10 @@ def lua-alternative-file -docstring 'Jump to the alternate file (implementation
|
|||
break
|
||||
fi
|
||||
done
|
||||
[ ! -d $altdir ] && echo "echo -color Error 'spec/ not found'" && exit
|
||||
[ ! -d $altdir ] && echo "echo -markup '{Error}spec/ not found'" && exit
|
||||
;;
|
||||
*)
|
||||
echo "echo -color Error 'alternative file not found'" && exit
|
||||
echo "echo -markup '{Error}alternative file not found'" && exit
|
||||
;;
|
||||
esac
|
||||
printf %s\\n "edit $altfile"
|
||||
|
|
|
@ -79,7 +79,7 @@ def ruby-alternative-file -docstring 'Jump to the alternate file (implementation
|
|||
case $kak_buffile in
|
||||
*spec/*_spec.rb)
|
||||
altfile=$(eval echo $(echo $kak_buffile | sed s+spec/+'*'/+';'s/_spec//))
|
||||
[ ! -f $altfile ] && echo "echo -color Error 'implementation file not found'" && exit
|
||||
[ ! -f $altfile ] && echo "echo -markup '{Error}implementation file not found'" && exit
|
||||
;;
|
||||
*.rb)
|
||||
path=$kak_buffile
|
||||
|
@ -91,10 +91,10 @@ def ruby-alternative-file -docstring 'Jump to the alternate file (implementation
|
|||
break
|
||||
fi
|
||||
done
|
||||
[ ! -d $altdir ] && echo "echo -color Error 'spec/ not found'" && exit
|
||||
[ ! -d $altdir ] && echo "echo -markup '{Error}spec/ not found'" && exit
|
||||
;;
|
||||
*)
|
||||
echo "echo -color Error 'alternative file not found'" && exit
|
||||
echo "echo -markup '{Error}alternative file not found'" && exit
|
||||
;;
|
||||
esac
|
||||
echo "edit $altfile"
|
||||
|
|
|
@ -18,7 +18,7 @@ Formats of language supported:
|
|||
%sh{
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ ${#1} -ne 2 ] && [ ${#1} -ne 5 ]; then
|
||||
echo 'echo -color Error Invalid language code (examples of expected format: en, en_US, en-US)'
|
||||
echo "echo -markup '{Error}Invalid language code (examples of expected format: en, en_US, en-US)'"
|
||||
rm -rf "$(dirname "$kak_opt_spell_tmp_file")"
|
||||
exit 1
|
||||
else
|
||||
|
@ -46,7 +46,7 @@ Formats of language supported:
|
|||
;;
|
||||
'') line_num=$((line_num + 1));;
|
||||
\*) ;;
|
||||
*) printf 'echo -color Error %%{%s}\n' "${line}" | kak -p "${kak_session}";;
|
||||
*) printf 'echo -markup %%{{Error}%s}\n' "${line}" | kak -p "${kak_session}";;
|
||||
esac
|
||||
done
|
||||
printf 'set "buffer=%s" spell_regions %%{%s}' "${kak_bufname}" "${regions}" \
|
||||
|
|
|
@ -18,7 +18,7 @@ def -hidden -params 1.. tmux-new-impl %{
|
|||
%sh{
|
||||
tmux=${kak_client_env_TMUX:-$TMUX}
|
||||
if [ -z "$tmux" ]; then
|
||||
echo "echo -color Error 'This command is only available in a tmux session'"
|
||||
echo "echo -markup '{Error}This command is only available in a tmux session'"
|
||||
exit
|
||||
fi
|
||||
tmux_args="$1"
|
||||
|
|
|
@ -27,7 +27,7 @@ The optional arguments will be passed as arguments to the new client} \
|
|||
-command-completion \
|
||||
x11-new %{ %sh{
|
||||
if [ -z "${kak_opt_termcmd}" ]; then
|
||||
echo "echo -color Error 'termcmd option is not set'"
|
||||
echo "echo -markup '{Error}termcmd option is not set'"
|
||||
exit
|
||||
fi
|
||||
if [ $# -ne 0 ]; then kakoune_params="-e '$@'"; fi
|
||||
|
|
|
@ -333,9 +333,9 @@ def c-family-alternative-file -docstring "Jump to the alternate file (header/imp
|
|||
done
|
||||
;;
|
||||
*)
|
||||
echo "echo -color Error 'extension not recognized'"
|
||||
echo "echo -markup '{Error}extension not recognized'"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
echo "echo -color Error 'alternative file not found'"
|
||||
echo "echo -markup '{Error}alternative file not found'"
|
||||
}}
|
||||
|
|
|
@ -23,7 +23,7 @@ def -hidden -params 1..2 doc-open %{
|
|||
printf %s\\n "try %{ exec '%<a-s><a-k>(?i)^\h+[^\n]*?\Q${needle}\E<ret>\'' } catch %{ exec <space>gg }"
|
||||
fi
|
||||
else
|
||||
printf %s\\n "echo -color Error %{doc '$@' failed: see *debug* buffer for details}"
|
||||
printf %s\\n "echo -markup %{{Error}doc '$@' failed: see *debug* buffer for details}"
|
||||
rm ${manout}
|
||||
fi
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ An optional keyword argument can be passed to the function, which will be automa
|
|||
if [ -f "${PATH_DOC}" ]; then
|
||||
printf %s\\n "eval -try-client %opt{docsclient} doc-open ${PATH_DOC} $@"
|
||||
else
|
||||
printf %s\\n "echo -color Error No such doc file: ${PATH_DOC}"
|
||||
printf %s\\n "echo -markup '{Error}No such doc file: ${PATH_DOC}'"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ def format -docstring "Format the contents of the current buffer" %{ eval -draft
|
|||
printf '%s\\n' \"%sh{ rm -f '\${path_file_out}' }\"
|
||||
else
|
||||
printf '%s\\n' \"
|
||||
eval -client '${kak_client}' echo -color Error formatter returned an error (\$?)
|
||||
eval -client '${kak_client}' echo -markup '{Error}formatter returned an error (\$?)'
|
||||
\"
|
||||
rm -f \"\${path_file_out}\"
|
||||
fi
|
||||
|
@ -25,7 +25,7 @@ def format -docstring "Format the contents of the current buffer" %{ eval -draft
|
|||
}
|
||||
"
|
||||
else
|
||||
printf '%s\n' "eval -client '${kak_client}' echo -color Error formatcmd option not specified"
|
||||
printf '%s\n' "eval -client '${kak_client}' echo -markup '{Error}formatcmd option not specified'"
|
||||
fi
|
||||
}
|
||||
} }
|
||||
|
|
|
@ -53,11 +53,11 @@ def -hidden make-jump %{
|
|||
# Try to parse the error into capture groups, failing on absolute paths
|
||||
exec s "Entering directory '([^']+)'.*\n([^:/][^:]*):(\d+):(?:(\d+):)?([^\n]+)\'" <ret>l
|
||||
set buffer make_current_error_line %val{cursor_line}
|
||||
eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -color Information %{%reg{5}}; try %{ focus }"
|
||||
eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -markup %{{Information}%reg{5}}; try %{ focus }"
|
||||
} catch %{
|
||||
exec <a-h><a-l> s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" <ret>l
|
||||
set buffer make_current_error_line %val{cursor_line}
|
||||
eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -color Information %{%reg{4}}; try %{ focus }"
|
||||
eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -markup %{{Information}%reg{4}}; try %{ focus }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ def -hidden -params 1..2 man-impl %{ %sh{
|
|||
set window manpage '$@'
|
||||
"
|
||||
else
|
||||
printf %s\\n "echo -color Error %{man '$@' failed: see *debug* buffer for details }"
|
||||
printf %s\\n "echo -markup %{{Error}man '$@' failed: see *debug* buffer for details}"
|
||||
rm ${colout}
|
||||
fi
|
||||
} }
|
||||
|
|
|
@ -49,7 +49,7 @@ def autorestore-purge-backups -docstring "Remove all the backups of the current
|
|||
rm -f "${f}"
|
||||
done
|
||||
}
|
||||
echo -color Information 'Backup files removed'
|
||||
echo -markup '{Information}Backup files removed'
|
||||
}
|
||||
|
||||
## If for some reason, backup files need to be ignored
|
||||
|
|
|
@ -172,7 +172,7 @@ def clang-diagnostics-next -docstring "Jump to the next line that contains an er
|
|||
if [ -n "$line" ]; then
|
||||
printf %s\\n "exec ${line} g"
|
||||
else
|
||||
echo 'echo -color Error no next clang diagnostic'
|
||||
echo "echo -markup '{Error}no next clang diagnostic'"
|
||||
fi
|
||||
)
|
||||
} }
|
||||
|
|
|
@ -6,7 +6,7 @@ decl -hidden bool editorconfig_trim_trailing_whitespace false
|
|||
def editorconfig-load -params ..1 -docstring "editorconfig-load [file]: set formatting behavior according to editorconfig" %{
|
||||
remove-hooks buffer editorconfig-hooks
|
||||
%sh{
|
||||
command -v editorconfig >/dev/null 2>&1 || { echo 'echo -color Error editorconfig could not be found'; exit 1; }
|
||||
command -v editorconfig >/dev/null 2>&1 || { echo 'echo -markup "{Error}editorconfig could not be found"'; exit 1; }
|
||||
editorconfig "${1:-$kak_buffile}" | awk -F= -- '
|
||||
/indent_style=/ { indent_style = $2 }
|
||||
/indent_size=/ { indent_size = $2 == "tab" ? 4 : $2 }
|
||||
|
|
|
@ -115,9 +115,9 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
|
|||
# Handle case where message needs not to be edited
|
||||
if grep -E -q -e "-m|-F|-C|--message=.*|--file=.*|--reuse-message=.*|--no-edit"; then
|
||||
if git commit "$@" > /dev/null 2>&1; then
|
||||
echo 'echo -color Information Commit succeeded'
|
||||
echo 'echo -markup "{Information}Commit succeeded"'
|
||||
else
|
||||
echo 'echo -color Error Commit failed'
|
||||
echo 'echo -markup "{Error}Commit failed"'
|
||||
fi
|
||||
exit
|
||||
fi <<-EOF
|
||||
|
@ -130,9 +130,9 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
|
|||
printf %s "edit '$msgfile'
|
||||
hook buffer BufWritePost '.*\Q$msgfile\E' %{ %sh{
|
||||
if git commit -F '$msgfile' --cleanup=strip $@ > /dev/null; then
|
||||
printf %s 'eval -client $kak_client echo -color Information Commit succeeded; delete-buffer'
|
||||
printf %s 'eval -client $kak_client echo -markup %{{Information}Commit succeeded}; delete-buffer'
|
||||
else
|
||||
printf %s 'eval -client $kak_client echo -color Error Commit failed'
|
||||
printf %s 'eval -client $kak_client echo -markup %{{Error}Commit failed}'
|
||||
fi
|
||||
} }"
|
||||
}
|
||||
|
@ -159,19 +159,19 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
|
|||
add)
|
||||
name="${2:-${kak_buffile}}"
|
||||
if git add -- "${name}" > /dev/null 2>&1; then
|
||||
printf %s "echo -color Information 'git: added ${name}'"
|
||||
printf %s "echo -markup '{Information}git: added ${name}'"
|
||||
else
|
||||
printf %s "echo -color Error 'git: unable to add ${name}'"
|
||||
printf %s "echo -markup '{Error}git: unable to add ${name}'"
|
||||
fi
|
||||
;;
|
||||
rm)
|
||||
name="${2:-${kak_buffile}}"
|
||||
if git rm -- "${name}" > /dev/null 2>&1; then
|
||||
printf %s "echo -color Information 'git: removed ${name}'"
|
||||
printf %s "echo -markup '{Information}git: removed ${name}'"
|
||||
else
|
||||
printf %s "echo -color Error 'git: unable to remove ${name}'"
|
||||
printf %s "echo -markup '{Error}git: unable to remove ${name}'"
|
||||
fi
|
||||
;;
|
||||
*) printf %s "echo -color Error %{unknown git command '$1'}"; exit ;;
|
||||
*) printf %s "echo -markup %{{Error}unknown git command '$1'}"; exit ;;
|
||||
esac
|
||||
}}
|
||||
|
|
|
@ -80,5 +80,5 @@ def -params ..1 -client-completion \
|
|||
If no client is passed then the current one is used} \
|
||||
iterm-focus %{
|
||||
# Should be possible using ${kak_client_env_ITERM_SESSION_ID}.
|
||||
%sh{echo "echo -color Error 'Not implemented yet for iTerm'"}
|
||||
%sh{echo "echo -markup '{Error}Not implemented yet for iTerm'"}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ def moon-alternative-file -docstring 'Jump to the alternate file (implementation
|
|||
case $kak_buffile in
|
||||
*spec/*_spec.moon)
|
||||
altfile=$(eval printf %s\\n $(printf %s\\n $kak_buffile | sed s+spec/+'*'/+';'s/_spec//))
|
||||
[ ! -f $altfile ] && echo "echo -color Error 'implementation file not found'" && exit
|
||||
[ ! -f $altfile ] && echo "echo -markup '{Error}implementation file not found'" && exit
|
||||
;;
|
||||
*.moon)
|
||||
path=$kak_buffile
|
||||
|
@ -46,10 +46,10 @@ def moon-alternative-file -docstring 'Jump to the alternate file (implementation
|
|||
break
|
||||
fi
|
||||
done
|
||||
[ ! -d $altdir ] && echo "echo -color Error 'spec/ not found'" && exit
|
||||
[ ! -d $altdir ] && echo "echo -markup '{Error}spec/ not found'" && exit
|
||||
;;
|
||||
*)
|
||||
echo "echo -color Error 'alternative file not found'" && exit
|
||||
echo "echo -markup '{Error}alternative file not found'" && exit
|
||||
;;
|
||||
esac
|
||||
printf %s\\n "edit $altfile"
|
||||
|
|
|
@ -25,7 +25,7 @@ hook global KakBegin .* %{
|
|||
def -hidden -params 1..2 tmux-repl-impl %{
|
||||
%sh{
|
||||
if [ -z "$TMUX" ]; then
|
||||
echo "echo -color Error This command is only available in a tmux session"
|
||||
echo "echo -markup '{Error}This command is only available in a tmux session'"
|
||||
exit
|
||||
fi
|
||||
tmux_args="$1"
|
||||
|
@ -64,5 +64,5 @@ def -hidden tmux-send-text -docstring "Send the selected text to the repl pane"
|
|||
|
||||
def -hidden tmux-repl-disabled %{ %sh{
|
||||
VERSION_TMUX=$(tmux -V)
|
||||
printf %s "echo -color Error %{The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}"
|
||||
printf %s "echo -markup %{{Error}The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}"
|
||||
} }
|
||||
|
|
|
@ -5,7 +5,7 @@ All optional parameters are forwarded to the new window} \
|
|||
-command-completion \
|
||||
x11-repl %{ %sh{
|
||||
if [ -z "${kak_opt_termcmd}" ]; then
|
||||
echo "echo -color Error 'termcmd option is not set'"
|
||||
echo "echo -markup '{Error}termcmd option is not set'"
|
||||
exit
|
||||
fi
|
||||
if [ $# -eq 0 ]; then cmd="${SHELL:-sh}"; else cmd="$@"; fi
|
||||
|
|
|
@ -1087,8 +1087,7 @@ const CommandDesc echo_cmd = {
|
|||
nullptr,
|
||||
"echo <params>...: display given parameters in the status line",
|
||||
ParameterDesc{
|
||||
{ { "color", { true, "set message color" } },
|
||||
{ "markup", { false, "parse markup" } },
|
||||
{ { "markup", { false, "parse markup" } },
|
||||
{ "debug", { false, "write to debug buffer instead of status line" } } },
|
||||
ParameterDesc::Flags::SwitchesOnlyAtStart
|
||||
},
|
||||
|
@ -1103,10 +1102,7 @@ const CommandDesc echo_cmd = {
|
|||
else if (parser.get_switch("markup"))
|
||||
context.print_status(parse_display_line(message));
|
||||
else
|
||||
{
|
||||
auto face = get_face(parser.get_switch("color").value_or("StatusLine").str());
|
||||
context.print_status({ std::move(message), face } );
|
||||
}
|
||||
context.print_status({ std::move(message), get_face("StatusLine") });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user