From 413f850fff7ca23a0818a64dac4941d87d007a2c Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 24 Nov 2014 10:55:53 +0000 Subject: Accept empty input on switch-site --- sx-question-list.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sx-question-list.el') diff --git a/sx-question-list.el b/sx-question-list.el index 45982a4..e1ea349 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -440,17 +440,18 @@ relevant window." (defun sx-question-list-switch-site (site) "Switch the current site to SITE and display its questions. -Uses `ido-completing-read' if variable `ido-mode' is active. Retrieves -completions from `sx-site-get-api-tokens'. Sets -`sx-question-list--current-site' and then +Use `ido-completing-read' if variable `ido-mode' is active. +Retrieve completions from `sx-site-get-api-tokens'. +Sets `sx-question-list--current-site' and then call `sx-question-list-refresh' with `redisplay'." (interactive (list (funcall (if ido-mode #'ido-completing-read #'completing-read) "Switch to site: " (sx-site-get-api-tokens) (lambda (site) (not (equal site sx-question-list--current-site))) t))) - (setq sx-question-list--current-site site) - (sx-question-list-refresh 'redisplay)) + (when (and (stringp site) (> (length site) 0)) + (setq sx-question-list--current-site site) + (sx-question-list-refresh 'redisplay))) (provide 'sx-question-list) ;;; sx-question-list.el ends here -- cgit v1.2.3