]> git.eshelyaron.com Git - emacs.git/commit
(editorconfig-set-local-variables): Get first, set later
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 10 Jun 2024 20:58:27 +0000 (16:58 -0400)
committerEshel Yaron <me@eshelyaron.com>
Fri, 21 Jun 2024 19:00:08 +0000 (21:00 +0200)
commit218dd7e2448ed89ea4bbf72e151f64719d4dd8b1
treefe872e74dbcef5ecfde420394d1c699d33b6bea8
parent866b4309f291a1fdbafb09d8e43b12aca426242b
(editorconfig-set-local-variables): Get first, set later

In preparation for the use of Emacs-30's
`hack-dir-local-get-variables-functions`, split the job of
`editorconfig-set-local-variables` into getting an alist of settings
and then applying them.

Rename the `editorconfig-set-*` functions to `editorconfig--get-*`
and make them return an alist of settings rather than applying them
(except for `editorconfig-set-coding-system-revert` which arguably
belongs in `editorconfig-tools.el` anyway).

* lisp/editorconfig.el (editorconfig-indentation-alist): Flesh out the doc.
Use the new `editorconfig--get-indentation-*-mode` functions.
(editorconfig--get-indentation-web-mode): New function extracted from
`editorconfig-indentation-alist`.
(editorconfig--get-indentation-*-mode): Don't `boundp`-test the vars.
(editorconfig--default-indent-size-function): New function.
Test `boundp` here.
(editorconfig-indent-size-vars): New var.
(editorconfig--get-indentation, editorconfig--get-trailing-nl): Rewrite.
(editorconfig--add-hook-safe-p): New function.
Add it to the `safe-local-eval-function` property of `add-hook`.
(editorconfig-get-local-variables-functions): New hook.
(editorconfig--get-local-variables): Rewrite using it.
(editorconfig-set-local-variables): Test `editorconfig--should-set` here.
Rewrite it using `editorconfig--get-local-variables`.

(cherry picked from commit f2803456f029f24276901c2b3115965d892a99d0)
lisp/editorconfig.el