From ad3c2c9c05705512415afb469c8545b875c7cfe8 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 7 Feb 2015 23:31:54 -0200 Subject: Hot Fix #249. Searching without query --- sx-search.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sx-search.el') diff --git a/sx-search.el b/sx-search.el index aefd12e..c1e1e23 100644 --- a/sx-search.el +++ b/sx-search.el @@ -84,7 +84,7 @@ prefix argument, the user is asked for everything." (when current-prefix-arg (setq tags (sx-tag-multiple-read site (concat "Tags" (when query " (optional)")))) - (when (and (not query) (string= "" tags)) + (unless (or query tags) (sx-user-error "Must supply either QUERY or TAGS")) (setq excluded-tags (sx-tag-multiple-read site "Excluded tags (optional)"))) -- cgit v1.2.3 From 384855876c6fcb0048551ceed335805babc19b1f Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Wed, 11 Feb 2015 08:18:28 -0600 Subject: Hotfix sx-search autoload Should fix #255 --- sx-search.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sx-search.el') diff --git a/sx-search.el b/sx-search.el index c1e1e23..cd2f4e7 100644 --- a/sx-search.el +++ b/sx-search.el @@ -62,7 +62,7 @@ KEYWORDS is passed to `sx-method-call'." :filter sx-browse-filter)) -;;; User command +;;;###autoload (defun sx-search (site query &optional tags excluded-tags) "Display search on SITE for question titles containing QUERY. When TAGS is given, it is a lists of tags, one of which must -- cgit v1.2.3 From c56c78f4a285a9c48a7917eda016efbf00553b5a Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 11 Feb 2015 15:41:16 +0000 Subject: Add ordering to question lists created by sx-search --- sx-search.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sx-search.el') diff --git a/sx-search.el b/sx-search.el index cd2f4e7..7b4e6c0 100644 --- a/sx-search.el +++ b/sx-search.el @@ -52,7 +52,6 @@ fail. EXCLUDED-TAGS is only is used if TAGS is also provided. KEYWORDS is passed to `sx-method-call'." (sx-method-call 'search :keywords `((page . ,page) - (sort . activity) (intitle . ,query) (tagged . ,tags) (nottagged . ,excluded-tags) @@ -61,6 +60,16 @@ KEYWORDS is passed to `sx-method-call'." :auth t :filter sx-browse-filter)) +(defconst sx-search--order-methods + (cons '("Relevance" . relevance) + (cl-remove-if (lambda (x) (eq (cdr x) 'hot)) + (default-value 'sx-question-list--order-methods))) + "Alist of possible values to be passed to the `sort' keyword.") + +(defvar sx-search-default-order 'activity + "Default ordering method used on new searches. +Possible values are the cdrs of `sx-search--order-methods'.") + ;;;###autoload (defun sx-search (site query &optional tags excluded-tags) @@ -98,8 +107,11 @@ prefix argument, the user is asked for everything." (lambda (page) (sx-search-get-questions sx-question-list--site page - query tags excluded-tags))) + query tags excluded-tags + `((sort . ,sx-question-list--order))))) (setq sx-question-list--site site) + (setq sx-question-list--order sx-search-default-order) + (setq sx-question-list--order-methods sx-search--order-methods) (sx-question-list-refresh 'redisplay) (switch-to-buffer (current-buffer)))) -- cgit v1.2.3 From 2c2becfa47d0b13d633f85a7c18f4d40193dc454 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 11 Feb 2015 15:52:16 +0000 Subject: sx-search-get-questions make KEYWORDS a &rest argument. --- sx-search.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sx-search.el') diff --git a/sx-search.el b/sx-search.el index 7b4e6c0..55964b9 100644 --- a/sx-search.el +++ b/sx-search.el @@ -39,7 +39,9 @@ ;;; Basic function -(defun sx-search-get-questions (site page query &optional tags excluded-tags keywords) +(defun sx-search-get-questions (site page query + &optional tags excluded-tags + &rest keywords) "Like `sx-question-get-questions', but restrict results by a search. Perform search on SITE. PAGE is an integer indicating which page @@ -108,7 +110,7 @@ prefix argument, the user is asked for everything." (sx-search-get-questions sx-question-list--site page query tags excluded-tags - `((sort . ,sx-question-list--order))))) + (cons 'sort sx-question-list--order)))) (setq sx-question-list--site site) (setq sx-question-list--order sx-search-default-order) (setq sx-question-list--order-methods sx-search--order-methods) -- cgit v1.2.3