[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat a7d9649 72/99: Manually advise functions when na
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat a7d9649 72/99: Manually advise functions when nadvice is not available |
Date: |
Sun, 17 Oct 2021 05:57:59 -0400 (EDT) |
branch: externals/compat
commit a7d9649d369dc8a14aae2a08b3cd9875f3054a16
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Manually advise functions when nadvice is not available
---
compat-macs.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/compat-macs.el b/compat-macs.el
index 02609bc..6144eff 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -152,15 +152,17 @@ attributes (see `compat-generate-common')."
;; function.
`(defalias ',name #',realname))
((eq type 'advice)
- ;; nadvice.el was introduced in Emacs 24.4, so
- ;; older versions have to use `defadvice'.
+ ;; nadvice.el was introduced in Emacs 24.4, so older versions
+ ;; have to manually advise the old function.
(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))))))
+ ;; FIXME consider using advice.el and `ad-add-advice'.
+ (let ((oldfun (make-symbol (format "oldfun-%S" name))))
+ `(progn
+ (defvar ,oldfun (indirect-function ',name))
+ (defalias ',name
+ (lambda (&rest args)
+ (apply #',realname (cons ,oldfun args))))))))))
(lambda ()
(cond
((memq type '(func macro))
- [elpa] externals/compat 343bcbb 46/99: Fix if-let implementation, (continued)
- [elpa] externals/compat 343bcbb 46/99: Fix if-let implementation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 32031ea 50/99: Remove unnecessary compat-- prefix from gensym-counter, ELPA Syncer, 2021/10/17
- [elpa] externals/compat f8f4a9f 52/99: Use right function in some compat-maxargs-/= invocations, ELPA Syncer, 2021/10/17
- [elpa] externals/compat fa09ea0 54/99: Factor out multibyte regexp tests for string-search and -replace, ELPA Syncer, 2021/10/17
- [elpa] externals/compat aa112d8 63/99: Implement lookup-key handling of keymap lists, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 86fb58f 64/99: Move compat--alist-get-full-elisp to emacs-25.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 954c97b 67/99: Update compat-tests header, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 5cd751b 68/99: Mention GitHub issue tracker in README, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 598a040 69/99: Add :cond check to lookup-key, ELPA Syncer, 2021/10/17
- [elpa] externals/compat b16122b 71/99: Use explicit symbol names instead of alii, ELPA Syncer, 2021/10/17
- [elpa] externals/compat a7d9649 72/99: Manually advise functions when nadvice is not available,
ELPA Syncer <=
- [elpa] externals/compat 904d660 74/99: Add documentation to manual advice wrapper, ELPA Syncer, 2021/10/17
- [elpa] externals/compat e689153 76/99: Merge compile and run into one GitHub Action job, ELPA Syncer, 2021/10/17
- [elpa] externals/compat c37e1d1 80/99: Fix quoting in compat-macs' legacy advice installation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 18c2bf9 83/99: Autoload advised functions is necessary, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 50767a8 90/99: Load deferred code even if file doesn't exist, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2bb6c10 91/99: Check if function is bound before extracting documentation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat f4c0979 92/99: Prevent shadowing declarations in functional compatibility code, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 3257cf6 93/99: Implement TCO for named-let, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 347f5a8 94/99: Change version suffix to -rc, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 25879c7 95/99: Require instead of loading compat-*.el files, ELPA Syncer, 2021/10/17