From unknown Fri Aug 22 01:33:44 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#3238: python mode comments should define indentation level Reply-To: akkana@shallowsky.com (Akkana Peck), 3238@debbugs.gnu.org Resent-From: akkana@shallowsky.com (Akkana Peck) Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 07 May 2009 17:25:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: report 3238 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124171681930332 (code B ref -1); Thu, 07 May 2009 17:25:06 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 7 May 2009 17:20:19 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n47HKBZ6030155 for ; Thu, 7 May 2009 10:20:13 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M27GV-0004OC-AA for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:20:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M27GQ-0004M0-6Q for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:20:10 -0400 Received: from [199.232.76.173] (port=58822 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M27GQ-0004Lx-3P for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:20:06 -0400 Received: from relay-2.mail.nethere.net ([66.63.128.162]:35499) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M27GP-0004Pb-Kx for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:20:05 -0400 Received: from scan-2.mail.nethere.net (scan-2.mail.nethere.net [66.63.128.133]) by relay-2.mail.nethere.net (Postfix) with ESMTP id 20CFA12BF50 for ; Thu, 7 May 2009 10:20:03 -0700 (PDT) Received: from mta-1.mail.nethere.net by scan-2.mail.nethere.net with LMTP id FG508qGNqtzt; Thu, 7 May 2009 10:20:03 -0700 (PDT) Received: from clavius.shallowsky.com (adsl-69-105-235-1.dsl.pltn13.pacbell.net [69.105.235.1]) by mta-1.mail.nethere.net (Postfix) with ESMTP id EAA62108815 for ; Thu, 7 May 2009 10:20:02 -0700 (PDT) Received: by clavius.shallowsky.com (Postfix, from userid 666) id 8AD0A19DD1; Thu, 7 May 2009 10:20:01 -0700 (PDT) To: bug-gnu-emacs@gnu.org Message-Id: <20090507172001.8AD0A19DD1@clavius.shallowsky.com> Date: Thu, 7 May 2009 10:20:01 -0700 (PDT) From: akkana@shallowsky.com (Akkana Peck) X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) In python mode (python.el), I'm having a lot of trouble adding comments because newline-and-indent always re-indents to the level of the last code line, ignoring comment lines. For instance, if I have this code: for item in items : for c in chars : do_stuff() # hitting return after do_stuff() will indent 12 spaces # But I want to start a comment block with a 4-space indent. # Here is the start of a comment describing what the next code block does. # Each of these lines is indented 12 spaces, not 4. When I hit return after the do_stuff() line, I'm indented 12 spaces, which is reasonable given the context. I backspace 8 chars to where I actually want to be. If I now type a code line, like i = 10, and hit return, the next line will be indented 4 spaces. But if I type a comment line like the one shown in my example, the next line will be indented 12 spaces, not 4. So it's difficult to add comments for functions or blocks of code, because you have to correct the indentation with every line you type. newline-and-indent in python mode should do the same thing from comment lines as it does from code lines: use the indentation of the current line. In GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.14.1) of 2008-09-05 on vernadsky, modified by Ubuntu Windowing system distributor `The X.Org Foundation', version 11.0.10502000 configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 locale-coding-system: utf-8 default-enable-multibyte-characters: t Major mode: Python Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t line-number-mode: t transient-mark-mode: identity Recent input: C-b C-b C-w C-x C-s C-u C-v C-u C-v C-n C-n C-n C-n C-n C-a C-k C-k C-p C-p C-y C-p C-n C-a C-k C-k C-x C-f C-g C-x C-f s h a C-s d e l e t e C-n C-x b C-h C-h C-h C-h g i m p . d e l e t e ( n e w i m g ) C-x C-s C-p C-h C-h C-h C-h # SPC I f SPC t h e SPC s a v e SPC w a s SPC s u c c e s s f u l , SPC w e SPC d o n ' t SPC n e e d SPC t o SPC s h o w SPC t h e SPC n e w SPC i m a g e , C-h C-h C-h C-h # SPC s o SPC d e l e t e SPC i t : C-x C-s C-n C-n C-a C-x C-s C-x b C-x k C-x b C-h . C-h C-h C-h C-h # SPC C-x C-f C-w C-h / . e m a c s C-x b C-x C-s X X X C-x C-s C-h C-h C-h C-x C-s C-x b C-s p y t h o n C-s C-s C-s C-s C-a C-x b C-h C-h C-h SPC a s d f SPC a s d f SPC a s d f a s SPC d f a s d SPC f a s d SPC f a s d SPC f a s d f M-q M-x r e p o t C-h r t - e m Recent messages: Making completion list... Quit Mark saved where search started Wrote /home/akkana/.gimp-2.6/plug-ins/wallpaper.py [3 times] Wrote /home/akkana/bin/pytopo [3 times] Mark saved where search started Loading newcomment...done Loading emacsbug... Loading regexp-opt...done Loading emacsbug...done From unknown Fri Aug 22 01:33:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#3238: python mode comments should define indentation level References: <20090507172001.8AD0A19DD1@clavius.shallowsky.com> In-Reply-To: <20090507172001.8AD0A19DD1@clavius.shallowsky.com> Resent-From: =?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Oct 2012 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 3238 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 3238@debbugs.gnu.org Received: via spool by 3238-submit@debbugs.gnu.org id=B3238.134962684426679 (code B ref 3238); Sun, 07 Oct 2012 16:21:02 +0000 Received: (at 3238) by debbugs.gnu.org; 7 Oct 2012 16:20:44 +0000 Received: from localhost ([127.0.0.1]:60199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKtau-0006wG-Hp for submit@debbugs.gnu.org; Sun, 07 Oct 2012 12:20:44 -0400 Received: from mail-gg0-f172.google.com ([209.85.161.172]:60806) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKtar-0006w4-Mo for 3238@debbugs.gnu.org; Sun, 07 Oct 2012 12:20:42 -0400 Received: by mail-gg0-f172.google.com with SMTP id i4so991237ggn.3 for <3238@debbugs.gnu.org>; Sun, 07 Oct 2012 09:20:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=YM7ofkKDi7pOQQn0clvhQKppbXJei4GsLlgXCqDLWCE=; b=TBnOThANZpLWr0BoLfyID1pmEo3oqBOuwsElSVu8qkigHbwGZ+WL8FuEcKz+F1iJjZ jRUbYpUCjAJbvPGqVFXYc8rE6ayqBYuBBN7eOoLN/QtCdhTqyIVyneRxFodkWMxRfCM8 en9N1SYOf0Vke1I1jDF6/cC0Kn/EhDO0BzJnw3lTUhw5BprxTS0FXgumUBF+DHGBSeyj +CIQA1Ue6MamuC1sZTkIypLWzJHuuCEQIDSCjh6z6evupn9nXWOaotlMR/4cd3vYK2+n 3RHWpfT2I8Mk7xtkBzcV4m11dgcU0gfTy6BlXvRWr2D9vJZfTb86KLAmglfDRIOF347r SKIA== Received: by 10.100.202.19 with SMTP id z19mr2520819anf.21.1349626813251; Sun, 07 Oct 2012 09:20:13 -0700 (PDT) Received: from [192.168.1.25] (host17.181-14-226.telecom.net.ar. [181.14.226.17]) by mx.google.com with ESMTPS id u13sm15003495anl.5.2012.10.07.09.20.11 (version=SSLv3 cipher=OTHER); Sun, 07 Oct 2012 09:20:12 -0700 (PDT) Message-ID: <5071ABD8.9050701@anue.biz> Date: Sun, 07 Oct 2012 13:20:40 -0300 From: =?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120910 Thunderbird/15.0.1 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQn+Ht5/qeozsyAiOQ5Az9vKwRPKNLDzRKos4G+bJjtpge5KDNoOu+EPz+2w8JnS6xr2s8Ek X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) Fixed in revno 110426. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 07 12:20:59 2012 Received: (at control) by debbugs.gnu.org; 7 Oct 2012 16:20:59 +0000 Received: from localhost ([127.0.0.1]:60202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKtb8-0006wl-TT for submit@debbugs.gnu.org; Sun, 07 Oct 2012 12:20:59 -0400 Received: from mail-yh0-f44.google.com ([209.85.213.44]:55331) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKtb7-0006wY-Mr for control@debbugs.gnu.org; Sun, 07 Oct 2012 12:20:57 -0400 Received: by mail-yh0-f44.google.com with SMTP id 56so764858yhq.3 for ; Sun, 07 Oct 2012 09:20:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:content-type :content-transfer-encoding:x-gm-message-state; bh=gi+GIwtfafuri+Ik/vy/a4xD42alrX26y8WtIFZo7I0=; b=iL5S/vy3oeaJYggJYTjO/I888bhDlp1QP8qFct4GDAmBvPAZuaInhXjKHZUj7gGuDv w1Gdrj9ME/D+7FrdyHmvWLlZQfUmyAfQ0G66IF8yEMgLtyg664pQvPKjaXXCqQ1s/mVv 4F7oWEIdUbf9G9SOf4821NXqlwcHE1gWhJWfW1iz7sH2w0COPnR6DxsJFl32kyKxDv6J gVcXEnLqRfJQqrBgc5hy74ih2RMr7HPu9wjcOL8Dn1RDWmc4HIf9Xc+wPhI6nCXj750n EwKYit9i3oGTWTBgYd6bRCAahq/GQMxgSJg63iE0cD7E0E4AEZQDNRX/tquBX6vF2CQv XTvg== Received: by 10.236.85.97 with SMTP id t61mr13663783yhe.53.1349626829566; Sun, 07 Oct 2012 09:20:29 -0700 (PDT) Received: from [192.168.1.25] (host17.181-14-226.telecom.net.ar. [181.14.226.17]) by mx.google.com with ESMTPS id d66sm22559626yhe.1.2012.10.07.09.20.28 (version=SSLv3 cipher=OTHER); Sun, 07 Oct 2012 09:20:28 -0700 (PDT) Message-ID: <5071ABE8.2010207@anue.biz> Date: Sun, 07 Oct 2012 13:20:56 -0300 From: =?ISO-8859-1?Q?Fabi=E1n_Ezequiel_Gallina?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120910 Thunderbird/15.0.1 MIME-Version: 1.0 To: control@debbugs.gnu.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlUHXEXzKUD8tw4YOavWpXPdYVlEc51gbU4LlSKEwkn4GaZZEFOrsPp+8IHDsDAjcAKOiz2 X-Spam-Score: 4.9 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close #3238 [...] Content analysis details: (4.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.0 GOT_NO_SUBJECT No real subject 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.44 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 4.9 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close #3238 [...] Content analysis details: (4.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.44 listed in list.dnswl.org] 3.0 GOT_NO_SUBJECT No real subject 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] 1.8 MISSING_SUBJECT Missing Subject: header 0.0 TVD_SPACE_RATIO TVD_SPACE_RATIO close #3238