[TxMt] Re: leopard quick look on TextMate text documents

Chris Poirier cpoirier at gmail.com
Thu Nov 1 14:24:06 UTC 2007


Hi Jasper,

> When I do a quick look on a TextMate text document, I just see a big
> TextMate icon and not the content. Does anyone have an idea how that could
> be fixed? Is it a Mac OS problem for not showing the content of a text file
> or is the OS simply asking the app (TextMate) how the document should be
> shown somehow?

I was able to hack together something that works on my machine, based
on the comments here and some docs at Apple:
http://developer.apple.com/macosx/uniformtypeidentifiers.html.  Note
that there are probably *WAY* more intelligent ways to do this, and if
you implement what I suggest here you are doing so AT YOUR OWN RISK.
:-)

Now, with that out of the way, I just created an empty application
(from the shell) with a hacked Info.plist, as follows:

/Applications/TypeMapper.app/
   Contents/
      Info.plist

In Info.plist I put the following:
===========================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>TypeMapper</string>
	<key>CFBundleVersion</key>
	<string>1436</string>
	<key>LSMinimumSystemVersion</key>
	<string>10.3.9</string>
	<key>NSAppleScriptEnabled</key>
	<string>NO</string>
	<key>NSMainNibFile</key>
	<string>MainMenu</string>
	<key>NSPrincipalClass</key>
	<string>OakApplication</string>
   <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeIdentifier</key>
      <string>org.blah.LaTex</string>

      <key>UTTypeDescription</key>
      <string>LaTex</string>

      <key>UTTypeConformsTo</key>
      <array>
        <string>public.plain-text</string>
      </array>

      <key>UTTypeTagSpecification</key>
      <dict>
        <key>public.filename-extension</key>
        <array>
          <string>tex</string>
        </array>
      </dict>
    </dict>
  </array>
</dict>
</plist>
==================================================

The important stuff in there is the UTType stuff.  Just adjust/copy
that "dict" section with fake data about the file type you want to use
with QuickLook.  As long as UTTypeConformsTo is public.plain-text,
QuickLook will display it as text.

And if someone else knows how to do this properly, please let me know.  :-)

Regards,
   Chris.



More information about the textmate mailing list