Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(provide 'google-eldoc)
(require 'eldoc)
(require 'crxel)
(defun google-eldoc-turn-on-eldoc-mode ()
"Enable google-eldoc-mode"
(interactive)
(set (make-local-variable 'eldoc-documentation-function)
'google-eldoc-search-current-symbol-info)
(turn-on-eldoc-mode))
(defun google-eldoc-search-current-symbol-info ()
(let* ((symbol (thing-at-point 'symbol))
(url (format "https://www.google.co.jp/search?q=%s"
(url-hexify-string
(encode-coding-string symbol 'utf-8)))))
(crxel/eval (format "chrome.tabs.update({
url: \"%s\"
});" url))) ; XXX Escape
nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment