The problem is that once I move into a code chunk in a .Rnw file
(automatically switching from AUCTeX to ESS mode) and then back out of
the code chunch (automatically switching back to AUCTeX mode),
TeX-master and TeX-PDF-mode both get set to nil. Worse, this also
causes the invaluable reftex to lose all its reference information.
Typing C-cC-n (i.e., running TeX-normal-mode) causes all the
auctex/reftex information to be reset properly. However, the Noweb
menu disappears when I do this and when I move back into a code chunk
the buffer remains in PDFLaTeX/M mode instead of ESS[S] mode. Typing
C-cC-n again seems to toggle this behavior, but then TeX-master and
TeX-PDF-mode get set to nil again. Obviously this whole process
becomes especially annoying when editing a complicated document.
FWIW, I can partially automate the call of TeX-normal-mode with
(add-hook 'noweb-select-doc-mode-hook
(function (lambda ()
(TeX-normal-mode t))))