aboutsummaryrefslogtreecommitdiff
path: root/sx-tab.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-tab.el')
-rw-r--r--sx-tab.el31
1 files changed, 8 insertions, 23 deletions
diff --git a/sx-tab.el b/sx-tab.el
index f36d10f..32a7784 100644
--- a/sx-tab.el
+++ b/sx-tab.el
@@ -26,11 +26,7 @@
(require 'sx)
(require 'sx-question-list)
-
-(defcustom sx-tab-default-site "emacs"
- "Name of the site to use by default when listing questions."
- :type 'string
- :group 'sx)
+(require 'sx-interaction)
(defvar sx-tab--list nil
"List of the names of all defined tabs.")
@@ -38,23 +34,12 @@
(defun sx-tab-switch (tab)
"Switch to another question-list tab."
(interactive
- (list (funcall (if ido-mode #'ido-completing-read #'completing-read)
- "Switch to tab: " sx-tab--list
- (lambda (tab) (not (equal tab sx-question-list--current-tab)))
- t)))
+ (list (sx-completing-read
+ "Switch to tab: " sx-tab--list
+ (lambda (tab) (not (equal tab sx-question-list--current-tab)))
+ t)))
(funcall (intern (format "sx-tab-%s" (downcase tab)))))
-(defun sx-tab--interactive-site-prompt ()
- "Query the user for a site."
- (let ((default (or sx-question-list--site
- (sx-assoc-let sx-question-mode--data
- .site)
- sx-tab-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)))
-
;;; The main macro
(defmacro sx-tab--define (tab pager &optional printer refresher
@@ -87,13 +72,13 @@ variables, but before refreshing the display."
,(format "Display a list of %s questions for SITE.
NO-UPDATE (the prefix arg) is passed to `sx-question-list-refresh'.
-If SITE is nil, use `sx-tab-default-site'."
+If SITE is nil, use `sx-default-site'."
tab)
(interactive
(list current-prefix-arg
- (sx-tab--interactive-site-prompt)))
+ (sx--interactive-site-prompt)))
(sx-initialize)
- (unless site (setq site sx-tab-default-site))
+ (unless site (setq site sx-default-site))
;; Create the buffer
(unless (buffer-live-p ,buffer-variable)
(setq ,buffer-variable