[Geany-devel] Per-filetype indentation settings

Colomban Wendling lists.ban at xxxxx
Sun Aug 21 16:31:45 UTC 2011

Le 21/08/2011 05:22, Lex Trotman a écrit :
> [...]
>> 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?
> If the indentation setting is set on open, it is not possible to have
> a file open without indentation settings.  After opening the only time
> it should change is if the user sets it, and then it should go to what
> the user specifies.

But when creating a new file.  The user will set the filetype, but will
also probably want her filetypes indentation settings to be set since
she didn't chose any at this point -- well, assuming she didn't chose
indentation settings first, so checking this too.

>> [1] does assuming None filetype means "no user choice" OK, or should we
>> track whether the user chosen None?
> There is always some setting, even if its a default coded in Geany.
> IIUC thats what happens now if you create a new file.

What I meant is that we need to track whether the user set a fietype if
we don't assume "filetype None" == "the use did not choice".  Both are
possible, assumption is cheaper, the other probably a little better.

>>> 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?
> Well in the new scheme its the only time the user can tell Geany to
> use detect when its not the usual preference, unless we add it to the
> set indent menu, which is probably the better option.

Well, if the user haven't chosen auto-detection in the setting it's
probably she don't want it.  But I agree that we probably should have a
"reset indentation settings" or something in the document menu, which
would basically call document_apply_indent_settings().


More information about the Devel mailing list