Search at both stackoverflow and google code in Emacs

  |   Source

Two programming sites are most valuable to me:
solution design and code prototype
google code search
code sample from real product

So I write some elisp code w3mext-hacker-search to automate the workflow.

Copy the into ~/.emacs and you can use hotkey "C-c ; s" to open search results in external browser (firefox, for example):

; external browser should be firefox
(setq browse-url-generic-program
       (*is-a-mac* "open")
       (*linux* (executable-find "firefox"))

;; use external browser to search

(defun w3mext-hacker-search ()
  "search word under cursor in google code search and"
  (require 'w3m)
  (let ((keyword (w3m-url-encode-string (thing-at-point 'symbol))))
    (browse-url-generic (concat "" keyword))
    (browse-url-generic (concat "" keyword "" )))

(add-hook 'prog-mode-hook '( lambda () (local-set-key (kbd "C-c ; s") 'w3mext-hacker-search)) )

Comments powered by Disqus