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

2007-08-09 Thread Neal Becker
Edward Loper wrote:

 Anyone testing on xemacs?  I tried it, and C-c C-c sent xemacs into an
 infinite loop (apparantly).
 
 It works fine for me in XEmacs 21.4 (patch 17) (i386-debian-linux,
 Mule).  If you could answer a few questions, it might help me track down
 the problem:
 
 - What version of xemacs are you running?
 - What version of doctest-mode are you running (0.4 or 0.5)?
 - Are you using doctest-mode by itself, or in combination with another
mode (via mmm-mode)?
 - Does pressing control-g (possibly repeatedly) cause it to become
unstuck?
 - Does it always freeze when you hit C-c C-c?  Or does it depend on the
contents of the buffer?  Does it freeze if you run it in an empty
buffer?
 
 You could try changing the value of doctest-python-command, to see if
 that helps -- M-x customize-variable doctest-python-command.  Set it
 to the full path to a Python interpreter.
 
 Thanks,
 -Edward

Value: 21.5  (beta28) \fuki\ XEmacs Lucid

I tested with 'hello.py', which is attached.

Load hello.py.  M-x mmm-mode.  Then move cursor to the highlighted test
region (the triple quoted doctest).  C-h k C-c C-c says 'doctest-execute'. 
good.  Now C-c C-c sends xemacs into an infinite loop.

hello.py---
import math

'''
 print 2 + 2
4
'''

def _test():
import doctest
doctest.testmod()

if __name__ == __main__:
_test()


-- 
http://mail.python.org/mailman/listinfo/python-list


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

2007-08-09 Thread Edward Loper
Edward Loper wrote:
 Anyone testing on xemacs?  I tried it, and C-c C-c sent xemacs into an
 infinite loop (apparantly).

I may have tracked down the cause of this problem.  Please download the 
most recent version, and try again.  And when you do, let me know 
whether that fixed it. :)

-Edward
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2007-08-08 Thread Neal Becker
Anyone testing on xemacs?  I tried it, and C-c C-c sent xemacs into an
infinite loop (apparantly).

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2007-08-08 Thread Edward Loper
 Anyone testing on xemacs?  I tried it, and C-c C-c sent xemacs into an
 infinite loop (apparantly).

It works fine for me in XEmacs 21.4 (patch 17) (i386-debian-linux, 
Mule).  If you could answer a few questions, it might help me track down 
the problem:

- What version of xemacs are you running?
- What version of doctest-mode are you running (0.4 or 0.5)?
- Are you using doctest-mode by itself, or in combination with another
   mode (via mmm-mode)?
- Does pressing control-g (possibly repeatedly) cause it to become
   unstuck?
- Does it always freeze when you hit C-c C-c?  Or does it depend on the
   contents of the buffer?  Does it freeze if you run it in an empty
   buffer?

You could try changing the value of doctest-python-command, to see if 
that helps -- M-x customize-variable doctest-python-command.  Set it 
to the full path to a Python interpreter.

Thanks,
-Edward
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2007-08-07 Thread Edward Loper
[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


-- 
http://mail.python.org/mailman/listinfo/python-list


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

2007-08-07 Thread John J Lee
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:

 https://python-mode.svn.sf.net/svnroot/python-mode/trunk/python-mode/doctest-mode.el

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


John

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-12-01 Thread bruno at modulix
John J Lee wrote:
 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 don't know.

(snip)
 
 Any tips appreciated!
 

Seems like comp.emacs could be a good place for this question

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-12-01 Thread John J. Lee
bruno at modulix [EMAIL PROTECTED] writes:

 John J Lee wrote:
  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 don't know.
 
 (snip)
  
  Any tips appreciated!
  
 
 Seems like comp.emacs could be a good place for this question

I've only posted to gnu.emacs.help previously (the message you reply
to was cross-posted there), since the name seemed to suggest
friendliness to people like me who use emacs a lot but are clueless
with elisp :-).  But thinking again I guess comp.emacs is just the
general emacs group, while gnu.emacs.help is the GNU-specific one?


John

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] mmm-mode, python-mode and doctest-mode?

2005-12-01 Thread bruno at modulix
John J. Lee wrote:
 bruno at modulix [EMAIL PROTECTED] writes:
 
 
John J Lee wrote:

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?

(snip)

Seems like comp.emacs could be a good place for this question
 
 
 I've only posted to gnu.emacs.help previously (the message you reply
 to was cross-posted there), 

Sorry, did not see that. But then you should have set the follow-up there.

 since the name seemed to suggest
 friendliness to people like me who use emacs a lot but are clueless
 with elisp :-)

You can script your emacs with Python too.

.  But thinking again I guess comp.emacs is just the
 general emacs group, while gnu.emacs.help is the GNU-specific one?

Probably. I must say I don't spend that much time configuring my
emacs... Changing mode manually when needed is ok for me.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-11-30 Thread 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?

In my utter e-lisp ignorance, I tried this:

(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(mmm-add-classes
  '(
(doctest
 :submode doctest-mode
 :front \\\
 :back \\\)))
(mmm-add-mode-ext-class nil \\.py$ 'doctest)

That has the following problems:

  - Fails to set the background colour of the doctest-mode regions to the 
default mmm-mode gray (as documented by mmm-mode - and observed for 
another mmm class I have).  Maybe an interaction with python-mode?

  - Confuses python-mode: the face of docstrings sometimes fluctuates from 
second to second between the string face and the face of ordinary text 
(I assume the former face is python-mode's string face and the latter face 
is the doctest-mode English-text face)!


Any tips appreciated!


John
-- 
http://mail.python.org/mailman/listinfo/python-list