Skip to content

Instantly share code, notes, and snippets.

@uskanda
Created November 19, 2011 21:34
Show Gist options
  • Save uskanda/1379387 to your computer and use it in GitHub Desktop.
Save uskanda/1379387 to your computer and use it in GitHub Desktop.
[Emacs]anything source of spotlight (open binary files by associated mac application)
(defcustom anything-c-source-mac-spotlight2-open-file-extensions
'("pdf" "jpg" "gif" "psd" "ai" "png" "mpg" "avi" "mov")
"List of file extensions to open by Mac OS X application."
:type 'list
:group 'anything-c-source-mac-spotlight2)
(defvar anything-c-source-mac-spotlight2
'((name . "mdfind")
(candidates
. (lambda () (start-process "mdfind-process" nil "mdfind" anything-pattern)))
(type . file)
(requires-pattern . 3)
(action . (lambda (candidate)
(progn
(if (member (file-name-extension candidate) anything-c-source-mac-spotlight2-open-file-extensions)
(shell-command (concat "open " candidate))
(anything-c-find-file-or-marked candidate)))))
(delayed))
"Source for retrieving files via Spotlight's command line
utility mdfind.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment