[Geany-devel] Per-filetype indentation settings

Colomban Wendling lists.ban at xxxxx
Sat Aug 20 14:55:49 UTC 2011


Le 15/08/2011 14:00, Lex Trotman a écrit :
> Hi Colomban,
> 
> [...]
>>> 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).
>>
> 
> I have thought some more on this and I have changed my mind, I am now
> convinced that the settings should not change for open files unless
> the user deliberately changes them.
> 
> The reason is that changing settings does not change the content of
> the open files.  So if the settings can change they can become
> different to the file's existing content, and that would lead to files
> having mixed indentations, something that is frowned on (or totally
> wrong for offside languages like Python).
> 
> Instead the hierarchy I outlined above should set the indentation
> settings when opening files unless the preference has been set to use
> auto detection.  The hierarchy should also be used to set the
> indentation settings for new files the first time the filetype is set
> (provided the user hasn't manually set the indentation before setting
> the filetype).

Makes sense.

So if setting the filetype for a file that had no one set [1], apply the
indent settings hierarchy, otherwise do nothing.  Maybe we should do the
same as on open, so also do auto-detection?


[1] does assuming None filetype means "no user choice" OK, or should we
track whether the user chosen None?

> I would suggest adding an indentation setting combo box to the open
> file dialog (like the encoding one) with the options:
> 
> 1. to set specific indentation settings (and the selectors for those
> settings of course)
> 2. to use autodetect
> 3. to use whichever the hierarchy chooses based on prefs or filetypes
> (this should of course show what it will be and potentially the
> source)
> 
> The default would be 2 or 3 depending on the "use autodetect" preference.
> 
> The user must always be allowed to change the settings as the user has
> the menu items to change the content if required, or if autodetect
> gets it wrong, or its just a file with a different indentation
> standard, they do exist :-)

I'm not sure a setting in the file open dialogue makes much sense.  I
doubt this setting would be used often, and the user can easily change
the setting once the file is actually opened.  Do you really think it's
worth adding one more option to file opening?


Cheers,
Colomban



More information about the Devel mailing list