GNU bug report logs - #15400
Python mode: "eval region" indentation problem

Previous Next

Package: emacs;

Reported by: "Hendrik Weisser" <hendrik.weisser <at> gmx.net>

Date: Tue, 17 Sep 2013 15:21:02 UTC

Severity: minor

Tags: patch

Merged with 15137

Done: fgallina <at> gnu.org

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15400 in the body.
You can then email your comments to 15400 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15400; Package emacs. (Tue, 17 Sep 2013 15:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Hendrik Weisser" <hendrik.weisser <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Sep 2013 15:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Hendrik Weisser" <hendrik.weisser <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Python mode: "eval region" indentation problem
Date: Tue, 17 Sep 2013 14:42:54 +0200 (CEST)
Dear developers,

The "eval region" function in Emacs' Python major mode (python.el) has problems dealing with indented code.
Consider this example:

1 for i in range(10**10):
2     do_something(i)
3     do_more(i)
4 

When testing such code, it is often useful to evaluate the loop contents for an example value of the parameter, rather than running the whole loop. In the example, I would like to be able to define a region consisting of lines 2 and 3, and run them using the "eval region" command (after setting a value for "i" in the interpreter). However, this will give me an "IndentationError: unexpected indent" in Python (either for the first or the second line, depending on whether the region starts at the beginning of line 2 or after the indent).

It should be possible to resolve such cases by stripping any leading whitespace from the first line in the region, and stripping the same amount from each following line (provided that the region starts at the beginning of the line). I believe this behaviour would be quite intuitive.

Please consider adapting the "eval region" function in this way to increase its utility.


Best regards

Hendrik




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15400; Package emacs. (Tue, 17 Sep 2013 15:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 15400 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: "Hendrik Weisser" <hendrik.weisser <at> gmx.net>
Cc: 15400 <at> debbugs.gnu.org
Subject: Re: bug#15400: Python mode: "eval region" indentation problem
Date: Tue, 17 Sep 2013 11:56:39 -0400
This was recently fixed in Emacs trunk:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15137




Forcibly Merged 15137 15400. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 17 Sep 2013 15:58:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 16 Oct 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.