Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for ELPA support #1756

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions methods/el-get-elpa.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ PACKAGE isn't currently installed by ELPA."
;; package directories are named <package>-<version>.
(let* ((pname (el-get-as-string package))
(version-offset (+ (length pname) 1)))
(loop for pkg-dir in (directory-files package-user-dir nil
(concat "^" (regexp-quote pname) "-"))
if (ignore-errors
(version-to-list (substring pkg-dir version-offset)))
return (expand-file-name pkg-dir package-user-dir))))
(loop for pkg-base-dir in (cons package-user-dir
(when (boundp 'package-directory-list)
package-directory-list))
with dir = nil
when (file-directory-p pkg-base-dir)
do
(setq dir
(loop for pkg-dir in (directory-files
pkg-base-dir nil
(concat "\\`" (regexp-quote pname) "-"))
if (ignore-errors
(version-to-list (substring pkg-dir version-offset)))
return (expand-file-name pkg-dir pkg-base-dir)))
and when dir return dir)))

(defun el-get-elpa-package-repo (package)
"Get the ELPA repository cons cell for PACKAGE.
Expand Down Expand Up @@ -70,8 +79,10 @@ the recipe, then return nil."
(defun el-get-elpa-symlink-package (package)
"ln -s ../elpa/<package> ~/.emacs.d/el-get/<package>"
(let* ((package (el-get-as-string package))
(elpa-dir (file-relative-name
(el-get-elpa-package-directory package) el-get-dir)))
(pkg-dir (el-get-elpa-package-directory package))
(elpa-dir (if pkg-dir
(file-relative-name pkg-dir el-get-dir)
(error "No package directory for `%s' found" package))))
(unless (el-get-package-exists-p package)
;; better style would be to check for (fboundp 'make-symbolic-link) but
;; that would be true on Vista, where by default only administrator is
Expand Down Expand Up @@ -183,10 +194,13 @@ first time.")

(defun el-get-elpa-post-remove (package)
"Do remove the ELPA bits for package, now"
(let ((p-elpa-dir (el-get-elpa-package-directory package)))
(if p-elpa-dir
(dired-delete-file p-elpa-dir 'always)
(message "el-get: could not find ELPA dir for %s." package))))
(let* ((pkg (el-get-as-symbol package))
(pkg-descs (cdr (assq pkg package-alist))))
(dolist (pkg-desc pkg-descs)
(with-no-warnings
(if (version< emacs-version "24.4")
(package-delete pkg (package-desc-version pkg-desc))
(package-delete pkg-desc))))))

(add-hook 'el-get-elpa-remove-hook 'el-get-elpa-post-remove)

Expand Down