Closed vosov closed 9 months ago
After further investigation, I've found that the issue is the scope of the hook. Something like the following does do what I intended.
hook global BufSetOption filetype=(c|cpp) %{
set-option buffer formatcmd "astyle --indent=tab --style=allman --keep-one-line-statements"
hook buffer BufWritePre .* format
}
This ticket can be closed.
Version of Kakoune
v2023.07.29
Reproducer
I produced the issue by running the format command in a BufWritePre hook, so for example
Ditto for the BufWritePost hook.
Outcome
The hook is triggered by
:write<ret>
, but it is not triggered by:write-all<ret>
.Expectations
I would expect the hook to be triggered by the write-all command as well. I took a peek at the code https://github.com/mawww/kakoune/blob/990e92a5f320953bab12ba2c0419d382cd68102e/src/commands.cc#L620 It seems that the write_all_buffers procedure does attempt to run the pre- and post-hooks.
Additional information
No response