[SVN] Re: Best Practice for Bundle-Specific Preferences

Allan Odgaard mailinglist at textmate.org
Sun Aug 3 12:20:53 UTC 2008


On 6 Jul 2008, at 00:25, Thomas Aylott - subtleGradient wrote:

> I've been working on Javascript Tools and a few other things.
> And there seem to be a larger and larger amount of thing for which I'd
> like to set config options and preferences.
>
> EG: JSLint, YUI Compressor, etc...
>
> Currently the jslint prefs are handled in a config file inside the
> bundle.
> There are other options which are set using environment variables.
>
> I'm thinking we need some sort of global preference system that each
> bundle can hook into to get/set preferences.
> Maybe the bundle provides a list of potential keys along with their
> potential values and then we use a single global GUI to set them all.

We presently have a few Preferences… menu items in the bundle  
specific menus (TODO, SQL, LaTeX, etc.) -- when the bundle has a  
grammar, the item should be scoped and have a key equivalent of ⌥⌘,  
so e.g. in LaTeX you press ⌘, for global preferences and ⌥⌘, for  
the mode specific preferences.

There is some value in having a central place for all preferences, but  
it is quite a challenge to do it right, so I am content with the  
current approach where we do a nib per bundle, but I would like to see  
the system evolve toward both a central overview of preferences, and  
also to have the current textual settings (bundle items) appear in a  
settings UI -- but here we need to tackle things like the Source¹  
bundle adding “comment preferences” to all modes, likewise with  
Hyperlink Helper and a few others.

> On a technical level, what should we use? Personally I'm all for using
> the mac defaults system since that's built right into the global
> system preferences and everything.
>
> Is there perhaps something already done to use that?

The nib-using preferences items use the defaults system via bindings,  
so it is almost ideal.

It would be best if each bundle had its own preferences file (~/ 
Library/Preferences/com.macromates.textmate.«bundle».plist) so that  
there won’t be name clashes, preferences can be reset per bundle,  
etc. but I was unable to pull this off in a way that would still allow  
us to use bindings in Interface Builder to hookup the controls with  
the stored values.




More information about the textmate-dev mailing list