Re: a good programming text editor (not IDE)

2006-06-15 Thread david . reitter

Slawomir Nowaczyk wrote:

> #> That's true, but even emacs and xemacs don't offer simple automatic
> #> word wrap (i.e. wrap a line without splitting words or putting an eol
> #> or hard carriage return at the end of every line).
>
> Of course it does... there is longlines.el and longlines-mode in my
> copy of GNU Emacs:
>
> ,--
> | Toggle Long Lines mode.
> | In Long Lines mode, long lines are wrapped if they extend beyond
> | `fill-column'.  The soft newlines used for line wrapping will not
> | show up when the text is yanked or saved to disk.
> `-

Not quite. Longlines Mode actually inserts real carriage returns into
the buffer, which you will notice in a lot of situations. For example,
text does not get rewrapped when you resize the frame to a different
width. Also, searching for two words (with a space in between them)
won't work when the target text happens to wrap them just there
(happens to me all the time when editing LaTeX). Thirdly, you'll find
that when you load a file, its lines won't automatically wrap at the
frame (actually, the window) width position.

All of these things don't bother long-time Emacs people, because most
of them tend to see a GUI as a way to display many terminals (something
like that has been said by someone else before in this thread), and
most of them rely on traditional Unix tools such as grep which work
line-by-line.

I have advocated seeing lines (with a CR and/or LF) as paragraphs, and
making the display of lines a matter of the particular display, not the
original data. That is much more natural for wrapped text, i.e. real
text rather than computer-parseable files.
A patch to Emacs 22 has been produced after that discussion, but sadly,
it isn't mature enough to make it into the final Emacs 22 release. But
I am confident we're going to see this in GNU Emacs 23, or at least in
Aquamacs Emacs in a little while.

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


match groups: optional groups not accessible

2005-06-10 Thread david . reitter
Why does the following result in an IndexError?
I try to match an optional group, and then access it via its group
name. The group happens to not participate in the match, but is
obviously defined in the pattern.
The documentation says that, at least for numbered groups, "If a group
is contained in a part of the pattern that did not match, the
corresponding result is None.".
So I would expect None rather than an IndexError, which is (only?)
supposed to occur "If a string argument is not used as a group name in
the pattern".

I would expect named groups and numbered groups to be behave the same
way.
Where's my mistake?

>>> import re
>>> m = re.match('(?Pmaybe)?yes', "yes")
>>> m.group(1)
>>> m.group('maybe')
Traceback (most recent call last):
  File "", line 1, in ?
IndexError: no such group

PS.: Please cc your reply to my e-mail address.

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


Re: match groups: optional groups not accessible

2005-06-10 Thread David Reitter
On 10 Jun 2005, at 20:38, Michael Chermside wrote:
> David Reitter writes:
>
>> Why does the following result in an IndexError?
>>
>  [...]
>
>>>>> import re
>>>>> m = re.match('(?Pmaybe)?yes', "yes")
>>>>> m.group(1)
>>>>> m.group('maybe')
>>>>>
>> Traceback (most recent call last):
>>   File "", line 1, in ?
>> IndexError: no such group
>>
>
> Because the name of the named group in your example is 'm' not  
> 'maybe'. 'maybe'
> is the text to match.

Oh shoot! how couldn't i see this!
thanks very much for pointing it out...

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


Re: Can I run a python program from within emacs?

2008-03-22 Thread David Reitter
On Mar 20, 3:09 pm, jmDesktop <[EMAIL PROTECTED]> wrote:
> Hi, I'm trying to learn Python.  I using Aquamac an emac
> implementation with mac os x.  I have a program.  If I go to the
> command prompt and type pythong myprog.py, it works.  Can the program
> be run from within the editor or is that not how development is done?
> I ask because I was using Visual Studio with C# and, if you're
> familiar, you just hit run and it works.  On Python do I use the
> editor for editing only and then run the program from the command
> line?  Thank you.

Aquamacs, just like any variant of GNU Emacs, will show a Python
menu.  There's a "Start Interpreter" function, and one to evaluate the
buffer (C-c C-c).  It's pretty straightforward (a euphemism for
obvious).

If the Python menu doesn't show, then something is going wrong. M-x
python-mode RET would switch it on.


--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and
support the Aquamacs Project!
-- 
http://mail.python.org/mailman/listinfo/python-list