diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2018-07-30 13:06:39 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2018-07-30 15:12:41 +0300 |
| commit | eee0035a0fb8b98105d89c1ccbcbda897ce53def (patch) | |
| tree | d8d0359d182a9f10e2054668b07ebdf1805f8643 | |
| parent | 075d1048ab8807ce5bd40fb3448e0ff0c8788b7d (diff) | |
rc lint: Create temporary file with the same buffer extension
Fixes #2189
| -rw-r--r-- | rc/base/lint.kak | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/rc/base/lint.kak b/rc/base/lint.kak index dfa35037..d0a8b78c 100644 --- a/rc/base/lint.kak +++ b/rc/base/lint.kak @@ -15,9 +15,14 @@ define-command lint -docstring 'Parse the current buffer with a linter' %{ exit 1 fi + extension="" + if printf %s "${kak_buffile}" | grep -qE '[^/.]\.[[:alnum:]]+$'; then + extension=".${kak_buffile##*.}" + fi + dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-lint.XXXXXXXX) mkfifo "$dir"/fifo - printf '%s\n' "evaluate-commands -no-hooks write -sync $dir/buf" + printf '%s\n' "evaluate-commands -no-hooks write -sync $dir/buf${extension}" printf '%s\n' "evaluate-commands -draft %{ edit! -fifo $dir/fifo -debug *lint-output* @@ -31,7 +36,7 @@ define-command lint -docstring 'Parse the current buffer with a linter' %{ { # do the parsing in the background and when ready send to the session - eval "$kak_opt_lintcmd '$dir'/buf" | sort -t: -k2,2 -n > "$dir"/stderr + eval "$kak_opt_lintcmd '$dir'/buf${extension}" | sort -t: -k2,2 -n > "$dir"/stderr # Flags for the gutter: # stamp l3|{red}█ l11|{yellow}█ |
