aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--helpful.el2
-rw-r--r--test/helpful-unit-test.el12
3 files changed, 15 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3188861..3d6662d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@ buffer-local values.
Better source detection for functions defined by `defstruct` or other
macros.
+Fixed issues with functions that had more than one advice active.
+
# v0.15
Fixed a crash on formatting values.
diff --git a/helpful.el b/helpful.el
index 4c51689..fe73020 100644
--- a/helpful.el
+++ b/helpful.el
@@ -1518,7 +1518,7 @@ E.g. (x x y z y) -> ((x . 2) (y . 2) (z . 1))"
(defun helpful--without-advice (sym)
"Given advised function SYM, return the function object
without the advice."
- (advice--cdr
+ (advice--cd*r
(advice--symbol-function sym)))
(defun helpful--advised-p (sym)
diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el
index 541639c..008a052 100644
--- a/test/helpful-unit-test.el
+++ b/test/helpful-unit-test.el
@@ -141,6 +141,18 @@ symbol (not a form)."
;; `rename-buffer' is primitive, but it's advised by uniquify.
(should (helpful--primitive-p 'rename-buffer t)))
+(ert-deftest helpful--without-advice ()
+ "Ensure we remove advice to get the underlying function."
+ ;; Removing the advice on an unadvised function should give us the
+ ;; same function.
+ (should
+ (eq (helpful--without-advice #'test-foo)
+ (indirect-function #'test-foo)))
+ ;; Removing the advice should give us an unadvised function.
+ (should
+ (not (helpful--advised-p
+ (helpful--without-advice #'test-foo-advised)))))
+
(ert-deftest helpful-callable ()
;; Functions. Also a regression test for #170.
(helpful-callable 'face-attribute)