[Geany-devel] Indentation using regex (was [PATCH 14/19] Rewrite tab switching queue)

Lex Trotman elextr at xxxxx
Wed Sep 22 12:06:24 UTC 2010


>> Welcome to the per project per filetype build command configuration
>> problem :-D
>
> Exactly what I want to avoid ;-).

Ditto :-)

>
>>
>> The build system solution of using the current file to select the
>> filetype is, as you have pointed out in the past, potentially
>> confusing, but the alternative is very bloating, especially since with
>> custom filetypes you have to be able to handle an unknown number of
>> filetypes.
>>
>> So I'd have to say that, for now anyway, the way to go would be for
>> the combo box in the project and global prefs dialogs to show only the
>> styles from the current filetype (plus none and basic) and to only set
>> the current filetype.
>
> If it's for the current filetype only, then I would just copy the most
> confusing part of the per-filetype settings - I definitely don't want
> to do it this way.
>
>>
>>
>>  Maybe
>>> some standard indent styles could exist so e.g. if you select "GNU
>>> style" in the project settings dialog, geany would search for
>>> [indent-gnu_style] section in the filetype settings file for each file
>>> you are using in your project.
>>
>> Except for files where you have set it manually of course.
>>
>> Well gnu-style is meaningless for Python, and I wouldn't expect C to
>> have a Stroustrup style etc. so the fixed list for all filetypes is
>> always going to be insufficient.
>
> OK, another idea. There would be a global and per-project "preferred
> indent style" option containing the standard styles.

What are the standard styles and where are they defined?

Every filetype
> would have its own default style and arbitrary number of additional
> styles.

Are these hand edited in the filetypes files?  (Personally I don't
think there is anything wrong with saying they are manually edited in
the filetype files)

If one of the styles matches the "preferred indent style",
> this style will be used. Otherwise the default style will be used.

This is still only ever going to be right for one language because
only one will match, might as well just use the default from the
filetype file..


 So
> for python, which has basically one style only, this single style will
> be always used no matter what the preferred style is.

Yep, Python is an exception since the indent style is part of the
language syntax so there isn't any choice, but the bracketed languages
have several options and they don't overlap much (I'm no Java style
expert but as I understand it the default is different to GNU and ANSI
but probably closest to Stroustrup, and Perl has no style :-)


>
> Finally, the document menu would have a submenu with all indent styles
> for the document's filetype. This is IMO the only place which you
> expect to be per-filetype.


Yes.

Please note that my expectations for indenting may be a bit high
because I am forced to use Emacs for work at the moment and the
indenting works really well (for C/C++ anyway) but is much more
complex.

Have you given any thought to if there is a regex that would indent
continuation lines (eg ending in comma) but for that line only.  IIUC
Jedit has a regex that indents only the next line without incrementing
the indent level.


Cheers
Lex

>
> Cheers,
>
> Jiri
>
>>
>> Cheers
>> Lex
>>>
>>> Cheers,
>>>
>>> Jiri
>>>
>>>>
>>>> Maybe a later extension would be to save the style with the filename
>>>> in sessions and/or recognise some mode line in the file eg Emacs type
>>>> // -*- variable:value -*- settings.  There are several other things
>>>> that have been suggested to be recognised like that (eg .h header
>>>> files C or C++??).
>>>>
>>>> Cheers
>>>> Lex
>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Jiri
>>>>>
>>>>>>
>>>>>> Cheers
>>>>>> Lex
>>>>>>
>>>>>>>
>>>>> _______________________________________________
>>>>> Geany-devel mailing list
>>>>> Geany-devel at uvena.de
>>>>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>>>>>
>>>> _______________________________________________
>>>> Geany-devel mailing list
>>>> Geany-devel at uvena.de
>>>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>>>>
>>> _______________________________________________
>>> Geany-devel mailing list
>>> Geany-devel at uvena.de
>>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>>>
>> _______________________________________________
>> Geany-devel mailing list
>> Geany-devel at uvena.de
>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>>
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list