Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to non-binary writefile() for writing buffer.
The previous commit switched use of writefile() to binary mode so that we could prevent a newline being added to a completely empty buffer. Evidently, however, binary mode has side effects (see #567) so this commit returns to non-binary mode - with a simpler fix for completely empty files. Unfortunately this implementation does not work for noeol files - see the failing test - because writefile() does not take account of 'nofixeol' (unlike :write). This is suboptimal but acceptable because noeol files are not be encountered often. See #567.
- Loading branch information
1d422b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@airblade
Maybe you want to adopt/use this?
https://github.com/neomake/neomake/blob/f528f0683e91faca66a38d69e43e436de56a6777/autoload/neomake/utils.vim#L496-L511
1d422b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blueyed Thanks! I looked at that when I wrote my binary-writefile code. I think my version did the same as neomake's while being a little simpler. I could be wrong though ;)
I reverted it because of a mysterious, still-unidentified side-effect it had (see #567). I would love to find and fix the problem there but I can't reproduce the problem myself.
1d422b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be tested thoroughly in Neomake: https://github.com/neomake/neomake/blob/421b1e1840d5b6b8ca6fa20930e3c6f96d5dcba2/tests/utils.vader#L850-L895
1d422b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had tests too but I still can't reproduce the problem from #567....