mirror of
https://github.com/larstvei/Try.git
synced 2024-11-26 03:28:31 +00:00
Fix #7
This commit is contained in:
parent
271b0a362c
commit
2fcfcbd9b0
10
try.el
10
try.el
@ -36,9 +36,6 @@
|
||||
(require 'package)
|
||||
(require 'url)
|
||||
|
||||
(defvar try-tmp-dir (make-temp-file "try" t)
|
||||
"A temporary directory for storing packages.")
|
||||
|
||||
(defun try-raw-link-p (url)
|
||||
"Returns non-nil if this looks like an URL to a .el file."
|
||||
(string-match-p "[^:]*://\\([^?\r\n]+\\).*\.el?$" url))
|
||||
@ -87,11 +84,12 @@ to a raw .el file. Packages are stored in `try-tmp-dir' and raw
|
||||
(package-symbol (intern url-or-package)))
|
||||
(cond ((try-raw-link-p url-or-package) (try-raw-link url-or-package))
|
||||
((try-package-exists-p package-symbol)
|
||||
(let ((package-user-dir try-tmp-dir)
|
||||
(package-alist nil))
|
||||
(let* ((tmp-dir (make-temp-file (concat url-or-package "-") t))
|
||||
(package-user-dir tmp-dir)
|
||||
(package-alist nil))
|
||||
(if (version< emacs-version "25.1")
|
||||
(package-install package-symbol)
|
||||
(package-install package-symbol 'dont-select))
|
||||
(package-install package-symbol 'dont-select))
|
||||
(message "Trying %s!" url-or-package)))
|
||||
(t (message (concat "Couldn't find a sensible way to try this. "
|
||||
"Try running `package-refresh-contents'!"))))))
|
||||
|
Loading…
Reference in New Issue
Block a user