branch: scratch/editorconfig-cc
commit 2171e0073897ce7dbf8ae3490d62aa6cb2f36d77
Author: 10sr <[email protected]>
Commit: Stefan Monnier <[email protected]>
Remove editorconfig-mode legacy version (#304)
* Remove switch to use legacy version
Remove `editorconfig--lagacy-version` variable.
* Update CHANGELOG
---
CHANGELOG.md | 4 ++++
editorconfig.el | 58 +++++++++++++++++++--------------------------------------
2 files changed, 23 insertions(+), 39 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01134c4b89..69fd964461 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Remove editorconfig-mode legacy version ([#304])
+ - Remove flag `editorconfig--legacy-version`, which was defined in [#263]
+
### Deprecated
### Removed
@@ -300,6 +303,7 @@ and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0
[0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3
[0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2
[0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1
+[#304]: https://github.com/editorconfig/editorconfig-emacs/issues/304
[#306]: https://github.com/editorconfig/editorconfig-emacs/issues/306
[#305]: https://github.com/editorconfig/editorconfig-emacs/issues/305
[#302]: https://github.com/editorconfig/editorconfig-emacs/issues/302
diff --git a/editorconfig.el b/editorconfig.el
index c884db4bdb..76c0fd9a3e 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -748,11 +748,6 @@ F is that function, and FILENAME and ARGS are arguments
passed to F."
(format "Error while setting variables from
EditorConfig: %S" err))))
ret))
-(defvar editorconfig--legacy-version nil
- "Use legacy version of editorconfig-mode.
-
-As of 2021/08/30, `editorconfig-mode' uses totally new implementation by
default.
-This flag disables this and go back to previous version.")
;;;###autoload
(define-minor-mode editorconfig-mode
@@ -762,41 +757,26 @@ To disable EditorConfig in some buffers, modify
`editorconfig-exclude-modes' or `editorconfig-exclude-regexps'."
:global t
:lighter editorconfig-mode-lighter
- (if (not editorconfig--legacy-version)
- (let ((modehooks '(prog-mode-hook
- text-mode-hook
- read-only-mode-hook
- ;; Some modes call `kill-all-local-variables' in
their init
- ;; code, which clears some values set by editorconfig.
- ;; For those modes, editorconfig-apply need to be
called
- ;; explicitly through their hooks.
- rpm-spec-mode-hook)))
- (if editorconfig-mode
- (progn
- (advice-add 'find-file-noselect :around
'editorconfig--advice-find-file-noselect)
- (advice-add 'insert-file-contents :around
'editorconfig--advice-insert-file-contents)
- (dolist (hook modehooks)
- (add-hook hook
- 'editorconfig-major-mode-hook
- t)))
- (advice-remove 'find-file-noselect
'editorconfig--advice-find-file-noselect)
- (advice-remove 'insert-file-contents
'editorconfig--advice-insert-file-contents)
+ (let ((modehooks '(prog-mode-hook
+ text-mode-hook
+ read-only-mode-hook
+ ;; Some modes call `kill-all-local-variables' in their
init
+ ;; code, which clears some values set by editorconfig.
+ ;; For those modes, editorconfig-apply need to be called
+ ;; explicitly through their hooks.
+ rpm-spec-mode-hook)))
+ (if editorconfig-mode
+ (progn
+ (advice-add 'find-file-noselect :around
'editorconfig--advice-find-file-noselect)
+ (advice-add 'insert-file-contents :around
'editorconfig--advice-insert-file-contents)
(dolist (hook modehooks)
- (remove-hook hook 'editorconfig-major-mode-hook))))
-
- ;; editorconfig--legacy-version is enabled
- ;; See https://github.com/editorconfig/editorconfig-emacs/issues/141 for
why
- ;; not `after-change-major-mode-hook'
- (dolist (hook '(change-major-mode-after-body-hook
- read-only-mode-hook
- ;; Some modes call `kill-all-local-variables' in their init
- ;; code, which clears some values set by editorconfig.
- ;; For those modes, editorconfig-apply need to be called
- ;; explicitly through their hooks.
- rpm-spec-mode-hook))
- (if editorconfig-mode
- (add-hook hook 'editorconfig-mode-apply)
- (remove-hook hook 'editorconfig-mode-apply)))))
+ (add-hook hook
+ 'editorconfig-major-mode-hook
+ t)))
+ (advice-remove 'find-file-noselect
'editorconfig--advice-find-file-noselect)
+ (advice-remove 'insert-file-contents
'editorconfig--advice-insert-file-contents)
+ (dolist (hook modehooks)
+ (remove-hook hook 'editorconfig-major-mode-hook)))))
;; Tools