Hi,
The feature to strip the trailing spaces in a document at save time is indeed useful but this also affects the lines I didn't write in a file. Since I work a lot with patches, modifying one line in a file may lead to a longer patch because of the white space removal. This makes reviewing the patches on public mailing lists more difficult (and the Linux people might reject the patch, unless one does two separate patches, one for trailing spaces stripping and the other being the real modification).
OTOH, trailing spaces are not accepted on the projects I work, though some files still have them.
My solution (this is actually the behaviour of emacs) is to strip the trailing spaces of a single line when newline is inserted.
See the attached patch. If you don't like to always have this behaviour, could you please consider adding a configuration option?
Thanks.
On Wed, 26 Sep 2007 15:49:25 +0100, "Catalin Marinas" catalin.marinas@gmail.com wrote:
Hi,
The feature to strip the trailing spaces in a document at save time is indeed useful but this also affects the lines I didn't write in a file. Since I work a lot with patches, modifying one line in a file may lead to a longer patch because of the white space removal. This makes reviewing the patches on public mailing lists more difficult (and the Linux people might reject the patch, unless one does two separate patches, one for trailing spaces stripping and the other being the real modification).
OTOH, trailing spaces are not accepted on the projects I work, though some files still have them.
My solution (this is actually the behaviour of emacs) is to strip the trailing spaces of a single line when newline is inserted.
Nice idea. I know the described problem when creating patches on sources where trailing spaces exist. In general, I delete all parts of the patch which are created because of trailing spaces.
Anyway, I would like to add an option. So, the user can decide whether to always get trailing spaces cut off at saving time or on newline. The problem is, sometimes you edit files but don't insert a newline, so the trailing spaces still exist. If you think of this and add and remove the newline to manually invoke the function, all is fine. But I guess there are some people like me, who probably won't think of it ;-).
Regards, Enrico
On 26/09/07 17:22:12, Enrico Tröger wrote:
On Wed, 26 Sep 2007 15:49:25 +0100, "Catalin Marinas" catalin.marinas@gmail.com wrote:
My solution (this is actually the behaviour of emacs) is to strip
the
trailing spaces of a single line when newline is inserted.
This would be great.
The problem is, sometimes you edit files but don't insert a newline, so the trailing spaces still exist. If you think of this and add and remove the newline to manually invoke the function, all is fine. But I guess there are some people like me, who probably won't think of it ;-).
As suggested before, we could also add a 'Strip trailing spaces' command in the Document menu.
Regards, Nick
On 9/26/07, Nick Treleaven nick.treleaven@btinternet.com wrote:
On 26/09/07 17:22:12, Enrico Tröger wrote:
On Wed, 26 Sep 2007 15:49:25 +0100, "Catalin Marinas" catalin.marinas@gmail.com wrote:
My solution (this is actually the behaviour of emacs) is to strip
the
trailing spaces of a single line when newline is inserted.
This would be great.
The problem is, sometimes you edit files but don't insert a newline, so the trailing spaces still exist. If you think of this and add and remove the newline to manually invoke the function, all is fine. But I guess there are some people like me, who probably won't think of it ;-).
As suggested before, we could also add a 'Strip trailing spaces' command in the Document menu.
If I'm understanding Catalin's problem correctly, it sounds like he wants a way to make sure only the part of the code he's changing has the trailing spaces stripped. Seems like it might be simplest to have an item under the Edit menu for "strip trailing spaces in selection" (that is, affect the text that's currently selected).
I don't think this would belong under the Document menu, since it wouldn't affect the entire document as a whole.
Also, if you wanted to strip trailing spaces for the whole doc, and don't have "Prefs --> Files tab --> strip trailing spaces" selected, you could always select-all, then strip-trailing-spaces-in-selection.
---John
On 26/09/2007, John Gabriele jmg3000@gmail.com wrote:
If I'm understanding Catalin's problem correctly, it sounds like he wants a way to make sure only the part of the code he's changing has the trailing spaces stripped. Seems like it might be simplest to have an item under the Edit menu for "strip trailing spaces in selection" (that is, affect the text that's currently selected).
I mainly want _not_ to create new trailing spaces. While I'm pretty careful with lines of code, there is no way in the current geany to avoid the empty lines having spaces due to the automatic indentation. Hence the patch to strip the trailing spaces on the current line when hitting <Enter> (both emacs and vi do this but I try to use geany more and more).
On 26/09/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Wed, 26 Sep 2007 15:49:25 +0100, "Catalin Marinas" catalin.marinas@gmail.com wrote:
My solution (this is actually the behaviour of emacs) is to strip the trailing spaces of a single line when newline is inserted.
Nice idea. I know the described problem when creating patches on sources where trailing spaces exist. In general, I delete all parts of the patch which are created because of trailing spaces.
I use a patch management system (StGIT) to automate the patch maintenance, sending, updating etc. and I have tens of patches. It's a bit more difficult to edit each patch manually.
Anyway, I would like to add an option. So, the user can decide whether to always get trailing spaces cut off at saving time or on newline.
This sounds good.
The problem is, sometimes you edit files but don't insert a newline, so the trailing spaces still exist. If you think of this and add and remove the newline to manually invoke the function, all is fine. But I guess there are some people like me, who probably won't think of it ;-).
I don't really care about trailing spaces on a line I edit, they can stay. As I said in a different e-mail, I do not want to create new trailing spaces. The current newline behaviour is to leave the indentation spaces on empty lines. The simplest fix was the one I sent (and with which I got used from emacs).
On 9/26/07, Catalin Marinas catalin.marinas@gmail.com wrote:
[snip] The current newline behaviour is to leave the indentation spaces on empty lines.
^^^^^
Ah, I see what you mean now. Because of the autoindent.