Skip to content

Commit 34f8c1f

Browse files
authored
fix: Compatible to Emacs 26 (#209)
* 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
1 parent d2cc4d8 commit 34f8c1f

File tree

17 files changed

+5018
-12
lines changed

17 files changed

+5018
-12
lines changed

.github/workflows/exec.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
matrix:
3232
os: [ubuntu-latest, macos-latest, windows-latest]
3333
emacs-version:
34-
- 26.3
3534
- 27.2
3635
- 28.2
3736
- 29.1

.github/workflows/link.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
matrix:
3232
os: [ubuntu-latest, macos-latest, windows-latest]
3333
emacs-version:
34-
- 26.3
3534
- 27.2
3635
- 28.2
3736
- 29.1

lisp/_prepare.el

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,21 @@ Arguments FNC and ARGS are used for advice `:around'."
483483
;;
484484
;;; Package
485485

486+
(defun eask-use-legacy-package-build ()
487+
"Return t if using the legacy `package-build' package."
488+
(version< emacs-version "27.1"))
489+
490+
(defun eask-load-legacy-package-build ()
491+
"Load the legacy `package-build' package."
492+
(when (eask-use-legacy-package-build)
493+
(add-to-list 'load-path
494+
(format "%sextern/package-build/%s/"
495+
eask-lisp-root
496+
emacs-major-version)
497+
t)))
498+
499+
(eask-load-legacy-package-build)
500+
486501
(defun eask--update-exec-path ()
487502
"Add all bin directory to the variable `exec-path'."
488503
(dolist (entry (directory-files package-user-dir t directory-files-no-dot-files-regexp))
@@ -1460,7 +1475,11 @@ ELPA)."
14601475
(eask-with-verbosity 'debug
14611476
(eask-with-progress
14621477
(ansi-blue (format "Generating recipe for package %s... " (ansi-yellow pkg)))
1463-
(write-region (pp-to-string recipe) nil (expand-file-name pkg github-elpa-recipes-dir))
1478+
(progn
1479+
(ignore-errors (make-directory github-elpa-recipes-dir t))
1480+
(with-current-buffer (find-file (expand-file-name pkg github-elpa-recipes-dir))
1481+
(insert (pp-to-string recipe))
1482+
(save-buffer)))
14641483
(ansi-blue "done ✓")))
14651484
(setq eask-depends-on-recipe-p t))
14661485
recipe))))
@@ -1971,14 +1990,6 @@ variable we use to test validation."
19711990
(eask-msg ""))
19721991
(setq eask-lint-first-file-p t))
19731992

1974-
;;
1975-
;;; Externals
1976-
1977-
(eask-load "extern/compat")
1978-
(eask-load "extern/ansi")
1979-
(eask-load "extern/package")
1980-
(eask-load "extern/package-build")
1981-
19821993
;;
19831994
;;; API
19841995

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

2007+
;;
2008+
;;; Externals
2009+
2010+
(eask-load "extern/compat")
2011+
(eask-load "extern/ansi")
2012+
(eask-load "extern/package")
2013+
(eask-load "extern/package-build")
2014+
19962015
;;; _prepare.el ends here
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
;;; package-build-badges.el --- Create batches for packages
2+
3+
;; Copyright (C) 2011-2013 Donald Ephraim Curtis <[email protected]>
4+
;; Copyright (C) 2012-2014 Steve Purcell <[email protected]>
5+
;; Copyright (C) 2009 Phil Hagelberg <[email protected]>
6+
7+
;; Author: Donald Ephraim Curtis <[email protected]>
8+
;; Keywords: tools
9+
10+
;; This file is not (yet) part of GNU Emacs.
11+
;; However, it is distributed under the same license.
12+
13+
;; GNU Emacs is free software; you can redistribute it and/or modify
14+
;; it under the terms of the GNU General Public License as published by
15+
;; the Free Software Foundation; either version 3, or (at your option)
16+
;; any later version.
17+
18+
;; GNU Emacs is distributed in the hope that it will be useful,
19+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
;; GNU General Public License for more details.
22+
23+
;; You should have received a copy of the GNU General Public License
24+
;; along with GNU Emacs; see the file COPYING. If not, write to the
25+
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26+
;; Boston, MA 02110-1301, USA.
27+
28+
;;; Commentary:
29+
30+
;; In future we should provide a hook. Note also that it would be
31+
;; straightforward to generate the SVG ourselves, which would save
32+
;; the network overhead.
33+
34+
;;; Code:
35+
36+
(require 'package-build)
37+
38+
(defun package-build--write-melpa-badge-image (name version target-dir)
39+
(shell-command
40+
(mapconcat #'shell-quote-argument
41+
(list "curl" "-f" "-o"
42+
(expand-file-name (concat name "-badge.svg") target-dir)
43+
(format "https://img.shields.io/badge/%s-%s-%s.svg"
44+
(if package-build-stable "melpa stable" "melpa")
45+
(url-hexify-string version)
46+
(if package-build-stable "3e999f" "922793")))
47+
" ")))
48+
49+
(provide 'package-build-badges)
50+
51+
;; Local Variables:
52+
;; coding: utf-8
53+
;; checkdoc-minor-mode: 1
54+
;; indent-tabs-mode: nil
55+
;; End:
56+
;;; package-badges.el ends here

0 commit comments

Comments
 (0)