unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14076: 24.3; Comments in Fortran Source
@ 2013-03-28 15:44 fkrogh
  2013-03-30  1:46 ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: fkrogh @ 2013-03-28 15:44 UTC (permalink / raw)
  To: 14076

I have options set so that comments should not be touched when
formatting a region, but they are indented to the current indentation
level.  It is a bit of a pain to use a regular expression search and
replace to get them back where they belong.



In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.3)
 of 2013-03-25 on mon1
Windowing system distributor `The X.Org Foundation', version 11.0.11400000
System Description:	Gentoo Base System release 2.2

Configured using:
 `configure '--prefix=/usr' '--build=x86_64-pc-linux-gnu'
 '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man'
 '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc'
 '--localstatedir=/var/lib' '--libdir=/usr/lib64'
 '--disable-dependency-tracking' '--program-suffix=-emacs-24'
 '--program-transform-name=s/emacs-[0-9].*/emacs-24/'
 '--infodir=/usr/share/info/emacs-24'
 '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64'
 '--with-gameuser=games' '--without-compress-info' '--without-hesiod'
 '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus'
 '--without-gnutls' '--without-xml2' '--without-selinux'
 '--without-wide-int' '--with-sound' '--with-x' '--without-ns'
 '--without-gconf' '--without-gsettings' '--without-toolkit-scroll-bars'
 '--without-gif' '--with-jpeg' '--with-png' '--with-rsvg'
 '--without-tiff' '--with-xpm' '--without-imagemagick' '--without-xft'
 '--without-libotf' '--without-m17n-flt' '--with-x-toolkit=gtk3'
 'GENTOO_PACKAGE=app-editors/emacs-24.3'
 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu'
 'CFLAGS=-O2 -march=native -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'
 'CPPFLAGS=''

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: F90

Minor modes in effect:
  shell-dirtrack-mode: t
  recentf-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: f90-do-auto-fill
  transient-mark-mode: t

Recent input:
t h a l a c a r t e . c o m <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-1> W h e n SPC r e f o r m a 
t t i n g SPC <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> f o 
r m a t t i n g SPC a SPC r e g i o n SPC i n SPC F 
o r t r a n SPC c o m m e n t s SPC a r e SPC i n d 
e n t e d SPC t o SPC t h e SPC c u r r e n t SPC i 
n d e n t a t i o n SPC l e v 3 e l <backspace> <backspace> 
<backspace> e l , SPC e v e n SPC t h o u g h SPC I 
SPC h a v e SPC s e t SPC t h e SPC o p t i o n s SPC 
n o t SPC t o SPC c h a n g e SPC c o m m e n t s . 
<return> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> 
<mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> 
<mouse-5> <double-down-mouse-5> <double-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <down-mouse-4> 
<mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <down-mouse-4> 
<mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<down-mouse-1> <mouse-1> C-x k <return> y e s <return> 
C-x k <return> <down-mouse-1> <mouse-1> C-x k <return> 
C-x k <return> <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> C-M-\ C-/ <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <menu-bar> <help-menu> <se
nd-emacs-bug-report>

Recent messages:

Load-path shadows:
/home/m/color-theme hides /usr/local/share/emacs/site-lisp/color-theme/color-theme
/home/m/color-theme-freds hides /usr/local/share/emacs/site-lisp/color-theme/color-theme-freds
/home/m/color-theme hides /usr/local/share/emacs/site-lisp/color-theme
/home/m/color-theme-freds hides /usr/local/share/emacs/site-lisp/color-theme-freds
/home/m/.emacs hides /usr/share/emacs/site-lisp/.emacs

Features:
(shadow sort gnus-util mail-extr emacsbug message idna format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader find-func pp help-mode apropos
time-stamp shell pcomplete compile comint ansi-color ring misearch
multi-isearch cc-langs preview prv-emacs warnings tex-buf reftex-dcr
reftex-auc reftex reftex-vars noutline outline font-latex byte-opt
bytecomp byte-compile cconv latex easy-mmode tex-style tex dbus xml
latexenc make-mode color-theme cl-macs gv edmacro kmacro cl sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils reporter ps-bdf
ps-mule ps-print ps-def lpr fortran f90 cus-edit cus-start cus-load
recentf tree-widget wid-edit cc-mode cc-fonts easymenu cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs pc-bufsw uniquify
advice help-fns cl-lib advice-preload bm-ext bm paren site-gentoo
preview-latex tex-site auto-loads time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting move-toolbar gtk x-toolkit
x multi-tty emacs)





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-03-28 15:44 bug#14076: 24.3; Comments in Fortran Source fkrogh
@ 2013-03-30  1:46 ` Glenn Morris
  2013-03-30  2:27   ` Fred Krogh
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2013-03-30  1:46 UTC (permalink / raw)
  To: fkrogh; +Cc: 14076

fkrogh@mathalacarte.com wrote:

> I have options set so that comments should not be touched when
> formatting a region, but they are indented to the current indentation
> level.

Thanks for the report, but please give a complete example of what you
mean, starting from emacs -Q.





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-03-30  1:46 ` Glenn Morris
@ 2013-03-30  2:27   ` Fred Krogh
  2013-04-03  0:19     ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Fred Krogh @ 2013-03-30  2:27 UTC (permalink / raw)
  To: Glenn Morris

On 03/29/2013 06:46 PM, Glenn Morris wrote:
> fkrogh@mathalacarte.com wrote:
>
>> I have options set so that comments should not be touched when
>> formatting a region, but they are indented to the current indentation
>> level.
> Thanks for the report, but please give a complete example of what you
> mean, starting from emacs -Q.
>
O.k. The program shows up with emacs -Q with this program

program tmp
   integer :: i
   do i = 1, 5
! Comment
      print '("i=",i0)', i
   end do
end program tmp

Highlight the whole program, then <cntrl><alt>\
and the ! Comment is indented, and I think this should not happen.

Thanks for looking into this.
Fred







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

* bug#14076: 24.3; Comments in Fortran Source
  2013-03-30  2:27   ` Fred Krogh
@ 2013-04-03  0:19     ` Glenn Morris
  2013-04-03  0:34       ` Fred Krogh
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2013-04-03  0:19 UTC (permalink / raw)
  To: fkrogh


Please keep the debbugs address cc'd.
[I then forgot to do so myself...]

Fred Krogh wrote:

> O.k. The program shows up with emacs -Q with this program
>
> program tmp
>   integer :: i
>   do i = 1, 5
> ! Comment
>      print '("i=",i0)', i
>   end do
> end program tmp
>
> Highlight the whole program, then <cntrl><alt>\
> and the ! Comment is indented, and I think this should not happen.

Why do you think it should not happen?
F90 mode has always behaved like this.

Earlier you said:

> I have options set so that comments should not be touched when
> formatting a region,

What options are those?





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-03  0:19     ` Glenn Morris
@ 2013-04-03  0:34       ` Fred Krogh
  2013-04-03  1:01         ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Fred Krogh @ 2013-04-03  0:34 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14076

On 04/02/2013 05:19 PM, Glenn Morris wrote:
> Please keep the debbugs address cc'd.
>
> Fred Krogh wrote:
>
>> O.k. The program shows up with emacs -Q with this program
>>
>> program tmp
>>    integer :: i
>>    do i = 1, 5
>> ! Comment
>>       print '("i=",i0)', i
>>    end do
>> end program tmp
>>
>> Highlight the whole program, then <cntrl><alt>\
>> and the ! Comment is indented, and I think this should not happen.
> Why do you think it should not happen?
> F90 mode has always behaved like this.
I'm hoping that just because it has "always" done this, that does not 
make it correct.
>
> Earlier you said:
>
>> I have options set so that comments should not be touched when
>> formatting a region,
> What options are those?

fortran-comment-indent-style is a variable defined in `fortran.el'.
Its value is nil
Original value was fixed

   This variable is safe as a file local variable if its value
   satisfies the predicate which is a byte-compiled expression.

Documentation:
How to indent comments.
nil forces comment lines not to be touched;
`fixed' indents to `fortran-comment-line-extra-indent' columns beyond
   `fortran-minimum-statement-indent-fixed' (if `indent-tabs-mode' nil), or
   `fortran-minimum-statement-indent-tab' (if `indent-tabs-mode' non-nil);
`relative' indents to current Fortran indentation plus
   `fortran-comment-line-extra-indent'.

You can customize this variable.

Specifically nil forces comment lines not to be touched.  When you get 
down to it, I don't care what nil does, but I certainly want some way to 
say "don't change my comments".  But from the above, that seems to be 
what nil is supposed to do.  I'd be happy if there was some choice that 
did this, but here is what I see for choices


Fortran Comment Indent Style:
(*) Untouched
( ) fixed
( ) relative
     State : SAVED and set.
    How to indent comments. Hide
    nil forces comment lines not to be touched;
    `fixed' indents to `fortran-comment-line-extra-indent' columns beyond
      `fortran-minimum-statement-indent-fixed' (if `indent-tabs-mode' 
nil), or
      `fortran-minimum-statement-indent-tab' (if `indent-tabs-mode' 
non-nil);
    `relative' indents to current Fortran indentation plus
      `fortran-comment-line-extra-indent'.
Groups: Fortran Indent

I have fortran-comment-line-extra-indent set to 0.  Perhaps there is 
some combination in there that would make it do what I want, but since 
it appears that nil should do the job, I've filed this report.

Many thanks for looking into this.
Fred





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-03  0:34       ` Fred Krogh
@ 2013-04-03  1:01         ` Glenn Morris
  2013-04-03  1:57           ` Fred Krogh
  2013-04-03 19:04           ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Glenn Morris @ 2013-04-03  1:01 UTC (permalink / raw)
  To: fkrogh; +Cc: 14076

Fred Krogh wrote:

> fortran-comment-indent-style is a variable defined in `fortran.el'.
> Its value is nil

Fortran mode is not F90 mode. They don't have all the same features,
and fortran- variables have no effect on F90 mode. It's a bit
unfortunate that we ended up with "fortran" mode meaning "F77", but here
we are.





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-03  1:01         ` Glenn Morris
@ 2013-04-03  1:57           ` Fred Krogh
  2013-04-04  3:50             ` Glenn Morris
  2013-04-03 19:04           ` Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: Fred Krogh @ 2013-04-03  1:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14076

On 04/02/2013 06:01 PM, Glenn Morris wrote:
> Fred Krogh wrote:
>
>> fortran-comment-indent-style is a variable defined in `fortran.el'.
>> Its value is nil
> Fortran mode is not F90 mode. They don't have all the same features,
> and fortran- variables have no effect on F90 mode. It's a bit
> unfortunate that we ended up with "fortran" mode meaning "F77", but here
> we are.
>
I guess now this turns into a new feature request.  I'd love to have 
some way to leave comments untouched (the nil in Fortran mode). Looking 
in the f90 settings, I don't see any way to do this.
Thanks,
    Fred





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-03  1:01         ` Glenn Morris
  2013-04-03  1:57           ` Fred Krogh
@ 2013-04-03 19:04           ` Stefan Monnier
  2013-04-04  3:51             ` Glenn Morris
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-04-03 19:04 UTC (permalink / raw)
  To: Glenn Morris; +Cc: fkrogh, 14076

>> fortran-comment-indent-style is a variable defined in `fortran.el'.
>> Its value is nil
> Fortran mode is not F90 mode.  They don't have all the same features,
> and fortran- variables have no effect on F90 mode.  It's a bit
> unfortunate that we ended up with "fortran" mode meaning "F77", but here
> we are.

How 'bout we rename fortran.el to f77.el, change the "fortran-" prefix
to "f77-" (and add obsolete aliases where needed)?


        Stefan





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-03  1:57           ` Fred Krogh
@ 2013-04-04  3:50             ` Glenn Morris
  2013-04-04  4:27               ` Fred Krogh
  2013-04-04 12:36               ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Glenn Morris @ 2013-04-04  3:50 UTC (permalink / raw)
  To: fkrogh; +Cc: 14076

Fred Krogh wrote:

> I guess now this turns into a new feature request.  I'd love to have
> some way to leave comments untouched (the nil in Fortran mode).
> Looking in the f90 settings, I don't see any way to do this.

You should be able to (ab)use f90-directive-comment-re for this:

(setq f90-directive-comment-re "!")

I don't really want to add a feature for this since AFAIK other
programming modes don't have such a thing. Fortran mode is different
because comments are weird in old-school F77.





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-03 19:04           ` Stefan Monnier
@ 2013-04-04  3:51             ` Glenn Morris
  0 siblings, 0 replies; 13+ messages in thread
From: Glenn Morris @ 2013-04-04  3:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: fkrogh, 14076

Stefan Monnier wrote:

> How 'bout we rename fortran.el to f77.el, change the "fortran-" prefix
> to "f77-" (and add obsolete aliases where needed)?

Probably the right thing to do; but: Once I had some vague hope to make
"fortran-mode" a smart thing that chose the correct mode, f77 or f90 (or
f95 or f2000 or ...), based on the filename/contents, but it never
happened and shows no sign of doing so. Without a realistic expectation
of that second step, the first step of renaming things will just annoy
people for no reason, so I can't see much point.





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-04  3:50             ` Glenn Morris
@ 2013-04-04  4:27               ` Fred Krogh
  2013-04-04 12:36               ` Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Fred Krogh @ 2013-04-04  4:27 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14076

On 04/03/2013 08:50 PM, Glenn Morris wrote:
> Fred Krogh wrote:
>
>> I guess now this turns into a new feature request.  I'd love to have
>> some way to leave comments untouched (the nil in Fortran mode).
>> Looking in the f90 settings, I don't see any way to do this.
> You should be able to (ab)use f90-directive-comment-re for this:
>
> (setq f90-directive-comment-re "!")
>
> I don't really want to add a feature for this since AFAIK other
> programming modes don't have such a thing. Fortran mode is different
> because comments are weird in old-school F77.
>
I don't know about the abuse, but it works, and I'm very happy to have it.
Many Thanks,
   Fred





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-04  3:50             ` Glenn Morris
  2013-04-04  4:27               ` Fred Krogh
@ 2013-04-04 12:36               ` Stefan Monnier
  2013-04-05 19:18                 ` Glenn Morris
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-04-04 12:36 UTC (permalink / raw)
  To: Glenn Morris; +Cc: fkrogh, 14076

> I don't really want to add a feature for this since AFAIK other
> programming modes don't have such a thing.  Fortran mode is different
> because comments are weird in old-school F77.

You could make f90 follows the "3 comment chars" convention, as
in Lisp.


        Stefan





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

* bug#14076: 24.3; Comments in Fortran Source
  2013-04-04 12:36               ` Stefan Monnier
@ 2013-04-05 19:18                 ` Glenn Morris
  0 siblings, 0 replies; 13+ messages in thread
From: Glenn Morris @ 2013-04-05 19:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14076

Stefan Monnier wrote:

> You could make f90 follows the "3 comment chars" convention, as
> in Lisp.

!!! comments are already indented to column 0. !! comments can be
indented to code with

(setq f90-indented-comment-re "!!")





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

end of thread, other threads:[~2013-04-05 19:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 15:44 bug#14076: 24.3; Comments in Fortran Source fkrogh
2013-03-30  1:46 ` Glenn Morris
2013-03-30  2:27   ` Fred Krogh
2013-04-03  0:19     ` Glenn Morris
2013-04-03  0:34       ` Fred Krogh
2013-04-03  1:01         ` Glenn Morris
2013-04-03  1:57           ` Fred Krogh
2013-04-04  3:50             ` Glenn Morris
2013-04-04  4:27               ` Fred Krogh
2013-04-04 12:36               ` Stefan Monnier
2013-04-05 19:18                 ` Glenn Morris
2013-04-03 19:04           ` Stefan Monnier
2013-04-04  3:51             ` Glenn Morris

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