branch: master
commit 1760860f168fea3d17731394ce02a893cbdf8caf
Author: Ryan C. Thompson <[email protected]>
Commit: Ryan C. Thompson <[email protected]>
Fix a test failure under Emacs 24.3
In Emacs 24.4, "symbol-function" was changed to return nil when called
on a symbol with no function. Previously, it threw a void-function
error. This commit backports that fix so that cl-letf can work
properly in ivy-test.el. The fix is only installed when running the
tests.
---
ivy-test.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ivy-test.el b/ivy-test.el
index 136a4b7..1035003 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -59,6 +59,18 @@
(setq this-command cmd)
(apply #'command-execute cmd args))
+(defadvice symbol-function (around no-void-function activate)
+ "Suppress void-function errors.
+
+This advice makes `symbol-function' return nil when called on a
+symbol with no function rather than throwing a void-fucntion
+error. On Emacs 24.4 and above, this has no effect, because
+`symbol-function' already does this, but on 24.3 and earlier, it
+will bring the behavior in line with the newer Emacsen."
+ (condition-case nil
+ ad-do-it
+ (void-function nil)))
+
(ert-deftest ivy-partial ()
(should (equal
(ivy-with '(ivy-read "test: " '("case" "Case"))