[Geany-devel] Development of code re-formatting plugin

Lex Trotman elextr at xxxxx
Mon Apr 9 23:59:04 UTC 2012


On 10 April 2012 09:05, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> Hi,
>
> Le 09/04/2012 12:41, Lex Trotman a écrit :
>> On 9 April 2012 20:08, Nayan Shah <nayan at nayanshah.com> wrote:
>>> Hello,
>>>
>>> I am planning to develop a code re-formatting plugin for geany. I want it to
>>> be more on the lines of Notepad++'s C++ re-indent plugin which is pretty
>>> awesome.
>
> I don't know Notepad++, but I started a indenter plugin awhile ago, I'll
> try to check where it is and make the source available if it can be
> useful.  I should also finish it, but...
>
>>> The feature could be something like : user selects bunch of text and clicks
>>> beautify or maybe it works on the whole file by default.
>>>
>>> Astyle <http://astyle.sourceforge.net/> is a small automatic formatter and
>>> released under LGPL. It is pretty small with loads of options. and supports
>>> C, C++, Java code.
>>>
>>> Can it be used for development of the plugin ?
>>>
>>> Any feedback / comments would be appreciated.
>>
>> Yes you could make a plugin to run astyle, but it would probably be
>> easier to just use it as a custom command, see
>> http://www.geany.org/manual/current/index.html#sending-text-through-custom-commands
>
> Unfortunately astyle does crazy stuff (like seeking back and forth) with

I can understand why it would do that to look ahead, but it would be
good if it documented that it *does not* work with pipes.

> its input, making impossible to pipe data to it (actually it'll work
> until the data size exceeds the OS's IO buffer size IIRC, but if it

Looking at the code it should give an error message if it can't seek
in the file, so it should just generate no output, but maybe thats
recent.

> exceeds that size astyle will just hang indefinitely).  Calling that
> executable requires a real file then.  The plugin I talked about
> previously has an astyle backend too, but it writes a temp file for the
> very reason above.

Does that mean it is universal and can use any beautifier?  And maybe
integrate Universal Indent GUI to set them up?

Cheers
Lex



More information about the Devel mailing list