diff options
author | Sean Allred <code@seanallred.com> | 2015-01-02 18:13:26 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2015-01-02 18:13:26 -0500 |
commit | 2797cd52800b628c91de9c191f24f5513fe244ca (patch) | |
tree | 16125090a71812cab759eaa0bba9bde55c4b566a /sx-tab.el | |
parent | f97c84c2d4a0a8ef6e53333a0a5c528397ccaded (diff) | |
parent | dd9c2017cb3f0b145b39150562a0c4e59c244df1 (diff) |
Merge branch 'get-all' into tag-bot
Diffstat (limited to 'sx-tab.el')
-rw-r--r-- | sx-tab.el | 31 |
1 files changed, 8 insertions, 23 deletions
@@ -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 |