Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > re: mmm-mode, python-mode and doctest-mode?

Reply
Thread Tools

re: mmm-mode, python-mode and doctest-mode?

 
 
Edward Loper
Guest
Posts: n/a
 
      08-07-2007
[John J Lee]
> Is it possible to get doctest-mode to work with mmm-mode and python-mode
> nicely so that docstrings containing doctests are editable in
> doctest-mode?


I recently released a new version of doctest-mode [1], and I came across
your email [2] (it was on the first page of google hits for
"doctest-mode"). So I decided to have a go at getting doctest-mode to
play nicely with mmm-mode. The result is available here:

https://python-mode.svn.sf.net/svnro...octest-mode.el

I still consider it alpha code (the version that's available for
download on the official doctest-mode webpage [3] doesn't include the
mmm-mode features), but it works pretty well for me. If you want to
give it a spin, let me know what you think. The following should load
everything you need:

(autoload 'doctest-mode "doctest-mode" "doctest mode" t)
(autoload 'doctest-register-mmm-classes "doctest-mode")
(doctest-register-mmm-classes t t)

It defines 2 classes. Quoting from the docstring for doctest-register-
mmm-classes:

> `doctest-docstring'
>
> Used to edit docstrings containing doctest examples in python-
> mode. Docstring submode regions start and end with triple-quoted
> strings (\"\"\"). In order to avoid confusing start-string
> markers and end-string markers, all triple-quote strings in the
> buffer are treated as submode regions (even if they're not
> actually docstrings). Use (C-c % C-d) to insert a new doctest-
> docstring region. When `doctest-execute' (C-c C-c) is called
> inside a doctest-docstring region, it executes just the current
> docstring. The globals for this execution are constructed by
> importing the current buffer's contents in Python.
>
> `doctest-example'
>
> Used to edit doctest examples in text-editing modes, such as
> `rst-mode' or `text-mode'. Docstring submode regions start with
> optionally indented prompts (>>>) and end with blank lines. Use
> (C-c % C-e) to insert a new doctest-example region. When
> `doctest-execute' (C-c C-c) is called inside a doctest-example
> region, it executes all examples in the buffer.


Take care,
-Edward

[1] doctest-mode 0.4 announcement:

http://mail.python.org/pipermail/pyt...st/006038.html

[2] email re mmm-mode:
http://mail.python.org/pipermail/pyt...er/354482.html

[3] doctest-mode homepage:
http://www.cis.upenn.edu/~edloper/projects/doctestmode/

[4] doctest-mode walkthrough:
http://tinyurl.com/25bljc

[5] doctest-mode subversion:

https://python-mode.svn.sf.net/svnro...octest-mode.el


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments