diff options
author | Sean Allred <code@seanallred.com> | 2015-01-16 00:57:01 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2015-01-16 00:57:01 -0500 |
commit | a1fc7125f9260411af04c21137ef1e53a5b1b634 (patch) | |
tree | e6e2ae4ea094c4418a71bb403303afa918b0d3f3 /sx-filter.el | |
parent | fe140f7891257890687ec6e3243d66f1aa95fc65 (diff) | |
parent | ef5b4639cb8e70f2d4ddd26a7621f1361ccb1af7 (diff) |
Merge pull request #223 from vermiculus/build-filter-from-default
Build filter from default
Diffstat (limited to 'sx-filter.el')
-rw-r--r-- | sx-filter.el | 16 |
1 files changed, 7 insertions, 9 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 |