[ESS] ESS Sweave plug into Auctex problem

ottorino ottorino-luca.pantani at unifi.it
Tue Jul 15 12:07:38 CEST 2014


Hi all, I'm also experiencing some problems, 
probably related to my obsolete .emacs file

Il giorno mar, 01/07/2014 alle 14.21 +0930, Andreas Kiermeier ha
scritto:

> 
> I've just struck a little problem with plugging ESS Sweave into AUCTEX.
> 
> I'm running ESS 14.05 in GNU Emacs 24.3.1 on Windows 8.1.

Here, on 
debian wheezy
GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
ESS version 12.04-4
R version 3.1.0 (2014-04-10) -- "Spring Dance"

> I've set ess-swv-toggle-plug-into-AUCTeX-p to t using customize.
> 
> When I load a .Rnw file the "AUCTeX Interface" (on the Noweb > Sweaving,
> Tangling, ... menu) is ticked.  However, Sweave and LatexSweave are not on
> AUCTeX's Command menu, irrespective of whether R is running or not.

With "AUCTeX Interface" ticked, with  a .Rnw file loaded (not R)
under "Command" I find, in the order and at the end of the drop-down
menu, 

Sweave
Stangle 
Sweave
LatexSweave
Sweave
LatexSweave

> Pressing C-c C-c defaults to View (even after making changes to the file).
Here C-c C-c out of chunks defaults to latex compilation. 
Within chunks send the commands to R (and start it if not present)

EDIT. Not always. The behaviour above is not consistent !!
Sometimes the minibuffer propose the latex compilation


> Typing "Swe [TAB]" results in a "(no match)" in the minibuffer. Typing
> "Sweave [Enter]" also gives a "(no match)".
The same beahviour here (ESC x Swe[TAB])

> Activating and de-activating the "AUCTeX Interface" then shows the Sweave
> and LatexSweave options on AUCTeX's Command menu, 
After doing this at the end of the dropdown menu "Command" I find


Stangle 
LatexSweave
LatexSweave
Sweave
Sweave

Re-ticking "AUCTeX Interface", the end of the dropdown menu "Command"
appears as follows

Stangle 
LatexSweave
LatexSweave
Sweave
Sweave
Sweave
Sweave
LatexSweave

De-ticking again, gets back to 
Stangle 
LatexSweave
LatexSweave
Sweave
Sweave

and then looping in re-ticking and de-ticking results in consistent
lists.
ESC x Swe[TAB] still results in "no match "

> and C-c C-c behaves as
> expected ... it allows me to Sweave.
Now, Auctex Interface de-ticked, after pressing C-c C-c the minibuffer
defaults to Sweave 

> 
> The behaviour of "M-n s" is unaffected and works / sweaves as expected.
Also here.

I nevertheless have problems with M-n-P, to produce and see the pdf
document.

My usual working sequence has always been

M-n-s
wait R to finish
M-n-P
an evince/atril windows appear with the pdf in it
modify the .Rnw file somehow
M-n-s
wait R to finish
M-n-P
...etc

At this point I expected a refresh of the pdf in the evince/atril
window.

Lately I have the annoyance of a message in the minibuffer

"A command is running.  Kill it? (yes or no) "

The running command  is most probably something related to evince/atril,
since the message do not appear if I close (each time) the 
evince/atril window.

If I respond "yes" the evince/atril window closes and the pdf reappears
in a new window.

Here below some relevant lines of my .emacs (badly copied from your
site, Andreas !!)


> Is this working for others? Any thoughts or guidance on what I might be
> doing wrong would be greatly appreciated.
I also would appreciate any help.
Thanks to you all
Ottorino



;;; ==============================================================
;;; http://sites.google.com/site/andreaskiermeier/essmaterials
;;; added on 9 maggio 2011
;;; ==============================================================
;;; see also rows 24,38,40 in 3_init_latex.el
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist '("\\.Snw\\'" . Snw-mode))
(add-hook 'Rnw-mode-hook
 (lambda ()
  (add-to-list 'TeX-expand-list 
   '("%rnw" file "Rnw" t) t)
;
  (add-to-list 'TeX-command-list
   '("Stangle" "R CMD Stangle %rnw"
     TeX-run-command nil (latex-mode) :help "Run Stangle") t)
;
  (add-to-list 'TeX-command-list
  '("Sweave" "R CMD Sweave %rnw"
     TeX-run-command nil t :help "Run Sweave") t)
                   ; nil (latex-mode) :help "Run Sweave") t)
;
  (add-to-list 'TeX-command-list
   '("LatexSweave" "%l \"%(mode)\\input{%s}\""
     TeX-run-TeX nil t :help "Run Latex after Sweave") t)
               ; nil (latex-mode) :help "Run Latex after Sweave") t)
(setq TeX-command-default "Sweave")))


;;; rows 28-40 of 3_init_latex.el
;
(defun my-latex-mode ()
  (add-to-list 'TeX-command-list '("Sweave" "Sweave.sh -l %s"
TeX-run-command t t :help "Sweave file and produce DVI") t)
  (latex-math-mode)
  (TeX-fold-mode t) ; can hide certain parts (like footnotes,
references 
                    ; etc.) not often edited
  (turn-on-reftex)  ; allows RefTeX to interact with AUCTeX
;;  (set-face-font 'font-latex-italic-face "lucidasans-italic-12")
;;  (set-face-font 'font-latex-bold-face "lucidasans-bold-12")
  (setq ispell-extra-args '("-t"))
;  (define-key LaTeX-math-keymap [?` (?-)] 'LaTeX-math-bar)
;  (define-key LaTeX-math-keymap [?` (?e)] 'LaTeX-math-varepsilon)
(turn-on-auto-fill) ; Breaks automatically lines at 80 columns
while-u-write
)

(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"))



More information about the ESS-help mailing list