[Geany-Devel] Why smart indentation is so stupid?

Matthew Brush mbrush at xxxxx
Fri Jul 25 22:28:21 UTC 2014


On 14-07-25 01:01 PM, Colomban Wendling wrote:
> Le 25/07/2014 21:33, Pavel Roschin a écrit :
>> I'm very wondered how does "smart indentation" feature work. If previous line
>> is empty, it removes indent assuming that single empty line is an empty indent.
>> Smart indentation for multiple lines is absolutely awful: it doesn't take into
>> account internal sub-indents and makes selection "flat".
>
> It's a lie, this feature isn't smart, it just sets the same indentation
> than the previous line.
>
>> Is anybody using this?
>
> I doubt it
>
>> Under "smart" indentation people assume astyle, php-beautifier and so on:
>> http://stackoverflow.com/questions/18828162/smart-auto-indentation-available-in-geany
>
> Yeah, we know we should have a nice (and complex) system for
> configurable smart indentation, but every time we tried to think about
> it we discovered that some languages are so crazy that it's really not
> simple, and probably would require some specific code for some languages
> (did I say Haskell?).  And nobody did the filetypes plugins yet :(
>
> However, you might be able to use some indenters tools from Geany using
> custom commands to some extent.  In a similar way, I once started a
> multi-indernters plugin, but I didn't finish it for various reasons, one
> being my lack of much interest in it (I'd rather work on a solution for
> configurable and nice thing for Geany than on wrapping gnuindent, astyle
> or others, tools I never really used).
> If anyone is interested, it's here: https://github.com/b4n/grind
>

And for "smart" indentation/formatting, I have written a plugin which 
works with C, C++, Objective-C (and I think I remember they talked about 
JS support) by using clang-format. See:

http://codebrainz.github.io/code-format/

Cheers,
Matthew Brush




More information about the Devel mailing list