[TxMt] Re: best example for user-configurable bundle-specific preferences

Allan Odgaard mailinglist at textmate.org
Wed Mar 27 10:29:38 UTC 2013


On 27 Mar 2013, at 0:16, Phil Schumm wrote:

> […] The result can then be written to
>
> com.macromates.textmate.plist

This would be for 1.x. The nib will bind to the program’s user 
defaults, which is `~/Library/Preferneces/«app-identifier».plist`. In 
2.0 we have introduced the `TM_APP_IDENTIFIER` variable that should be 
used to access this file.

E.g. to read the LaTeX bundle’s ‘Viewer’ setting, from shell:

     defaults read "$TM_APP_IDENTIFIER" latexViewer

And from ruby:

     require "#{ENV['TM_SUPPORT_PATH']}/lib/osx/plist"

     settings_path = 
"#{ENV['HOME']}/Library/Preferences/#{ENV['TM_APP_IDENTIFIER'] || 
'com.macromates.textmate'}.plist"
     settings = open(settings_path) { |io| OSX::PropertyList.load(io) }

     puts settings['latexViewer']

> and subsequently queried with tm_query.

The `TM_QUERY` tool is for querying settings set in `.tm_properties` 
files.


More information about the textmate mailing list