From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#6141: 23.2; comment-choose-indent does the wrong thing Date: Sat, 8 May 2010 09:52:38 -0700 Message-ID: <05022FFFFF0A4CB5A9568BD72D554BA9@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1273337793 22231 80.91.229.12 (8 May 2010 16:56:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 8 May 2010 16:56:33 +0000 (UTC) To: 6141@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 08 18:56:32 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1OAnKH-0001L5-BC for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 May 2010 18:56:31 +0200 Original-Received: from localhost ([127.0.0.1]:42810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAnKF-0005yn-QY for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 May 2010 12:56:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAnKB-0005yg-Ge for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:56:23 -0400 Original-Received: from [140.186.70.92] (port=40427 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAnK9-0005y6-2c for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:56:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAnK7-0007T4-UQ for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:56:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60981) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnK7-0007Sw-Rw for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:56:19 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OAnGv-0002oF-LK; Sat, 08 May 2010 12:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 May 2010 16:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6141 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.127333757010790 (code B ref -1); Sat, 08 May 2010 16:53:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 May 2010 16:52:50 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnGj-0002nz-Lv for submit@debbugs.gnu.org; Sat, 08 May 2010 12:52:50 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnGh-0002nu-Fo for submit@debbugs.gnu.org; Sat, 08 May 2010 12:52:47 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:51624) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OAnGi-0003Nh-1F for submit@debbugs.gnu.org; Sat, 08 May 2010 12:52:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAnGh-0005ha-BP for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:47 -0400 Original-Received: from [140.186.70.92] (port=56173 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAnGf-0005hS-3J for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAnGd-0006lT-BH for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:44 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:54924) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnGc-0006kz-7E for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:43 -0400 Original-Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o48GqdxZ032240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 8 May 2010 16:52:41 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o487Pehn013859 for ; Sat, 8 May 2010 16:52:39 GMT Original-Received: from abhmt021.oracle.com by acsmt353.oracle.com with ESMTP id 224977551273337557; Sat, 08 May 2010 09:52:37 -0700 Original-Received: from dradamslap1 (/10.175.229.69) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 08 May 2010 09:52:37 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acruzt2qnNKW1DtQTNGmH/KomkbK2g== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Auth-Type: Internal IP X-Source-IP: rcsinet13.oracle.com [148.87.113.125] X-CT-RefId: str=0001.0A090204.4BE596D9.0049:SCFMA4539811,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 08 May 2010 12:53:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , 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:36799 Archived-At: Put the cursor on the first comment line in this defun and hit M-;. The comment is moved one space to the right. It should not be moved at all. (defun foo (zz) "..." (let (;; (xx xx) ;; (ww ww) (mm mm)) toto)) `comment-choose-indent' is the problematic code. It is called with arg INDENT = 0 in this case The doc string of `comment-choose-indent', which is the problematic code, even says that the code should try to align with surrounding comments, and that it should prefer INDENT: "Choose the indentation to use for a right-hand-side comment. The criteria are (in this order): - try to keep the comment's text within `comment-fill-column'. - try to align with surrounding comments. - prefer INDENT (or `comment-column' if nil). Point is expected to be at the start of the comment." The problem comes from the systematic (1+ (current-column)), which sets the minimum (variable MIN) to one more than the current column. See also this comment: ;; Can't align to a previous comment: let's try to align to comments ;; on the following lines, then. These have not been re-indented yet, ;; so we can't directly align ourselves with them. All we do is to try ;; and choose an indentation point with which they will be able to ;; align themselves. The assumption that the following comment lines have not been correctly indented is incorrect in this case. `comment-choose-indent' should not be assuming anything about "re-indenting" - it is for _caller_ functions to deal with any re-indenting that might take place on other lines than the current one. `comment-choose-indent' does not do any "re-indenting". It does not even do any indenting. It simply returns a computed possible indent value for code that might want to indent or re-indent. This bug exists since Emacs 21, BTW. Emacs 20 does the right thing in this case. In GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1 Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include'