haddoc: Browse HTML Python Documentation From Emacs

Table of Contents

Description

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.

Important

[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.

Motivation

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.

Design

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.

Documentation

Use the source.

Note

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

Download

A Mercurial repository can be found at:

https://hg.furius.ca/public/haddoc/

Click here for download instructions.

Installation

Dependencies

  • Requires Python and Emacs.

Portability

  • 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

Author

Martin Blais <blais@furius.ca>