mirror of
https://github.com/larstvei/Try.git
synced 2024-11-26 11:38:30 +00:00
Clean up completion
This commit is contained in:
parent
933c795720
commit
ac65ffa207
11
try.el
11
try.el
@ -100,6 +100,12 @@
|
|||||||
"Compose two functions."
|
"Compose two functions."
|
||||||
(lambda (&rest x) (funcall f (apply g x))))
|
(lambda (&rest x) (funcall f (apply g x))))
|
||||||
|
|
||||||
|
(defun try-complete (archive)
|
||||||
|
"Complete from available package names."
|
||||||
|
(let* ((f (try-compose #'symbol-name #'car))
|
||||||
|
(pkgs (mapcar f archive)))
|
||||||
|
(completing-read "url or package: " pkgs)))
|
||||||
|
|
||||||
(defun try-and-refresh ()
|
(defun try-and-refresh ()
|
||||||
"Refreshes package-list before calling `try'."
|
"Refreshes package-list before calling `try'."
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -112,10 +118,7 @@ to a raw .el file. Packages are stored in `try-tmp-dir' and raw
|
|||||||
.el files are not stored at all."
|
.el files are not stored at all."
|
||||||
(interactive)
|
(interactive)
|
||||||
;; Completions for packages.
|
;; Completions for packages.
|
||||||
(let* ((url-or-package (completing-read
|
(let* ((url-or-package (try-complete package-archive-contents))
|
||||||
"url or package: "
|
|
||||||
(mapcar (try-compose 'symbol-name 'car)
|
|
||||||
package-archive-contents)))
|
|
||||||
(package-symbol (intern url-or-package)))
|
(package-symbol (intern url-or-package)))
|
||||||
(cond ((try-raw-link-p url-or-package) (try-raw-link url-or-package))
|
(cond ((try-raw-link-p url-or-package) (try-raw-link url-or-package))
|
||||||
((try-package-exists-p package-symbol)
|
((try-package-exists-p package-symbol)
|
||||||
|
Loading…
Reference in New Issue
Block a user