aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-12-30 23:12:58 -0500
committerSean Allred <code@seanallred.com>2014-12-30 23:12:58 -0500
commit9650a1541b43da18067466df7671d23d5baffeed (patch)
tree52e043a0b6db21604bd029f064b3d462bcd4bc03
parent1267f300c850173e74dda0b7f704261b4a25b85c (diff)
parentb8eb3d978109c1d5bf18be8cc1e1678afb6c017a (diff)
Merge pull request #169 from vermiculus/issue-151--dot-variables
Fix dot-variable troubles
-rw-r--r--sx-request.el2
-rw-r--r--sx.el5
-rw-r--r--test/tests.el26
3 files changed, 19 insertions, 14 deletions
diff --git a/sx-request.el b/sx-request.el
index 1031ea7..bc34f9c 100644
--- a/sx-request.el
+++ b/sx-request.el
@@ -162,7 +162,7 @@ the main content of the response is returned."
.method .error_id .error_name .error_message))
(when (< (setq sx-request-remaining-api-requests .quota_remaining)
sx-request-remaining-api-requests-message-threshold)
- (sx-message "%d API requests reamining"
+ (sx-message "%d API requests remaining"
sx-request-remaining-api-requests))
(sx-encoding-clean-content-deep .items)))))))
diff --git a/sx.el b/sx.el
index 508de46..8fe31ac 100644
--- a/sx.el
+++ b/sx.el
@@ -136,10 +136,11 @@ with a `link' property)."
If ALIST doesn't have a `site' property, one is created using the
`link' property."
(declare (indent 1) (debug t))
+ (require 'let-alist)
`(progn
- (require 'let-alist)
(sx--ensure-site ,alist)
- (let-alist ,alist ,@body)))
+ ,(macroexpand
+ `(let-alist ,alist ,@body))))
;;; Browsing filter
diff --git a/test/tests.el b/test/tests.el
index 66d8d88..3c275fd 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -120,17 +120,21 @@
(ert-deftest macro-test--sx-assoc-let ()
"Tests macro expansion for `sx-assoc-let'"
- (should
- (equal '(progn (require 'let-alist)
- (sx--ensure-site data)
- (let-alist data .test))
- (macroexpand '(sx-assoc-let data .test))))
- (should
- (equal '(progn (require 'let-alist)
- (sx--ensure-site data)
- (let-alist data (cons .test-one .test-two)))
- (macroexpand
- '(sx-assoc-let data (cons .test-one .test-two))))))
+ (let ((prototype '((test . nil) (test-one . 1) (test-two . 2)
+ (link . "http://meta.emacs.stackexchange.com/"))))
+ (let ((data (copy-tree prototype)))
+ (should
+ (null (let-alist data .site))))
+
+ (let ((data (copy-tree prototype)))
+ (should
+ (equal (sx-assoc-let data .site)
+ "meta.emacs")))
+
+ (let ((data (copy-tree prototype)))
+ (should
+ (equal (sx-assoc-let data (cons .test-one .test-two))
+ '(1 . 2))))))
(ert-deftest sx--user-@name ()
"Tests macro expansion for `sx-assoc-let'"