Use stderr/fail to return errors in modeline.kak

This commit is contained in:
Maxime Coste 2020-12-20 11:28:41 +11:00
parent ce96c3f262
commit c99731ebf1

View File

@ -36,8 +36,7 @@ define-command -hidden modeline-parse-impl %{
unix) value="lf";; unix) value="lf";;
dos) value="crlf";; dos) value="crlf";;
*) *)
printf 'echo -debug %s' "$(kakquote "Unsupported file format: ${value}")" \ printf '%s\n' "Unsupported file format: ${value}" >&2
| kak -p "${kak_session}";
return;; return;;
esac esac
;; ;;
@ -52,8 +51,7 @@ define-command -hidden modeline-parse-impl %{
key="spell_lang"; key="spell_lang";
value="${value%%,*}";; value="${value%%,*}";;
*) *)
printf 'echo -debug %s' "$(kakquote "Unsupported vim variable: ${key}")" \ printf '%s\n' "Unsupported vim variable: ${key}" >&2
| kak -p "${kak_session}";
return;; return;;
esac esac
@ -78,8 +76,9 @@ define-command -hidden modeline-parse-impl %{
case "${kak_selection}" in case "${kak_selection}" in
*vi:*|*vim:*) type_selection="vim";; *vi:*|*vim:*) type_selection="vim";;
*kak:*|*kakoune:*) type_selection="kakoune";; *kak:*|*kakoune:*) type_selection="kakoune";;
*) printf 'echo -debug %s' "$(kakquote "Unsupported modeline format: ${kak_selection}")" \ *)
| kak -p "${kak_session}"; exit 1 ;; printf 'fail %s\n' "$(kakquote "Unsupported modeline format: ${kak_selection}")"
exit 1 ;;
esac esac
# The following subshell will keep the actual options of the modeline, and strip: # The following subshell will keep the actual options of the modeline, and strip: