haddoc: Browse HTML Python Documentation From Emacs

Table of Contents


Haddoc is a simple tool that allows an emacs user to search the Python HTML documentation indexes and to bring a web browser to an index term page.


[2009-12-03] I haven't used Haddoc in a while, and it's not in a working state at the moment. Feel free to try to scavenge bits and pieces to make it work again, but please don't expect a polished work at this point.


Even though I have the Python TexInfo documentation installed from my Emacs, somehow I always end up browsing the documentation from a web browser. Most of the time I start from either the Python Library Reference or from the index. I wanted to be able to bring up the documentation from within Emacs. This does it.

With haddoc, you invoke the elisp function haddoc-lookup (I type C-c .), enter some search terms, and the matches from the Python indexes are shown in a buffer, from which you can select to direct your external web browser to. I like to drive an external Firefox with it.


I took the simple approach and wrote a combination of Emacs-LISP and Python code to implement this:

  • haddoc-update: a Python script that will parse the HTML documentation indexes and generate a mapping of the index entries to the HTML pages in a DBM database (in /var/lib/haddoc/haddoc.db by default)
  • haddoc-lookup: a Python script that does a lookup of search terms (potentially incomplete) on the index keys and returns the page references for each of the search terms on stdout
  • haddoc.el: an Emacs-LISP package that can query the results of haddoc-lookup and spawn a webbrowser to the appropriate pages.


Use the source.


This will not work on Python HTML documentation before Python-2.3.3. Update your documentation if necessary (or fix the code).


A Mercurial repository can be found at:


Click here for download instructions.



  • Requires Python and Emacs.


  • I have not tried with Xemacs, and I won't. If you want to fix it, send me the changes. Otherwise I won't bother.

Reporting Bugs


Martin Blais <blais@furius.ca>