Hi Stephen and all others,

thanks very much! This worked.  Hack or not, I am happy I don't have to
squint at my code chunks any more.

Thanks again,

On 11/28/06, Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> wrote:
>
> >
> > The TAB does indent within a code chunk. I put up my dotemacs at this
> > location in case you want to try it out:
> >
> > http://www.ling.uni-potsdam.de/~vasishth/temp/
>
> Great, thanks.  I now see the problem.
>
> In a regular foo.R file, RET is bound to newline-and-indent whereas
> in a code chunk of an Rnw buffer, RET is bound to noweb-newline which
> does not include any indent.
>
> --- From noweb-mode.el: -----------------------------------------------
> ;; For some reason that I do not understand, `newline' does not do the
> ;; right thing in quoted code. If point is not preceded by whitespace,
> ;; it moves to the beginning of the current line, not the beginning of
> ;; the new line. `newline 1' works fine, hence the kludge. I'd love to
> ;; understand what's going on, though. Try running M-x newline in the
> ;; middle of a code quote in a doc chunk to see
> ;; what I mean: its odd.
>
> (defun noweb-newline (&optional arg)
>   "A kludge to get round very odd behaviour of newline in quoted code."
>   (interactive "p")
>   (if arg (newline arg) (newline 1)))
> ----------------------------------------------------------------------
>
>
>
> So, a simple fix in your case would be to add the following to the end
> of .emacs:
>
> (require 'noweb-mode)
> (defun noweb-newline (&optional arg)
>   "A kludge to get round very odd behaviour of newline in quoted code."
>   (interactive "p")
>   (if arg (newline arg) (newline 1))
>   (noweb-indent-line))
>
> BUT THIS IS A HACK!!!  Someone who knows the noweb code better than me
> can probably advise what's best...
>
>
> Stephen
>



-- 
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]]


