[Fwd: Re: [IPython-user] Problems with ipython.el]
Fernando Perez
Fernando.Perez at colorado.edu
Thu Mar 17 17:13:37 CST 2005
I'm forwarding Alex's reply (he's the ipython.el author and our official emacs
guru in-residence). For some reason his post bounced (Alex, I just blanket
whitelisted your gmx.net address on the ipython lists so this doesn't happen
again).
f
-------- Original Message --------
Subject: Re: [IPython-user] Problems with ipython.el
Date: Thu, 17 Mar 2005 23:08:30 +0000
From: Alexander Schmolck <a.schmolck at gmx.net>
To: Fernando Perez <Fernando.Perez at colorado.edu>
CC: IPython User <ipython-user at scipy.net>
References: <Pine.LNX.4.61.0503171710290.2154 at neuron.noos.fr>
<4239C9E6.4040207 at colorado.edu>
<Pine.LNX.4.61.0503172142500.11363 at neuron.noos.fr> <4239F889.1090104 at colorado.edu>
Fernando Perez <Fernando.Perez at colorado.edu> writes:
> Yann Le Du wrote:
>> On Thu, 17 Mar 2005, Fernando Perez wrote:
>>
>>> Sorry about this folks, it's a little subtle bug that crept in and was
>>> tracked down by an enterprising new user. You should be able to use 0.6.12
>>> if you set your prompt strings to have an explicit space at the end, in
>>> ~/.ipython/ipythonrc. For example, mine read:
>>>
>>>prompt_in1 'In [\#]: '
>>>prompt_in2 ' .\D.: '
>>>prompt_out 'Out[\#]: '
>>>
>>> That single missing space is confusing the lisp regexp which identifies
>>> that the prompt came back.
>>>
>>>Let me know if this helps, please.
>> Yes, thanks, it works fine now !
>
> Great. I wonder if Alex (or another elisp expert) is willing to modify the
> regexp in ipython.el to make it a bit more robust against such problems.
> In principle, it should be possible for users to have (or not) spaces at the
> end of their prompts.
Do people really want to customize just the number of spaces in their prompt?
If so, I'd be happy to modify ipython.el accordingly -- otherwise I'd
recommend that anyone who wants to customize his ipython prompt just adjust
``ipython-de-input-prompt-regexp`` accordingly (by adding (setq
ipython-de-input-prompt-regexp ...) to .emacs).
This is not too difficult if you know some flavour of regexps; emacs's regexps
are the the same style that python used to support with the regexp module that
was superseded by re; the main difference is fewer constructs and slightly
different use of backslashes:
so
r'(group|alternative[\d\s])'
becomes
"\\(group\\|alternative[0-9 \t]\\)"
> I'm not 100% comfortable with emacs regexps (I think they are a bit
> different from the perl/python ones I know), but it should be a simple
> change.
Indeed -- just adding a * after each space (same as in a newer perl style
regexp).
> At any rate, the CVS code has now the corrected prompts everywhere, so most
> people should be OK. I'd just like to make the emacs support a bit more
> robust, if possible.
If you want I can certainly do it -- but I guess one of the reasons why I made
the regexp fairly fuzzy was robustness (i.e. avoiding false positives)
-- since the "standard" prompts already can be quite complex and varied (e.g.
command rewriting and multiline stuff).
alex
More information about the IPython-user
mailing list