Hi,

Thanks, but no, this unfortunately does not work.  My .emacs now looks like
this, after the addition Stephen suggested (this is on Mac OS 10.3.9):

(load "/Users/shravanvasishth/ESS/ess-5.3.2/lisp/ess-site")
(setq ess-ask-for-ess-directory nil)

(defun my-ess-hook ()
   "Add my keybindings to ESS mode."
   (local-set-key (kbd "<f5>") 'ess-eval-chunk))
 (add-hook 'ess-mode-hook 'my-ess-hook)

(require 'tex-site)


(load "preview-latex.el" nil t t)

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode


(defun Rnw-mode ()
 (require 'ess-noweb)
 (noweb-mode)
 (if (fboundp 'R-mode)
     (setq noweb-default-code-mode 'R-mode)))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist '("\\.Snw\\'" . Rnw-mode))

(setq reftex-file-extensions
     '(("Snw" "Rnw" "nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
(setq TeX-file-extensions
     '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))



On 11/27/06, Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> wrote:
>
>
> > In Emacs+ESS, code files with the extension .R are auto-formatted, which
> > makes everything much more readable; e.g., if I hit enter after starting
> a
> > for loop, I get a nicely indented new line. However, this does not
> happen
> > when I write a code chunk inside an .Rnw document. How can I get auto
> > indenting inside a
> >
> > <<>>=
> >
> > @
> >
> > escape sequence?
>
> I have the following in my .emacs, does that work for you?
>
> Stephen
>
> (defun Rnw-mode ()
>   (require 'ess-noweb)
>   (noweb-mode)
>   (if (fboundp 'R-mode)
>       (setq noweb-default-code-mode 'R-mode)))
> (add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
> (add-to-list 'auto-mode-alist '("\\.Snw\\'" . Rnw-mode))
>
> (setq reftex-file-extensions
>       '(("Snw" "Rnw" "nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
> (setq TeX-file-extensions
>       '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
>



-- 
Shravan Vasishth,    Empirical Methods in Syntax
Juniorprofessor, Institute for Linguistics, Potsdam
Tel: +49-(0)331-977-2016, -2457  Fax: -2087
http://www.ling.uni-potsdam.de/~vasishth

	[[alternative HTML version deleted]]


