I think I have a clear enough idea of how support for Editorconfig should be integrated into Emacs, in terms of "how to hook it to the right places". There are still pending questions about how to adapt the code of the `editorconfig` package, but in the mean time: here's a first step to make sure Emacs offers the right hooks. Find below two patch which do that. The first patch slightly extends `auto-coding-functions` so that it can use the file name to decide which coding system to use. This is a fairly simple change: this clearly the right place to hook ourselves into. I make the change by adding a dynamically scoped `auto-coding-file-name` variable. The resulting API would be cleaner if we instead passed the filename as an additional argument, which we could do easily (even with some amount of backward compatibility), but the change proposed has the advantage of being 100% backward compatible. The cleaner API would replace: (let ((auto-coding-file-name filename)) (funcall (pop funcs) size)) with (let ((fun (pop funcs))) (condition-case nil (funcall fun size filename) (wrong-number-of-arguments (funcall fun size)))) In the long run the cleaner API is probably preferable, but it does come with a slight risk of backward incompatibility. The second patch adds a new hook `hack-dir-local-get-variables-functions`. This one is not as "obvious": there are other places we could hook ourselves into. E.g. it's tempting to hook deeper into the dir-locals machinery so as to reuse its caching mechanism. In the end I decided not to do that because the dir-locals machinery is not prepared to accept settings coming from different levels of the directory tree, so that trying to shoehorn Editorconfig into it would be a bit messy and/or unreliable. The downside is that this hook forces its users to take care of their own caching. But since the current examples all need to do their caching a bit differently, I think this is OK. There's one other design choice I made: `hack-dir-local-get-variables-functions` returns elements of the form (DIR . ALIST) where DIR is used to obey `safe-local-variable-directories' as well as to provide a bit more info to the user when prompting for confirmation in cache of risky settings. But that does not provide any actual info about the actual source of the ALIST, so the message we emit when prompting the user can't tell the user whether the settings come from a `.dir-locals.el` or something else. This is not a new problem: the current code already can't tell the user if the settings come from a `.dir-locals.el`, or a "project class" or a `.dir-locals-2.el`. So, apparently, this is a problem we have not deemed worthwhile to fix, so I left it like unsolved. I'm hoping this can get into Emacs-30. Comments/objections? Stefan