From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: akkana@shallowsky.com (Akkana Peck) Newsgroups: gmane.emacs.bugs Subject: bug#3238: python mode comments should define indentation level Date: Thu, 7 May 2009 10:20:01 -0700 (PDT) Message-ID: <20090507172001.8AD0A19DD1@clavius.shallowsky.com> Reply-To: Akkana Peck , 3238@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1241735638 27866 80.91.229.12 (7 May 2009 22:33:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 May 2009 22:33:58 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 08 00:33:50 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M2CA1-0006rk-Ix for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 May 2009 00:33:50 +0200 Original-Received: from localhost ([127.0.0.1]:47739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2CA0-0005Mc-Ss for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 May 2009 18:33:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M27S8-0005uc-An for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:32:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M27S3-0005tg-Lv for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:32:12 -0400 Original-Received: from [199.232.76.173] (port=49393 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M27S3-0005tS-DE for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:32:07 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:50599) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M27S2-0007Vt-Fc for bug-gnu-emacs@gnu.org; Thu, 07 May 2009 13:32:07 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n47HVrvs001662; Thu, 7 May 2009 10:32:00 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n47HP66C031514; Thu, 7 May 2009 10:25:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: akkana@shallowsky.com (Akkana Peck) Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 07 May 2009 17:25:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 3238 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124171681930332 (code B ref -1); Thu, 07 May 2009 17:25:06 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 7 May 2009 17:20:19 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) Original-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) Original-Received: by clavius.shallowsky.com (Postfix, from userid 666) id 8AD0A19DD1; Thu, 7 May 2009 10:20:01 -0700 (PDT) X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 07 May 2009 13:32:12 -0400 X-Mailman-Approved-At: Thu, 07 May 2009 18:33:15 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27769 Archived-At: 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