From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Hendrik Weisser" Newsgroups: gmane.emacs.bugs Subject: bug#15400: Python mode: "eval region" indentation problem Date: Tue, 17 Sep 2013 14:42:54 +0200 (CEST) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1379431304 19582 80.91.229.3 (17 Sep 2013 15:21:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Sep 2013 15:21:44 +0000 (UTC) To: 15400@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 17 17:21:48 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VLx63-0000QX-Mv for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Sep 2013 17:21:47 +0200 Original-Received: from localhost ([::1]:41937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLx63-0006EI-9M for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Sep 2013 11:21:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLx5U-0005ew-KI for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 11:21:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLx5L-0006t2-01 for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 11:21:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLx5K-0006sv-Sk for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 11:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VLx5K-0007tU-DQ for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 11:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Hendrik Weisser" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Sep 2013 15:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15400 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137943121630264 (code B ref -1); Tue, 17 Sep 2013 15:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Sep 2013 15:20:16 +0000 Original-Received: from localhost ([127.0.0.1]:44219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLx4Z-0007s2-Nk for submit@debbugs.gnu.org; Tue, 17 Sep 2013 11:20:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59492) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLuco-0003hC-Nc for submit@debbugs.gnu.org; Tue, 17 Sep 2013 08:43:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLuca-0004Tt-4z for submit@debbugs.gnu.org; Tue, 17 Sep 2013 08:43:21 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:45420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLuca-0004Tp-1X for submit@debbugs.gnu.org; Tue, 17 Sep 2013 08:43:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLucS-00073K-Nd for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 08:43:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLucL-0004SL-EL for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 08:43:04 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:54432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLucL-0004S7-56 for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2013 08:42:57 -0400 Original-Received: from 3capp-gmx-bs48.server.lan ([172.19.170.101]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MPK6I-1VHWu643wO-004Qxl for ; Tue, 17 Sep 2013 14:42:55 +0200 Original-Received: from [193.62.202.242] by 3capp-gmx-bs48.server.lan with HTTP; Tue Sep 17 14:42:54 CEST 2013 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K0:jwQ9svS7Yg6deQCx3OykXUZ07/ETK5JV4eFPpFF7xk0 DJvTv6O+ArpGvCzl1QsDUSW52u8gmW4hRTpxyXiKxemHshMT0Z 4Esxm9ZWQc3hnrIwvORha9oEf7g0vvXthVu1UzYJTSLOU+YKLF vuBQ1hhA7wdVEoyxxmEkkndMtlbe2BkztlUdaf0b5AcdDG6/gW jEwjEKnuqrbJ0JnBv+ip//mv1nD8HZ3o9BLsbn3Ts+cmDUhHZj +Tv1VfVDzxN7HritbsThC/Mp9DWJyKVXv9fOGHRiEsYhHfqtrk 8mhPks= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Tue, 17 Sep 2013 11:20:13 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78488 Archived-At: 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