editorconfig / editorconfig-emacs

EditorConfig plugin for Emacs
https://editorconfig.org
GNU General Public License v3.0
748 stars 107 forks source link

editorconfig.el: Hook elsewhere for the coding-system #356

Closed monnier closed 1 month ago

monnier commented 3 months ago

Until now, the file's coding system was set via an advice on insert-file-contents, which depends on being called from within the find-file-noselect advice. While it mostly works, it doesn't account for all the cases (e.g. it fails to be used when doing write-region), is a bit cumbersome, and does not interact well with Emacs's other ways to specify a coding-system, such as auto-coding-alist.

This patch replaces it with an advice on find-auto-coding, so as to integrate better with the rest of Emacs's handling of files' coding systems. An immediate benefit is that we don't need to special case jar and zip files any more because auto-coding-alist does it for us already (and for many more file types like tar, exe, ...).

monnier commented 1 month ago

Yay! Thanks!