Discussion:
Fortran
(too old to reply)
Dieter Britz
2017-01-12 13:39:55 UTC
Permalink
Next question: my new emacs "helps" me type in
Fortran text, by providing indentation, but it guesses
wrong, which is irritating. I can't find the option to
turn that off. Which is it?
--
Dieter Britz
Dieter Britz
2017-01-12 13:42:12 UTC
Permalink
Next question: my new emacs "helps" me type in Fortran text, by
providing indentation, but it guesses wrong, which is irritating. I
can't find the option to turn that off. Which is it?
I ought to add that it is only the unasked-for indentation
I want to turn off. The other things, like colouring etc
is in fact helpful.

--
Dieter Britz
N. Jackson
2017-01-12 16:58:57 UTC
Permalink
Post by Dieter Britz
Next question: my new emacs "helps" me type in
Fortran text, by providing indentation, but it guesses
wrong, which is irritating. I can't find the option to
turn that off. Which is it?
1. I haven't edited Fortran for a long time, but poking around
in the docs, my first question would be "are you using the right
mode"?

Typing `M-h f fortran-mode RET', I see (prominently displayed
near the top):

Major mode for editing Fortran code in fixed format. For free
format code, use `f90-mode'.

Also, looking at `auto-mode-alist' (`C-h v auto-mode-alist RET')
I see -- on my Emacs at least -- that files with an extension of
`.f' or `.for' will open in fortran-mode; those with an
extension of `.f90' or `.f95' will open in f90-mode.

If your files have a different extension, you will probably want
to add it to your auto-mode-alist.


2. Assuming you are editing your files in the right mode, and
you are still experiencing incorrect indentation, I would
recommend that you report this with

`M-x report-emacs-bug RET'

showing the code to be indented, how you expect it to indented,
and how Emacs is actually indenting it. Then the problem can
(potentially) be fixed for everyone.


3. Turning off automatic indentation would seem to be a
drastic measure, but you can learn how to do it if you read
"Chapter 24 Indentation" in the Emacs Manual
(use `M-: (info "(emacs) Indentation")' to view it).

You will see in the last paragraph of the chapter:

Electric Indent mode is a global minor mode that automatically
indents the line after every <RET> you type. This mode is
enabled by default. To toggle this minor mode, type `M-x
electric-indent-mode'. To toggle the mode in a single buffer,
use `M-x electric-indent-local-mode'.

N.
Dieter Britz
2017-02-02 10:12:46 UTC
Permalink
Next question: my new emacs "helps" me type in Fortran text, by
providing indentation, but it guesses wrong, which is irritating. I
can't find the option to turn that off. Which is it?
1. I haven't edited Fortran for a long time, but poking around in the
docs, my first question would be "are you using the right mode"?
Typing `M-h f fortran-mode RET', I see (prominently displayed near the
Major mode for editing Fortran code in fixed format. For free format
code, use `f90-mode'.
Also, looking at `auto-mode-alist' (`C-h v auto-mode-alist RET')
I see -- on my Emacs at least -- that files with an extension of `.f' or
`.for' will open in fortran-mode; those with an extension of `.f90' or
`.f95' will open in f90-mode.
If your files have a different extension, you will probably want to add
it to your auto-mode-alist.
2. Assuming you are editing your files in the right mode, and you are
still experiencing incorrect indentation, I would recommend that you
report this with
`M-x report-emacs-bug RET'
showing the code to be indented, how you expect it to indented, and how
Emacs is actually indenting it. Then the problem can (potentially) be
fixed for everyone.
3. Turning off automatic indentation would seem to be a drastic measure,
but you can learn how to do it if you read "Chapter 24 Indentation" in
the Emacs Manual (use `M-: (info "(emacs) Indentation")' to view it).
Electric Indent mode is a global minor mode that automatically indents
the line after every <RET> you type. This mode is enabled by default.
To toggle this minor mode, type `M-x electric-indent-mode'. To toggle
the mode in a single buffer, use `M-x electric-indent-local-mode'.
N.
The indentation is mostly fine, but when I type in a new comment line
after an existing one, the new, and the previous line, get indented.
That is annoying. Emacs says "F90" at the top. I'd like to stop that.
--
Dieter Britz
Loading...