emacs-oob-reboot
emacs-oob-reboot copied to clipboard
Handle whitespace cleanup more intelligently
Cleaning up all the trailing whitespace in a buffer might not be a good default, mostly because of the reason pointed out in https://github.com/lewang/ws-butler:
Then I got a job working on a code base where no one else trimmed spaces, so my commits became super noisy.
Maybe ws-butler mode could be installed and enabled instead of a delete-trailing-whitespace hook?
Is ws-butler-mode in ELPA?
A default using packages from MELPA probably won't get accepted.
Unfortunately not. Still, I'd prefer no cleanup rather than really intrusive cleanup as most people working on whitespace codebases would. eg Eclipse tends to leave a lot of whitespace around so collaboration with Eclipse users would be a pain.
The easiest way to get people to clean up their extra whitespace is enabling show-trailing-whitespace
from both prog-mode-hook
and text-mode-hook
. The only downside of that is that it makes redisplay a bit slower.
I think show-trailing-whitespace
is a dubious default for much the same reason that trimming all trailing whitespace upon saving is a bad idea: As soon as you work on a version-controlled file where someone else has committed trailing whitespace, these supposedly helpful settings just generate unwanted noise.
ws-trim and ws-butler are the two libraries I know of which deal with the problem properly, and I think ws-trim might be a little too aggressive to use by default. I don't think either of them are in GNU ELPA in any case.
@phil-s On the other hand, it would promote good practices in that team. It's also pretty straightforward to disable.
With that being said, I don't recall any editor/IDE that I've used showing trailing whitespaces and/or blank lines by default.
@phil-s Disagree. Deleting trailing whitespace is better for use with git
(and in general, IMO) and some other editors by default clean this up.
@ssunday can't agree with you more.... languages like python even gets faulty with unwanted whitespaces. Even elisp with whitespaces gives you a warning with Flycheck. Definitely need this.
I would consider showing whitespaces. Deleting is way to intrusive (and opinionated) in my opinion, same thing for newline at the end of files.
I used to have the setting to auto-delete whitespace on my Emacs, until I started having to deal with conflicts on almost all merges on a really whitespace-dirty (python) codebase. Definitely not a good standard.
A default causing merge conflicts in a popular language is not good. We should definitely avoid that.
I never thought about Refactoring dirty code-base actually that's my in-experience. But I will definitely have it on when I am starting something new.
Emacs shouldn't be annoying to new users or create extra work for them by default, so cleaning up whitespace shouldn't be enabled by default. Highlighting trailing whitespace would be okay, but maybe still not a good idea.
What would definitely be a good idea would be to mention these modes (the best one, whichever it may be) in a short-and-sweet "recommended addons" list that's linked on the startup screen.
If we are adding Flycheck then trailing whitespace will be automatically highlighted as a warning.
If we are adding Flycheck then trailing whitespace will be automatically highlighted as a warning.
In which flycheck modes? I've never noticed that.
In Python and elisp. But I could check for other modes too.
Emacs shouldn't be annoying to new users or create extra work for them by default, so cleaning up whitespace shouldn't be enabled by default. Highlighting trailing whitespace would be okay, but maybe still not a good idea.
Totally agreed.
If we are adding Flycheck then trailing whitespace will be automatically highlighted as a warning.
Let's not assume flycheck gets added right yet. For now it's a MELPA package, and those are a no go.
In which flycheck modes? I've never noticed that.
Indeed. This is mode-specific behaviour, so it doesn't really solve any whitespace-problem specifically, only incidentally at best. With a MELPA-package we can't use.
I guess now that this has shown to be such a contentious issue, maybe we should just revert auto-cleanup of whitespace. Anyone strongly against such a decision?
I agree, for the revert
On Sat, May 13, 2017, 3:15 PM Jostein Kjønigsen [email protected] wrote:
Emacs shouldn't be annoying to new users or create extra work for them by default, so cleaning up whitespace shouldn't be enabled by default. Highlighting trailing whitespace would be okay, but maybe still not a good idea.
Totally agreed.
If we are adding Flycheck then trailing whitespace will be automatically highlighted as a warning.
Let's not assume flycheck gets added right yet. For now it's a MELPA package, and those are a no go.
In which flycheck modes? I've never noticed that.
Indeed. This is mode-specific behaviour, so it doesn't really solve any whitespace-problem specifically, only incidentally at best. With a MELPA-package we can't use.
I guess now that this has shown to be such a contentious issue, maybe we should just revert auto-cleanup of whitespace. Anyone strongly against such a decision?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/josteink/emacs-oob-reboot/issues/19#issuecomment-301268891, or mute the thread https://github.com/notifications/unsubscribe-auth/AMUYO2ihEDbzGJDrDtE3GmtHZ39Gl8Azks5r5gE-gaJpZM4NSpLh .
I also agree with removing this. Although I use it myself, there are corner cases where whitespace is significant, and it would be puzzling and frustrating if emacs is silently deleting it.
I would support showing whitespace by default. Whitespace is significant in many languages, and being able to visualize whitespace characters (particularly if we can differentiate between tabs and spaces) is helpful.
@alandmoore
Whitespace is significant in many languages, and being able to visualize whitespace characters (particularly if we can differentiate between tabs and spaces) is helpful.
But that would look messy thou....and remember we are only removing trailing white space, which is never useful in any ways I think, but it will mess with version control thou, which is why we are removing it.
I think recent changes to Emacs (eglot, tree-sitter, etc) has helped make Emacs much more usable OOB. Considering repo-purpose obsolete.
Closing all issues and archiving repo. Thanks to all contributors!