[ESS] Combining sweave and pdflatex into one helper function
Paul Johnson
pauljohn32 at gmail.com
Tue Feb 8 22:04:49 CET 2011
Hello, I need to revive this thread from December.
I've got that same problem Dirk had. I'm running Ubuntu linux with
Emacs 23.2 and ess 5.12. After Sweaving a document, I get no further,
ESS refuses, minibuffer says:
ess-error: ESS process not ready. Finish your command before trying again.
Did you find an answer to this problem?
Boring details below
On Wed, Dec 29, 2010 at 4:37 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Hi Stephen,
>
> Stephen Eglen <S.J.Eglen <at> damtp.cam.ac.uk> writes:
>> (defun edd-sweave ()
>> "Run sweave and pdflatex"
>> (interactive)
>> (ess-swv-weave) ; this should make no difference to what you had
>> (sleep-for 30) ; wait 30 seconds ...
>> ;;(ess-swv-latex) ;; is this needed? if the next line runs pdflatex?
>> (ess-swv-PDF "pdflatex")
>> )
>
> Still doesn't work, sadly.
>
> ess-swv-weave leaves me in the associated R buffer.
>
> Dirk
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
I Sweave the document by using the "noweb" menubar item,
"Sweaving" then "Sweave". After that, I can't rund the document
through pdflatex, the minibuffer keeps saying
ess-error: ESS process not ready. Finish your command before trying again.
The *R* buffer says:
> .help.ESS <- help
> options(STERM='iESS', editor='emacsclient')
> local({..od <- getwd(); setwd("/home/pauljohn/ps/SVN-repo/Rcourse/data-1/"); Sweave("/home/pauljohn/ps/SVN-repo/Rcourse/data-1/data1.Rnw"); setwd(..od) })
Writing to file data1.tex
Processing code chunks ...
1 : term verbatim
2 : term verbatim (label=Roptions)
3 : echo term verbatim
4 : echo term verbatim
5 : echo term verbatim
6 : echo term verbatim
7 : echo term verbatim
8 : echo term verbatim eps pdf
9 : echo term verbatim
10 : echo term verbatim
11 : echo term verbatim
12 : echo term verbatim
13 : echo term verbatim (label=resetcol)
14 : echo term verbatim
15 : echo term verbatim
16 : echo term verbatim
17 : echo term verbatim
18 : echo term verbatim
19 : echo term verbatim
20 : echo term verbatim
21 : echo term verbatim
22 : echo term verbatim
23 : echo term verbatim
24 : echo term verbatim
25 : echo term verbatim
26 : echo term verbatim
27 : echo term verbatim
28 : echo term verbatim
29 : echo term verbatim
You can now run LaTeX on 'data1.tex'
But in Emacs I choose the noweb menu, it won't let me run the file
through latex.
So far as I know, I do not have any customizations of Emacs that
concern sweave. Here's my Emacs init.el file:
;; Paul Johnson <pauljohn at ku.edu>
;; 2011-01-09
;; This updates my previous startup option file that was called
;; 50emacs-ess-ku.el. Either you should put this file in your
;; Emacs site-start.d folder or put it in your home directory
;; and call it .emacs.
;; If you are using this because you use Emacs to work with R, the
;; main special features are:
;; 1. Shift+Enter will send the current line to R, and it will start
;; R if it is not running.
;; 2. R will start in the current working directory, without stopping
;; to ask the user about a working directory.
;; 2. R runs in its own "frame"
;; 3. Emacs help information pops up in its own frame.
;; This is my .emacs file, it is a collection of special tricks I've
;; learned by complaining to Emacs users. It makes Emacs easy for me
;; to use. If you try this file, I believe you can use Emacs without
;; knowing any Lisp and without even reading the Emacs tutorial. The
;; intention is to make Emacs work more like a "modern" GUI editor. I
;; don't want it to try to supply a window manager or re-design the
;; keyboard and mouse. I respect the long heritage of Emacs and its
;; extensibility, but I don't need those legacy features that were
;; written before modern computers were invented. I agree with the
;; idea behind "oneonone Emacs"
;; (http://www.emacswiki.org/emacs/OneOnOneEmacs), but think it is too
;; difficult to implement and maintain.
;; I've never liked the complicated system of "mark" and "point" for
;; text selection and I don't generally use any of the multi-click
;; keyboard commands. Any "shortcut" that requires me to type several
;; keys is not really a shortcut. It is not easier to type C-x C-f
;; that it is to click "File" with the mouse. I do use some single
;; key-combination shortcuts, like M-q to "reformat region".
;; I started on this because I was constantly aggravated that files on
;; which I was working would get covered over by new material from
;; Emacs. I completely hate that. I want new content to pop new
;; panels and/or windows wherever possible. When I do M-x to open the
;; command mini-buffer, and then I type a letter or two and hit TAB, I
;; want to leave my document undisturbed on the screen. I want the
;; options resulting from the TAB to appear in their own window, which
;; automatically disappears after I make my choice.
;; The only exception below is caused by a bug in Emacs for
;; Windows. The file selection GUI is broken, so the file dialog is
;; turned off.
;; I've added comments for the commands below, you can read them if
;; you are curious what they do.
(if (eq system-type 'windows-nt)
(setq use-file-dialog nil)) ; necessary on windows b/c dialog bug
; make mouse selection work in the usual Mac/Windows way
(require 'pc-select)
(transient-mark-mode t) ; highlight text selection
(delete-selection-mode t) ; delete seleted text when typing
(cua-mode t) ; windows style keybind C-x, C-v, cut paste
(setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
(setq cua-keep-region-after-copy t) ;; Selection remains after C-c
;; Stop Emacs from splitting "frames", encourage it to pop up new
; frames for new content.
; see: http://www.gnu.org/software/emacs/elisp/html_node/Choosing-Window.html
(setq pop-up-frames t)
(setq special-display-popup-frame t)
(setq split-window-preferred-function nil) ;discourage horizontal splits
(setq pop-up-windows nil)
;; Wow. "pop-up-frames" is different from "framepop". Crazy!
;; The framepop package can "catch" some special small buffers and
;; divert them off to a specially configured frame. I made it pink!
;; The framepop packages is in emacs-goodies on Ubuntu, I hope
;; it is installed in whatever system I use. If it is installed
;; the following causes useful changes in the way special frames are
;; delivered. It doesn't get all special frames, such as "grep".
;; But it does grab tab completions. That's a big plus.
(require 'advice)
(when window-system
(require 'framepop nil t)
(framepop-enable))
(setq framepop-frame-parameters
'((name . nil) ; use buffer name
(unsplittable . t) ; always include this
(menu-bar-lines . 0) ; no menu bar
(minibuffer . nil) ; or minubuffer
(left . -1) ; top left corner of screen,
(top . 30) ; away from my main frame
(width . 71) ; narrower, so it fits nicely
(background-color . "MistyRose") ; for October.
(tool-bar-lines . 0)
(minibuffer)))
(setq framepop-min-frame-size 20)
(setq framepop-use-advice (quote automatic))
(setq framepop-auto-resize t)
;; Framepop does not catch all of the frames you want. It will
;; pop up full sized frames for little lists. .
;; I see no benefit in it.
(setq special-display-buffer-names
'("*Help*" "*shell*" "*Completions*" "*grep*" "*tex-shell*"))
;; I wish I could make all new files & buffers appear in separate frames.
;; But I can't find a way. But I can make files opened from the menu bar
;; appear in their own frames. This overrides the default menu bar settings.
;; Opening an existing file and creating new one in a new frame are the exact
;; same operations.
;; adapted from Emacs menu-bar.el
(defun menu-find-existing ()
"Edit the existing file FILENAME."
(interactive)
(let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog)
(x-uses-old-gtk-dialog))))
(filename (car (find-file-read-args "Find file: " mustmatch))))
(if mustmatch
(find-file-other-frame filename)
(find-file filename))))
(define-key menu-bar-file-menu [new-file]
'(menu-item "New..." find-file-other-frame
:enable (menu-bar-non-minibuffer-window-p)
:help "Create a new file"))
(define-key menu-bar-file-menu [open-file]
`(menu-item ,(purecopy "Open File...") menu-find-existing
:enable (menu-bar-non-minibuffer-window-p)
:help ,(purecopy "Read an existing file into an Emacs buffer")))
;(define-key menu-bar-file-menu [open-file]
; '(menu-item "Open File..." find-file-other-frame
; :enable (menu-bar-non-minibuffer-window-p)
; :help "Open Existing File"))
;;Open directory list in new frame.
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired-other-frame
:help "Read a directory; operate on its files (Dired)"
:enable (not (window-minibuffer-p (frame-selected-window
menu-updating-frame)))))
;; Remove "splash screen"
;; http://fuhm.livejournal.com/
(defadvice command-line-normalize-file-name
(before kill-stupid-startup-screen activate)
(setq inhibit-startup-screen t))
(setq inhibit-splash-screen t)
;; Default Emacs does not scroll pages smoothly with down arrow key.
; It tries to jump a page-worth.
; See this for advice on preventing that
; http://stackoverflow.com/questions/3631220/fix-to-get-smooth-scrolling-in-emacs
(setq redisplay-dont-pause t)
(setq scroll-conservatively 20)
(setq scroll-margin 2)
(setq scroll-preserve-screen-position 1)
;; programming conveniences:
(show-paren-mode t) ; light-up matching parens
(global-font-lock-mode t) ; turn on syntax highlight
(setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
;;
;;(setq default-frame-alist '((width . 90) (height . 65)))
;; ESS for R customization begins here:
(setq inferior-ess-own-frame t)
(setq inferior-ess-same-window nil)
;;;
;;;;;create a new frame for each help instance
;;;
;;(setq ess-help-own-frame t)
;;;;;If you want all help
;;;;; buffers to go into one frame do:
;;;
(setq ess-help-own-frame 'one)
;; minibuffer tips
;;(require 'ess-eldoc)
;; html help
; (setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
;;start R in current working directory
(setq ess-ask-for-ess-directory nil)
(setq ess-local-process-name "R")
;; cause "Shift+Enter" to send the current line to *R*
(defun my-ess-eval ()
(interactive)
(if (and transient-mark-mode mark-active)
(call-interactively 'ess-eval-region)
(call-interactively 'ess-eval-line-and-step)))
(add-hook 'ess-mode-hook
'(lambda()
(local-set-key [(shift return)] 'my-ess-eval)))
;;http://stackoverflow.com/questions/840279/passwords-in-emacs-tramp-mode-editing
;; Emacs "tramp" service (ssh connection) constantly
;; asks for the log in password without this
(setq password-cache-expiry nil)
;; I'm right handed, need scroll bar on right (like other programs)
(setq scroll-bar-mode-explicit t)
(set-scroll-bar-mode `right)
(setq ansi-color-for-comint-mode 'filter)
(setq comint-prompt-read-only t)
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)
pj
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
More information about the ESS-help
mailing list