implf · 2022-02-07 11:38
When I save buffer in Doom Emacs, it automatically deletes trailing newlines. I think `doom/delete-trailing-newlines` is called on each save. But I couldn't figure out how to disable this functionality
__nautilus__ · 2022-02-07 13:57
I’m not at my computer so I can’t verify, but turning off `ws-butler-mode` has worked for me to prevent cleaning up of extra whitespace at the end of lines. It may also be what’s cleaning up the end of the file, but not sure.
northWe5t · 2022-02-07 14:53
Why do you want trailing new lines?
cazzipropri · 2022-02-07 16:09
Redefine that function to do nothing.
acadian_cajun · 2022-02-07 18:12
This was a mild nuissance to me because I was accidentally disagreeing with my team's IDEs about whitespace for every file I touched.
Sure it's tidier to get rid of whitespace, but it's just so far below the line of things that I care about, compared simpler git diffs.
implf · 2022-02-07 18:54
Really thank you, it worked, this was frustrating me
implf · 2022-02-07 18:56
Thanks for suggestion. This could be little hack for achieving result, but solution by u/__nautilus__ is better
cazzipropri · 2022-02-07 19:08
I don't think that his solution works, though.
Look at how delete-trailing-newlines is implemented:
`(defun doom/delete-trailing-newlines ()`
`(interactive)`
`(save-excursion`
`(goto-char (point-max))`
`(delete-blank-lines)))`
it invokes directly delete-blank-lines, from simple.el.
It does not seem to involve ws-butler in any way.
implf · 2022-02-07 19:18
I tried that solution with `M-x` `ws-butler-mode`, and that worked as expected. But actually, I'm not sure how to disable it in my config file
implf · 2022-02-07 20:00
Finally, I solved this problem by adding `(remove-hook 'doom-first-buffer-hook #'ws-butler-global-mode)` to my config file.
ThockiestBoard · 2022-02-07 20:04
Same for me. If whitespace changes are warranted I’d rather do a separate commit then have it interleaved with any non-superficial changes.
[deleted] · 2022-04-12 12:52
[deleted]