[TxMt] Re: best example for user-configurable bundle-specific preferences
Peter Geil
256petabyte at googlemail.com
Wed Mar 27 11:23:13 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.
Cool! Didn't know about that functionality.
More information about the textmate
mailing list