Skip to content

Commit

Permalink
ci: run .el files against byte-compile-file
Browse files Browse the repository at this point in the history
  • Loading branch information
jtbx committed Aug 7, 2024
1 parent 62dd097 commit 2fd45d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml → .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- name: Run tests
run: just test

- name: Check indentation
run: emacs --script scripts/indent-lisp-files.el
- name: Check .el files
run: emacs --script scripts/check-lisp-files.el

- name: Compare changes
- name: Check indentation
run: git diff --exit-code
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.elc
9 changes: 7 additions & 2 deletions scripts/indent-lisp-files.el → scripts/check-lisp-files.el
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
;;; indent-lisp-files.el --- call `indent-region' over all Lisp files -*- lexical-binding: t; -*-

(require 'bytecomp)
(require 'seq)
(when (version< emacs-version "29.1")
(require 'compat)) ; file-name-parent-directory
Expand All @@ -17,9 +18,13 @@
(files (.el-files-in root-path))
(scripts (.el-files-in (concat root-path "/scripts/"))))
(dolist (file (append files scripts))
(setq
byte-compile-error-on-warn t
indent-tabs-mode nil
lisp-indent-offset 2)
(unless (byte-compile-file file)
(error "byte-compile-file failed (%s)" file))
(with-current-buffer (find-file-noselect file)
(setq indent-tabs-mode nil
lisp-indent-offset 2)
(indent-region (point-min) (point-max))
(save-buffer)
(kill-buffer (current-buffer)))))

0 comments on commit 2fd45d3

Please sign in to comment.