[comp.lang.fortran] Fortran-mode in emacs

sullivan@msor.exeter.ac.uk (Rob Sullivan) (07/28/90)

I would be very grateful if someone could point me in the right
direction for an enhanced fortran-mode for emacs. Specifically, I
would like to see emacs correctly indenting the code as I type it. Is
this at all possible or am I just dreaming?

                                  Thanks in advance,

                                                        Rob...

--
- - - -
Robert Sullivan           JANET    : sullivan@uk.ac.exeter.msor
Theoretical Physics Dept. UUCP     : sullivan%msor.exeter.ac.uk@ukc.uucp
University of Exeter      BITNET   : sullivan%msor.exeter.ac.uk@UKACRL
England.                  Internet : sullivan%msor.exeter.ac.uk@cunyvm.cuny.edu
EX4 4QL                   Tel      : +44 392 264198

"One must be open-minded --
 --but not so open-minded that one's brains fall out."

sbs@csc.fi (07/30/90)

In article <SULLIVAN.90Jul27195908@msor0.msor.exeter.ac.uk>, sullivan@msor.exeter.ac.uk (Rob Sullivan) writes:
> I would be very grateful if someone could point me in the right
> direction for an enhanced fortran-mode for emacs. Specifically, I
> would like to see emacs correctly indenting the code as I type it. Is
> this at all possible or am I just dreaming?
> 
>                                   Thanks in advance,
> 
>                                                         Rob...
> 
> --
> - - - -
> Robert Sullivan           JANET    : sullivan@uk.ac.exeter.msor
> Theoretical Physics Dept. UUCP     : sullivan%msor.exeter.ac.uk@ukc.uucp
> University of Exeter      BITNET   : sullivan%msor.exeter.ac.uk@UKACRL
> England.                  Internet : sullivan%msor.exeter.ac.uk@cunyvm.cuny.edu
> EX4 4QL                   Tel      : +44 392 264198
> 
> "One must be open-minded --
>  --but not so open-minded that one's brains fall out."


hi!

I assume you are using GNU-emacs or related (a good fortran-mode available).
use 'TAB'-character (control-I) in the lines where you want the indenting.
fortran-mode DOES NOT add tabs, but spaces.

for example:

        IF (i.eq.9) THEN
        write(6,*)'good bye'
        ENDIF

becomes

        IF (i.eq.9) THEN
           write(6,*)'good bye'
        ENDIF

if u use 'tab' in line 'write...'.

this is almost all I need when I code with emacs. there is other tools
available too, which format whole file of code. I have heard, however, that
this will fail sometimes, if you have too much comment lines (never tested
myself!).

regards,
Sami Saarinen
Center for Scientific Computing, Finland
mail: sbs@csc.fi

davis@pacific.mps.ohio-state.edu ("John E. Davis") (07/31/90)

In article <1990Jul30.005504.1@csc.fi> sbs@csc.fi writes:


   In article <SULLIVAN.90Jul27195908@msor0.msor.exeter.ac.uk>, sullivan@msor.exeter.ac.uk (Rob Sullivan) writes:
   > I would be very grateful if someone could point me in the right
   > direction for an enhanced fortran-mode for emacs. Specifically, I
   > would like to see emacs correctly indenting the code as I type it. Is
   > this at all possible or am I just dreaming?
   > 
                 [stuff deleted]

   I assume you are using GNU-emacs or related (a good fortran-mode available).
   use 'TAB'-character (control-I) in the lines where you want the indenting.
   fortran-mode DOES NOT add tabs, but spaces.

   for example:

	   IF (i.eq.9) THEN
	   write(6,*)'good bye'
	   ENDIF

   becomes

	   IF (i.eq.9) THEN
	      write(6,*)'good bye'
	   ENDIF

   if u use 'tab' in line 'write...'.
-------------------------------------------------------------
While this works, I bind the return key to 'newline-and-indent'.  This way,
hitting the return automatically indents the next line.

Also you might want to bind it to 'reindent-then-newline-and-indent' which
indents the current line then opens a newline and indents it properly.

--
John

  bitnet: davis@ohstpy
internet: davis@pacific.mps.ohio-state.edu