branch: externals/compat commit ee068f000d7fac853a48784240931f9d8dd96e29 Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Revert back to manual advising --- compat-macs.el | 10 ++++------ compat.el | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/compat-macs.el b/compat-macs.el index e019090..da5d91c 100644 --- a/compat-macs.el +++ b/compat-macs.el @@ -156,18 +156,16 @@ attributes (see `compat-generate-common')." `(defalias ',name #',realname)) ((eq type 'advice) ;; nadvice.el was introduced in Emacs 24.4, so older versions - ;; have to manually advise the old function. + ;; have to advise the function using advice.el's `defadvice'. (if (version<= "24.4" emacs-version) `(advice-add ',name :around #',realname) - ;; FIXME consider using advice.el and `ad-add-advice'. (let ((oldfun (make-symbol (format "compat--oldfun-%S" realname)))) `(progn (defvar ,oldfun (indirect-function ',name)) (put ',name 'compat-advice-fn #',realname) - (defadvice ,name (around - ,(intern (format "ad--%S" realname)) - (&rest args) activate) - (apply #',realname (cons ,oldfun args))))))))) + (defalias ',name + (lambda (&rest args) + (apply #',realname (cons ,oldfun args)))))))))) (lambda () (cond ((memq type '(func macro)) diff --git a/compat.el b/compat.el index d150b86..2ec5aaa 100644 --- a/compat.el +++ b/compat.el @@ -43,9 +43,7 @@ ;;;; Core functionality -(declare-function ad-is-advised "advice" (function)) (declare-function ad-is-active "advice" (function)) -(declare-function ad-get-advice-info-field "advice" (function field)) (declare-function advice--p "nadvice" (func)) (declare-function advice--car "nadvice" (func)) @@ -67,10 +65,8 @@ advice." (if (numberp (cdr arity)) (1- (cdr arity)) (cdr arity))))) - ((and handle-advice - (featurep 'advice) - ;; See `ad-advice-p' - (ad-is-active func)) + ((and handle-advice (get func 'compat-advice-fn)) + ;; Handle manual advising: (let* ((adv (get func 'compat-advice-fn)) (arity (compat-func-arity adv))) (cons (1- (car arity))