diff options
Diffstat (limited to 'sx-search.el')
-rw-r--r-- | sx-search.el | 16 |
1 files changed, 14 insertions, 2 deletions
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)))) |