From b990e4f30024eb26ca68298691944fd9bfa1c67f Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 29 Dec 2023 02:21:43 -0800 Subject: [PATCH] enhance --- .github/workflows/exec.yml | 1 - lisp/_prepare.el | 27 +++++++++++++++++---------- lisp/core/package.el | 3 ++- lisp/init/cask.el | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/exec.yml b/.github/workflows/exec.yml index 35e7b91e..01b7739e 100644 --- a/.github/workflows/exec.yml +++ b/.github/workflows/exec.yml @@ -31,7 +31,6 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] emacs-version: - - 26.3 - 27.2 - 28.2 - 29.1 diff --git a/lisp/_prepare.el b/lisp/_prepare.el index 1325ea0e..68d3ebcc 100644 --- a/lisp/_prepare.el +++ b/lisp/_prepare.el @@ -483,15 +483,18 @@ Arguments FNC and ARGS are used for advice `:around'." ;; ;;; Package -(defun eask-install-package-build () - "Correct way to install the package `package-build'." - (cond ((version< emacs-version "27.1") - (add-to-list 'load-path - (format "%sextern/package-build/%s/" eask-lisp-root - emacs-major-version) - t)) - (t (eask-with-archives "melpa" - (eask-package-install 'package-build))))) +(defun eask-load-legacy-package-build () + "Load the legacy `package-build' package." + (eask-with-progress + (let ((name (ansi-green"package-build")) + (version (ansi-yellow (eask-2str emacs-major-version)))) + (format " - %sInstalling legacy %s (%s)... " eask--action-prefix name version)) + (add-to-list 'load-path + (format "%sextern/package-build/%s/" + eask-lisp-root + emacs-major-version) + t) + "done ✓")) (defun eask--update-exec-path () "Add all bin directory to the variable `exec-path'." @@ -547,7 +550,8 @@ scope of the dependencies (it's either `production' or `development')." (eask-defvc< 27 (eask-pkg-init)) ; XXX: remove this after we drop 26.x (when eask-depends-on-recipe-p (eask-log "Installing required external packages...") - (eask-install-package-build) + (eask-with-archives "melpa" + (eask-package-install 'package-build)) (eask-with-progress "Building temporary archives (this may take a while)... " (eask-with-verbosity 'debug (github-elpa-build)) @@ -642,6 +646,9 @@ Argument BODY are forms for execution." (eask-defvc< 27 (eask-pkg-init)) ; XXX: remove this after we drop 26.x (eask--pkg-process pkg (cond + ((and (equal (eask-2str pkg) "package-build") + (version< emacs-version "27.1")) + (eask-load-legacy-package-build)) ((package-installed-p pkg) (eask-msg " - %sSkipping %s (%s)... already installed ✗" eask--action-prefix diff --git a/lisp/core/package.el b/lisp/core/package.el index 67242a55..eb01ce8e 100644 --- a/lisp/core/package.el +++ b/lisp/core/package.el @@ -74,7 +74,8 @@ Argument VERSION is a string represent the version number of this package." (ignore-errors (make-directory eask-dist-path t)) (eask-defvc< 27 (eask-pkg-init)) ; XXX: remove this after we drop 26.x - (eask-install-package-build) + (eask-with-archives "melpa" + (eask-package-install 'package-build)) (eask-load "extern/package-build") ; override (let* ((version (eask-package-version)) diff --git a/lisp/init/cask.el b/lisp/init/cask.el index 6a8de381..4ea622a9 100644 --- a/lisp/init/cask.el +++ b/lisp/init/cask.el @@ -206,8 +206,8 @@ Optional argument CONTENTS is used for nested directives. e.g. development." (eask-start ;; Preparation - (eask-install-package-build) (eask-with-archives `("jcs-elpa" "melpa") + (eask-package-install 'package-build) (eask-package-install 'cask)) ;; Start Converting