Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[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")
. (lambda () (start-process "mdfind-process" nil "mdfind" anything-pattern)))
(type . file)
(requires-pattern . 3)
(action . (lambda (candidate)
(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)))))
"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