GNU bug report logs - #5595
comment-indent-new-line in f90-mode

Previous Next

Package: emacs;

Reported by: Angelo Graziosi <angelo.graziosi <at> alice.it>

Date: Thu, 18 Feb 2010 10:58:01 UTC

Severity: minor

Tags: help

Merged with 14448

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5595 in the body.
You can then email your comments to 5595 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Thu, 18 Feb 2010 10:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Angelo Graziosi <angelo.graziosi <at> alice.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 18 Feb 2010 10:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>
Subject: Commenting in F90
Date: Thu, 18 Feb 2010 11:30:26 +0100
I do not know if this is a bug but it looks strange to me.

Start Emacs with:

$ emacs -Q &

Then visit a new file:

C-x C-f foo.f90

Type '!' (it is at line 1, column 0 in Emacs).

Then continue to comment: C-M-j. The new '!' is at line 2, column 2 and 
not at line 2, column 0, i.e. below the previous '!', as one expects (at 
least me!). In other word the second '!' is indended.

Why this?

Ciao,
Angelo.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Fri, 19 Feb 2010 09:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 5595 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 5595 <at> debbugs.gnu.org
Subject: Re: bug#5595: Commenting in F90
Date: Fri, 19 Feb 2010 04:12:14 -0500
retitle 5595 comment-indent-new-line in f90-mode
stop

Angelo Graziosi wrote:

> C-x C-f foo.f90
>
> Type '!' (it is at line 1, column 0 in Emacs).
>
> Then continue to comment: C-M-j. The new '!' is at line 2, column 2
> and not at line 2, column 0, i.e. below the previous '!', as one
> expects (at least me!). In other word the second '!' is indended.

C-M-j runs comment-indent-new-line, a function which I do not understand. 
Maybe it's doing what it is supposed to do.

The only way to customize the behaviour of this function is through
standard comment variables. As far as I know these are all set
correctly in f90-mode.

The doc-string says

    Break line at point and indent, continuing comment if within one.
    This indents the body of the continued comment
    under the previous comment line.

It's a little ambiguous from that as to whether it indents the first
line or not. The Emacs manual is clearer, saying:

   Like <RET> followed by inserting and aligning a comment

Ie, it does not indent the first line, only the second.
Under these criteria, it appears to be working correctly.

Personally I prefer C-j `f90-indent-new-line'.




Changed bug title to 'comment-indent-new-line in f90-mode' from 'Commenting in F90' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 19 Feb 2010 09:13:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Fri, 19 Feb 2010 09:43:01 GMT) Full text and rfc822 format available.

Message #13 received at 5595 <at> debbugs.gnu.org (full text, mbox):

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: 5595 <at> debbugs.gnu.org
Subject: Re: bug#5595: Commenting in F90
Date: Fri, 19 Feb 2010 10:42:05 +0100
Il 19/02/2010 10.12, Glenn Morris ha scritto:
> It's a little ambiguous from that as to whether it indents the first
> line or not. The Emacs manual is clearer, saying:
>
>     Like<RET>  followed by inserting and aligning a comment
>
> Ie, it does not indent the first line, only the second.
> Under these criteria, it appears to be working correctly.

Uhm...

It is not clear why this happens only with F90 mode. Repeating with 
'foo.cpp' (C/C++ mode and '!' --> '//') or with 'foo.f' (Fortran mode, 
'!' --> 'C'), C-M-j sets the comment character correctly indended (to 
me!), under the previous and not shifted...

In any case thanks for clarification.


Ciao,
Angelo.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Fri, 19 Feb 2010 18:02:01 GMT) Full text and rfc822 format available.

Message #16 received at 5595 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 5595 <at> debbugs.gnu.org
Subject: Re: bug#5595: Commenting in F90
Date: Fri, 19 Feb 2010 13:01:21 -0500
Angelo Graziosi wrote:

> It is not clear why this happens only with F90 mode. Repeating with
> foo.cpp' (C/C++ mode and '!' --> '//') or with 'foo.f' (Fortran mode,
> !' --> 'C'), C-M-j sets the comment character correctly indended (to
> me!), under the previous and not shifted...

But 'C' comments in Fortran mode get zero indentation, so how can one
tell if this functin is indenting the first line or not?

Like I said, I don't really understand what this function is supposed
to do, nor which variables modes should set to make it work correctly.

Perhaps the maintainer of newcomment.el can help us out...




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Fri, 19 Feb 2010 18:26:01 GMT) Full text and rfc822 format available.

Message #19 received at 5595 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 5595 <at> debbugs.gnu.org
Subject: Re: bug#5595: Commenting in F90
Date: Fri, 19 Feb 2010 13:25:16 -0500
>> It's a little ambiguous from that as to whether it indents the first
>> line or not. The Emacs manual is clearer, saying:
>> Like<RET>  followed by inserting and aligning a comment
>> Ie, it does not indent the first line, only the second.
>> Under these criteria, it appears to be working correctly.

> Uhm...

> It is not clear why this happens only with F90 mode. Repeating with
> foo.cpp' (C/C++ mode and '!' --> '//') or with 'foo.f' (Fortran mode,
> !' --> 'C'), C-M-j sets the comment character correctly indended (to me!),
> under the previous and not shifted...

comment-indent-new-line is written with a "traditional" free text style
of languages and comments, so I'm not surprised it doesn't work 100%
right under languages such as Fortran.
It's a nasty function, but I've spent a fair bit of time in it (years
ago), so I should be able to track down the problem.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Sun, 21 Feb 2010 00:34:02 GMT) Full text and rfc822 format available.

Message #22 received at 5595 <at> debbugs.gnu.org (full text, mbox):

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: 5595 <at> debbugs.gnu.org
Subject: Re: bug#5595: Commenting in F90
Date: Sun, 21 Feb 2010 01:33:29 +0100
Il 19/02/2010 19.01, Glenn Morris ha scritto:
> Angelo Graziosi wrote:
>
>> It is not clear why this happens only with F90 mode. Repeating with
>> foo.cpp' (C/C++ mode and '!' -->  '//') or with 'foo.f' (Fortran mode,
>> !' -->  'C'), C-M-j sets the comment character correctly indended (to
>> me!), under the previous and not shifted...
>
> But 'C' comments in Fortran mode get zero indentation, so how can one
> tell if this functin is indenting the first line or not?
>
> Like I said, I don't really understand what this function is supposed
> to do, nor which variables modes should set to make it work correctly.
>
> Perhaps the maintainer of newcomment.el can help us out...

...or, perhaps, the indentation should regard only the cursor, not the 
character! For example, editing bash script, the following happens (with 
the cursor, X, at the end of last line):

## [...]
## [...]
##    foo text...X  <== last line

Typing C-M-j produces

## [...]
## [...]
##    foo text...
##    X

with the cursor (X) under the 'f' of 'foo': the character '##' is 
vertically aligned.

Ciao,
Angelo.




Added tag(s) help. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 21 Jun 2012 19:41:02 GMT) Full text and rfc822 format available.

Merged 5595 14448. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 23 May 2013 17:06:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 26 May 2013 03:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5595; Package emacs. (Sat, 05 Feb 2022 23:45:03 GMT) Full text and rfc822 format available.

Message #31 received at 5595 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: Glenn Morris <rgm <at> gnu.org>, 14448 <at> debbugs.gnu.org, 5595 <at> debbugs.gnu.org
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Sun, 06 Feb 2022 00:44:37 +0100
Angelo Graziosi <angelo.graziosi <at> alice.it> writes:

> Start Emacs with:
>
> $ emacs -Q &
>
> Then visit a new file:
>
> C-x C-f foo.f90
>
> Type '!' (it is at line 1, column 0 in Emacs).
>
> Then continue to comment: C-M-j. The new '!' is at line 2, column 2
> and not at line 2, column 0, i.e. below the previous '!', as one
> expects (at least me!). In other word the second '!' is indended.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I'm unable to reproduce this in more recent Emacs versions, so I'm
guessing it's been fixed in the decade since this was reported, and I'm
therefore closing this bug report.  If this bug is still present, please
respond to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 14448 <at> debbugs.gnu.org and Angelo Graziosi <angelo.graziosi <at> alice.it> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 05 Feb 2022 23:45:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Mar 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.