[glug-t] Wikipedia from Emacs

Here is a small Emacs hack, I wrote, to access Wikipedia. You will
need emacs-w3m package.

This piece of code will get the keyword from the user(default is the
word at cursor), and will invoke w3m with the computed url.  With
little tweaking, you can make it search the web using google...

(defun wikipedia (arg)
  "Search the wikipedia!"
  (interactive 
   (list (let* ((default (current-word))
                (input (read-string 
                        (format "Wikipedia%s: "
                                (if (string= default "")
                                    ""
                                  (format " (default %s)" default))))))
           (if (string= input "")
               (if (string= default "")
                   (error "No wikipedia args given")
                 default)
             input))))
  (w3m-browse-url (concat 
                   "http://www.wikipedia.org/wiki/Special:Search?search="; 
                   (w3m-url-encode-string arg))))
---------------------------------------------------------------
To unsubscribe send a mail to glug_t-request@xxxxxxxxxxxxx with 
'unsubscribe' as subject.

Website: http://glugt.linuxisle.com

Other related posts: