]> git.eshelyaron.com Git - emacs.git/commit
lisp/editorconfig: Advise `find-auto-coding` i.s.o `insert-file-contents`
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 18 Jun 2024 03:25:52 +0000 (23:25 -0400)
committerEshel Yaron <me@eshelyaron.com>
Fri, 21 Jun 2024 19:00:12 +0000 (21:00 +0200)
commit9168e30613b5275d02907dd414982124cde277a1
tree95d59ca2129786483f9bdc0eb23cd507054e7302
parent59bd7c7ea3636100d0984134a0cf7815ddcdc7c2
lisp/editorconfig: Advise `find-auto-coding` i.s.o `insert-file-contents`

In Emacs<30, we can't use `auto-coding-functions`, but we can get
almost the same result by advising `find-auto-coding`.

* lisp/editorconfig.el (editorconfig-merge-coding-systems): Return nil
if there's no setting.  Don't merge if there's no need.
(editorconfig-set-coding-system-revert); Adjust accordingly.
(editorconfig--filename-codingsystem-hash): Delete var.
(editorconfig--advice-insert-file-contents): Delete function.
(editorconfig--advice-find-file-noselect); Simplify.
(editorconfig--advice-find-auto-coding): New function.
(editorconfig-mode): Use it.

(cherry picked from commit 0b3e688b230607b0c8571b604621b34860ebccea)
lisp/editorconfig.el