GNU bug report logs - #14448
Wrong indentation in comment lines for F90 mode?

Previous Next

Package: emacs;

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

Date: Thu, 23 May 2013 11:37:01 UTC

Severity: minor

Tags: help

Merged with 5595

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 14448 in the body.
You can then email your comments to 14448 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 bug-gnu-emacs <at> gnu.org:
bug#14448; Package emacs. (Thu, 23 May 2013 11:37: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, 23 May 2013 11:37:01 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-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Wrong indentation in comment lines for F90 mode?
Date: Thu, 23 May 2013 12:51:35 +0200
Start Emacs with

$ emacs -Q &

then "C-x C-f foo.f90". Now type "!" to start a comment line and then 
type M-j to produce other comment lines. The result is as follow:


!
  !
  !
  !
  !

from the second line, the comment is indented. Repeating the same steps 
for a C++ mode file, "C-x C-f foo.cpp", the result is

//
//
//
//
//

without indentation. I would expect the same for F90 mode...

So, is the behavior in F90 mode to be expected (on purpose) or is it wrong?


Ciao,
 Angelo.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14448; Package emacs. (Thu, 23 May 2013 17:06:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 14448 <at> debbugs.gnu.org
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Thu, 23 May 2013 13:04:24 -0400
Angelo Graziosi wrote:

> Start Emacs with
>
> $ emacs -Q &
>
> then "C-x C-f foo.f90". Now type "!" to start a comment line and then
> type M-j to produce other comment lines. The result is as follow:
>
>
> !
>   !

You reported this before.
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5595

As I said then:

  I don't understand what comment-indent-new-line is supposed to do, nor
  which variables modes should set to make it work correctly.




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.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14448; Package emacs. (Thu, 23 May 2013 20:13:01 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: Glenn Morris <rgm <at> gnu.org>
Cc: bug-emacs <bug-gnu-emacs <at> gnu.org>,
	Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Thu, 23 May 2013 22:00:13 +0200
Il 23/05/2013 19.04, Glenn Morris ha scritto:
> Angelo Graziosi wrote:
>
>> Start Emacs with
>>
>> $ emacs -Q &
>>
>> then "C-x C-f foo.f90". Now type "!" to start a comment line and then
>> type M-j to produce other comment lines. The result is as follow:
>>
>>
>> !
>>    !
>
> You reported this before.
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5595
>
> As I said then:
>
>    I don't understand what comment-indent-new-line is supposed to do, nor
>    which variables modes should set to make it work correctly.
>

Oh, sorry for the noise then... :(

Any way, all my observations I did in that thread are still alive...


Stefan, have you some comment? In that thread you wrote:

> 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%

F90 is a "free text style of languages and comments" like C++, so one 
doesn't understand why its comments behaves differently...

> 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.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(WoW! I didn't remember that... :-) )



Ciao,
 Angelo.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14448; Package emacs. (Sat, 25 May 2013 03:25:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: Glenn Morris <rgm <at> gnu.org>, bug-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Fri, 24 May 2013 23:23:27 -0400
>> I don't understand what comment-indent-new-line is supposed to do, nor
>> which variables modes should set to make it work correctly.

To tell you the truth, I don't know either.  The way I see it, M-j
should be bound to a function that funcalls comment-line-break-function
(whose default value is comment-indent-new-line).  So modes can modify
comment-line-break-function (ideally via add-function) to tune
its behavior.

> F90 is a "free text style of languages and comments" like C++, so one
> doesn't understand why its comments behaves differently...

I see now that it behaves differently because f90 tells it to, via
f90-comment-indent.  Try:

! bla
! bli

and then hit either TAB or M-; on the second line, and you'll see it
gets indented by 1 more space, just like in your example.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14448; Package emacs. (Sat, 25 May 2013 11:27:02 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, bug-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Sat, 25 May 2013 13:24:28 +0200
Il 25/05/2013 5.23, Stefan Monnier ha scritto:
>>> I don't understand what comment-indent-new-line is supposed to do, nor
>>> which variables modes should set to make it work correctly.
>
> To tell you the truth, I don't know either.  The way I see it, M-j
> should be bound to a function that funcalls comment-line-break-function
> (whose default value is comment-indent-new-line).  So modes can modify
> comment-line-break-function (ideally via add-function) to tune
> its behavior.
>
>> F90 is a "free text style of languages and comments" like C++, so one
>> doesn't understand why its comments behaves differently...
>
> I see now that it behaves differently because f90 tells it to, via
> f90-comment-indent.  Try:
>
> ! bla
> ! bli
>
> and then hit either TAB or M-; on the second line, and you'll see it
> gets indented by 1 more space, just like in your example.

Indeed...

It seems that this happens only for comments before source code... 
Anyway, it isn't very important.

Thanks for clarification..

Ciao.
 Angelo.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14448; Package emacs. (Sun, 26 May 2013 03:11:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14448 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Sat, 25 May 2013 23:09:03 -0400
Stefan Monnier wrote:

> I see now that it behaves differently because f90 tells it to, via
> f90-comment-indent.  Try:
>
> ! bla
> ! bli
>
> and then hit either TAB or M-; on the second line, and you'll see it
> gets indented by 1 more space, just like in your example.

ITYM 2 spaces?

This takes me back to my original question:
Is M-j supposed to re-indent the line it starts on, or not?

If not, is it supposed to indent the following line as it would normally
be indented, or to match the indentation of the original line?

If the answers are "no", and "as normal", then there is no bug here.

> It seems that this happens only for comments before source code... 

Probably because that is an ambiguous state, depending on whether or not
a leading "program" line gets added. See
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3729#10




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#14448; Package emacs. (Sun, 26 May 2013 18:39:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 14448 <at> debbugs.gnu.org, Angelo Graziosi <angelo.graziosi <at> alice.it>
Subject: Re: bug#14448: Wrong indentation in comment lines for F90 mode?
Date: Sun, 26 May 2013 14:36:47 -0400
> Is M-j supposed to re-indent the line it starts on, or not?

That's unspecified.  IIUC it doesn't, currently.

> If not, is it supposed to indent the following line as it would normally
> be indented, or to match the indentation of the original line?

The new line should be indented according to indent-according-to-mode.

> If the answers are "no", and "as normal", then there is no bug here.

At least w.r.t M-j, that's my impression as well: the only problem is
that the OP wants his ! comments to be on column 0 whereas f90-mode puts
them in column 1, but that's unrelated to M-j.


        Stefan




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

Message #30 received at 14448 <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 107 days ago.

Previous Next


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