Post by Dieter BritzNext 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.