This is documented behavior: https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Named-Functions.html It is possible to advise a primitive (see What Is a Function ), but one should typically *not* do so, for two reasons. Firstly, some primitives are used by the advice mechanism, and advising them could cause an infinite recursion. Secondly, many primitives are called directly from C, and such calls ignore advice; hence, one ends up in a confusing situation where some calls (occurring from Lisp code) obey the advice and other calls (from C code) do not. Vitalie Spinu schrieb am Mi., 14. Okt. 2015 um 03:55 Uhr: > > Hi, > > Put this function into a file, compile the file and then load the file: > > > (defun foobar () > (save-restriction > (widen))) > > > then: > > > (defun restrict-widen (orig-widen) > (message "here") > (apply orig-widen nil)) > > (advice-add 'widen :around #restrict-widen) > > (foobar) > > > > The advice is not triggered. > > > Eval the `foobar` definition interactively and the advice will start > working. The problem occurs only for primitive c functions. Elisp > functions are fine. It doesn't work with 24.4.1 either. > > > Vitalie > > > > > In GNU Emacs 25.0.50.3 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2) > of 2015-09-26 > Repository revision: 139e55a58466058a8c9ae54536cb790ac7b7cc64 > Windowing system distributor 'The X.Org Foundation', version 11.0.11600000 > System Description: Ubuntu 14.10 > > > >