[Geany-Users] Possible unintentional behavior when stripping trailing spaces and tabs

Little Girl littlergirl at xxxxx
Sun Sep 3 23:40:00 UTC 2017

Hey there,

John Yeung wrote:

> It's working as intended.

I figured as much. It was worth asking, though.
> When people say "trailing" they usually mean "at the end of the
> line". And certainly if a line only has whitespace, then ALL of the
> whitespace on that line should be considered BOTH leading AND
> trailing.

This was where there were shades of grey since it's then at the

> Philosophically, if you consider a "saved file" as a finished
> product, then it makes sense that there would be no lines with only
> whitespace.

A saved file can be in an unfinished state if you intend to continue
to work on it later. I often do this.

Another type of saved file can be considered finished when you create
it as a template, but unfinished when you use it as a template for
whatever it is you're creating with it. I often do this. As an
example, I create a template that has specific levels of indentation.
I decide I want the cursor at this level of indentation when I go to
that line in the file. That way I don't have to tab over every time I
load that template and wish to type on that particular line.

> I personally wouldn't want there to be saved whitespace which only
> exists to allow the cursor to go there simply because the cursor
> happens to be there at save time. The only argument that might sway
> me is that whitespace *up to the current indent level* should be
> preserved. This would be more complicated and possibly unreliable
> (what if the file isn't properly/consistently indented?) than simply
> removing all end-of-line whitespace; and as far as I can tell,
> pretty nonstandard among editors.

No idea, but it sounds like you might accept my use case as a valid
reason for wanting such a thing, at least.

> I think the best setup for you, given your preferences, would be to
> not have Geany automatically strip whitespace, but to write a script
> that goes through a file (or a whole project) and strips the
> whitespace that *you* want to strip. You would of course run this
> script manually yourself every so often, or include it in your
> commit process, or make a Geany plugin for it, etc.

Yep. The indentations are important enough to me and the trailing
spaces and tabs happen infrequently enough that it's worth it for me
to not use that option and to toss together a little script if
manually checking for and getting rid of them becomes too much of a

Thanks for the reply.

Little Girl

There is no spoon.

More information about the Users mailing list