Not all functions can be reliably advised. The byte compiler may choose to replace a call to a function with a sequence of instructions that doesn’t call the function you were interested in altering.
This usually happens due to one of the three following mechanisms:
byte-compile
propertiesIf a function’s symbol has a byte-compile
property, that
property will be used instead of the symbol’s function definition.
See Byte-Compilation Functions.
byte-optimize
propertiesIf a function’s symbol has a byte-optimize
property, the byte
compiler may rewrite the function arguments, or decide to use a
different function altogether.
compiler-macro
declare formsA function can have a special compiler-macro
declare
form in its definition (see The declare
Form) that defines an
expander to call when compiling the function. The expander
could then cause the produced byte-code not to call the original
function.