Skip to content

Instantly share code, notes, and snippets.

@mori-dev
Created August 16, 2010 11:44
Show Gist options
  • Save mori-dev/526828 to your computer and use it in GitHub Desktop.
Save mori-dev/526828 to your computer and use it in GitHub Desktop.
(setq anything-c-source-pylookup
'((name . "pylookup")
(candidates . (lambda ()
(with-temp-directory "~/.emacs.d/elisp/pylookup"
(start-process
"Pylookup" nil
"~/.emacs.d/elisp/pylookup/pylookup.py"
"-l" anything-pattern))))
(candidate-transformer . (lambda (x)
(mapcar
(lambda (x)
(cons (concat (car (split-string x "\t")) "\t" (cadr (split-string x "\t")))
(caddr (split-string x "\t"))))
x)))
(action . (("Browse-url" . (lambda (x)
(browse-url
(browse-url-file-url
(replace-regexp-in-string "\\[.*\\];" "" x)))))))
(migemo)))
(defmacro* with-temp-directory (dir &body body)
`(with-temp-buffer
(cd ,dir)
,@body))
(defun my-pylookup-anything ()
(interactive)
(anything 'anything-c-source-pylookup))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment