From 41c3ab7c498e5be8175d7851e8408788352cdca1 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Tue, 26 Mar 2013 21:09:50 +0000 Subject: [PATCH] After interactively building a package, prompt to install locally --- package-build.el | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/package-build.el b/package-build.el index 9f6ae510..799a95d6 100644 --- a/package-build.el +++ b/package-build.el @@ -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."