Skip to content

Instantly share code, notes, and snippets.

@mechairoi
Last active December 12, 2015 06:38
Show Gist options
  • Save mechairoi/4730270 to your computer and use it in GitHub Desktop.
Save mechairoi/4730270 to your computer and use it in GitHub Desktop.
(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