[OS X TeX] How to make locate/spotlight search ~/Library/texmf

Michael Sharpe msharpe at ucsd.edu
Tue Aug 10 22:32:44 CEST 2010


On Aug 10, 2010, at 10:41 AM, Alan Munn wrote:

> On Aug 10, 2010, at 1:35 PM, Herbert Schulz wrote:
> 
>> 
>> On Aug 10, 2010, at 12:16 PM, Alan Munn wrote:
>> 
>>> 
>>> On Aug 10, 2010, at 12:51 PM, Herbert Schulz wrote:
>>> 
>>>> 
>>>> On Aug 10, 2010, at 11:22 AM, Alan Munn wrote:
>>>> 
>>>>> Hi,  I can use the locate command in a Terminal to quickly find files in /usr/local/texlive.  However, it doesn't find files in ~/Library/texmf.  How do I make it do that?
>>>>> 
>>>> 
>>>> I'd guess that the locate database won't contain anything in the Users folder since that is private for each individual user. Perhaps there is a way to ell it to build a personal database.
>>>> 
>>>>> Secondly, what's the relationship between the Spotlight search (via Command-space) and the locate search database?  They clearly don't find the same things, since /usr/local files never show up in the Command-Space searches.  Is there a way to make them match?
>>>> 
>>>> There is no relationship between them. The technology is different for the two things.
>>> 
>>> Ok.  That makes sense then.  So is there a way to get Spotlight command-space to index ~/Library/texmf?
>>> 
>> 
>> Howdy,
>> 
>> Actually Spotlight does index everything but there is no way to make it show that information that I know of using the simple Cmd-Space. If you do a Cmd-F AND then click on Kind and pick Other and the select System Files (you can put that on the default list with a check box---that will save one step later) and then select `are included'' you can find those files. I wish there was a way to just have that turned on by default but I don't know of any.
> 
> Bummer.
> 
>> 
>>>> 
>>>> I've been using `Find Any File', <http://apps.tempel.org/FindAnyFile/index.html>, and I'm quite happy with it.
>>> 
>>> Yes, I have that too, but I'm lazy... For most quick searches command-space is simply more convenient.  I'd just like to be able to find things in my local texmf folder as easily.  If locate could do that, that would be fine, since I've always got a terminal window open; if it can't, I'd prefer to use Spotlight if possible.
>>> 
>>> Alan
>> 
>> And that's why I use `Find Any File'!
> 
> Sure, but they're far from functionally equivalent, since Find Any File doesn't search on content.  So if I don't know the name of something but I know what's inside it, I can't find it with that tool.  Since that's my preferred searching method for many things, using Find Any File just adds a third tool for me, so it's really a last resort.
> 
> Thanks
> 
> Alan
> 

There is a way to get Spotlight functionality with access to system and ~/Library/texmf files, using the Automator that came with Snow Leopard. Create an application, drag "Find Finder Items" onto the right hand panel, the select "Computer", "All" and "Any Content". Then, under Options, check "Show this action when workflow runs". Next, drag "Filter paragraphs" to the right panel, underneath "Find Finder Items", and set it to Return paragraphs that do not end with .emlx". After that, drag "Run Applescript" onto the right panel under the two other items, and enter the following:

on run {input, parameters}
	set dq to ASCII character 34
	set AppleScript's text item delimiters to ASCII character 10
	set dat to input as text
	tell application "Terminal"
		activate
                delay 1
		do script ("echo " & dq & dat & dq) in window 1
	end tell
end run

Then save the application, say as myfind.app. You can set a hotkey for it under System preferences/Keyboard. The end result is that when you hit the hotkey, the Find Finder Items dialog will appear, and after pressing Continue, you will see a list in a Terminal window of all files containing the specified text.

Michael


More information about the macostex-archives mailing list