2

In Spotlight you can enable and disable file categories that will appear in search results. enter image description here How does Spotlight determine that a certain file belongs to a certain category? The following specific event triggered this curiosity:

For some time .tex files would come up under the Documents category. Spotlight would handle the search filename.tex just fine. Then suddenly I could not find .tex files anymore in Spotlight. Finder searches were OK though. Turns out that I had the Developer category disabled in the Spotlight preferences, and Spotlight now thought that .tex files belonged in that category. After enabling the Developer category everything went back to normal.

What made Spotlight decide to switch categories for the .tex files?

  • I am thinking any other stuff that cannot be categorized to one of these category will be categorized as Documents. – Shane Hsu Aug 1 '13 at 14:16
  • But why has the .tex file been categorised under Documents and then under Developer? – Saaru Lindestøkke Aug 1 '13 at 14:19
  • When you right click on one of the .tex files and choose "Open With...", what shows up as the default choice? – Mr Rabbit Aug 1 '13 at 15:28
  • It's also categorized by I guess application associations. – Shane Hsu Aug 1 '13 at 15:49
  • Open with says TexShop, but now .tex files also show as Documents again in Spotlight... weird. – Saaru Lindestøkke Aug 1 '13 at 15:58
1

I think it depends on the parent UTIs defined in an application's Info.plist or in /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist. .tex is not included in the CoreTypes Info.plist, so the UTI depends on which application's UTI declaration was registered first. For example on my installation the UTI was com.barebones.bbedit.tex-source and the first parent UTI was public.source-code:

$ touch a.tex; mdls -n kMDItemContentTypeTree a.tex
kMDItemContentTypeTree = (
    "com.barebones.bbedit.tex-source",
    "public.source-code",
    "public.plain-text",
    "public.text",
    "public.data",
    "public.item",
    "public.content"
)

When I deleted BBEdit and rebuilt the Launch Services database, the UTI became org.tug.tex and the first parent UTI became public.text:

$ touch b.tex; mdls -n kMDItemContentTypeTree b.tex
kMDItemContentTypeTree = (
    "org.tug.tex",
    "public.text",
    "public.data",
    "public.item",
    "public.content",
    "public.plain-text"
)
1

I had a similar problem with one of my TeX documents, that developed immediately after TeXShop updated itself while I had the document open.

I tried the UTI listing trick above, and it turns out all my other TeX documents are categorised as either "org.tug.tex" or "edu.uo.texshop.tex". These all come up as 'Documents' in Spotlight searches. However, the one file that was open while TeXShop updated has now been categorised as "com.barebones.bbedit.tex-source" which seems to fall into the 'Developer' category.

Perhaps the moral of the story in my case is: close all TeXShop documents before allowing the application to update itself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .