43 changes: 34 additions & 9 deletions .github/workflows/build.yaml
@@ -1,4 +1,3 @@
---
name: build

on:
Expand All @@ -12,30 +11,56 @@ on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
emacs_version:
- "24.5"
- "25.3"
- "26.3"
- "27.2"
- "28.2"
- "29.1"
experimental: [false]
include:
- emacs_version: snapshot
- os: ubuntu-latest
emacs_version: snapshot
experimental: true
- os: macos-latest
emacs_version: snapshot
experimental: true
# 2023/8/2 Recently this test always fails
# so remove this until it works
# - os: windows-latest
# emacs_version: snapshot
# experimental: true
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Emacs
uses: purcell/setup-emacs@master
uses: jcs090218/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}
- name: Run tests
run: make check

- uses: emacs-eask/setup-eask@master
with:
version: 'snapshot'

- name: Run tests (Unix)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: make check-unix

- name: Run tests (Windows)
if: matrix.os == 'windows-latest'
run: make check-dos
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,11 @@
\#*
.\#*
*.autosave

# eask packages
.eask/
dist/

# packaging
*-autoloads.el
*-pkg.el
48 changes: 47 additions & 1 deletion CHANGELOG.md
Expand Up @@ -20,6 +20,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security


## [0.10.1]

### Fixed

- Fix when-let (again) ([#305])
- Fix compile warning of python-mode offset ([#306])


## [0.10.0] - 2023-05-07

### Added

- Enable indentation for tree-sitter based typescript mode ([#282])
- Add support for json-ts-mode ([#283])
- Add support for some treesit modes ([#287])
- Add indent variable associations for numerous tree-sitter modes ([#290])
- Add js-ts-mode' spec to editorconfig-indentation-alist' ([#293])
- Add bash-ts-mode to editorconfig-indentation-alist ([#296])
- Add support for gdscript-mode ([#300])

### Changed

- Drop Emacs 24.x and 25.x ([#286])

### Fixed

- Fix write-file-functions default value ([#295])
- Check mode-class property for special modes ([#301])
- Load subr-x when compiling ([#302])


## [0.9.1] - 2022-11-07

### Fixed
Expand Down Expand Up @@ -241,7 +272,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
*Undocumented*


[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.1...HEAD
[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.10.1...HEAD
[0.10.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.1...v0.10.0
[0.9.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.2...v0.9.0
[0.8.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.1...v0.8.2
Expand Down Expand Up @@ -270,6 +303,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3
[0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2
[0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1
[#306]: https://github.com/editorconfig/editorconfig-emacs/issues/306
[#305]: https://github.com/editorconfig/editorconfig-emacs/issues/305
[#302]: https://github.com/editorconfig/editorconfig-emacs/issues/302
[#301]: https://github.com/editorconfig/editorconfig-emacs/issues/301
[#300]: https://github.com/editorconfig/editorconfig-emacs/issues/300
[#296]: https://github.com/editorconfig/editorconfig-emacs/issues/296
[#295]: https://github.com/editorconfig/editorconfig-emacs/issues/295
[#293]: https://github.com/editorconfig/editorconfig-emacs/issues/293
[#290]: https://github.com/editorconfig/editorconfig-emacs/issues/290
[#287]: https://github.com/editorconfig/editorconfig-emacs/issues/287
[#286]: https://github.com/editorconfig/editorconfig-emacs/issues/286
[#283]: https://github.com/editorconfig/editorconfig-emacs/issues/283
[#282]: https://github.com/editorconfig/editorconfig-emacs/issues/282
[#280]: https://github.com/editorconfig/editorconfig-emacs/issues/280
[#263]: https://github.com/editorconfig/editorconfig-emacs/issues/263
[#260]: https://github.com/editorconfig/editorconfig-emacs/issues/260
Expand Down
20 changes: 20 additions & 0 deletions Eask
@@ -0,0 +1,20 @@
(package "editorconfig"
"0.10.1"
"EditorConfig Emacs Plugin")

(website-url "https://github.com/editorconfig/editorconfig-emacs#readme")
(keywords "convenience" "editorconfig")

(package-file "editorconfig.el")

(files "editorconfig-*.el")

(script "test" "echo \"Error: no test specified\" && exit 1")

(source "gnu")
(source "melpa")

(depends-on "emacs" "26.1")
(depends-on "nadvice")

(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432
18 changes: 12 additions & 6 deletions Makefile
Expand Up @@ -3,6 +3,7 @@
TEXI_CHAPTER := EditorConfig Emacs Plugin

EMACS = emacs
EASK = eask
PANDOC = pandoc
AWK = awk

Expand All @@ -16,21 +17,26 @@ MAIN_SRC = editorconfig.el
SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el)
OBJS = $(SRCS:.el=.elc)

.PHONY: check \
.PHONY: check-unix check-dos \
compile clean \
test test-ert test-core \
sandbox doc

check: compile test
# CI entry
check-unix: package install compile test
check-dos: package install compile test-ert

package:
$(EASK) package

compile: $(OBJS)
install:
$(EASK) install

$(OBJS): %.elc: %.el
$(EMACS) $(BATCHFLAGS) -f batch-byte-compile $^
compile:
$(EASK) compile

clean:
-rm -f $(OBJS)
$(EASK) clean elc


doc: doc/editorconfig.texi
Expand Down
51 changes: 18 additions & 33 deletions README.md
Expand Up @@ -3,15 +3,12 @@
[![MELPA Stable](https://stable.melpa.org/packages/editorconfig-badge.svg)](https://stable.melpa.org/#/editorconfig)
[![NonGNU ELPA](http://elpa.nongnu.org/nongnu/editorconfig.svg)](http://elpa.nongnu.org/nongnu/editorconfig.html)


# EditorConfig Emacs Plugin

This is an [EditorConfig][] plugin for [Emacs][].


## Getting Started


### package.el

This package is available from [MELPA][], [MELPA Stable][] and [NonGNU ELPA][].
Expand All @@ -26,7 +23,6 @@ all other configurations are optional.
This mode sets up hooks so that EditorConfig properties will be
loaded and applied to the new buffers automatically when visiting files.


### use-package

If you use [**use-package**][use-package], add the following to your
Expand All @@ -39,7 +35,6 @@ If you use [**use-package**][use-package], add the following to your
(editorconfig-mode 1))
```


### Manual installation

Copy all `.el` files in this repository to `~/.emacs.d/lisp` and add the
Expand All @@ -51,8 +46,6 @@ following:
(editorconfig-mode 1)
```



## Supported properties

Current Emacs plugin coverage for EditorConfig's [properties][]:
Expand All @@ -64,16 +57,16 @@ Current Emacs plugin coverage for EditorConfig's [properties][]:
* `charset`
* `trim_trailing_whitespace`
* `insert_final_newline = true` is supported
* <del>`insert_final_newline = false`</del> is not enforced
* ~~`insert_final_newline = false`~~ is not enforced
(as in trailing newlines actually being removed automagically),
we just buffer-locally override any preferences that would auto-add them
to files `.editorconfig` marks as trailing-newline-free
* `max_line_length`
* <del>`file_type_ext` (Experimental)</del> (See below)
* <del>`file_type_emacs` (Experimental)</del> (See below)
* ~~`file_type_ext` (Experimental)~~ (See below)
* ~~`file_type_emacs` (Experimental)~~ (See below)
* `root` (only used by EditorConfig core)

Not yet covered properties marked with <del>over-strike</del>
Not yet covered properties marked with ~~over-strike~~
– pull requests implementing missing features warmly welcomed!
Typically, you will want to tie these to native functionality,
or the configuration of existing packages handling the feature.
Expand All @@ -82,24 +75,20 @@ As several packages have their own handling of, say, indentation,
we might not yet cover some mode you use, but we try to add the
ones that show up on our radar.



### <del>File Type (file_type_ext, file_type_emacs)</del>
### ~~File Type (file_type_ext, file_type_emacs)~~

File-type feature is currently disabled, because this package is now undergoing
big internal refactoring.
For those who want this functionality,
please consider using [editorconfig-custom-majormode](https://github.com/10sr/editorconfig-custom-majormode-el).


## Customize

`editorconfig-emacs` provides some customize variables.

Here are some of these variables: for the full list of available variables,
type <kbd>M-x customize-group [RET] editorconfig [RET]</kbd>.


### `editorconfig-trim-whitespaces-mode`

Buffer local minor-mode to use to trim trailing whitespaces.
Expand All @@ -118,7 +107,6 @@ init.el:
'ws-butler-mode)
```


### `editorconfig-after-apply-functions`

(Formerly `editorconfig-custom-hooks`)
Expand All @@ -135,8 +123,6 @@ only blocks of `web-mode` by adding following to your init.el:
(lambda (props) (setq web-mode-block-padding 0)))
```



## Troubleshooting

Enabling `editorconfig-mode` should be enough for normal cases.
Expand All @@ -149,8 +135,6 @@ loaded for current buffer.
You can check if EditorConfig properties were not read for buffers at all,
or they were loaded but did not take effect for some other reasons.



### Indentation for new major-modes

Because most Emacs major-modes have their own indentation settings, this plugin
Expand All @@ -164,7 +148,6 @@ Please feel free to submit issue or pull-request for such major-mode!
Supported major-modes and their indentation configs are defined in the variable
`editorconfig-indentation-alist`.


### Not work at all for FOO-mode!

Most cases properties are loaded just after visiting files when
Expand All @@ -176,7 +159,6 @@ Typically it will occur when the major-mode is not defined using
`define-derived-mode` (`rpm-spec-mode` is an example for this).
Please feel free to submit issues if you find such modes!


### `editorconfig-format-buffer` does not work well with lsp-mode

By default, [lsp-mode][] configures indent-region-function so that Emacs uses
Expand All @@ -187,28 +169,31 @@ themselves support loading configs from `.editorconfig`.

To avoid this behavior ad-hocly, set `lsp-enable-indentation` to nil.



## Submitting Bugs and Feature Requests

Bugs, feature requests, and other issues should be submitted to the issue
tracker: https://github.com/editorconfig/editorconfig-emacs/issues


### Development

Make and [CMake][] must be installed to run the tests
locally:
To run the test locally, you will need the following tools:

$ make check
- Make
- [CMake][]
- [Eask][]

To start a new Emacs process with current `*.el` and without loading user init
file, run:
If you are on `Linux` or `macOS`:

$ make sandbox
$ make check-unix

On `Windows`:

$ make check-dos

To start a new Emacs process with current `*.el` and without loading user init
file, run:

$ make sandbox

## License

Expand All @@ -226,7 +211,6 @@ You should have received a copy of the GNU General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.



[Emacs]: https://www.gnu.org/software/emacs/
[MELPA]: https://melpa.org/#/editorconfig
[MELPA Stable]: https://stable.melpa.org/#/editorconfig
Expand All @@ -236,4 +220,5 @@ with this program. If not, see <https://www.gnu.org/licenses/>.
[EditorConfig C Core]: https://github.com/editorconfig/editorconfig-core-c
[properties]: https://editorconfig.org/#supported-properties
[CMake]: https://cmake.org
[Eask]: https://github.com/emacs-eask/cli
[lsp-mode]: https://github.com/emacs-lsp/lsp-mode