aboutsummaryrefslogtreecommitdiff
path: root/sx-interaction.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-interaction.el')
-rw-r--r--sx-interaction.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/sx-interaction.el b/sx-interaction.el
index b2673c8..3877035 100644
--- a/sx-interaction.el
+++ b/sx-interaction.el
@@ -364,6 +364,18 @@ from context at point."
(sx-site-get-api-tokens) nil t nil nil
default)))
+(defun sx--maybe-site-prompt (arg)
+ "Get a site token conditionally in an interactive context.
+If ARG is non-nil, use `sx--interactive-site-prompt'.
+Otherwise, use `sx-question-list--site' if non-nil.
+If nil, use `sx--interactive-site-prompt' anyway."
+ ;; This could eventually be generalized into (sx--maybe-prompt
+ ;; prefix-arg value-if-non-nil #'prompt-function).
+ (if arg
+ (sx--interactive-site-prompt)
+ (or sx-question-list--site
+ (sx--interactive-site-prompt))))
+
;;;###autoload
(defun sx-ask (site)
"Start composing a question for SITE.