The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
locate and spotlight

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ryan Davis

Posts: 651
Nickname: zenspider
Registered: Oct, 2004

Ryan Davis is a ruby nerd.
locate and spotlight Posted: Mar 2, 2007 3:55 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Ryan Davis.
Original Post: locate and spotlight
Feed Title: Polishing Ruby
Feed URL: http://blog.zenspider.com/index.rdf
Feed Description: Musings on Ruby and the Ruby Community...
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Ryan Davis
Latest Posts From Polishing Ruby

Advertisement

locate and spotlight each have their pros and cons. I like both for different reasons, but recently I caught on to using mdfind (spotlight's command-line interface) to search for file-names only. It is still a little slower than locate (but not much) but always up to date:

(defun locate-make-mdfind-command-line (search-string)
  (list "mdfind" (concat "kMDItemDisplayName=*" search-string "*")))

(defun spotlight ()
  "Search for files by name using spotlight"
  (interactive)
  (let ((locate-command "mdfind")
        (locate-make-command-line 'locate-make-mdfind-command-line))
    (call-interactively 'locate nil)))

(defun spotlight-full ()
  "Search using spotlight"
  (interactive)
  (let ((locate-command "mdfind"))
    (call-interactively 'locate nil)))

If you're feeling adventurous, keep the first defun and set locate-command and locate-make-command-line via customize. I did that for a few weeks but I like the flexibility of having both available.

Read: locate and spotlight

Topic: Cita sobre Expresiones Regulares Previous Topic   Next Topic Topic: Building Ruby, Rails, Subversion, Mongrel, and MySQL on Mac OS X Tiger - The Easy Way

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use