[Geany-devel] Per-filetype indentation settings
Colomban Wendling
lists.ban at xxxxx
Sun Aug 14 13:09:56 UTC 2011
Le 14/08/2011 06:54, Lex Trotman a écrit :
> Hi Colomban,
>
> On 14 August 2011 06:17, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
>> Hi,
>>
>> Recent bug report #3390435 [1] remembered me about per-filetype
>> indentation settings. This would remove hard-coded settings we have for
>> Makefile and Fortran 77, moving the setting to the filetype definitions,
>> as well as allowing further per-filetype tweaking -- e.g. we could
>> imagine that somebody would like to have Python set to "4 spaces" to
>> follow PEP8.
>
> Good idea.
>
>>
>> I have come with an initial implementation and would like your wise
>> criticism and design opinions.
>
> I havn't had the chance to try it, but by my (questionable) inspection
> it looks ok.
At least another pair of eyes looked at the code and didn't see anything
obvious :)
>> A few trivial questions:
>> * should the settings be "indent_type" and "indent_width" under
>> [settings] rather than adding a new section?
>
> I don't see much difference, so keep your existing implementation.
Actually, I think using sections rather than prefixing the key's name is
probably better (that's the reason I did so in the first place), but
OTOH all our current settings uses prefixed names in the [settings]
section... anyway probably not a big deal.
>> * do you think it's sensible to reset the indentation settings when
>> switch from a filetype that had specific settings?
>
> Settings should take the value of the most specific setting present,
> ie individual file specific, user filetype specific, system filetype
> specific, user general preference, system general setting/default
> value. If something changes in that sequence like changing the
> filetype then yes it should change.
That was my thinking too. The only thing we may want to add is the
ability to re-do the auto-detection in such cases (or remember the
previous values, but it looks quite overkill).
>> * do you think the filetype-specific settings should override the
>> auto-detection? (the second patch makes auto-detection prevail)
>>
>
> Well if they do and there is a filetype setting for every filetype,
> how do the detected settings get used?
They wouldn't, that's the reason I did the 2nd patch :)
> Would need a menu option and
> possibly an option on the file open dialog to say use detected
> settings. And a preference of course.
Well, we already have a pref to chose whether to auto-detect or not
(actually, two: one for type and one for width). So either we add two
more filetype settings to choose whether auto-detection can override the
defined values, or we leave this to the current global preferences and
don't override them at all.
> PS minor English correction for the documentation, "allows to define"
> S/B "allows definition of"
Fixed, thanks :)
Cheers,
Colomban
More information about the Devel
mailing list