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

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

[elpa] master f0bc797 04/12: Use old advice for Emacs 24.3.


From: Jackson Ray Hamilton
Subject: [elpa] master f0bc797 04/12: Use old advice for Emacs 24.3.
Date: Sun, 21 Jun 2015 21:16:13 +0000

branch: master
commit f0bc797b6c5c2b297fc981ab943cfb5696065dc1
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Use old advice for Emacs 24.3.
---
 test/context-coloring-test.el |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 272ee1d..c84ae67 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -198,20 +198,29 @@ signaled."
   (let ((name (intern (format "context-coloring-test-%s-mode" name))))
     `(define-derived-mode ,name fundamental-mode "Testing")))
 
+(defvar context-coloring-test-caused-p nil
+  "Dumb flag tracking for lambdas inside old advice definitions
+which don't seem to have lexical binding.")
+
 (defmacro context-coloring-test-assert-causes-coloring (&rest body)
   "Assert that BODY causes coloring."
-  (let ((colorized-p (make-symbol "colorized-p")))
-    `(let (,colorized-p)
-       (advice-add #'context-coloring-colorize
-                   :after (lambda ()
-                            (setq ,colorized-p t))
-                   '((name . assert-causes-coloring)))
-       ,@body
-       (when (not ,colorized-p)
-         (ert-fail "Expected to have colorized, but it didn't.")))))
+  `(progn
+     ;; Gross, but I want this to pass on 24.3.
+     (ad-add-advice #'context-coloring-colorize
+                    '(assert-causes-coloring
+                      nil t
+                      (advice . (lambda ()
+                                  (setq context-coloring-test-caused-p t))))
+                    'after
+                    0)
+     (ad-activate #'context-coloring-colorize)
+     ,@body
+     (when (not context-coloring-test-caused-p)
+       (ert-fail "Expected to have colorized, but it didn't."))))
 
 (defun context-coloring-test-cleanup-assert-causes-coloring ()
-  (advice-remove #'context-coloring-colorize 'assert-causes-coloring))
+  (ad-unadvise #'context-coloring-colorize)
+  (setq context-coloring-test-caused-p nil))
 
 (context-coloring-test-define-derived-mode mode-startup)
 



reply via email to

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