Subject: Re: bug#21683: 25.0.50; `advice-add` doesn't work for compiled primitive functions

From: Vitalie Spinu <[email-masked]>
Date: Mon, 19 Oct 2015 17:51:46 +0200

>> On Sun, Oct 18 2015 14:25, Daniel Colascione wrote:

> On 10/18/2015 02:16 PM, Philipp Stephani wrote:

>> This is documented behavior:

Well, conceptually the call is from elisp, even if it's a compiled code. What is
technically happening in the compiled code shouldn't be the user's concern.

I think that piece of documentation should be nuanced that advice doesn't work
in compiled elisp calls. I took me 4 hours to figure out why my font-lock code
was chaotically working here and not there.

> I just haven't had a good reason to want to advise a primitive, but if someone
> wants to do this work, I wouldn't object to it.

I am trying hard to make polymode [1] functional for complex sub-modes like
c-lang. For that I need to restrict `widen` and `parse-partial-sexp` in order
for the sub-mode to have an illusion that a region of a buffer is a whole
buffer.

> If we wanted to allow advising of primitives such that we also redirect direct
> calls from C, it wouldn't be that hard:

That would be so great!

 Vitalie

[1] https://github.com/vspinu/polymode/