aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-16 00:57:01 -0500
committerSean Allred <code@seanallred.com>2015-01-16 00:57:01 -0500
commita1fc7125f9260411af04c21137ef1e53a5b1b634 (patch)
treee6e2ae4ea094c4418a71bb403303afa918b0d3f3
parentfe140f7891257890687ec6e3243d66f1aa95fc65 (diff)
parentef5b4639cb8e70f2d4ddd26a7621f1361ccb1af7 (diff)
Merge pull request #223 from vermiculus/build-filter-from-default
Build filter from default
-rw-r--r--sx-filter.el16
-rw-r--r--test/test-macros.el5
2 files changed, 9 insertions, 12 deletions
diff --git a/sx-filter.el b/sx-filter.el
index af3717f..1ccf611 100644
--- a/sx-filter.el
+++ b/sx-filter.el
@@ -47,7 +47,7 @@ Structure:
;;; Creation
(defmacro sx-filter-from-nil (included)
- "Creates a filter data structure with INCLUDED fields.
+ "Create a filter data structure with INCLUDED fields.
All wrapper fields are included by default."
`(quote
((,@(sx--tree-expand
@@ -64,23 +64,21 @@ All wrapper fields are included by default."
.page_size
.quota_max
.quota_remaining
- .total)
- nil none)))
+ )
+ nil nil)))
;;; @TODO allow BASE to be a precompiled filter name
(defun sx-filter-compile (&optional include exclude base)
"Compile INCLUDE and EXCLUDE into a filter derived from BASE.
-INCLUDE and EXCLUDE must both be lists; BASE should be a string.
+INCLUDE and EXCLUDE must both be lists; BASE should be a symbol.
Returns the compiled filter as a string."
(let ((keyword-arguments
`((include . ,(if include (sx--thing-as-string include)))
(exclude . ,(if exclude (sx--thing-as-string exclude)))
(base . ,(if base base)))))
- (let ((response (elt (sx-request-make
- "filter/create"
- keyword-arguments) 0)))
- (sx-assoc-let response
+ (let ((result (elt (sx-request-make "filter/create" keyword-arguments) 0)))
+ (sx-assoc-let result
.filter))))
@@ -93,7 +91,7 @@ Returns the compiled filter as a string."
(defun sx-filter-get (&optional include exclude base)
"Return the string representation of the given filter.
-If the filter data exist in `sx--filter-alist', that value will
+If the filter data exists in `sx--filter-alist', that value will
be returned. Otherwise, compile INCLUDE, EXCLUDE, and BASE into
a filter with `sx-filter-compile' and push the association onto
`sx--filter-alist'. Re-cache the alist with `sx-cache-set' and
diff --git a/test/test-macros.el b/test/test-macros.el
index 1634603..5e0eac9 100644
--- a/test/test-macros.el
+++ b/test/test-macros.el
@@ -39,6 +39,5 @@
.page
.page_size
.quota_max
- .quota_remaining
- .total)
- nil none))))
+ .quota_remaining)
+ nil nil))))