summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-12-20 11:28:41 +1100
committerMaxime Coste <mawww@kakoune.org>2020-12-20 11:30:32 +1100
commitc99731ebf134e9c526f205b79ca061dc82cdb3df (patch)
tree02124210a4c66defb619642cabb57ef8aa1196fa
parentce96c3f26246ca1d1ae380e5a14e2880256ded25 (diff)
Use stderr/fail to return errors in modeline.kak
-rw-r--r--rc/detection/modeline.kak11
1 files changed, 5 insertions, 6 deletions
diff --git a/rc/detection/modeline.kak b/rc/detection/modeline.kak
index 7bfd7852..55cba460 100644
--- a/rc/detection/modeline.kak
+++ b/rc/detection/modeline.kak
@@ -36,8 +36,7 @@ define-command -hidden modeline-parse-impl %{
unix) value="lf";;
dos) value="crlf";;
*)
- printf 'echo -debug %s' "$(kakquote "Unsupported file format: ${value}")" \
- | kak -p "${kak_session}";
+ printf '%s\n' "Unsupported file format: ${value}" >&2
return;;
esac
;;
@@ -52,8 +51,7 @@ define-command -hidden modeline-parse-impl %{
key="spell_lang";
value="${value%%,*}";;
*)
- printf 'echo -debug %s' "$(kakquote "Unsupported vim variable: ${key}")" \
- | kak -p "${kak_session}";
+ printf '%s\n' "Unsupported vim variable: ${key}" >&2
return;;
esac
@@ -78,8 +76,9 @@ define-command -hidden modeline-parse-impl %{
case "${kak_selection}" in
*vi:*|*vim:*) type_selection="vim";;
*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
# The following subshell will keep the actual options of the modeline, and strip: