aboutsummaryrefslogtreecommitdiff
path: root/sx-interaction.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-02 12:47:03 -0500
committerSean Allred <code@seanallred.com>2015-01-02 12:47:03 -0500
commitcf97f4c691ff5a2ee001e1f22e2eed0d7f6a9df8 (patch)
tree2f521c8f35a9a65f9da02eab4ff83257aa0a0260 /sx-interaction.el
parent542ddf73506c2c297106e4b3f4ec0a1d80a35ad8 (diff)
parent9a420bffcc426b4826f14ad1f62b5430750821df (diff)
Merge branch 'master' into goto-map
Diffstat (limited to 'sx-interaction.el')
-rw-r--r--sx-interaction.el23
1 files changed, 18 insertions, 5 deletions
diff --git a/sx-interaction.el b/sx-interaction.el
index 619f259..3877035 100644
--- a/sx-interaction.el
+++ b/sx-interaction.el
@@ -359,11 +359,24 @@ from context at point."
(let ((default (or sx-question-list--site
(sx-assoc-let sx-question-mode--data .site_par)
sx-default-site)))
- (funcall (if ido-mode #'ido-completing-read #'completing-read)
- (format "Site (%s): " default)
- (sx-site-get-api-tokens) nil t nil nil
- default)))
-
+ (sx-completing-read
+ (format "Site (%s): " default)
+ (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.
SITE is a string, indicating where the question will be posted."