Skip to content

Instantly share code, notes, and snippets.

@milkypostman
Created June 20, 2013 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milkypostman/5820870 to your computer and use it in GitHub Desktop.
Save milkypostman/5820870 to your computer and use it in GitHub Desktop.
grizzl'd
(defun to-string (object)
"Convert OBJECT to a string."
(cond
((symbolp object) (symbol-name object))
((stringp object) object)
((numberp object) (number-to-string object))
(t (prin1-to-string object))))
(defadvice completing-read (around grizzl-advise-completing-read activate)
"Wrapper that uss grizzl"
(let* ((completions (mapcar 'to-string
(all-completions "" collection predicate)))
(search-index (grizzl-make-index completions)))
(if search-index
(setq ad-return-value
(grizzl-completing-read prompt search-index))
ad-do-it)))
(progn
(ad-disable-advice 'completing-read 'around 'grizzl-advise-completing-read)
(ad-activate 'completing-read))
(progn
(ad-enable-advice 'completing-read 'around 'grizzl-advise-completing-read)
(ad-activate 'completing-read))
@d11wtq
Copy link

d11wtq commented Jun 20, 2013

@milkypostman this looks awesome, thanks. I'm about to leave work and will be able to play around with this when I get home :) I'll be spending some time working on fiplr/grizzl tonight, with those extension points I mentioned... in particular.

@d11wtq
Copy link

d11wtq commented Jun 20, 2013

Ugh... "in particular, allowing extending the default behaviour for things like 'find file'".

@d11wtq
Copy link

d11wtq commented Jun 20, 2013

@milkypostman holy crap, this is awesome. I love it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment