Hi Tassilo,
OK, I think I now understand what's going on.
`TeX-style-path' has the same value in both cases. But *Messages* is
different. In the bad version:
Automatic display of crossref information was turned on
Automatic recentering of TOC window was turned on
Starting new Ispell process aspell with en_US dictionary...
Applying style hooks...
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/article.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/titlesec.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/fontenc.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/inputenc.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/babel.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/multicol.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/mdframed.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/geometry.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/fancyhdr.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/paralist.elc...done
Applying style hooks...done
And in the good version:
Automatic display of crossref information was turned on
Automatic recentering of TOC window was turned on
Starting new Ispell process aspell with en_US dictionary...
Applying style hooks...
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/beamer.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amsmath.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amstext.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amsbsy.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amsopn.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amssymb.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amsfonts.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/amsthm.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/color.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/geometry.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/hyperref.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/url.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/nameref.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/inputenc.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/xcolor.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/fontenc.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/babel.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/multicol.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/mdframed.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/fancyhdr.elc...done
Loading /home/greg/.emacs.d/elpa/auctex-12.1.1/style/paralist.elc...done
Sorting xcolor-definecolor...done
Removing duplicates...done
Applying style hooks...done
So yes, beamer.el is loaded in the good version, but not in the bad version. I
think the reason is because my preamble begins with:
%==8<==8<==8<==8<==8<==8<==8<==8<==%
%% SLIDES
% \documentclass[ignorenonframetext,t]{beamer} %
%% HANDOUT
% \documentclass[ignorenonframetext,t,handout]{beamer} %
% \usepackage{pgfpages} %
% \pgfpagesuselayout{4 on 1}[a4paper,landscape,border shrink=5mm] %
%% NOTES
% \documentclass[a4paper,twocolumn]{article} %
% \usepackage[tiny,noindentafter,compact]{titlesec} % must be loaded before
% % beamerarticle
% \usepackage{beamerarticle} %
%==8<==8<==8<==8<==8<==8<==8<==8<==%
I use this template to generate material for lectures. When I want to generate
the slides, I uncomment the \documentclass...{beamer} block; when I want to make
handouts for students, I uncomment the \documentclass...handout]{beamer} block;
and for notes for myself, the \documentclass...{article} block.
The lines for the bad version from *Messages* above are from a file with the
\documentclass...{article} block uncommented; the lines for the good version are
from the same file, but with the \documentclass...{beamer} block uncommented.
So I think what happens is that AUCTeX loads style files depending on which
block it finds uncommented when the file is visited. The fontification seemed
random to me because it depends on which block I happened to leave uncommented
last time I closed the file.
So the solution might be something like:
- Is there a way to tell AUCTeX to load style files for stuff it finds commented
out? E.g., when I leave the \documentclass...{article} block uncommented, it
could still load beamer.el? After all, if you have a commented out
\documentclass or \usepackage in your preamble, you might want to uncomment it
later and its style file could be loaded when the file is visited.
- If that would create problems, is there a command to tell AUCTeX explicitly to
re-scan the file and load the style