On Wed, Sep 22, 2010 at 14:06, Lex Trotman elextr@gmail.com wrote:
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?
There would be a list of styles e.g. in geany.conf, for instance something like this:
preferred_style_list=GNU style;ANSI style; K&R style
Just a list of names that would be used to populate the "preferred indent style" combo. The styles themselves would then be defined in individual filetypes and based on the style name match with the preferred style, either the default or the matching style would be used.
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)
Yes, the GUI for that would be too bloated.
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 :-)
Depends what you want to indent. If we are talking only about indentation after braces (or, in general, begin and end block markers), I think C is a superset of all styles. Of course there are millions of variants like whether to indent public:, private:, ..., case: in switch and so on, but Geany shouldn't do that (of course if someone decides to write his own regexes, he can) because this is really very individual. So the basic set of indent styles is quite limited and can be applied to non-brace langauges as well (I think all the C styles make sense for pascal as well).
In general I think indenting less is better than indenting more - it's not such a big problem to press tab in special cases when the text doesn't get indented automatically.
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.
I'm afraid that detecting such cases with regexes would be much harder - braces are quite unique but commas are much more overloaded. Also there are too many different options how much to indent - fized size, aligned after = in assignments, behind the latest opening brace and so on. These are almost impossible to do in a more generic way and would force the users to use some very specific style. As I said, indenting less is better IMO for a multipurpose editor like geany.
Jiri
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@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel