summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl X. Su <bcbcarl@gmail.com>2017-06-14 20:06:54 +0800
committerGitHub <noreply@github.com>2017-06-14 20:06:54 +0800
commitdf5427ce2a5ad4dab652dbb1c4a1834d7ddc2abc (patch)
tree5275500b4a1f2157be3a3bfb10f59bc9eeac086d
parent00ae9ee54056b16bb20c5b35e6bd262e6bda7eb5 (diff)
parent3f5de24334a7edcaa7f67738be26540b42441621 (diff)
Merge pull request #9 from davep/master
Small improvements to passing city to wttrin
-rw-r--r--wttrin.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/wttrin.el b/wttrin.el
index c92ff1d..512b6a7 100644
--- a/wttrin.el
+++ b/wttrin.el
@@ -66,10 +66,14 @@
(setq buffer-read-only t)))))
;;;###autoload
-(defun wttrin ()
- "Display weather information."
- (interactive)
- (wttrin-query (completing-read "City name: " wttrin-default-cities nil nil)))
+(defun wttrin (city)
+ "Display weather information for CITY."
+ (interactive
+ (list
+ (completing-read "City name: " wttrin-default-cities nil nil
+ (when (= (length wttrin-default-cities) 1)
+ (car wttrin-default-cities)))))
+ (wttrin-query city))
(provide 'wttrin)