After interactively building a package, prompt to install locally

This commit is contained in:
Steve Purcell 2013-03-26 21:09:50 +00:00
parent 58bf468f42
commit 41c3ab7c49

View file

@ -672,6 +672,16 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs."
(let* ((entry (rassoc target files)))
(when entry (car entry))))
(defun pb/find-package-file (name)
"Return the filename of the most recently built package of NAME."
(let* ((pkg-info (cdr (assoc name (package-build-archive-alist))))
(version (package-version-join (aref pkg-info 0)))
(flavour (aref pkg-info 3)))
(expand-file-name
(format "%s-%s.%s" name version (if (eq flavour 'single) "el" "tar"))
package-build-archive-dir)))
;;; Public interface
;;;###autoload
(defun package-build-archive (name)
@ -818,11 +828,14 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs."
(save-buffer)
(error "Aborting")))
(package-build-reinitialize)
(package-build-archive (intern (file-name-nondirectory (buffer-file-name))))
(save-current-buffer
(find-file-other-window
(expand-file-name "archive-contents" package-build-archive-dir))
(revert-buffer t t)))
(let ((pkg-name (intern (file-name-nondirectory (buffer-file-name)))))
(package-build-archive pkg-name)
(save-current-buffer
(find-file-other-window
(expand-file-name "archive-contents" package-build-archive-dir))
(revert-buffer t t))
(when (yes-or-no-p "Install new package? ")
(package-install-file (pb/find-package-file pkg-name)))))
(defun package-build-archive-ignore-errors (pkg)
"Build archive for package PKG, ignoring any errors."