From 499f494efc40111dfdc06ca3c79f0b96e3e53b0a Mon Sep 17 00:00:00 2001 From: JenChieh Date: Mon, 15 Dec 2025 04:22:46 +0800 Subject: [PATCH 1/9] ci: Replace Cask with Eask --- .github/workflows/test.yml | 43 ++++++++++++++++++-------------------- .gitignore | 3 ++- Eask | 16 ++++++++++++++ Makefile | 16 +++++++------- 4 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 Eask diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 106f067..a213383 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,15 +6,13 @@ jobs: test: strategy: matrix: - os: [ubuntu-latest] - emacs_version: - - '24.3' - - '25.1' - - '25.3' - - '26.1' - - '26.2' + os: [ubuntu-latest, macos-latest, windows-latest] + emacs-version: - '26.3' - - '27.1' + - '27.2' + - '28.2' + - '29.4' + - '30.2' include: # - emacs_version: 'snapshot' # os: ubuntu-latest @@ -28,25 +26,24 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Set up Emacs - uses: purcell/setup-emacs@master + uses: jcs090218/setup-emacs@master with: - version: ${{ matrix.emacs_version }} - - - name: Set up Cask - uses: conao3/setup-cask@master - - - name: Install Lua (Ubuntu) - if: matrix.os != 'macos-latest' - run: sudo apt install lua5.2 && echo 'print(123)' | lua -i - - - name: Install Lua (MacOS) - if: matrix.os == 'macos-latest' - uses: xpol/setup-lua@master + version: ${{ matrix.emacs-version }} + + - name: Set up Eask + uses: emacs-eask/setup-eask@master + with: + version: 'snapshot' + + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Install Lua + uses: leafo/gh-actions-lua@v12 with: - lua-version: "5.2.4" + luaVersion: "5.2.4" - name: Run tests if: matrix.allow_failure != true diff --git a/.gitignore b/.gitignore index 566d49f..19adcf8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ release-notes-* *~ *.elc -/.cask +/.eask +/dist diff --git a/Eask b/Eask new file mode 100644 index 0000000..b2e0524 --- /dev/null +++ b/Eask @@ -0,0 +1,16 @@ +;; -*- mode: eask; lexical-binding: t -*- + +(package "lua-mode" + "20221027" + "a major-mode for editing Lua scripts") + +(website-url "https://immerrr.github.io/lua-mode") +(keywords "languages" "processes" "tools") + +(package-file "lua-mode.el") + +(script "test" "echo \"Error: no test specified\" && exit 1") + +(source "gnu") + +(depends-on "emacs" "24.3") diff --git a/Makefile b/Makefile index c6af0ff..25d9308 100644 --- a/Makefile +++ b/Makefile @@ -25,28 +25,28 @@ dist: rm -f $(DISTFILE) && \ git archive --format=zip -o $(DISTFILE) --prefix=lua-mode/ HEAD -.PHONY: test-compiled-nocask test-uncompiled-nocask test-compiled test-uncompiled +.PHONY: test-compiled-noeask test-uncompiled-noeask test-compiled test-uncompiled # check both regular and compiled versions -test-nocask: test-compiled-nocask test-uncompiled-nocask +test-noeask: test-compiled-noeask test-uncompiled-noeask test: test-compiled test-uncompiled -test-compiled-nocask: $(LUA_MODE_ELC) +test-compiled-noeask: $(LUA_MODE_ELC) $(EMACS) -batch -l $(LUA_MODE_ELC) -l buttercup -f buttercup-run-discover -test-uncompiled-nocask: +test-uncompiled-noeask: $(EMACS) -batch -l lua-mode.el -l buttercup -f buttercup-run-discover test-compiled: $(LUA_MODE_ELC) - EMACS=$(EMACS) cask exec buttercup -l $(LUA_MODE_ELC) + EMACS=$(EMACS) eask exec buttercup -l $(LUA_MODE_ELC) test-uncompiled: - EMACS=$(EMACS) cask exec buttercup -l lua-mode.el + EMACS=$(EMACS) eask exec buttercup -l lua-mode.el tryout: - cask exec $(EMACS) -Q -l init-tryout.el test.lua + eask exec $(EMACS) -Q -l init-tryout.el test.lua -tryout-nocask: +tryout-noeask: $(EMACS) -Q -l init-tryout.el test.lua release: From b8db3f9ba82c771a12104eb0c691d4e934f0e8f9 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Mon, 15 Dec 2025 04:28:16 +0800 Subject: [PATCH 2/9] Bump required Emacs version to 26 --- Eask | 7 +++++-- lua-mode.el | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Eask b/Eask index b2e0524..efe2ebf 100644 --- a/Eask +++ b/Eask @@ -8,9 +8,12 @@ (keywords "languages" "processes" "tools") (package-file "lua-mode.el") +(files "lua-mode-*.el") (script "test" "echo \"Error: no test specified\" && exit 1") -(source "gnu") +(source 'gnu) -(depends-on "emacs" "24.3") +(depends-on "emacs" "26.1") + +(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 diff --git a/lua-mode.el b/lua-mode.el index be56111..2e1dda5 100644 --- a/lua-mode.el +++ b/lua-mode.el @@ -13,7 +13,7 @@ ;; ;; URL: https://immerrr.github.io/lua-mode ;; Version: 20221027 -;; Package-Requires: ((emacs "24.3")) +;; Package-Requires: ((emacs "26.1")) ;; ;; This file is NOT part of Emacs. ;; From e0f1c8d96847ff1da7cd95ec9fad26acbaed2327 Mon Sep 17 00:00:00 2001 From: Jen-Chieh Shen Date: Sun, 14 Dec 2025 21:14:23 -0800 Subject: [PATCH 3/9] ci: Use eask command --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a213383..6cbc908 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,8 +47,8 @@ jobs: - name: Run tests if: matrix.allow_failure != true - run: 'cask && make test' + run: 'eask && make test' - name: Run tests (allow failure) if: matrix.allow_failure == true - run: 'cask && make test || true' + run: 'eask && make test || true' From e60cf0094365456a0da4bb0db5237c85ce0ef021 Mon Sep 17 00:00:00 2001 From: Jen-Chieh Shen Date: Sun, 14 Dec 2025 21:17:29 -0800 Subject: [PATCH 4/9] ci: Disable fail-fast --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6cbc908..3e0a7d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ on: push jobs: test: strategy: + fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] emacs-version: From ccc95753d3c2f6609cdf8cce79df5530387f4b9b Mon Sep 17 00:00:00 2001 From: "jcs090218@gmail.com" Date: Mon, 15 Dec 2025 13:27:46 +0800 Subject: [PATCH 5/9] ci: Fix sandbox using eask --- .github/workflows/test.yml | 24 +++++++++++++++--------- Eask | 4 ++++ Makefile | 6 ++++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e0a7d3..bdf074a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,16 +14,22 @@ jobs: - '28.2' - '29.4' - '30.2' + experimental: [false] include: - # - emacs_version: 'snapshot' - # os: ubuntu-latest - # allow_failure: true - # - os: macos-latest - # emacs_version: '24.3' + - os: ubuntu-latest + emacs-version: snapshot + experimental: true + - os: macos-latest + emacs-version: snapshot + experimental: true + - os: windows-latest + emacs-version: snapshot + experimental: true + exclude: - os: macos-latest - emacs_version: '25.1' + emacs-version: 26.3 - os: macos-latest - emacs_version: '27.1' + emacs-version: 27.2 runs-on: ${{ matrix.os }} steps: - name: Checkout code @@ -48,8 +54,8 @@ jobs: - name: Run tests if: matrix.allow_failure != true - run: 'eask && make test' + run: 'make test' - name: Run tests (allow failure) if: matrix.allow_failure == true - run: 'eask && make test || true' + run: 'make test || true' diff --git a/Eask b/Eask index efe2ebf..1a65e5a 100644 --- a/Eask +++ b/Eask @@ -13,7 +13,11 @@ (script "test" "echo \"Error: no test specified\" && exit 1") (source 'gnu) +(source 'melpa) (depends-on "emacs" "26.1") +(development + (depends-on "buttercup")) + (setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 diff --git a/Makefile b/Makefile index 25d9308..c551b04 100644 --- a/Makefile +++ b/Makefile @@ -38,10 +38,12 @@ test-uncompiled-noeask: $(EMACS) -batch -l lua-mode.el -l buttercup -f buttercup-run-discover test-compiled: $(LUA_MODE_ELC) - EMACS=$(EMACS) eask exec buttercup -l $(LUA_MODE_ELC) + eask install-deps --dev + eask exec buttercup -l $(LUA_MODE_ELC) test-uncompiled: - EMACS=$(EMACS) eask exec buttercup -l lua-mode.el + eask install-deps --dev + eask exec buttercup -l lua-mode.el tryout: eask exec $(EMACS) -Q -l init-tryout.el test.lua From f054a83e9f1304af857b66ce3125f1ef5d972512 Mon Sep 17 00:00:00 2001 From: "jcs090218@gmail.com" Date: Mon, 15 Dec 2025 14:22:04 +0800 Subject: [PATCH 6/9] ci: Use eask's buttercup command --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c551b04..820baf3 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,11 @@ default: %.elc: %.el $(EMACS_BATCH) -f batch-byte-compile $< -compile: $(LUA_MODE_ELC) +compile: + eask compile dist: - rm -f $(DISTFILE) && \ - git archive --format=zip -o $(DISTFILE) --prefix=lua-mode/ HEAD + eask package .PHONY: test-compiled-noeask test-uncompiled-noeask test-compiled test-uncompiled # check both regular and compiled versions @@ -37,13 +37,15 @@ test-compiled-noeask: $(LUA_MODE_ELC) test-uncompiled-noeask: $(EMACS) -batch -l lua-mode.el -l buttercup -f buttercup-run-discover -test-compiled: $(LUA_MODE_ELC) +test-compiled: eask install-deps --dev - eask exec buttercup -l $(LUA_MODE_ELC) + eask compile + eask test buttercup test-uncompiled: eask install-deps --dev - eask exec buttercup -l lua-mode.el + eask clean elc + eask test buttercup tryout: eask exec $(EMACS) -Q -l init-tryout.el test.lua From 7c61ffae4f7f1e256cd5a384a9d5961953415d7d Mon Sep 17 00:00:00 2001 From: JenChieh Date: Mon, 15 Dec 2025 18:00:21 +0800 Subject: [PATCH 7/9] print verbose --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 820baf3..c829d67 100644 --- a/Makefile +++ b/Makefile @@ -40,12 +40,12 @@ test-uncompiled-noeask: test-compiled: eask install-deps --dev eask compile - eask test buttercup + eask test buttercup --verbose 5 test-uncompiled: eask install-deps --dev eask clean elc - eask test buttercup + eask test buttercup --verbose 5 tryout: eask exec $(EMACS) -Q -l init-tryout.el test.lua From b808d2ba643d1bdb041cdc37560145a9a4eadbba Mon Sep 17 00:00:00 2001 From: JenChieh Date: Mon, 15 Dec 2025 18:41:59 +0800 Subject: [PATCH 8/9] ci: Avoid suffix error on windows --- test/test-indentation.el | 184 ++++++++++++++++++++------------------- 1 file changed, 94 insertions(+), 90 deletions(-) diff --git a/test/test-indentation.el b/test/test-indentation.el index fff9bdd..22abeba 100644 --- a/test/test-indentation.el +++ b/test/test-indentation.el @@ -1,8 +1,8 @@ ;; -*- flycheck-disabled-checkers: (emacs-lisp-checkdoc) ; lexical-binding:t -*- ;; -*- lexical-binding: t -*- (load (concat (file-name-directory (or load-file-name (buffer-file-name) - default-directory)) - "utils.el") nil 'nomessage 'nosuffix) + default-directory)) + "utils.el") nil 'nomessage 'nosuffix) (require 'buttercup) (require 'cl-lib) @@ -10,69 +10,73 @@ (defun lua--get-indentation-test-sections (file-path) (with-temp-buffer - (insert-file-contents-literally file-path) - (hack-local-variables) - (let (results - section-name - (begin (point-min)) - end - cur-str - (next-section-name "start")) - (goto-char (point-min)) - (while next-section-name - ;; Scan towards the next comment or end of file, save the comment as - ;; the name for the section that comes AFTER the current one. - (setq next-section-name - (when (re-search-forward "^--\\(.*\\)" nil 'noerror) (lua--string-trim (match-string-no-properties 1)))) - ;; Record current section bounds and contents - (setq end (if next-section-name (match-beginning 0) (point-max))) - (setq cur-str (lua--string-trim (buffer-substring-no-properties begin end))) - ;; Save current section to be returned - (if (> (length cur-str) 0) - (push (list (or section-name (format "section %d" (1+ (length results)))) - cur-str - file-local-variables-alist) - results)) - ;; Transition to the next iteration of the loop. - (setq section-name next-section-name) - (setq begin (point))) - (nreverse results)))) + (insert-file-contents-literally file-path) + ;; XXX: Avoid error `Local variables entry is missing the suffix' + ;; on Windows with Emacs version lower than 29. + (if (fboundp #'eask-ignore-errors) + (eask-ignore-errors (hack-local-variables)) + (hack-local-variables)) + (let (results + section-name + (begin (point-min)) + end + cur-str + (next-section-name "start")) + (goto-char (point-min)) + (while next-section-name + ;; Scan towards the next comment or end of file, save the comment as + ;; the name for the section that comes AFTER the current one. + (setq next-section-name + (when (re-search-forward "^--\\(.*\\)" nil 'noerror) (lua--string-trim (match-string-no-properties 1)))) + ;; Record current section bounds and contents + (setq end (if next-section-name (match-beginning 0) (point-max))) + (setq cur-str (lua--string-trim (buffer-substring-no-properties begin end))) + ;; Save current section to be returned + (if (> (length cur-str) 0) + (push (list (or section-name (format "section %d" (1+ (length results)))) + cur-str + file-local-variables-alist) + results)) + ;; Transition to the next iteration of the loop. + (setq section-name next-section-name) + (setq begin (point))) + (nreverse results)))) (defun lua--indentation-test-make-it-or-xit-clause (x) (let ((it-or-xit (if (string-match "XFAIL" (car x)) 'xit 'it))) - (eval `(,it-or-xit ,(format "%s" (car x)) - (let ((lua-code ,(cadr x)) - ,@(mapcar (lambda (alist-cons) - (list (car alist-cons) (cdr alist-cons))) - ;; cl-caddr here is to support Emacs<26 that don't have caddr. - (cl-caddr x))) - (expect lua-code :to-be-reindented-the-same-way)))))) + (eval `(,it-or-xit ,(format "%s" (car x)) + (let ((lua-code ,(cadr x)) + ,@(mapcar (lambda (alist-cons) + (list (car alist-cons) (cdr alist-cons))) + ;; cl-caddr here is to support Emacs<26 that don't have caddr. + (cl-caddr x))) + (expect lua-code :to-be-reindented-the-same-way)))))) (let* ((current-path (or load-file-name (buffer-file-name) default-directory)) - (indentation-tests-dir (concat (file-name-directory current-path) "indentation-tests")) - (indentation-tests (directory-files indentation-tests-dir nil ".*\.lua$" 'nosort))) + (indentation-tests-dir (concat (file-name-directory current-path) "indentation-tests")) + (indentation-tests (directory-files indentation-tests-dir nil ".*\.lua$" 'nosort))) (mapcar (lambda (test-file) - (let ((file-path (expand-file-name test-file indentation-tests-dir))) - (describe (format "Indentation test `%s'" test-file) - (mapcar #'lua--indentation-test-make-it-or-xit-clause - (lua--get-indentation-test-sections file-path))))) - indentation-tests)) + (let ((file-path (expand-file-name test-file indentation-tests-dir))) + (describe (format "Indentation test `%s'" test-file) + (mapcar #'lua--indentation-test-make-it-or-xit-clause + (lua--get-indentation-test-sections file-path))))) + indentation-tests)) (describe "Continuation lines" (lua--parametrize-tests (binop) (("+") ("-") ("*") ("/") ("^") ("%") ("..") - ("<") ("<=") (">") (">=") ("==") ("~=") ("and") ("or")) + ("<") ("<=") (">") (">=") ("==") ("~=") ("and") ("or")) :it (format "are indented before/after binary operators: %s" binop) (expect (replace-regexp-in-string "BINOP" binop "\ a = foo BINOP bar" 'fixedcase) - :to-be-reindented-the-same-way) + :to-be-reindented-the-same-way) (expect (replace-regexp-in-string "BINOP" binop "\ a = foo BINOP bar" 'fixedcase) - :to-be-reindented-the-same-way)) + :to-be-reindented-the-same-way)) ) ;; ( @@ -110,112 +114,112 @@ a = foo (describe "Function indentation" (it "indents function call arguments" - (expect "\ + (expect "\ foobar( a, b, c)" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar( a, b, c)" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar( a, b, c )" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar(a, - b, - c)" :to-be-reindented-the-same-way) + b, + c)" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar{ a, b, c }" :to-be-reindented-the-same-way)) (it "indent blocks with lua-indent-nested-block-content-align" - (let ((lua-indent-nested-block-content-align nil)) - (expect "\ + (let ((lua-indent-nested-block-content-align nil)) + (expect "\ call_some_fn( something, { - val = 5, - another = 6, + val = 5, + another = 6, } )" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ local def = { some_very_long_name = { fn = - function() - return true - end + function() + return true + end } }" :to-be-reindented-the-same-way) - )) + )) (it "indent blocks with lua-indent-close-paren-align" - (let ((lua-indent-close-paren-align nil)) - (expect "\ + (let ((lua-indent-close-paren-align nil)) + (expect "\ local foo = setmetatable( { - a = 4, - b = 5, + a = 4, + b = 5, }, { - __index = some_func, + __index = some_func, } )" :to-be-reindented-the-same-way) - )) + )) (it "indents nested tables with alternative block indenting" - (let ((lua-indent-nested-block-content-align nil) + (let ((lua-indent-nested-block-content-align nil) (lua-indent-close-paren-align nil)) - (expect "\ + (expect "\ foobar({ - a, b, c + a, b, c })" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar(a, { - b, - c + b, + c })" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar( a, { - b, - c + b, + c })" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar( a, { - b, - c + b, + c } )" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar(a, { - b, - c + b, + c })" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar(a, { - b, - c + b, + c } )" :to-be-reindented-the-same-way) - (expect "\ + (expect "\ foobar( { - a, - b + a, + b }, c, d )" :to-be-reindented-the-same-way) - ))) + ))) (ert-deftest lua-indentation-keywords-with-special-characters () From fac287cbba5b7585693bdafd3c6f3bb28ddac9b6 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Mon, 15 Dec 2025 18:43:43 +0800 Subject: [PATCH 9/9] ci: Revert verbose flag --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c829d67..820baf3 100644 --- a/Makefile +++ b/Makefile @@ -40,12 +40,12 @@ test-uncompiled-noeask: test-compiled: eask install-deps --dev eask compile - eask test buttercup --verbose 5 + eask test buttercup test-uncompiled: eask install-deps --dev eask clean elc - eask test buttercup --verbose 5 + eask test buttercup tryout: eask exec $(EMACS) -Q -l init-tryout.el test.lua