aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-02 19:30:37 -0500
committerSean Allred <code@seanallred.com>2015-01-02 19:30:37 -0500
commit48273879d34d6027d9edd623e9f946ef819d363e (patch)
treebe85820d301cec2f03f4e4bba5f7dd9b40fc1a68
parent6663067a60deb40545840b86f2ff54d19404383f (diff)
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.
-rw-r--r--sx-filter.el35
-rw-r--r--sx-tag.el4
2 files changed, 37 insertions, 2 deletions
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)
diff --git a/sx-tag.el b/sx-tag.el
index 511c474..9f8a5a9 100644
--- a/sx-tag.el
+++ b/sx-tag.el
@@ -26,7 +26,9 @@
;;; Getting the list from a site
-(defvar sx-tag-filter '((tag.name))
+(defvar sx-tag-filter
+ (sx-filter-from-nil
+ (tag.name))
"Filter used when querying tags.")
(defun sx-tag--get-some-tags-containing (site string)