summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2020-08-23 18:55:50 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2020-08-24 19:01:05 +0200
commit9a7d8df44732b684255acd151c4104bf95aeebd5 (patch)
tree19c3ff9ed6bc0e88c285cc39da0b8e2f5f268d93 /rc
parent4b7fd68d48061cc9c1cbf4a89ae5b2d60937f7e3 (diff)
Avoid accidentally using environment variables in sh scopes
On the instances with altfile this was already the case, but this makes it more obvious. Closes #3673
Diffstat (limited to 'rc')
-rw-r--r--rc/detection/modeline.kak4
-rw-r--r--rc/filetype/lua.kak4
-rw-r--r--rc/filetype/ruby.kak4
-rw-r--r--rc/tools/autorestore.kak2
-rw-r--r--rc/tools/clang.kak2
-rw-r--r--rc/tools/doc.kak2
-rw-r--r--rc/tools/git.kak1
-rw-r--r--rc/tools/go/go-tools.kak1
-rw-r--r--rc/tools/man.kak3
-rw-r--r--rc/tools/spell.kak2
10 files changed, 20 insertions, 5 deletions
diff --git a/rc/detection/modeline.kak b/rc/detection/modeline.kak
index 3784a081..1a343448 100644
--- a/rc/detection/modeline.kak
+++ b/rc/detection/modeline.kak
@@ -58,9 +58,8 @@ define-command -hidden modeline-parse-impl %{
case "${kak_selection}" in
*vi:*|*vim:*) type_selection="vim";;
*kak:*|*kakoune:*) type_selection="kakoune";;
- *) echo "echo -debug Unsupported modeline format";;
+ *) echo "echo -debug Unsupported modeline format"; exit 1 ;;
esac
- [ -n "${type_selection}" ] || exit 1
# The following subshell will keep the actual options of the modeline, and strip:
# - the text that leads the first option, according to the official vim modeline format
@@ -82,6 +81,7 @@ define-command -hidden modeline-parse-impl %{
case "${type_selection}" in
vim) tr=$(translate_opt_vim "${name_option}" "${value_option}");;
kakoune) tr=$(translate_opt_kakoune "${name_option}" "${value_option}");;
+ *) tr="";;
esac
[ -n "${tr}" ] && printf %s\\n "${tr}"
diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak
index 995bd7b4..9328bc02 100644
--- a/rc/filetype/lua.kak
+++ b/rc/filetype/lua.kak
@@ -65,6 +65,8 @@ define-command lua-alternative-file -docstring 'Jump to the alternate file (impl
[ ! -f $altfile ] && echo "fail 'implementation file not found'" && exit
;;
*.lua)
+ altfile=""
+ altdir=""
path=$kak_buffile
dirs=$(while [ $path ]; do printf %s\\n $path; path=${path%/*}; done | tail -n +2)
for dir in $dirs; do
@@ -74,7 +76,7 @@ define-command lua-alternative-file -docstring 'Jump to the alternate file (impl
break
fi
done
- [ ! -d $altdir ] && echo "fail 'spec/ not found'" && exit
+ [ ! -d "$altdir" ] && echo "fail 'spec/ not found'" && exit
;;
*)
echo "fail 'alternative file not found'" && exit
diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak
index ea4b2279..06b0f781 100644
--- a/rc/filetype/ruby.kak
+++ b/rc/filetype/ruby.kak
@@ -120,6 +120,8 @@ define-command ruby-alternative-file -docstring 'Jump to the alternate file (imp
[ ! -f $altfile ] && echo "fail 'implementation file not found'" && exit
;;
*.rb)
+ altfile=""
+ altdir=""
path=$kak_buffile
dirs=$(while [ $path ]; do echo $path; path=${path%/*}; done | tail -n +2)
for dir in $dirs; do
@@ -130,7 +132,7 @@ define-command ruby-alternative-file -docstring 'Jump to the alternate file (imp
break
fi
done
- [ ! -d $altdir ] && echo "fail 'spec/ and test/ not found'" && exit
+ [ ! -d "$altdir" ] && echo "fail 'spec/ and test/ not found'" && exit
;;
*)
echo "fail 'alternative file not found'" && exit
diff --git a/rc/tools/autorestore.kak b/rc/tools/autorestore.kak
index 329a45b0..a59ce850 100644
--- a/rc/tools/autorestore.kak
+++ b/rc/tools/autorestore.kak
@@ -9,11 +9,11 @@ define-command autorestore-restore-buffer -docstring "Restore the backup for the
if [ -f "${kak_buffile}" ]; then
newer=$(find "${buffer_dirname}"/".${buffer_basename}.kak."* -newer "${kak_buffile}" -exec ls -1t {} + 2>/dev/null | head -n 1)
-
older=$(find "${buffer_dirname}"/".${buffer_basename}.kak."* \! -newer "${kak_buffile}" -exec ls -1t {} + 2>/dev/null | head -n 1)
else
# New buffers that were never written to disk.
newer=$(ls -1t "${buffer_dirname}"/".${buffer_basename}.kak."* 2>/dev/null | head -n 1)
+ older=""
fi
if [ -z "${newer}" ]; then
diff --git a/rc/tools/clang.kak b/rc/tools/clang.kak
index 56a32f2c..586a97f5 100644
--- a/rc/tools/clang.kak
+++ b/rc/tools/clang.kak
@@ -173,6 +173,8 @@ define-command clang-diagnostics-next -docstring "Jump to the next line that con
evaluate-commands %sh{
eval "set -- ${kak_quoted_opt_clang_errors}"
shift # skip timestamp
+ unset line
+ unset first_line
for error in "$@"; do
candidate=${error%%|*}
first_line=${first_line-$candidate}
diff --git a/rc/tools/doc.kak b/rc/tools/doc.kak
index 0fa7ad32..6e0cf74e 100644
--- a/rc/tools/doc.kak
+++ b/rc/tools/doc.kak
@@ -14,6 +14,7 @@ define-command -hidden -params 4 doc-render-regex %{
evaluate-commands %sh{
face="$4"
eval "set -- $kak_quoted_selections_desc"
+ ranges=""
for desc in "$@"; do ranges="$ranges '$desc|$face'"; done
echo "update-option buffer doc_render_ranges"
echo "set-option -add buffer doc_render_ranges $ranges"
@@ -154,6 +155,7 @@ define-command -params 1..2 \
evaluate-commands %sh{
readonly page="${kak_runtime}/doc/${1}.asciidoc"
if [ -f "${page}" ]; then
+ jump_cmd=""
if [ $# -eq 2 ]; then
jump_cmd="doc-jump-to-anchor '$2'"
fi
diff --git a/rc/tools/git.kak b/rc/tools/git.kak
index e355370d..fa705215 100644
--- a/rc/tools/git.kak
+++ b/rc/tools/git.kak
@@ -229,6 +229,7 @@ define-command -params 1.. \
fi
done
+ wrapped=false
if [ "$direction" = "next" ]; then
if [ -z "$next_hunk" ]; then
next_hunk=${hunks%% *}
diff --git a/rc/tools/go/go-tools.kak b/rc/tools/go/go-tools.kak
index 7e1241b9..af1cacbb 100644
--- a/rc/tools/go/go-tools.kak
+++ b/rc/tools/go/go-tools.kak
@@ -116,6 +116,7 @@ define-command -hidden -params 1..2 gogetdoc-cmd %{
cat ${dir}/buf | wc -c >> ${dir}/modified
cat ${dir}/buf >> ${dir}/modified
+ args=""
if [ "$2" = "1" ]; then
args="-json"
fi
diff --git a/rc/tools/man.kak b/rc/tools/man.kak
index 54960a23..730bc29d 100644
--- a/rc/tools/man.kak
+++ b/rc/tools/man.kak
@@ -74,6 +74,9 @@ define-command -params ..1 \
pagenum="${pagenum%\)}"
subject="${subject%%\(*}"
;;
+ *)
+ pagenum=""
+ ;;
esac
printf %s\\n "evaluate-commands -try-client %opt{docsclient} man-impl man $pagenum $subject"
diff --git a/rc/tools/spell.kak b/rc/tools/spell.kak
index ca231ee5..135b53df 100644
--- a/rc/tools/spell.kak
+++ b/rc/tools/spell.kak
@@ -143,6 +143,7 @@ define-command spell-next %{ evaluate-commands %sh{
define-command \
-docstring "Suggest replacement words for the current selection, against the last language used by the spell-check command" \
spell-replace %{ evaluate-commands %sh{
+ options=""
if [ -n "$kak_opt_spell_last_lang" ]; then
options="-l '$kak_opt_spell_last_lang'"
fi
@@ -159,6 +160,7 @@ define-command \
define-command -params 0.. \
-docstring "Add the current selection to the dictionary" \
spell-add %{ evaluate-commands %sh{
+ options=""
if [ -n "$kak_opt_spell_last_lang" ]; then
options="-l '$kak_opt_spell_last_lang'"
fi