aboutsummaryrefslogtreecommitdiff
path: root/sx-tag.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-04 14:07:40 -0500
committerSean Allred <code@seanallred.com>2015-01-04 14:07:40 -0500
commit01df71244d3fe5412e2420127dcd2282d9fa39c7 (patch)
tree0fe936bfa609ea19c454cdcb4d1c2349d5c0c746 /sx-tag.el
parent59327f6f9c6ba419543c47670a62af0aa41271ca (diff)
parent89834aa61adf1fff29379c82ab96629f0b2960d0 (diff)
Merge branch 'master' into filter-macro
Conflicts: sx-filter.el
Diffstat (limited to 'sx-tag.el')
-rw-r--r--sx-tag.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/sx-tag.el b/sx-tag.el
index 07b7a77..8c468a6 100644
--- a/sx-tag.el
+++ b/sx-tag.el
@@ -28,18 +28,24 @@
;;; Getting the list from a site
(defvar sx-tag-filter
(sx-filter-from-nil
- (tag.name))
+ (tag.name
+ tag.synonyms))
"Filter used when querying tags.")
-(defun sx-tag--get-all (site)
- "Retrieve all tags for SITE."
- (mapcar
- (lambda (tag)
- (cdr (assoc 'name tag)))
+(defun sx-tag--get-all (site &optional no-synonyms)
+ "Retrieve all tags for SITE.
+If NO-SYNONYMS is non-nil, don't return synonyms."
+ (cl-reduce
+ (lambda (so-far tag)
+ (let-alist tag
+ (cons .name
+ (if no-synonyms so-far
+ (append .synonyms so-far)))))
(sx-method-call 'tags
:get-all t
:filter sx-tag-filter
- :site site)))
+ :site site)
+ :initial-value nil))
(defun sx-tag--get-some-tags-containing (site string)
"Return at most 100 tags for SITE containing STRING.