doctest-mode is an Emacs major mode for editing text files that contain Python doctest examples. Doctest is a testing framework for Python that emulates an interactive session, and checks the result of each command. For more information, see the Python library reference documentation on doctest. doctest-mode makes it easier to write and maintain doctest files, by providing:
Walk-through | A brief demo of doctest-mode's features. | |
Commands | A summary of the commands provided by doctest-mode. | |
Customization | How to customize the appearance & behavior of doctest-mode. | |
Doctest submodes | How to use doctest-mode inside other modes (0.5alpha only). |
Download and save doctest-mode.el.
Copy doctest-mode.el to a directory that's on your Emacs load-path. (To see your Emacs load-path, type "control-h v load-path" in Emacs.) Alternatively, you can add the following line to your Emacs configuration file:
(add-to-list 'load-path "...path to dir containing doctest-mode.el...")
Add the following lines to your Emacs configuration file:
(add-to-list 'auto-mode-alist '("\\.doctest$" . doctest-mode)) (autoload 'doctest-mode "doctest-mode" "doctest mode" t)
Restart Emacs (or reload your configuration file).