[Geany-devel] Per-filetype indentation settings
elextr at xxxxx
Mon Aug 15 12:00:57 UTC 2011
>> 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
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
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 :-)
>>> * 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 :)
That was what I thought :)
More information about the Devel