From 42f3015298719733ef15f971dc63d849fe38a204 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Mon, 22 Jul 2013 10:10:28 +0100 Subject: [PATCH] Ensure we use vectors for parsed package info, even in Emacs HEAD `package-buffer-info` in Emacs HEAD now returns CL structs, which subtly breaks package-build, since they still kinda look like vectors. This commit introduces a wrapper for `package-buffer-info` so that we get the same sort of data back in any Emacs version. --- package-build.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/package-build.el b/package-build.el index 1f86dcf9..ace1cbc2 100644 --- a/package-build.el +++ b/package-build.el @@ -541,7 +541,7 @@ The file is written to `package-build-working-dir'." (pb/update-or-insert-version "0") (pb/ensure-ends-here-line file-path) (cl-flet ((package-strip-rcs-id (str) "0")) - (package-buffer-info)))))) + (pb/package-buffer-info-vec)))))) (defun pb/get-pkg-file-info (file-path) "Get a vector of package info from \"-pkg.el\" file FILE-PATH." @@ -755,6 +755,17 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs." "Return the filename of the most recently built package of NAME." (pb/archive-file-name (assoc name (package-build-archive-alist)))) +(defun pb/package-buffer-info-vec () + "Return a vector of package info. +`package-buffer-info' returns a vector in older Emacs versions, +and a cl struct in Emacs HEAD. This wrapper normalises the results." + (let ((desc (package-buffer-info))) + (if (fboundp 'package-desc-create) + (vector (package-desc-name desc) + (package-desc-reqs desc) + (package-desc-summary desc) + (package-desc-version desc)) + desc))) ;;; Public interface ;;;###autoload @@ -802,7 +813,7 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs." (pb/ensure-ends-here-line pkg-source) (write-file pkg-target nil) (condition-case err - (package-buffer-info) + (pb/package-buffer-info-vec) (error (message "Warning: %S" err))) (kill-buffer)))