diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0c1753f..fd734e8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: Emacs Tests +name: Test .el files on: push: @@ -12,11 +12,10 @@ jobs: - name: Checkout source uses: actions/checkout@v3 - - name: Download Emacs25 package - run: wget http://mirrors.kernel.org/ubuntu/pool/main/e/emacs25/emacs25-nox_25.2+1-6_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/e/emacs25/emacs25-bin-common_25.2+1-6_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/e/emacs25/emacs25-common_25.2+1-6_all.deb http://mirrors.kernel.org/ubuntu/pool/main/e/emacsen-common/emacsen-common_2.0.8_all.deb - - - name: Install Emacs - run: sudo apt-get install --allow-downgrades ./emacs25-nox_25.2+1-6_amd64.deb ./emacs25-bin-common_25.2+1-6_amd64.deb ./emacs25-common_25.2+1-6_all.deb ./emacsen-common_2.0.8_all.deb + - name: Install Emacs 25 + run: | + wget http://mirrors.kernel.org/ubuntu/pool/main/e/emacs25/emacs25-nox_25.2+1-6_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/e/emacs25/emacs25-bin-common_25.2+1-6_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/e/emacs25/emacs25-common_25.2+1-6_all.deb http://mirrors.kernel.org/ubuntu/pool/main/e/emacsen-common/emacsen-common_2.0.8_all.deb http://mirrors.kernel.org/ubuntu/pool/universe/c/compat-el/elpa-compat_29.1.4.4+dfsg-1_all.deb + sudo apt-get install --allow-downgrades ./emacs25-nox_25.2+1-6_amd64.deb ./emacs25-bin-common_25.2+1-6_amd64.deb ./emacs25-common_25.2+1-6_all.deb ./emacsen-common_2.0.8_all.deb ./elpa-compat_29.1.4.4+dfsg-1_all.deb - name: Install Just uses: extractions/setup-just@v1 @@ -27,3 +26,9 @@ jobs: - name: Run tests run: just test + + - name: Check indentation + run: emacs --script scripts/indent-lisp-files.el + + - name: Compare changes + run: git diff --exit-code diff --git a/scripts/indent-lisp-files.el b/scripts/indent-lisp-files.el new file mode 100644 index 0000000..4a275c6 --- /dev/null +++ b/scripts/indent-lisp-files.el @@ -0,0 +1,22 @@ +;;; indent-lisp-files.el --- call `indent-region' over all Lisp files -*- lexical-binding: t; -*- + +(require 'seq) +(when (version< emacs-version "29.1") + (require 'compat)) ; file-name-parent-directory + +(defun .el-files-in (directory) + (seq-filter #'(lambda (path) (string-match "^.+\\.el$" path)) + (directory-files directory))) + +(let* + ((root-path (file-name-parent-directory + (file-name-parent-directory load-file-name))) + (files (.el-files-in root-path)) + (scripts (.el-files-in (concat root-path "/scripts")))) + (dolist (file (append files scripts)) + (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)))))