Add BufCloseFifo hook and use that to remove fifo directories
This commit is contained in:
parent
e78fd2d235
commit
3ef5bf53d5
|
@ -677,10 +677,14 @@ existing hooks are:
|
|||
* +BufOpen+: 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+: Executre just before a buffer is written, filename is
|
||||
* +BufWritePre+: Executed just before a buffer is written, filename is
|
||||
used for filtering.
|
||||
* +BufWritePost+: Executre just after a buffer is written, filename is
|
||||
* +BufWritePost+: Executed just after a buffer is written, filename is
|
||||
used for filtering.
|
||||
* +BufClose+: Executed when a buffer is deleted, while it is still valid.
|
||||
* +BufCloseFifo+: Executed when a fifo buffer closes its fifo file descriptor
|
||||
either because the buffer is being deleted, or because the writing
|
||||
end has been closed.
|
||||
* +RuntimeError+: an error was encountered while executing an user command
|
||||
the error message is used for filtering
|
||||
* +KakBegin+: Kakoune started, this is called just after reading the user
|
||||
|
|
|
@ -39,7 +39,7 @@ def -shell-params \
|
|||
echo "eval -try-client '$kak_opt_docsclient' %{
|
||||
edit! -fifo ${output} *git*
|
||||
set buffer filetype '${filetype}'
|
||||
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
|
||||
hook buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
|
||||
}"
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ def -shell-params -file-completion \
|
|||
echo "eval -try-client '$kak_opt_toolsclient' %{
|
||||
edit! -fifo ${output} -scroll *grep*
|
||||
set buffer filetype grep
|
||||
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
|
||||
hook buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
|
||||
}"
|
||||
}}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ def -shell-params make %{ %sh{
|
|||
echo "eval -try-client '$kak_opt_toolsclient' %{
|
||||
edit! -fifo ${output} -scroll *make*
|
||||
set buffer filetype make
|
||||
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
|
||||
hook buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
|
||||
}"
|
||||
}}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ Buffer* create_fifo_buffer(String name, int fd, bool scroll)
|
|||
buffer->flags() &= ~Buffer::Flags::Fifo;
|
||||
buffer->flags() &= ~Buffer::Flags::NoUndo;
|
||||
close(fifo);
|
||||
buffer->run_hook_in_own_context("BufCloseFifo", "");
|
||||
delete &watcher;
|
||||
}
|
||||
});
|
||||
|
@ -74,6 +75,7 @@ Buffer* create_fifo_buffer(String name, int fd, bool scroll)
|
|||
if (buffer->flags() & Buffer::Flags::Fifo)
|
||||
{
|
||||
close(watcher->fd());
|
||||
buffer->run_hook_in_own_context("BufCloseFifo", "");
|
||||
delete watcher;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user