all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Hendrik Weisser" <hendrik.weisser@gmx.net>
To: 15400@debbugs.gnu.org
Subject: bug#15400: Python mode: "eval region" indentation problem
Date: Tue, 17 Sep 2013 14:42:54 +0200 (CEST)	[thread overview]
Message-ID: <trinity-23e35834-512c-4c5f-bb2e-fe464f13a3e7-1379421774752@3capp-gmx-bs48> (raw)

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





             reply	other threads:[~2013-09-17 12:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 12:42 Hendrik Weisser [this message]
2013-09-17 15:56 ` bug#15400: Python mode: "eval region" indentation problem Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-23e35834-512c-4c5f-bb2e-fe464f13a3e7-1379421774752@3capp-gmx-bs48 \
    --to=hendrik.weisser@gmx.net \
    --cc=15400@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.