On Wed, Mar 02, 2022 at 09:47:31AM +0100, Omar Polo wrote: > Hello tech, > > mg(1) has this tendency to leave a lot of trailing whitespaces around in > auto-indent-mode and c-mode which I find annoying. Yes, there's > delete-trailing-space but it works only on the current line (and not the > whole buffer as in emacs) and one has to manually call it anyway. > Emacs, and even vi in base, are clever in this regard: trailing > whitespaces before the cursor are delete upon RET before adding a new > line. > > So, here's the same heuristic for mg when auto-indent-mode or c-mode is > enabled. It's still possible to leave trailing whitespace in a buffer > in those modes, it only gets a little bit harder to do. > > (as a next step I guess we could also garbage collect cc_strip_trailp, > it was used in only one place before this patch and is unconditionally > set to TRUE.) > > Thoughts/OK?
I've tested the patch and it works as intended. I like new behavior for c-mode, but not sure if it is good for auto-indent one. If user presses <tab> and then <enter> I'd argue that removing first tab is good idea in this particular mode, but no hard objections, since I don't use auto-indent.
