diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
commit | 07fcbb558d797272b9f43547da60beda485873a3 (patch) | |
tree | 77d5da14e9f9d9d8b1d877c70c01296fd3893796 /lisp/emacs-lisp/nadvice.el | |
parent | c9bdeff3e45a7ac84a74a81bb048046f82dddc91 (diff) | |
parent | fb81c8c3adf8633f2f617c82f6019aef630860c7 (diff) | |
download | emacs-07fcbb558d797272b9f43547da60beda485873a3.tar.gz |
Merge remote-tracking branch 'origin/master' into athena/unstable
Diffstat (limited to 'lisp/emacs-lisp/nadvice.el')
-rw-r--r-- | lisp/emacs-lisp/nadvice.el | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index afdd372d273..4804e859ebe 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -316,8 +316,26 @@ is also interactive. There are 3 cases: `(advice--add-function ,where (gv-ref ,(advice--normalize-place place)) ,function ,props)) +(declare-function comp-subr-trampoline-install "comp") + ;;;###autoload (defun advice--add-function (where ref function props) + (when (and (featurep 'native-compile) + (subr-primitive-p (gv-deref ref))) + (let ((subr-name (intern (subr-name (gv-deref ref))))) + ;; Requiring the native compiler to advice `macroexpand' cause a + ;; circular dependency in eager macro expansion. uniquify is + ;; advising `rename-buffer' while being loaded in loadup.el. + ;; This would require the whole native compiler machinery but we + ;; don't want to include it in the dump. Because these two + ;; functions are already handled in + ;; `native-comp-never-optimize-functions' we hack the problem + ;; this way for now :/ + (unless (memq subr-name '(macroexpand rename-buffer)) + ;; Must require explicitly as during bootstrap we have no + ;; autoloads. + (require 'comp) + (comp-subr-trampoline-install subr-name)))) (let* ((name (cdr (assq 'name props))) (a (advice--member-p (or name function) (if name t) (gv-deref ref)))) (when a @@ -485,7 +503,7 @@ arguments. Note if NAME is nil the advice is anonymous; otherwise it is named `SYMBOL@NAME'. \(fn SYMBOL (WHERE LAMBDA-LIST &optional NAME DEPTH) &rest BODY)" - (declare (indent 2) (doc-string 3) (debug (sexp sexp body))) + (declare (indent 2) (doc-string 3) (debug (sexp sexp def-body))) (or (listp args) (signal 'wrong-type-argument (list 'listp args))) (or (<= 2 (length args) 4) (signal 'wrong-number-of-arguments (list 2 4 (length args)))) |