From bc483a2a41c69214a26c4d6d3eb073d9870168c5 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 30 Oct 2014 21:50:59 -0400 Subject: Fix circular initialization dependency stack-filter needs stack-core to compile the filter, but stack-core uses the default filter to make a request. Note that setting `stack-core-filter' to `nil' still gives proper behaviour; no `filter' argument is passed through the method call. --- stack-core.el | 6 ++++-- tests.el | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/stack-core.el b/stack-core.el index 2cdf63c..8badc3a 100644 --- a/stack-core.el +++ b/stack-core.el @@ -151,9 +151,11 @@ entire response as a complex alist." (json-read-from-string (let ((call (stack-core-build-request method - (cons `(filter . ,stack-core-filter) + (cons `(filter . ,(if (boundp 'stack-core-filter) + stack-core-filter)) (if keyword-arguments keyword-arguments - (stack-core-get-default-keyword-arguments method))))) + (stack-core-get-default-keyword-arguments + method))))) (url-automatic-caching stack-core-cache-requests)) ;; TODO: url-retrieve-synchronously can return nil if the call is ;; unsuccessful should handle this case diff --git a/tests.el b/tests.el index 57cd42b..b1aa3c2 100644 --- a/tests.el +++ b/tests.el @@ -1,6 +1,16 @@ ;;; Tests +(add-to-list 'load-path ".") +(require 'stack-core) + (setq *t (stack-core-make-request "questions")) (prog1 t (prin1 (elt (stack-core-parse-questions *t) 0) #'insert)) + +(defun -stack--nuke () + (interactive) + (mapatoms + (lambda (symbol) + (if (string-prefix-p "stack-" (symbol-name symbol)) + (unintern symbol))))) -- cgit v1.2.3