[Geany-Devel] Some Auto-Indentation Ideas

Braden Walters meoblast at xxxxx
Thu Mar 14 04:42:05 UTC 2013

I had some ideas for some keybindings or settings that could help with 
some indentation issues. I'm willing to implement them myself, but I 
wanted to see what the other developers think first. First, the reason 
why I want to even write these.

I work on multiple projects, some of which have multiple developers and 
some where whitespace has been left all around some files. I generally 
use manual indentation (no auto-indent at all), and I can't help but 
think there's something better I could do. I could use the current 
character indent, but then I'll have trailing whitespace everywhere, or 
I'll have to backspace that out manually (sort of defeats the purpose). 
I could turn on "Strip trailing whitespace", but that's going to modify 
a lot of lines I never really changed.

Here are some solutions I've thought up:
- Keybindings for everything approach: Improve the "smart indent" key 
binding to just use the global (or project if available) settings for 
auto-indentation upon striking the key combination. Then, create a key 
binding that removes all contents from a line, but does not delete the 
line itself.
- Strip on return approach: Create a global/project settings option to 
strip whitespace from the current line upon striking return.

Both of these approaches introduce a problem though. If I remove 
whitespace from a line, I return back to a column position of zero. The 
auto-indent modes I've used will therefore make the following line 0 
columns indented. One solution to this could be to auto-indent up to the 
last indented line, if available. I'm sure there are other solutions to 
this though.

So I propose three questions in this email. First: Is this something I 
should even be making for an upstream core feature, or should it be in a 
plugin? Second: Which of my two approaches seems more reasonable? Third: 
Are there any other solutions anyone has to the final problem I 
mentioned, or will the solution I proposed suffice?

Sorry for the length of this e-mail, everyone.

Braden Walters

More information about the Devel mailing list