Better implementation for el-get-elpa-package-directory

This commit is contained in:
Ryan C. Thompson 2012-03-12 16:27:32 -07:00
parent 8fb9004098
commit e10d6dd3e0

View File

@ -28,25 +28,14 @@
(defun el-get-elpa-package-directory (package)
"Return the directory where ELPA stores PACKAGE, or nil if
PACKAGE isn't currently installed by ELPA."
(let* ((pname (format "%s" package)) ; easy way to cope with symbols etc.
(l
;; we use try-completion to find the realname of the directory
;; ELPA used, and this wants an alist, we trick ls -i -1 into
;; that.
(mapcar 'split-string
(split-string
(shell-command-to-string
(concat
"ls -i1 "
(shell-quote-argument
(expand-file-name
(file-name-as-directory package-user-dir))))))))
(realname (try-completion pname l)))
(if realname (concat (file-name-as-directory package-user-dir) realname)
realname)))
(when (package-installed-p package)
(let ((package-name (el-get-as-string package))
(package-version (package-desc-vers (assq package package-alist))))
;; See `package-unpack-single'
(expand-file-name (concat package-name "-"
(package-version-join
(version-to-list package-version)))
package-user-dir))))
(defun el-get-elpa-package-repo (package)
"Get the ELPA repository cons cell for PACKAGE.