I have a log library that has a autocmd log User
hook, to show saved log or set it to a dedicated scratch buffer or etc.
It works quite well, but there is slight nuisance. When inspection/debug done, I clear the hook by au! log User
. But then No matching autocommands: log User
will show at cmdline constantly. Since the log#log
function invoke doa log User
.
Problem:
Is there a way to suppress the No matching autocommands: log User
message when doa log User
but no log User
autocmd being set.
Or is there a function to check existence of a specified autocmd, if no one, then do not doa
(to avoid No matching autocommands
noise).
Failed attempts:
- use
sil doa
, then hook that just echoes will never work. Unacceptable.
:h exists()