Rename BufNew and BufOpen hooks to BufNewFile and BufOpenFile

Fixes #1225
This commit is contained in:
Maxime Coste 2017-02-19 13:08:06 +00:00
parent b456de78a7
commit edc2a88643
7 changed files with 11 additions and 11 deletions

View File

@ -1411,9 +1411,9 @@ existing hooks are:
is '<option_name>=<new_value>'
* `BufSetOption`: An option was set in a buffer context, the filtering text
is '<option_name>=<new_value>'
* `BufNew`: A buffer for a new file has been created, filename is used for
filtering
* `BufOpen`: A buffer for an existing file has been created, filename is
* `BufNewFile`: A buffer for a new file has been created, filename is used
for filtering
* `BufOpenFile`: A buffer for an existing file has been created, filename is
used for filtering
* `BufCreate`: A buffer has been created, filename is used for filtering
* `BufWritePre`: Executed just before a buffer is written, filename is

View File

@ -92,11 +92,11 @@ Default hooks
an option was set in a buffer context, the filtering text is
*<option_name>=<new_value>*
*BufNew*::
*BufNewFile*::
a buffer for a new file has been created, filename is used for
filtering
*BufOpen*::
*BufOpenFile*::
a buffer for an existing file has been created, filename is used
for filtering

View File

@ -1,4 +1,4 @@
hook global BufOpen .* %{ %sh{
hook global BufOpenFile .* %{ %sh{
if [ -z "${kak_opt_filetype}" ]; then
mime=$(file -b --mime-type "${kak_buffile}")
case "${mime}" in

View File

@ -281,7 +281,7 @@ def -hidden c-family-insert-include-guards %{
}
}
hook global BufNew .*\.(h|hh|hpp|hxx|H) c-family-insert-include-guards
hook global BufNewFile .*\.(h|hh|hpp|hxx|H) c-family-insert-include-guards
decl str-list alt_dirs ".;.."

View File

@ -60,4 +60,4 @@ def autorestore-disable -docstring "Disable automatic backup recovering" %{
remove-hooks global autorestore
}
hook -group autorestore global BufOpen .* %{ autorestore-restore-buffer }
hook -group autorestore global BufOpenFile .* %{ autorestore-restore-buffer }

View File

@ -97,7 +97,7 @@ def -hidden modeline-parse-impl %{
}
}
# Add the following function to a hook on BufOpen to automatically parse modelines
# Add the following function to a hook on BufOpenFile to automatically parse modelines
# Select the first and last `modelines` lines in the buffer, only keep modelines
def modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{
try %{ eval -draft %{

View File

@ -107,11 +107,11 @@ void Buffer::on_registered()
if (m_flags & Flags::File)
{
if (m_flags & Buffer::Flags::New)
run_hook_in_own_context("BufNew", m_name);
run_hook_in_own_context("BufNewFile", m_name);
else
{
kak_assert(m_fs_timestamp != InvalidTime);
run_hook_in_own_context("BufOpen", m_name);
run_hook_in_own_context("BufOpenFile", m_name);
}
}