emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat a983e8c 30/99: Install advice using advice inste


From: ELPA Syncer
Subject: [elpa] externals/compat a983e8c 30/99: Install advice using advice instead of nadvice for Emacs 24.3
Date: Sun, 17 Oct 2021 05:57:52 -0400 (EDT)

branch: externals/compat
commit a983e8c1129d21f1da35cc6d69244e22a4b3a66f
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Install advice using advice instead of nadvice for Emacs 24.3
---
 compat-macs.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/compat-macs.el b/compat-macs.el
index 31bb7b1..2c00f68 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -148,8 +148,15 @@ attributes (see `compat-generate-common')."
          ;; function.
          `(defalias ',name #',realname))
         ((eq type 'advice)
-         ;; Advice is installed the usual way.
-         `(advice-add ',name :around #',realname))))
+         ;; nadvice.el was introduced in Emacs 24.4, so
+         ;; older versions have to use `defadvice'.
+         (if (version<= "24.4" emacs-version)
+             `(advice-add ',name :around #',realname)
+           `(ad-add-advice
+             ',name
+             (list ,(format "setup:%S" name)
+                   nil t (cons 'advice ,(lambda ()))
+                   'around 'first))))))
      (lambda ()
        (cond
         ((memq type '(func macro))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]