-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"charset = utf-8" setting in .editorconfig breaks opening .jar files in emacs #294
Comments
I tried fixing this by customizing editorconfig-exclude-modes, adding the following to custom-set-variables in .emacs:
But I was unable to open .jar files in a project with .editorconfig files even with the editorconfig-exclude-modes setting in a freshly started emacs. |
The editorconfig-exclude-regexps did work for me. I customized editorconfig-exclude-regexps and tried to match buffers ending with .jar:
And after this .jar files opened correctly in a project containing an .editorconfig file. |
I removed both customizations and added a handwritten config in .emacs, and the following also works:
|
Even though I found a config workaround, this probably should be fixed in the way that editorconfig doesn't touch buffers where mode-class is special. For more detail, please see the following comments for an issue I opened for this on emacs (before I knew it was caused by editorconfig): |
This doesn't look right. Do you mean |
>>>> Jen-Chieh Shen ***@***.***>:
This doesn't look right. Do you mean `archive-mode`?
I just picked the leftmost mode in the mode list when opening a .jar file, which is a zip file.
You shouldn't enable `editorconfig-mode` in the archive-mode, that's why you are getting those error?
I haven't enabled editorconfig-mode in archive-mode. At least not explicitly.
I had an .editorconfig file on a maven project and tried opening a .jar
file in a target directory in that project, and that failed because of
the .editorconfig charset setting (found by first bisecting my config to
find that this was caused by editorconfig, and then bisecting the
.editorconfig file to find out what setting caused it).
Anyway: see this message in the thread with the links to messages in
the emacs-help mailing list, for what the emacs maintainers (at least
one of them is) thinks is the way editorconfig-mode should see to stay
away from buffers like this (editorconfig shouldn't touch buffers where
mode-class is special):
#294 (comment)
|
Wed 3 Jul 2024 00:33:50 BST I've just run into this problem with [*.{zip,jar}]
charset = unset Neither (setq editorconfig-exclude-modes '(archive-mode)) nor (setq editorconfig-exclude-regexps '("\\.jar$" "\\.zip$")) worked for me. versions:editorconfig: Melpa: 20240604.602 |
@rprimus Anyway I fixed the regression, so please try the latest version and comment if the problem still persists. |
.jar files in Java projects are actually .zip files, which emacs can open natively.
If I have a project with an .editorconfig file, like e.g. this project: https://github.com/steinarb/modelstore
and then builds that project with "mvn clean install"
and then tries opening the jar files in the modelstore/modelstore.services/target/ directory they fail to open correctly:
https://www.bang.priv.no/screenshots/Screenshot%20at%202023-04-03%2007-27-13.png
I bisected my .emacs and found that the offending config was the following in my ~/.emacs:
Removing the above config caused jar files to open correctly in .emacs, which BTW looks like this:
https://www.bang.priv.no/screenshots/Screenshot%20at%202023-04-03%2007-54-54.png
Removing the .editorconfig from the project also made .jar files open correctly in .emacs, so I bisected the .editorconfig file and found that the offending line was
Removing that line from a project's .editorconfig made .jar files open correctly
The text was updated successfully, but these errors were encountered: