refactor(editorconfig): remove unused advice

editorconfig-call-editorconfig-exec was renamed+redesigned upstream. The
advice can no longer be trivially repurposed, so I'm removing it.

Ref: editorconfig/editorconfig-emacs@f8f1a899df
This commit is contained in:
Henrik Lissner 2024-03-11 00:26:19 -04:00 committed by Yann Esposito (Yogsototh)
parent 8d9e0e8e23
commit c2432ab139
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -1,21 +1,5 @@
;;; tools/editorconfig/config.el -*- lexical-binding: t; -*-
;; editorconfig cannot procure the correct settings for extension-less files.
;; Executable scripts with a shebang line, for example. So why not use Emacs'
;; major mode to drop editorconfig a hint? This is accomplished by temporarily
;; appending an extension to `buffer-file-name' when we talk to editorconfig.
(defvar +editorconfig-mode-alist
'((emacs-lisp-mode . "el")
(js2-mode . "js")
(perl-mode . "pl")
(php-mode . "php")
(python-mode . "py")
(ruby-mode . "rb")
(sh-mode . "sh"))
"An alist mapping major modes to extensions. Used by
`doom--editorconfig-smart-detection-a' to give editorconfig filetype hints.")
;; Handles whitespace (tabs/spaces) settings externally. This way projects can
;; specify their own formatting rules.
(use-package! editorconfig
@ -30,20 +14,6 @@
(add-to-list 'editorconfig-exclude-regexps
"\\.\\(zip\\|\\(doc\\|xls\\|ppt\\)x\\)\\'")
(defadvice! +editorconfig--smart-detection-a (fn)
"Retrieve the properties for the current file. If it doesn't have an
extension, try to guess one."
:around #'editorconfig-call-editorconfig-exec
(let ((buffer-file-name
(if (and (not (bound-and-true-p org-src-mode))
(file-name-extension buffer-file-name))
buffer-file-name
(format "%s%s" (buffer-file-name (buffer-base-buffer))
(if-let (ext (alist-get major-mode +editorconfig-mode-alist))
(concat "." ext)
"")))))
(funcall fn)))
(add-hook! 'editorconfig-after-apply-functions
(defun +editorconfig-disable-indent-detection-h (props)
"Inhibit `dtrt-indent' if an explicit indent_style and indent_size is