From 48273879d34d6027d9edd623e9f946ef819d363e Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Fri, 2 Jan 2015 19:30:37 -0500 Subject: Fix sx-tag-filter It wasn't returning any .items because it wasn't included in the filter. This commit also introduces a convenience macro in sx-filter to avoid this scenario in the future. --- sx-filter.el | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'sx-filter.el') diff --git a/sx-filter.el b/sx-filter.el index 8c00c12..ad37e67 100644 --- a/sx-filter.el +++ b/sx-filter.el @@ -41,7 +41,40 @@ Structure: ...)") -;;; Compilation +;;; Creation + +(defmacro sx-filter-from-nil (included) + "Creates a filter data structure with INCLUDED fields. +All wrapper fields are included by default." + ;; @OTODO: it would be neat to have syntax like + ;; + ;; (field-a + ;; field-b + ;; (object-a subfield) + ;; field-c + ;; (object-b subfield-a subfield-b)) + ;; + ;; expand into + ;; + ;; (field-a + ;; field-b + ;; object-a.subfield + ;; field-c + ;; object-b.subfield-a object-b.subfield-b) + `(quote ((,@included + .backoff + .error_id + .error_message + .error_name + .has_more + .items + .page + .page_size + .quota_max + .quota_remaining + .total + .type) + nil none))) ;;; @TODO allow BASE to be a precompiled filter name (defun sx-filter-compile (&optional include exclude base) -- cgit v1.2.3 From ac34d14dd0dc61d8aad3d62b6e95c65208110c37 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Sun, 4 Jan 2015 12:36:24 -0500 Subject: Remove .total from default filter See http://api.stackexchange.com/docs/paging#total. --- sx-filter.el | 1 - 1 file changed, 1 deletion(-) (limited to 'sx-filter.el') diff --git a/sx-filter.el b/sx-filter.el index ad37e67..c67d05b 100644 --- a/sx-filter.el +++ b/sx-filter.el @@ -72,7 +72,6 @@ All wrapper fields are included by default." .page_size .quota_max .quota_remaining - .total .type) nil none))) -- cgit v1.2.3