Skip to content

Commit

Permalink
fix: Compatible to Emacs 26 (#209)
Browse files Browse the repository at this point in the history
* fix: Compatible to Emacs 26

* Remove docker

* enhance

* Add legacy package-build

* remove 26.x link test

* revert build legacy

* insist remove 26.x

* fix docker ci

* try use find file
  • Loading branch information
jcs090218 authored Dec 29, 2023
1 parent d2cc4d8 commit 34f8c1f
Show file tree
Hide file tree
Showing 17 changed files with 5,018 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/exec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
emacs-version:
- 26.3
- 27.2
- 28.2
- 29.1
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
emacs-version:
- 26.3
- 27.2
- 28.2
- 29.1
Expand Down
37 changes: 28 additions & 9 deletions lisp/_prepare.el
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,21 @@ Arguments FNC and ARGS are used for advice `:around'."
;;
;;; Package

(defun eask-use-legacy-package-build ()
"Return t if using the legacy `package-build' package."
(version< emacs-version "27.1"))

(defun eask-load-legacy-package-build ()
"Load the legacy `package-build' package."
(when (eask-use-legacy-package-build)
(add-to-list 'load-path
(format "%sextern/package-build/%s/"
eask-lisp-root
emacs-major-version)
t)))

(eask-load-legacy-package-build)

(defun eask--update-exec-path ()
"Add all bin directory to the variable `exec-path'."
(dolist (entry (directory-files package-user-dir t directory-files-no-dot-files-regexp))
Expand Down Expand Up @@ -1460,7 +1475,11 @@ ELPA)."
(eask-with-verbosity 'debug
(eask-with-progress
(ansi-blue (format "Generating recipe for package %s... " (ansi-yellow pkg)))
(write-region (pp-to-string recipe) nil (expand-file-name pkg github-elpa-recipes-dir))
(progn
(ignore-errors (make-directory github-elpa-recipes-dir t))
(with-current-buffer (find-file (expand-file-name pkg github-elpa-recipes-dir))
(insert (pp-to-string recipe))
(save-buffer)))
(ansi-blue "done ✓")))
(setq eask-depends-on-recipe-p t))
recipe))))
Expand Down Expand Up @@ -1971,14 +1990,6 @@ variable we use to test validation."
(eask-msg ""))
(setq eask-lint-first-file-p t))

;;
;;; Externals

(eask-load "extern/compat")
(eask-load "extern/ansi")
(eask-load "extern/package")
(eask-load "extern/package-build")

;;
;;; API

Expand All @@ -1993,4 +2004,12 @@ variable we use to test validation."
(setq eask-commands (delete-dups eask-commands))
`(defun ,name nil ,@body))

;;
;;; Externals

(eask-load "extern/compat")
(eask-load "extern/ansi")
(eask-load "extern/package")
(eask-load "extern/package-build")

;;; _prepare.el ends here
56 changes: 56 additions & 0 deletions lisp/extern/package-build/24/package-build-badges.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;;; package-build-badges.el --- Create batches for packages

;; Copyright (C) 2011-2013 Donald Ephraim Curtis <dcurtis@milkbox.net>
;; Copyright (C) 2012-2014 Steve Purcell <steve@sanityinc.com>
;; Copyright (C) 2009 Phil Hagelberg <technomancy@gmail.com>

;; Author: Donald Ephraim Curtis <dcurtis@milkbox.net>
;; Keywords: tools

;; This file is not (yet) part of GNU Emacs.
;; However, it is distributed under the same license.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; In future we should provide a hook. Note also that it would be
;; straightforward to generate the SVG ourselves, which would save
;; the network overhead.

;;; Code:

(require 'package-build)

(defun package-build--write-melpa-badge-image (name version target-dir)
(shell-command
(mapconcat #'shell-quote-argument
(list "curl" "-f" "-o"
(expand-file-name (concat name "-badge.svg") target-dir)
(format "https://img.shields.io/badge/%s-%s-%s.svg"
(if package-build-stable "melpa stable" "melpa")
(url-hexify-string version)
(if package-build-stable "3e999f" "922793")))
" ")))

(provide 'package-build-badges)

;; Local Variables:
;; coding: utf-8
;; checkdoc-minor-mode: 1
;; indent-tabs-mode: nil
;; End:
;;; package-badges.el ends here
Loading

0 comments on commit 34f8c1f

Please sign in to comment.