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

Discussion in 'Python' started by John J Lee, Aug 7, 2007.

  1. John J Lee

    John J Lee Guest

    On Tue, 7 Aug 2007, Edward Loper wrote:

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

    Nice! Works for me so far (emacs 22).

    I'm also very pleased to see that doctest-mode no longer attempts to
    auto-fill at the end of long lines -- that was extremely annoying, and the
    new behaviour is a big improvement.

    Here's another wish. My next-nearest doctest-mode annoyance: hitting TAB
    should have similar behaviour to python-mode. So, the first press of the
    TAB key gets you a sensible guess at the indentation you want. The second
    and subsequent TAB keypresses cycle through no indentation, '>>>'
    indentation, and '...' indentation. Ideally this would be made to work in
    combination with the standard indentation-cycling behaviour in those cases
    where multiple indentations are allowed within Python code (so, it might
    be ' ... ', '', ' >>> ', ' ... ',' ... ',
    ' ... ' as the TAB key is repeatedly pressed).

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

    I couldn't immediately see how to get this working in a .doctest file, so
    haven't tried this yet.

    Another wish: Even though I don't normally run code from emacs directly, I
    do think it would be very handy indeed to be able to execute a *single*
    doctest example from doctest-mode. Don't know what keybinding would be

    John J Lee, Aug 7, 2007
    1. Advertisements

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
    bruno at modulix
    Dec 1, 2005
  2. Edward Loper
    Edward Loper
    Aug 7, 2007
  3. Edward Loper

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

    Edward Loper, Aug 9, 2007, in forum: Python
    Edward Loper
    Aug 9, 2007
  4. Neal Becker
    Neal Becker
    Aug 9, 2007
  5. Jeffrey Moss

    eruby mode emacs with mmm-mode

    Jeffrey Moss, Jul 6, 2005, in forum: Ruby
    Alan Chen
    Jul 6, 2005

Share This Page