diff options
| author | Tim Allen <screwtape@froup.com> | 2018-06-01 20:22:08 +1000 |
|---|---|---|
| committer | Tim Allen <screwtape@froup.com> | 2018-06-20 21:11:58 +1000 |
| commit | 3d0c19f8fb6ed8ef62edf4ef9b83d8d2c15455b2 (patch) | |
| tree | 60fb80e43bbdfbfc2eab8659b7dbaf24482584d8 | |
| parent | 7591924f853eb0a7bd6a6466a2127a2676fe9b87 (diff) | |
Prevent the :format command from triggering hooks.
The :format command is often called from a BufWritePre hook to format the
current buffer, however the :format command itself calls `:write` to store the
buffer in a temporary location, potentially causing an infinite recursion.
If we disable hooks while running :format, there's no danger of that occurring.
| -rw-r--r-- | rc/core/formatter.kak | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rc/core/formatter.kak b/rc/core/formatter.kak index 2439bd4a..d84318dd 100644 --- a/rc/core/formatter.kak +++ b/rc/core/formatter.kak @@ -1,7 +1,7 @@ declare-option -docstring "shell command to which the contents of the current buffer is piped" \ str formatcmd -define-command format -docstring "Format the contents of the current buffer" %{ evaluate-commands -draft %{ +define-command format -docstring "Format the contents of the current buffer" %{ evaluate-commands -draft -no-hooks %{ %sh{ if [ -n "${kak_opt_formatcmd}" ]; then path_file_tmp=$(mktemp "${TMPDIR:-/tmp}"/kak-formatter-XXXXXX) |
