[ESS] noweb, Sweave, flyspell, terminating

Markus Jantti markus.jantti at iki.fi
Wed Sep 28 21:32:16 CEST 2005

On Tue, 2005-09-27 at 06:46 +0200, A.J. Rossini wrote:
> With respect to your other question, probably you want an R-mode-hook
> to turn off flyspell, and a LaTeXmode-hook to turn it back on.

I was a little inspired by this discussion to try this out, see below.
Copying a function to turn-reftex on (which works nicely in the Rnw mode
that I have learnt to use based on ESS helpers and Sweave instructions)
I wrote two functions to turn on and off flyspell and the wrote hooks to
make these operational, below. This does not work, however. In
particular, the initial text chunk seems OK and the next code chunk
correctly says on the subject line flyspell is not on. But moving out of
the code to the text, the buffer does not return to LaTeX-mode. 

Any ideas would be appreciated: spell-checking long documents has been
quite cumbersome in the otherwise so wonderful Sweave use of R and


code from .emacs:
;; these two functions defined on the basis of reftex.el turn-on-reftex

(defun turn-on-flyspell ()
  "Turn on flyspell mode."
  (flyspell-mode t))
(defun turn-off-flyspell ()
  "Turn off flyspell mode."
  (flyspell-mode nil))
;; this is a test
(autoload 'flyspell-mode    "flyspell" "Spell Checking on the Fly" t) 
(autoload 'turn-on-flyspell "flyspell" "Spell Checking on the Fly" nil) 
;; for sweave and ess. these do not work....
(add-hook 'LaTeX-mode-hook 'turn-on-flyspell)   ; with AUCTeX LaTeX mode
(add-hook 'S-mode-hook 'turn-off-flyspell)   ; 
(add-hook 'R-mode-hook 'turn-off-flyspell)   ; 

> best,
> -tony
> On 9/22/05, Alun Pope <POPEA at stgeorge.com.au> wrote:
> > The discussion on Rnw mode prompts me to ask:
> >
> > 1.  Is there a neat way to avoid processing (through Sweave in R) all of a .Rnw file?
> >
> > I sometimes would like to make a change at the beginning and get a quick turn-round without having to wait for all of the subsequent results of the remaining code chunks.  I have tried inserting "\end{document}" but that is ignored by Sweave as far as I can see.  Since R and LaTeX need different comment styles, it's not so easy to comment out sections of code and documentation simultaneously.   It is possible to make a second smaller document, sure, and I have done that.  The problem with that is then one of version control (of the R workspace): it was trying to avoid these problems that made me start using noweb (which is brilliant - thank you , thank you, thank you!).  What might be nice would be conditional execution of chunks (or - can't believe I am about to write this - a GO TO chunk-label)?
> >
> > 2.  If I turn on flyspell in .Rnw file editing, it picks up repeated words in code chunks:
> > date3 <- AllPipData.tidy1$GDW.Discharge.Close.Date
> > date3[1:10]
> > even though there is a new line.  (The "date" in "date3[1:10]" is marked.)  However nothing appears in the minibuffer window and I get clicking on the highlighted text has no (useful) effect.  What is more irritating is that the doc/code distinction is removed after this happens.  By that I mean that doc chunks are not recognised as such so the menus and font-locks for new text in the doc chunks are not available.  Closing and re-opening and not turning on flyspell fixes it, but it is an annoying little glitch.
> >
> > I am using ESS version 5.2.10, with GNU Emacs 21.3.1 (i386-mingw-nt5.0.2195) of 2004-03-11 on NYAUMO.
> >
> > Many thanks for your help.
> >
> > Alun
> >
> > ---------------------
> > Dr Alun Pope
> >
> > Group Credit
> > St.George Bank
> > Level 9
> > 182 George St
> > Sydney NSW 2000
> >
> > (T): 02 9236 1442
> > (F): 02 9236 1570
> >
> >
> >
> > **********************************************************************
> > *****   IMPORTANT INFORMATION    *****\ This document should...{{dropped}}
> >
> > ______________________________________________
> > ESS-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/ess-help
> >
> --
> best,
> -tony
> blindglobe at gmail.com
> Muttenz, Switzerland.
> "Commit early,commit often, and commit in a repository from which we can easily
> roll-back your mistakes" (AJR, 4Jan05).
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

Markus Jantti
Abo Akademi University
markus.jantti at iki.fi

More information about the ESS-help mailing list