* bug#5595: Commenting in F90
@ 2010-02-18 10:30 Angelo Graziosi
2010-02-19 9:12 ` Glenn Morris
2022-02-05 23:44 ` bug#14448: Wrong indentation in comment lines for F90 mode? Lars Ingebrigtsen
0 siblings, 2 replies; 7+ messages in thread
From: Angelo Graziosi @ 2010-02-18 10:30 UTC (permalink / raw)
To: 5595
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#5595: Commenting in F90
2010-02-18 10:30 bug#5595: Commenting in F90 Angelo Graziosi
@ 2010-02-19 9:12 ` Glenn Morris
2010-02-19 9:42 ` Angelo Graziosi
2022-02-05 23:44 ` bug#14448: Wrong indentation in comment lines for F90 mode? Lars Ingebrigtsen
1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2010-02-19 9:12 UTC (permalink / raw)
To: Angelo Graziosi; +Cc: 5595
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'.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#5595: Commenting in F90
2010-02-19 9:12 ` Glenn Morris
@ 2010-02-19 9:42 ` Angelo Graziosi
2010-02-19 18:01 ` Glenn Morris
2010-02-19 18:25 ` Stefan Monnier
0 siblings, 2 replies; 7+ messages in thread
From: Angelo Graziosi @ 2010-02-19 9:42 UTC (permalink / raw)
To: 5595
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#5595: Commenting in F90
2010-02-19 9:42 ` Angelo Graziosi
@ 2010-02-19 18:01 ` Glenn Morris
2010-02-21 0:33 ` Angelo Graziosi
2010-02-19 18:25 ` Stefan Monnier
1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2010-02-19 18:01 UTC (permalink / raw)
To: Angelo Graziosi; +Cc: 5595
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...
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#5595: Commenting in F90
2010-02-19 18:01 ` Glenn Morris
@ 2010-02-21 0:33 ` Angelo Graziosi
0 siblings, 0 replies; 7+ messages in thread
From: Angelo Graziosi @ 2010-02-21 0:33 UTC (permalink / raw)
To: 5595
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#5595: Commenting in F90
2010-02-19 9:42 ` Angelo Graziosi
2010-02-19 18:01 ` Glenn Morris
@ 2010-02-19 18:25 ` Stefan Monnier
1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2010-02-19 18:25 UTC (permalink / raw)
To: Angelo Graziosi; +Cc: 5595
>> 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
^ permalink raw reply [flat|nested] 7+ 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
2010-02-19 9:12 ` Glenn Morris
@ 2022-02-05 23:44 ` Lars Ingebrigtsen
1 sibling, 0 replies; 7+ 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] 7+ messages in thread
end of thread, other threads:[~2022-02-05 23:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-18 10:30 bug#5595: Commenting in F90 Angelo Graziosi
2010-02-19 9:12 ` Glenn Morris
2010-02-19 9:42 ` Angelo Graziosi
2010-02-19 18:01 ` Glenn Morris
2010-02-21 0:33 ` Angelo Graziosi
2010-02-19 18:25 ` Stefan Monnier
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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.