Search at both stackoverflow and google code in Emacs
Two programming sites are most valuable to me:
- stackoverflow.com
- 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 (cond (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 stackoverflow.com" (interactive) (require 'w3m) (let ((keyword (w3m-url-encode-string (thing-at-point 'symbol)))) (browse-url-generic (concat "http://code.google.com/codesearch?q=" keyword)) (browse-url-generic (concat "http://www.google.com.au/search?hl=en&q=" keyword "+site:stackoverflow.com" ))) )
(add-hook 'prog-mode-hook '( lambda () (local-set-key (kbd "C-c ; s") 'w3mext-hacker-search)) )