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

Discussion in 'Python' started by Edward Loper, Aug 7, 2007.

  1. Edward Loper

    Edward Loper Guest

    [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/svnroot/python-mode/trunk/python-mode/doctest-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/python-announce-list/2007-August/006038.html

    [2] email re mmm-mode:
    http://mail.python.org/pipermail/python-list/2005-November/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/svnroot/python-mode/trunk/python-mode/doctest-mode.el
     
    Edward Loper, Aug 7, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John J Lee
    Replies:
    3
    Views:
    490
    bruno at modulix
    Dec 1, 2005
  2. John J Lee
    Replies:
    0
    Views:
    529
    John J Lee
    Aug 7, 2007
  3. Edward Loper

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

    Edward Loper, Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    439
    Edward Loper
    Aug 9, 2007
  4. Neal Becker
    Replies:
    0
    Views:
    382
    Neal Becker
    Aug 9, 2007
  5. Jeffrey Moss

    eruby mode emacs with mmm-mode

    Jeffrey Moss, Jul 6, 2005, in forum: Ruby
    Replies:
    1
    Views:
    150
    Alan Chen
    Jul 6, 2005
Loading...

Share This Page