aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-interaction.el8
-rw-r--r--sx-question-list.el3
-rw-r--r--sx-tab.el8
-rw-r--r--sx.el7
4 files changed, 16 insertions, 10 deletions
diff --git a/sx-interaction.el b/sx-interaction.el
index 372a5b1..9ced1ab 100644
--- a/sx-interaction.el
+++ b/sx-interaction.el
@@ -340,10 +340,10 @@ from context at point."
(let ((default (or sx-question-list--site
(sx-assoc-let sx-question-mode--data .site)
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)))
;;;###autoload
(defun sx-ask (site)
diff --git a/sx-question-list.el b/sx-question-list.el
index 4bd6478..d84d1ea 100644
--- a/sx-question-list.el
+++ b/sx-question-list.el
@@ -559,12 +559,11 @@ This does not update `sx-question-mode--window'."
(defun sx-question-list-switch-site (site)
"Switch the current site to SITE and display its questions.
-Use `ido-completing-read' if variable `ido-mode' is active.
Retrieve completions from `sx-site-get-api-tokens'.
Sets `sx-question-list--site' and then call
`sx-question-list-refresh' with `redisplay'."
(interactive
- (list (funcall (if ido-mode #'ido-completing-read #'completing-read)
+ (list (sx-completing-read
"Switch to site: " (sx-site-get-api-tokens)
(lambda (site) (not (equal site sx-question-list--site)))
t)))
diff --git a/sx-tab.el b/sx-tab.el
index 6c5e21e..32a7784 100644
--- a/sx-tab.el
+++ b/sx-tab.el
@@ -34,10 +34,10 @@
(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)))))
diff --git a/sx.el b/sx.el
index 73d1a40..48a7edc 100644
--- a/sx.el
+++ b/sx.el
@@ -149,6 +149,7 @@ If ALIST doesn't have a `site' property, one is created using the
question.comments
question.answers
question.last_editor
+ question.last_activity_date
question.accepted_answer_id
question.link
question.upvoted
@@ -169,6 +170,7 @@ If ALIST doesn't have a `site' property, one is created using the
comment.comment_id
answer.answer_id
answer.last_editor
+ answer.last_activity_date
answer.link
answer.share_link
answer.owner
@@ -182,6 +184,11 @@ See `sx-question-get-questions' and `sx-question-get-question'.")
;;; Utility Functions
+(defun sx-completing-read (&rest args)
+ "Like `completing-read', but possibly use ido.
+All ARGS are passed to `completing-read' or `ido-completing-read'."
+ (apply (if ido-mode #'ido-completing-read #'completing-read)
+ args))
(defmacro sx-sorted-insert-skip-first (newelt list &optional predicate)
"Inserted NEWELT into LIST sorted by PREDICATE.