If region active - use it content as default value.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 19 Feb 2015 19:40:37 +0200
changeset 1214 f9baff417868
parent 1213 e0de9be5c1ee
child 1215 c7e52e93465a
If region active - use it content as default value.
pypi.el
--- a/pypi.el	Thu Feb 19 19:30:32 2015 +0200
+++ b/pypi.el	Thu Feb 19 19:40:37 2015 +0200
@@ -27,7 +27,10 @@
 
 ;;;###autoload
 (defun pypi.pkg (pkg)
-  (interactive (list (read-string "Python package: " "" 'pypi.pkg-history (thing-at-point 'symbol))))
+  (interactive (list
+                (read-string "Python package: "
+                             (if (region-active-p) (buffer-substring (mark) (point)) (thing-at-point 'symbol))
+                             'pypi.pkg-history)))
   (url-retrieve (format pypi.url pkg) #'pypi.pkg-callback))
 
 (provide 'pypi)