[ESS] r-mode name]

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Tue Jul 25 16:35:35 CEST 2006


Stephen Eglen wrote:
> I've taken a look at using folding-mode in ESS, in particular in
> foo.Rnw sweave files.  I tried the following:
> 
> (require 'folding)
> (folding-add-to-marks-list 'ess-mode               "<<"  "@" nil t)
> (folding-add-to-marks-list 'noweb-mode               "<<"  "@" nil t)

third argument can be used to specify how top markup line should end and
 >>= needs to be specified, as one can also reuse chunks of code i.e.

<<a>>=
@

<<b>>=
<<a>>
@

> Note that right off there is a problem using folding mode in .Rnw
> files, as .Rnw is defined to be in LaTeX mode for the documentation,
> and ess-mode for the code chunks. 
> 
> With the above, if I'm inside a code chunk, M-x folding-mode works
> fine and folds up the chunks.  But then when I leave a chunk, we
> revert to latex mode and the carriage returns can get converted to ^M,
> leaving the buffer looking a bit of a mess.

Yes, I get the same problem. I even got this problem if I used the
following setting

(folding-add-to-marks-list 'LaTeX-mode "%%% {{{" "%%% }}}" " ")
(folding-add-to-marks-list 'latex2e-mode "%%% {{{" "%%% }}}" " ")
(folding-add-to-marks-list 'latex-mode "%%% {{{" "%%% }}}" " ")
(folding-add-to-marks-list 'BibTeX-mode "%%% {{{" "%%% }}}" " ")
(folding-add-to-marks-list 'noweb-mode "%%% {{{" "%%% }}}" " " t)
(folding-add-to-marks-list 'ess-mode "### {{{" "### }}}" " ")

and putting marks around R chunks i.e.

%%% {{{
<<a>>=
@
%%% }}}

So this is probably a bug in folding?

> Note: for debugging purposes, the markers can be checked by examining
> the emacs variable folding-top-mark and folding-bottom-mark.  In
> LaTeX parts of the buffer, the marks are "%{{{"
> 
> So, I'm afraid, right now, this looks like it needs a bit more work to
> fix.

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc

----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.




More information about the ESS-help mailing list