Hi,
when I open a buffer on this file
----
\def\foo{bar}
\documentclass{foobar}
\begin{document}
hello
\end{document}
----
there is no activation of latex-mode.
I have to manually type-in M-x latex-mode.
What makes matters worse is that, in real life, I also
have issued (setq TeX-auto-save nil) earlier because
I edit LaTeX code in a directory which which should
not have any auto/ sub-directory, else something else
is broken (unrelated to latex or emacs).
The above file in real life is produced by some
build, so I must re-issue M-x latex-mode each time
I do M-x revert on the file after a new build.
Any hint to make my life less miserable?
I can not add any file local variable, the file is output
by some build.
Notice that the directory where the above file resides
does contain a foobar.cls file, if that helps.
But IMHO, should'nt \documentclass by itself trigger latex-mode?
It is relatively frequent to have to put code before the
\documentclass.
In my real life, the thing looks more like this
%% Hello there
\def\foobardocclass{report}
\documentclass[letterpaper,10pt,english]{foobar}
Best,
Jean-François