bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.Glenn Morris <rgm <at> gnu.org>
to control <at> emacsbugs.donarmstrong.com.
Full text available.
Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
(2007-08-08) on rzlab.ucr.edu
X-Spam-Level:
X-Spam-Status: No, score=-6.7 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
MURPHY_DRUGS_REL8,VALID_BTS_CONTROL autolearn=ham
version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 385) by emacsbugs.donarmstrong.com; 13 Jun 2008 16:48:19 +0000
Received: from chene.dit.umontreal.ca (chene.dit.umontreal.ca [132.204.246.20])
by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5DGmD64023624
for <385 <at> emacsbugs.donarmstrong.com>; Fri, 13 Jun 2008 09:48:14 -0700
Received: from ceviche.home (vpn-132-204-232-131.acd.umontreal.ca [132.204.232.131])
by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id m5DGmBlW026536
for <385 <at> emacsbugs.donarmstrong.com>; Fri, 13 Jun 2008 12:48:11 -0400
Received: by ceviche.home (Postfix, from userid 20848)
id 6F462B4087; Fri, 13 Jun 2008 12:47:41 -0400 (EDT)
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: 385 <at> debbugs.gnu.org
Subject: Re: bug#385: [PATCH] comment-indent doesn't respect
Message-ID: <jwvzlppb81n.fsf-monnier+emacsbugreports <at> gnu.org>
References: <20080611171102.7261.qmail <at> byte.local>
<jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
<21310.75.39.61.37.1213210741.squirrel <at> cjm.myvnc.com>
Date: Fri, 13 Jun 2008 12:47:41 -0400
In-Reply-To: <21310.75.39.61.37.1213210741.squirrel <at> cjm.myvnc.com>
(Christopher J. Madsen's message of "Wed, 11 Jun 2008 13:59:01 -0500
(CDT)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
HAS_X_HELO=0, RV3038=0
severity 385 minor
thanks
> I thought about something like that. The problem is that current versions
> of Emacs would have no idea what to do with a return value that's not an
> integer. I use a variety of Emacs versions on a number of machines. The
> indent function would have to check emacs-version and change the return
> value accordingly. That's always a mess.
I understand, but a variable like you suggests makes it impossible to
have the special indentation you want together with the auto-alignment
for other comment cases.
I don't want a half solution, just to make the transition easier.
You're trading off a minor short term gain again a long term loss.
Stefan
Stefan Monnier <monnier <at> IRO.UMontreal.CA>:Emacs Bugs <bug-gnu-emacs <at> gnu.org>.
Full text available.bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.
Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
(2007-08-08) on rzlab.ucr.edu
X-Spam-Level:
X-Spam-Status: No, score=-6.0 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 385) by emacsbugs.donarmstrong.com; 11 Jun 2008 18:59:13 +0000
Received: from sasl.smtp.pobox.com (a-sasl-quonix.sasl.smtp.pobox.com [208.72.237.25])
by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5BIx4v6025674
for <385 <at> emacsbugs.donarmstrong.com>; Wed, 11 Jun 2008 11:59:06 -0700
Received: from localhost.localdomain (localhost [127.0.0.1])
by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 0C3FE3170
for <385 <at> emacsbugs.donarmstrong.com>; Wed, 11 Jun 2008 14:59:04 -0400 (EDT)
Received: from orthanc.cjmweb.net (cpe-24-175-86-179.tx.res.rr.com
[24.175.86.179]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested) by a-sasl-quonix.sasl.smtp.pobox.com
(Postfix) with ESMTPSA id 02E0A316C for <385 <at> emacsbugs.donarmstrong.com>;
Wed, 11 Jun 2008 14:59:02 -0400 (EDT)
Received: (qmail 8228 invoked from network); 11 Jun 2008 18:59:01 -0000
Received: from localhost (HELO cjm.myvnc.com) (127.0.0.1) by localhost with
SMTP; 11 Jun 2008 18:59:01 -0000
Received: from 75.39.61.37 (SquirrelMail authenticated user cjm) by
cjm.myvnc.com with HTTP; Wed, 11 Jun 2008 13:59:01 -0500 (CDT)
Message-ID: <21310.75.39.61.37.1213210741.squirrel <at> cjm.myvnc.com>
In-Reply-To: <jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
References: <20080611171102.7261.qmail <at> byte.local>
<jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
Date: Wed, 11 Jun 2008 13:59:01 -0500 (CDT)
Subject: Re: bug#385: [PATCH] comment-indent doesn't respect
comment-indent-function
From: "Christopher J. Madsen" <cjm <at> cjmweb.net>
To: "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Cc: 385 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
User-Agent: SquirrelMail/1.4.10a
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
X-Pobox-Relay-ID:
75DDA59E-37E8-11DD-943C-B8BFEAD4C077-09214675!a-sasl-quonix.pobox.com
On Wed, June 11, 2008 1:04 pm, Stefan Monnier wrote:
>> It appears that comment-indent changed in 22.1. It gained some code
>> For example, I had a custom indent function that placed comments
>> immediately after a closing brace. However, in Emacs 22, I'd see this:
>
>> while (1) {
>> while (2) {
>
>> } # end 2 <-- this comment placed correctly
>> } # end 1 <-- this comment was aligned with the previous one
>
>> instead of this:
>
>> while (1) {
>> while (2) {
>
>> } # end 2
>> } # end 1 <-- here's where comment-indent-function placed it
>
> I'm not sure I understand. Are you saying that you don't want comments
> to be aligned in that case?
Yes. I want the comment one space after the closing brace. Period. In
Emacs 22, there's no way for the comment-indent-function to say "Put it
here and don't second guess me."
> If you need more control over the placement, rather than a variable
> comment-indent-fixed, maybe we should just say that if
> comment-indent-function returns a list of a single integer, it should be
> taken as the indentation position and not second-guessed. Or it could
> return a cons cell (MIN . MAX) to say "anywhere between MIN and MAX".
I thought about something like that. The problem is that current versions
of Emacs would have no idea what to do with a return value that's not an
integer. I use a variety of Emacs versions on a number of machines. The
indent function would have to check emacs-version and change the return
value accordingly. That's always a mess.
The advantage of my approach is that you can use the same indent function
on any version of Emacs. Older versions just won't pay any attention to
comment-indent-fixed. Otherwise, I'd go with returning a list.
--
Chris Madsen cjm cjmweb.net
-------------------- http://www.cjmweb.net --------------------
"Christopher J. Madsen" <cjm <at> cjmweb.net>:Emacs Bugs <bug-gnu-emacs <at> gnu.org>.
Full text available.bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.
Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
(2007-08-08) on rzlab.ucr.edu
X-Spam-Level:
X-Spam-Status: No, score=-7.0 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_LOW autolearn=ham
version=3.2.3-bugs.debian.org_2005_01_02
Received: (at submit) by emacsbugs.donarmstrong.com; 11 Jun 2008 18:59:15 +0000
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 m5BIxAGj025678
for <submit <at> emacsbugs.donarmstrong.com>; Wed, 11 Jun 2008 11:59:11 -0700
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1K6VXK-0001eQ-AB
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:59:10 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
id 1K6VXJ-0001dH-4G
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:59:09 -0400
Received: from [199.232.76.173] (port=40192 helo=monty-python.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43)
id 1K6VXI-0001cz-PL
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:59:08 -0400
Received: from a-sasl-quonix.sasl.smtp.pobox.com ([208.72.237.25]:62351 helo=sasl.smtp.pobox.com)
by monty-python.gnu.org with esmtp (Exim 4.60)
(envelope-from <cjm <at> cjmweb.net>)
id 1K6VXI-00037Z-QU
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:59:08 -0400
Received: from localhost.localdomain (localhost [127.0.0.1])
by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id B72253172
for <bug-gnu-emacs <at> gnu.org>; Wed, 11 Jun 2008 14:59:04 -0400 (EDT)
Received: from orthanc.cjmweb.net (cpe-24-175-86-179.tx.res.rr.com
[24.175.86.179]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested) by a-sasl-quonix.sasl.smtp.pobox.com
(Postfix) with ESMTPSA id 7A3B03171 for <bug-gnu-emacs <at> gnu.org>; Wed, 11 Jun
2008 14:59:02 -0400 (EDT)
Received: (qmail 8228 invoked from network); 11 Jun 2008 18:59:01 -0000
Received: from localhost (HELO cjm.myvnc.com) (127.0.0.1) by localhost with
SMTP; 11 Jun 2008 18:59:01 -0000
Received: from 75.39.61.37 (SquirrelMail authenticated user cjm) by
cjm.myvnc.com with HTTP; Wed, 11 Jun 2008 13:59:01 -0500 (CDT)
Message-ID: <21310.75.39.61.37.1213210741.squirrel <at> cjm.myvnc.com>
In-Reply-To: <jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
References: <20080611171102.7261.qmail <at> byte.local>
<jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
Date: Wed, 11 Jun 2008 13:59:01 -0500 (CDT)
Subject: Re: bug#385: [PATCH] comment-indent doesn't respect
comment-indent-function
From: "Christopher J. Madsen" <cjm <at> cjmweb.net>
To: "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Cc: 385 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
User-Agent: SquirrelMail/1.4.10a
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
X-Priority: 3 (Normal)
Importance: Normal
X-Pobox-Relay-ID:
7648AFEC-37E8-11DD-8FDA-B8BFEAD4C077-09214675!a-sasl-quonix.pobox.com
Content-Transfer-Encoding: quoted-printable
X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta)
On Wed, June 11, 2008 1:04 pm, Stefan Monnier wrote:
>> It appears that comment-indent changed in 22.1. It gained some code
>> For example, I had a custom indent function that placed comments
>> immediately after a closing brace. However, in Emacs 22, I'd see this=
:
>
>> while (1) {
>> while (2) {
>
>> } # end 2 <-- this comment placed correctly
>> } # end 1 <-- this comment was aligned with the previous one
>
>> instead of this:
>
>> while (1) {
>> while (2) {
>
>> } # end 2
>> } # end 1 <-- here's where comment-indent-function placed it
>
> I'm not sure I understand. Are you saying that you don't want comments
> to be aligned in that case?
Yes. I want the comment one space after the closing brace. Period. In
Emacs 22, there's no way for the comment-indent-function to say "Put it
here and don't second guess me."
> If you need more control over the placement, rather than a variable
> comment-indent-fixed, maybe we should just say that if
> comment-indent-function returns a list of a single integer, it should b=
e
> taken as the indentation position and not second-guessed. Or it could
> return a cons cell (MIN . MAX) to say "anywhere between MIN and MAX".
I thought about something like that. The problem is that current version=
s
of Emacs would have no idea what to do with a return value that's not an
integer. I use a variety of Emacs versions on a number of machines. The
indent function would have to check emacs-version and change the return
value accordingly. That's always a mess.
The advantage of my approach is that you can use the same indent function
on any version of Emacs. Older versions just won't pay any attention to
comment-indent-fixed. Otherwise, I'd go with returning a list.
--=20
Chris Madsen cjm cjmweb.net
-------------------- http://www.cjmweb.net --------------------
"Christopher J. Madsen" <cjm <at> cjmweb.net>:Emacs Bugs <bug-gnu-emacs <at> gnu.org>.
Full text available.bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.
Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
(2007-08-08) on rzlab.ucr.edu
X-Spam-Level:
X-Spam-Status: No, score=-5.5 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 385) by emacsbugs.donarmstrong.com; 11 Jun 2008 18:05:15 +0000
Received: from mercure.iro.umontreal.ca (mercure.iro.umontreal.ca [132.204.24.67])
by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5BI5BLx013330
for <385 <at> emacsbugs.donarmstrong.com>; Wed, 11 Jun 2008 11:05:13 -0700
Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50])
by mercure.iro.umontreal.ca (Postfix) with ESMTP id EBD712CFE75;
Wed, 11 Jun 2008 14:05:10 -0400 (EDT)
Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177])
by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id CE2E03FE1;
Wed, 11 Jun 2008 14:04:57 -0400 (EDT)
Received: by faina.iro.umontreal.ca (Postfix, from userid 20848)
id B370841BEC; Wed, 11 Jun 2008 14:04:57 -0400 (EDT)
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Christopher J. Madsen" <cjm <at> cjmweb.net>
Cc: 385 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#385: [PATCH] comment-indent doesn't respect comment-indent-function
Message-ID: <jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
References: <20080611171102.7261.qmail <at> byte.local>
Date: Wed, 11 Jun 2008 14:04:57 -0400
In-Reply-To: <20080611171102.7261.qmail <at> byte.local> (Christopher J. Madsen's
message of "11 Jun 2008 17:11:02 -0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-DIRO-MailScanner-Information: Please contact the ISP for more information
X-DIRO-MailScanner: Found to be clean
X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel,
SpamAssassin (score=-2.82, requis 5, autolearn=not spam,
ALL_TRUSTED -2.82)
X-DIRO-MailScanner-From: monnier <at> iro.umontreal.ca
> It appears that comment-indent changed in 22.1. It gained some code
Indeed, and it changed further in 22.2.
> to attempt to align the comment with those on surrounding lines.
> Unfortunately, this made it impossible to do certain things with
> comment-indent-function.
> For example, I had a custom indent function that placed comments
> immediately after a closing brace. However, in Emacs 22, I'd see this:
> while (1) {
> while (2) {
> } # end 2 <-- this comment placed correctly
> } # end 1 <-- this comment was aligned with the previous one
> instead of this:
> while (1) {
> while (2) {
> } # end 2
> } # end 1 <-- here's where comment-indent-function placed it
I'm not sure I understand. Are you saying that you don't want comments
to be aligned in that case?
If you need more control over the placement, rather than a variable
comment-indent-fixed, maybe we should just say that if
comment-indent-function returns a list of a single integer, it should be
taken as the indentation position and not second-guessed. Or it could
return a cons cell (MIN . MAX) to say "anywhere between MIN and MAX".
Stefan
Stefan Monnier <monnier <at> iro.umontreal.ca>:Emacs Bugs <bug-gnu-emacs <at> gnu.org>.
Full text available.bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.
Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
(2007-08-08) on rzlab.ucr.edu
X-Spam-Level:
X-Spam-Status: No, score=-6.0 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_LOW autolearn=ham
version=3.2.3-bugs.debian.org_2005_01_02
Received: (at submit) by emacsbugs.donarmstrong.com; 11 Jun 2008 18:05:16 +0000
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 m5BI5CEv013352
for <submit <at> emacsbugs.donarmstrong.com>; Wed, 11 Jun 2008 11:05:14 -0700
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1K6Uh6-0004LX-E5
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:05:12 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
id 1K6Uh5-0004L9-R0
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:05:12 -0400
Received: from [199.232.76.173] (port=49404 helo=monty-python.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43)
id 1K6Uh5-0004Kw-KP
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:05:11 -0400
Received: from mercure.iro.umontreal.ca ([132.204.24.67]:48451)
by monty-python.gnu.org with esmtp (Exim 4.60)
(envelope-from <monnier <at> iro.umontreal.ca>)
id 1K6Uh5-0002QT-JO
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 14:05:11 -0400
Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50])
by mercure.iro.umontreal.ca (Postfix) with ESMTP id EBD712CFE75;
Wed, 11 Jun 2008 14:05:10 -0400 (EDT)
Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177])
by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id CE2E03FE1;
Wed, 11 Jun 2008 14:04:57 -0400 (EDT)
Received: by faina.iro.umontreal.ca (Postfix, from userid 20848)
id B370841BEC; Wed, 11 Jun 2008 14:04:57 -0400 (EDT)
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Christopher J. Madsen" <cjm <at> cjmweb.net>
Cc: 385 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#385: [PATCH] comment-indent doesn't respect comment-indent-function
Message-ID: <jwv1w33vosi.fsf-monnier+emacsbugreports <at> gnu.org>
References: <20080611171102.7261.qmail <at> byte.local>
Date: Wed, 11 Jun 2008 14:04:57 -0400
In-Reply-To: <20080611171102.7261.qmail <at> byte.local> (Christopher J. Madsen's
message of "11 Jun 2008 17:11:02 -0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-DIRO-MailScanner-Information: Please contact the ISP for more information
X-DIRO-MailScanner: Found to be clean
X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel,
SpamAssassin (score=-2.82, requis 5, autolearn=not spam,
ALL_TRUSTED -2.82)
X-DIRO-MailScanner-From: monnier <at> iro.umontreal.ca
X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3)
X-CrossAssassin-Score: 2
> It appears that comment-indent changed in 22.1. It gained some code
Indeed, and it changed further in 22.2.
> to attempt to align the comment with those on surrounding lines.
> Unfortunately, this made it impossible to do certain things with
> comment-indent-function.
> For example, I had a custom indent function that placed comments
> immediately after a closing brace. However, in Emacs 22, I'd see this:
> while (1) {
> while (2) {
> } # end 2 <-- this comment placed correctly
> } # end 1 <-- this comment was aligned with the previous one
> instead of this:
> while (1) {
> while (2) {
> } # end 2
> } # end 1 <-- here's where comment-indent-function placed it
I'm not sure I understand. Are you saying that you don't want comments
to be aligned in that case?
If you need more control over the placement, rather than a variable
comment-indent-fixed, maybe we should just say that if
comment-indent-function returns a list of a single integer, it should be
taken as the indentation position and not second-guessed. Or it could
return a cons cell (MIN . MAX) to say "anywhere between MIN and MAX".
Stefan
Stefan Monnier <monnier <at> iro.umontreal.ca>:Emacs Bugs <bug-gnu-emacs <at> gnu.org>.
Full text available.bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.
Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
(2007-08-08) on rzlab.ucr.edu
X-Spam-Level:
X-Spam-Status: No, score=-5.0 required=4.0 tests=BAYES_00,FVGT_m_MULTI_ODD,
MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_LOW autolearn=ham
version=3.2.3-bugs.debian.org_2005_01_02
Received: (at submit) by emacsbugs.donarmstrong.com; 11 Jun 2008 17:11:31 +0000
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 m5BHBO6q032594
for <submit <at> emacsbugs.donarmstrong.com>; Wed, 11 Jun 2008 10:11:25 -0700
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1K6Tr1-0003Ey-SJ
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 13:11:23 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
id 1K6Tqy-0003DT-Qk
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 13:11:23 -0400
Received: from [199.232.76.173] (port=34187 helo=monty-python.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43)
id 1K6Tqy-0003DQ-Mh
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 13:11:20 -0400
Received: from a-sasl-quonix.sasl.smtp.pobox.com ([208.72.237.25]:47180 helo=sasl.smtp.pobox.com)
by monty-python.gnu.org with esmtp (Exim 4.60)
(envelope-from <cjm <at> cjmweb.net>)
id 1K6Tqy-0007RT-Jf
for bug-gnu-emacs <at> gnu.org; Wed, 11 Jun 2008 13:11:20 -0400
Received: from localhost.localdomain (localhost [127.0.0.1])
by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 9E08F24B9
for <bug-gnu-emacs <at> gnu.org>; Wed, 11 Jun 2008 13:11:15 -0400 (EDT)
Received: from orthanc.cjmweb.net (cpe-24-175-86-179.tx.res.rr.com
[24.175.86.179]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested) by a-sasl-quonix.sasl.smtp.pobox.com
(Postfix) with ESMTPSA id 3B8DB24B8 for <bug-gnu-emacs <at> gnu.org>; Wed, 11 Jun
2008 13:11:13 -0400 (EDT)
Received: (qmail 7262 invoked by uid 1000); 11 Jun 2008 17:11:02 -0000
Date: 11 Jun 2008 17:11:02 -0000
Message-ID: <20080611171102.7261.qmail <at> byte.local>
From: "Christopher J. Madsen" <cjm <at> cjmweb.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] comment-indent doesn't respect comment-indent-function
X-Pobox-Relay-ID:
6665F4FE-37D9-11DD-910D-B8BFEAD4C077-09214675!a-sasl-quonix.pobox.com
X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta)
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
It appears that comment-indent changed in 22.1. It gained some code
to attempt to align the comment with those on surrounding lines.
Unfortunately, this made it impossible to do certain things with
comment-indent-function.
For example, I had a custom indent function that placed comments
immediately after a closing brace. However, in Emacs 22, I'd see this:
while (1) {
while (2) {
} # end 2 <-- this comment placed correctly
} # end 1 <-- this comment was aligned with the previous one
instead of this:
while (1) {
while (2) {
} # end 2
} # end 1 <-- here's where comment-indent-function placed it
On the other hand, I do like the idea of automatically aligning
comments. I had code in my custom indent functions to do that, but it
would be nice if I didn't need to handle that in every indent
function.
I think what's needed is a way for comment-indent-function to
distinguish between "Here's where the comment goes, and that's final"
and "I suggest this position, but make it blend in with the
neighborhood". Ideally, this would be backwards-compatible with older
versions of Emacs.
Here's a patch I came up with to provide that. If
comment-indent-function sets comment-indent-fixed to non-nil, then the
return value will be used as-is. Otherwise, it behaves like Emacs
22.2 did.
Perhaps the sense should be reversed, and it should always respect the
value of comment-indent-function unless told it's ok to adjust it.
*** orig/newcomment.el Fri Mar 07 18:01:12 2008
--- new/newcomment.el Wed Jun 11 11:13:24 2008
*************** (defvar comment-indent-function 'comment
*** 135,140 ****
--- 135,143 ----
This function is called with no args with point at the beginning of
the comment's starting delimiter and should return either the desired
column indentation or nil.
+ The returned value may be adjusted by `comment-choose-indent'.
+ To prevent that, the function should set `comment-indent-fixed'
+ to a non-nil value.
If nil is returned, indentation is delegated to `indent-according-to-mode'.")
;;;###autoload
*************** (defun comment-indent (&optional continu
*** 585,591 ****
(beginning-of-line)
(let* ((eolpos (line-end-position))
(begpos (comment-search-forward eolpos t))
! cpos indent)
;; An existing comment?
(if begpos
(progn
--- 588,594 ----
(beginning-of-line)
(let* ((eolpos (line-end-position))
(begpos (comment-search-forward eolpos t))
! cpos indent comment-indent-fixed)
;; An existing comment?
(if begpos
(progn
*************** (defun comment-indent (&optional continu
*** 622,636 ****
(if (not indent)
;; comment-indent-function refuses: delegate to line-indent.
(indent-according-to-mode)
! ;; If the comment is at the right of code, adjust the indentation.
! (unless (save-excursion (skip-chars-backward " \t") (bolp))
! (setq indent (comment-choose-indent indent)))
! ;; Update INDENT to leave at least one space
! ;; after other nonwhite text on the line.
! (save-excursion
! (skip-chars-backward " \t")
! (unless (bolp)
! (setq indent (max indent (1+ (current-column))))))
;; If that's different from comment's current position, change it.
(unless (= (current-column) indent)
(delete-region (point) (progn (skip-chars-backward " \t") (point)))
--- 625,640 ----
(if (not indent)
;; comment-indent-function refuses: delegate to line-indent.
(indent-according-to-mode)
! (unless comment-indent-fixed
! ;; If the comment is at the right of code, adjust the indentation.
! (unless (save-excursion (skip-chars-backward " \t") (bolp))
! (setq indent (comment-choose-indent indent)))
! ;; Update INDENT to leave at least one space
! ;; after other nonwhite text on the line.
! (save-excursion
! (skip-chars-backward " \t")
! (unless (bolp)
! (setq indent (max indent (1+ (current-column)))))))
;; If that's different from comment's current position, change it.
(unless (= (current-column) indent)
(delete-region (point) (progn (skip-chars-backward " \t") (point)))
In GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600)
of 2008-03-26 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
--
Chris Madsen cjm cjmweb.net
-------------------- http://www.cjmweb.net --------------------
"Christopher J. Madsen" <cjm <at> cjmweb.net>:Emacs Bugs <bug-gnu-emacs <at> gnu.org>.
Full text available.bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:bug#385; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.