[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat eb0c027 26/99: Advise indirect-function to not r
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat eb0c027 26/99: Advise indirect-function to not raise void-function |
Date: |
Sun, 17 Oct 2021 05:57:51 -0400 (EDT) |
branch: externals/compat
commit eb0c027a33d1eaaa1bad112e7840d3f44dfe7f82
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Advise indirect-function to not raise void-function
---
compat-25.1.el | 8 ++++++++
compat-tests.el | 17 +++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/compat-25.1.el b/compat-25.1.el
index 100e578..67534b7 100644
--- a/compat-25.1.el
+++ b/compat-25.1.el
@@ -66,6 +66,14 @@ This implementation is equivalent to `format'."
?\\ ?/))
(aref name (1- (length name)))))
+;;;; Defined in data.c
+
+(compat-advise indirect-function (object)
+ "Prevent `void-function' from being signalled."
+ (condition-case nil
+ (funcall oldfun object)
+ (void-function nil)))
+
;;;; Defined in subr.el
(compat-defun string-greaterp (string1 string2)
diff --git a/compat-tests.el b/compat-tests.el
index b179cfa..ce5fe8b 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1245,5 +1245,22 @@ the compatibility function."
(compat--should t "dir/subdir/")
(compat--should nil "dir/subdir")))
+(ert-deftest compat-indirect-function ()
+ "Check if `indirect-function' was advised properly."
+ (compat-test indirect-function
+ ;; A symbol with a function alias should return the function it is
+ ;; aliasing:
+ (compat--should* (indirect-function #'process-send-string)
+ 'send-string)
+ (compat--should* (indirect-function #'string-equal)
+ 'string=)
+ ;; A function should return it self when not aliased:
+ (compat--should* (indirect-function #'string-equal) 'string-equal)
+ ;; A fresh symbol should return nil when no function is associated
+ ;; with it:
+ (compat--should* nil (make-symbol "foobar"))
+ ;; Anything else is return as is:
+ (compat--should* "foobar" "foobar")))
+
(provide 'compat-tests)
;;; compat-tests.el ends here
- [elpa] externals/compat 79d4778 23/99: Use compat--string-trim-left in file-name-with-extension, (continued)
- [elpa] externals/compat 79d4778 23/99: Use compat--string-trim-left in file-name-with-extension, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 156b5f5 27/99: Ensure substring is passed two arguments in string-width advise, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 14a3bce 39/99: Remove NonGNU ELPA installation code, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 6445814 51/99: Use compatibility functions in file-name-with-extension definition, ELPA Syncer, 2021/10/17
- [elpa] externals/compat fa1d0df 55/99: Use names of compatibility functions in ert docstrings, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 1d0f6db 56/99: Add compat-if-let* tests, ELPA Syncer, 2021/10/17
- [elpa] externals/compat c0c1889 57/99: Add compat-and-let* tests, ELPA Syncer, 2021/10/17
- [elpa] externals/compat a57cfed 66/99: Avoid comparing alist-get with testfn if not available, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 7d90061 21/99: Add made up macro name to macrop test, ELPA Syncer, 2021/10/17
- [elpa] externals/compat f3c5728 22/99: Wrap compat-tests setup in an eval-and-load block, ELPA Syncer, 2021/10/17
- [elpa] externals/compat eb0c027 26/99: Advise indirect-function to not raise void-function,
ELPA Syncer <=
- [elpa] externals/compat 797930f 34/99: Declare temporary-file-directory for make-nearby-temp-file, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 26acf1f 48/99: Use compatibility macros in ...-let definitions, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 8f64282 49/99: Use compatibility functions in string-trim definition, ELPA Syncer, 2021/10/17
- [elpa] externals/compat e6b5f08 53/99: Load all compatibility code unconditionally, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 021ffd1 59/99: Handle legacy bytecode argument lists, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 956db9b 60/99: Improve handling of conditional compatibility definitions, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 9be46b0 16/99: Add check for Emacs 28 to compat-tests.el, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 10ef8f4 36/99: Declare string-trim-left and directory-name-p, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 9df8e0c 38/99: Add GitHub action file for CI, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 4364563 43/99: Use unprefixed symbols where possible, ELPA Syncer, 2021/10/17