From 50465fe9cb68978088da2be1a88549892c6b3146 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 8 Jan 2015 16:03:54 -0200 Subject: Don't use .total the total property doubles the time taken for the request, according to https://api.stackexchange.com/docs/paging --- sx-filter.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sx-filter.el b/sx-filter.el index a3f6861..72ab6b2 100644 --- a/sx-filter.el +++ b/sx-filter.el @@ -64,7 +64,7 @@ All wrapper fields are included by default." .page_size .quota_max .quota_remaining - .total) + ) nil none))) ;;; @TODO allow BASE to be a precompiled filter name -- cgit v1.2.3 From 7818811a7ca2666a007007caa8b32be7787e932d Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 8 Jan 2015 16:09:54 -0200 Subject: Docs --- sx-filter.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sx-filter.el b/sx-filter.el index 72ab6b2..a35b51d 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 @@ -70,7 +70,7 @@ All wrapper fields are included by default." ;;; @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 @@ -93,7 +93,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 -- cgit v1.2.3 From 55682ee682c983f66c0a05b63ecb0ab4e5832cba Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 8 Jan 2015 16:10:05 -0200 Subject: Style --- sx-filter.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sx-filter.el b/sx-filter.el index a35b51d..bdbdab9 100644 --- a/sx-filter.el +++ b/sx-filter.el @@ -77,10 +77,8 @@ Returns the compiled filter as a string." `((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)))) -- cgit v1.2.3 From 117f78c3e16fa32f82e75f43a7aac24afd9a37d5 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 8 Jan 2015 16:11:54 -0200 Subject: Build filters from default. --- sx-filter.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sx-filter.el b/sx-filter.el index bdbdab9..0df9b5e 100644 --- a/sx-filter.el +++ b/sx-filter.el @@ -65,7 +65,7 @@ All wrapper fields are included by default." .quota_max .quota_remaining ) - nil none))) + nil nil))) ;;; @TODO allow BASE to be a precompiled filter name (defun sx-filter-compile (&optional include exclude base) -- cgit v1.2.3 From 0edc2c089f45672e9390ef98db468e4d690c09df Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 8 Jan 2015 18:27:37 -0200 Subject: Fix test --- test/test-macros.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-macros.el b/test/test-macros.el index 1634603..a43d383 100644 --- a/test/test-macros.el +++ b/test/test-macros.el @@ -41,4 +41,4 @@ .quota_max .quota_remaining .total) - nil none)))) + nil nil)))) -- cgit v1.2.3 From ef5b4639cb8e70f2d4ddd26a7621f1361ccb1af7 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 14 Jan 2015 17:20:11 -0200 Subject: Remove .total from tests too --- test/test-macros.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test-macros.el b/test/test-macros.el index a43d383..5e0eac9 100644 --- a/test/test-macros.el +++ b/test/test-macros.el @@ -39,6 +39,5 @@ .page .page_size .quota_max - .quota_remaining - .total) + .quota_remaining) nil nil)))) -- cgit v1.2.3