aboutsummaryrefslogtreecommitdiff
path: root/sx-search.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-search.el')
-rw-r--r--sx-search.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/sx-search.el b/sx-search.el
index 55964b9..b245cbe 100644
--- a/sx-search.el
+++ b/sx-search.el
@@ -32,6 +32,7 @@
(require 'sx)
(require 'sx-question-list)
+(require 'sx-question-mode)
(require 'sx-tag)
(defvar sx-search--query-history nil
@@ -117,6 +118,25 @@ prefix argument, the user is asked for everything."
(sx-question-list-refresh 'redisplay)
(switch-to-buffer (current-buffer))))
+
+;;; Tag
+(defun sx-search-tag-at-point (&optional pos)
+ "Follow tag under position POS or point."
+ (interactive)
+ (let ((tag (save-excursion
+ (when pos (goto-char pos))
+ (or (get-text-property (point) 'sx-tag)
+ (thing-at-point 'symbol))))
+ (meta (save-excursion
+ (when pos (goto-char pos))
+ (get-text-property (point) 'sx-tag-meta)))
+ (site (replace-regexp-in-string
+ (rx string-start "meta.") ""
+ (or sx-question-list--site
+ (sx-assoc-let sx-question-mode--data .site_par)))))
+ (sx-search (concat (when meta "meta.") site)
+ nil tag)))
+
(provide 'sx-search)
;;; sx-search.el ends here