unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14448: Wrong indentation in comment lines for F90 mode?
@ 2013-05-23 10:51 Angelo Graziosi
  2013-05-23 17:04 ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Angelo Graziosi @ 2013-05-23 10:51 UTC (permalink / raw)
  To: 14448

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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2013-05-23 10:51 bug#14448: Wrong indentation in comment lines for F90 mode? Angelo Graziosi
@ 2013-05-23 17:04 ` Glenn Morris
  2013-05-23 20:00   ` Angelo Graziosi
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2013-05-23 17:04 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 14448

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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2013-05-23 17:04 ` Glenn Morris
@ 2013-05-23 20:00   ` Angelo Graziosi
  2013-05-25  3:23     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Angelo Graziosi @ 2013-05-23 20:00 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14448

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.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2013-05-23 20:00   ` Angelo Graziosi
@ 2013-05-25  3:23     ` Stefan Monnier
  2013-05-25 11:24       ` Angelo Graziosi
  2013-05-26  3:09       ` Glenn Morris
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-05-25  3:23 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 14448

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2013-05-25  3:23     ` Stefan Monnier
@ 2013-05-25 11:24       ` Angelo Graziosi
  2013-05-26  3:09       ` Glenn Morris
  1 sibling, 0 replies; 8+ messages in thread
From: Angelo Graziosi @ 2013-05-25 11:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14448

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.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2013-05-25  3:23     ` Stefan Monnier
  2013-05-25 11:24       ` Angelo Graziosi
@ 2013-05-26  3:09       ` Glenn Morris
  2013-05-26 18:36         ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2013-05-26  3:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14448, Angelo Graziosi

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2013-05-26  3:09       ` Glenn Morris
@ 2013-05-26 18:36         ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-05-26 18:36 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14448, Angelo Graziosi

> 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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#14448: Wrong indentation in comment lines for F90 mode?
  2010-02-18 10:30 bug#5595: Commenting in F90 Angelo Graziosi
@ 2022-02-05 23:44 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05 23:44 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: Glenn Morris, 14448, 5595

Angelo Graziosi <angelo.graziosi@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-05 23:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-23 10:51 bug#14448: Wrong indentation in comment lines for F90 mode? Angelo Graziosi
2013-05-23 17:04 ` Glenn Morris
2013-05-23 20:00   ` Angelo Graziosi
2013-05-25  3:23     ` Stefan Monnier
2013-05-25 11:24       ` Angelo Graziosi
2013-05-26  3:09       ` Glenn Morris
2013-05-26 18:36         ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2010-02-18 10:30 bug#5595: Commenting in F90 Angelo Graziosi
2022-02-05 23:44 ` bug#14448: Wrong indentation in comment lines for F90 mode? Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).