unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15400: Python mode: "eval region" indentation problem
@ 2013-09-17 12:42 Hendrik Weisser
  2013-09-17 15:56 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Hendrik Weisser @ 2013-09-17 12:42 UTC (permalink / raw)
  To: 15400

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#15400: Python mode: "eval region" indentation problem
  2013-09-17 12:42 bug#15400: Python mode: "eval region" indentation problem Hendrik Weisser
@ 2013-09-17 15:56 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2013-09-17 15:56 UTC (permalink / raw)
  To: Hendrik Weisser; +Cc: 15400


This was recently fixed in Emacs trunk:

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-17 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 12:42 bug#15400: Python mode: "eval region" indentation problem Hendrik Weisser
2013-09-17 15:56 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).