[OS X TeX] Tex.mdimporter problem

Eric van der Oord eric.vanderoord at gmail.com
Mon Feb 21 09:37:03 CET 2011


Thank you !

Alas, I guess there is no rapid  and safe beginner's way to modify metadata in the *tex files of some directories so that they can be found via Spotlight

Eric

Le 20 févr. 2011 à 23:18, Peter Dyballa a écrit :

> 
> Am 19.02.2011 um 11:10 schrieb Eric van der Oord:
> 
>> Is that a known issue ? Any help ?
> 
> Yes, this is rather normal. The problem is that many file types are attributed with some anonymous or "dynamic" Content Type. So presumingly they're not "org.tug.tex".
> 
> To check whether TeXShop's mdimporter is known, run on the command line:
> 
> 	mdimport -L
> 
> What you can do is run – maybe some thousand times – on the command line
> 
> 	mdls <some TeX related non-binary file from the TeX Live/MacTeX distribution | grep -w kMDItemContentType | grep -v org.tug.tex
> 
> It will happen that from to file you might get a line like
> 
> 	kMDItemContentType             = "dyn.ah62d4rv4ge81g7d3"
> 
> This one of these "dynamic" content type identifiers. There can be a few of them, so improve your mdls command to:
> 
> 	mdls <some TeX related non-binary file from the TeX Live/MacTeX distribution | grep -w kMDItemContentType | egrep -v 'org.tug.tex|ah62d4rv4ge81g7d3'
> 
> and add another dynamic identifier, when it's found, to your command. (I certainly prefer the "dynamic duo".)
> 
> When you want, you can ease your life a bit and pass to mdls a set of files, like in this:
> 
> 	apply 'mdls %1 | grep -w kMDItemContentType | egrep -v "org.tug.tex\|ah62d4rv4ge81g7d3"' <some directory with TeX related non-binary file from the TeX Live/MacTeX distribution>/*
> 
> Then you might receive a list like this:
> 
> 	kMDItemContentType             = "dyn.ah62d4rv4ge80g3xh"
> 	kMDItemContentType             = "dyn.ah62d4rv4ge81g7d3"
> 	kMDItemContentType             = "dyn.ah62d4rv4ge81g7d3"
> 
> Shabby duplicates! Let's optimise once more:
> 
> 	apply 'mdls %1 | grep -w kMDItemContentType | egrep -v "org.tug.tex\|ah62d4rv4ge81g7d3"' <some directory with TeX related non-binary file from the TeX Live/MacTeX distribution>/* | sort -u
> 
> This will still make a lot of work, since TeX Live consists of 6.776 directories. We can handle this! No problem.
> 
> 	find /usr/local/texlive/2010 -type d -exec apply 'mdls %1 | grep -w kMDItemContentType | egrep -v "org.tug.tex\|ah62d4rv4ge81g7d3\|folder\|unix"' {}/* \; | sort -u
> 
> The "folder" is inserted that TeX distribution directories are not tested. The find command searches all directories of the TeX distribution up to the outermost leaf and passes all these directories' contents to apply which the mdls to each element. the first grep grabs for all occurrences of the word kMDItemContentType in the output of mdls. The egrep throws away all occurrences of the well-known kMDItemContentType's.
> 
> After, say, one hour you'll have a sorted list of unique TeX related kMDItemContentType's like that one above. Save it plus the two known types dyn.ah62d4rv4ge81g7d3 and org.tug.tex. They might be useful for Spotlight searches, they are useful for this command:
> 
> 	apply 'mdfind -count kMDItemContentType = %1' <the list of found kMDItemContentType's>
> 
> After a shorter period of time you'll have the number of files of the corresponding kMDItemContentType.
> 
> 
> *** I did not test the find command! I'm pretty sure that it will fail, that "{}/*" construct can't really work. It would work with an *executable* shell script MyScript.sh (its last line has to be empty) and that contents:
> 
> 	#!/bin/sh
> 	pushd $1 > /dev/null
> 	apply 'mdls %1 | grep -w kMDItemContentType' *
> 	popd > /dev/null
> 
> And the find command would become:
> 
> 	find /usr/local/texlive/2010 -type d -exec /path/to/MyScipt.sh {} \; | egrep -v 'org.tug.tex|ah62d4rv4ge81g7d3|folder|unix' | sort -u
> 
> 
> 
> TeX and Spotlight might be more efficient if Spotlight would know all the TeX related file types before TeX is installed. Than nothing would need to be "dynamic" or purely by chance.
> 
> --
> Greetings
> 
>  Pete
> 
> Sending unsolicited commercial eMail to this account incurs a fee of € 500 per message and acknowledges the legality of this contract.
> 
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
> 




More information about the macostex-archives mailing list