Remove final newlines when insert_final_newline = false
https://github.com/editorconfig/editorconfig-emacs/blob/648f0cf9aeb72db77b252832a58367332b7bc055/editorconfig.el#L592-L606
Creating a tracking issue for the known FIXME.
I'm thinking a local before-save hook could address this? ~~It'd be a little hacky, but it may work.~~ Looks like that's exactly what editorconfig-set-trailing-ws does. I'll prep a patch.
Creating a tracking issue for the known FIXME.
I'm not sure it's really what we want.
To me, "require_final_newline = false" means literally that a final newline is merely "not required". It doesn't mean it's harmful.
require_final_newline is important because plain-text files whose last
line does not end with LF have been known to be mis-handled by many
tools. In contrast AFAIK removing an "unnecessary final newline" has
never been necessary, it' merely a question of convention of preference.
"require_final_newline = false" can also be used for files where every byte counts, i.e. where the presence or absence of a terminating newline needs to be reserved.
It's not really up to us to determine what this key should do. From the site:
insert_final_newline: set totrueto ensure file ends with a newline when saving andfalseto ensure it doesn't.
It's in the spec.
To be clear, I'm working on getting this project to switch their style for all the reasons you cite, but we should adhere to the spec regardless.
To be clear, I'm working on getting this project to switch their style for all the reasons you cite, but we should adhere to the spec regardless.
I'm known to disagree already on other parts of the spec, and to disagree with "adhere to the spec regardless". 🙂
We can leave the last line as it is by setting "require_final_newline = unset" (or simply removing this property from .editorconfig).
I agree that it's natural to think that setting "require_final_newline = false" doesn't explicitly remove the final newline, but editorconfig spec defines actually it does. And changing this would require discussion with editorconfig plugin maintainers of other editors...