running ESS with S-PLUS 6.1

Tim Hesterberg timh at insightful.com
Wed Aug 4 19:58:40 CEST 2004


Tony wrote:
>I believe that there are problems with S-PLUS 6.1 on Windows, but that
>6.2 under windows behaves more like R (i.e. more like the Unix
>version).   I thought that Tim Hesterberg had some information about
>that. 

The big difference that I know of is that S+6.2 includes library(winjava).
Now when running Sqpe inside emacs, I do:

library(winjava)
java.graph()

and I get nice graphics.


I use the default 
	c:/Program Files/Insightful/splus62/users/timh
when running the GUI version with no connection to emacs
(other than using source() to read in files I may be editing
with emacs), and
	d:/timh
or other directories with no spaces when using Sqpe from emacs.


>From Sqpe I use the usual help system.  It seems to come up slowly,
or I may have to give the help command twice, but it does eventually
come up.



Here is the part of my .emacs dealing with S and ESS.
A lot of this is specific to our local setup, but other parts
may be useful to you.


; S and ESS

; For code I used for Unix and Linux with S-mode, see .emacs040330
; 3/30 -- I'm switching to ess.  Currently have unix stuff first,
; then windows.  Should merge that, once I'm sure I want to stick
; with ess on Unix.

		  ; Following two lines are so help works; they were
		  ; set to emacsclient, which is not defined for me.
  		  (setq ess-editor nil)
  		  (setq ess-pager "slynx -dump -nolist")

(if atUnix
    (prog1
	(load-file "/homes/timh/local/ess-5.1.24/lisp/ess-site.el")
  (setq ess-tab-always-indent nil)
  (setq ess-else-offset 0)
  (setq nuke-trailing-whitespace-p "ask")  ; uses ess-utils
  (setq numberOfTimesS-timhLoaded 0)  ; increment every time S-timh is loaded
  (setq auto-mode-alist (cons '("\\.t$" . ess-mode) auto-mode-alist))
  (add-hook 'ess-mode-hook
	    '(lambda ()
	       (load "S-timh")))

  ; Turn off two key bindings I object to
  ; ESS has _ set to ess-smart-underscore
  ; ESS has C-x n set to a prefix, in particular
  ;  C-x n d		ess-narrow-to-defun  (useful, bind to C-c n)
  (add-hook 'ess-mode-hook
  	       '(lambda ()
  		  (define-key ess-mode-map "_" 'self-insert-command)
  		  (define-key ess-mode-map "\C-xn" 'other-window)
  		  (define-key ess-mode-map "\C-cn" 'ess-narrow-to-defun)
  		  (define-key ess-mode-map "\C-cw" 'widen)
     ;		  (define-key ess-mode-map "\C-xC" 'S-compare-windows)
     ; like compare-windows, but _ and <- are equivalent if skip white
     ; commented out because doesn't work on older emacs on orange doesn't have
  		  ))
  (add-hook 'inferior-ess-mode-hook
  	       '(lambda ()
  		  (define-key inferior-ess-mode-map "_" 'self-insert-command)
  		  ))
  ; ess-mode is used for .S files
  ; inferior-ess-mode is used for windows running S
  (add-hook 'ess-pre-run-hook
	    '(lambda ()
	       (setq temp-ess-dialect "S")
	       ; That affects inside of inferior-ess,
	       ; so buffer name is *S* rather than *S+6*
	       ))
  ))


(if atUnix (prog1
  ;; Default version (either development or STABLE version
  ;(setq inferior-S-program "/sw/sca/bin/SplusSTABLE")

  (if (equal system-name "tomato.statsci.com")
    (setq inferior-ess-program "/sw/sca/bin/Splus6.1"))
    ;(setq inferior-ess-program "/sw/sca/bin/Splus6"))  ; fails on tomato, 7/7/03

  ; ~/emacs/S-versions.el has:
  ;    Splus3.3, Splus3.4, Splus4.0, Splus4.5, Splus4.7, Splus2000
  ;    Splus5.1, Splus5, Splus5STABLE, Splus6beta2, Splus6j
  ; Some may run only on some machines, e.g. 4.7 on scythe & octopus
  
  (defun SplusSTABLE ()
  	  "This command invokes SplusSTABLE"
  	  (interactive)
  	  (let ((inferior-ess-program "/sw/sca/bin/SplusSTABLE"))
  	    (S)))
  
  (defun Splus6.0 ()
  	  "This command invokes the Splus6.0 script"
  	  (interactive)
  	  (let ((inferior-ess-program "/sw/sca/bin/Splus6.0"))
  	    (S)))
  
  (defun Splus6.1 ()
  	  "This command invokes the Splus6.0 script"
  	  (interactive)
  	  (let ((inferior-ess-program "/sw/sca/bin/Splus6.1"))
  	    (S)))

  ; Comment out the last line, which messed up pager & help.pager
  (defun S+6 (&optional proc-name)
    "Call 'Splus6', based on S version 4, from Bell Labs.
  New way to do it."
    (interactive)
    (setq ess-customize-alist S+6-customize-alist)
    (ess-write-to-dribble-buffer
     (format "\n(S+6): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
    (inferior-ess)
    ;(if inferior-ess-language-start
    ;	(ess-eval-linewise inferior-ess-language-start))
  )

  ))

; Had the following on Unix with S-mode; consider doing this for ess
;   ;(global-set-key "\C-a" 'comint-bol)
;   ;(define-key S-mode-map "\C-a" 'comint-bol)



(if atPC (prog1
  (if atHome			     
      (load-file "c:/emacs/ess-5.1.24/lisp/ess-site.el")
      (load-file "d:/emacs/ess-5.1.24/lisp/ess-site.el")
      )
  ; That shouldn't be necessary, should be loaded by site-start
  (setq ess-tab-always-indent nil)
  (setq ess-else-offset 0)
  (setq nuke-trailing-whitespace-p "ask")  ; uses ess-utils
  (if atWorkPC
      (setq ess-directory "d:/timh/"))
  ; (add-hook 'ess-mode-load-hook
  ; 	    '(lambda ()
  ; 	       (load "S-timh")))   ; That didn't work
  (setq numberOfTimesS-timhLoaded 0)  ; increment every time S-timh is loaded
  (add-hook 'ess-mode-hook
	    '(lambda ()
	       (load "S-timh")))
  ;(setq inferior-Sqpe+4-program-name "sqpe")

  
  ; Turn off two key bindings I object to
  ; ESS has _ set to ess-smart-underscore
  ; ESS has C-x n set to a prefix, in particular
  ;  C-x n d		ess-narrow-to-defun  (useful, bind to C-c n)
  (add-hook 'ess-mode-hook
  	       '(lambda ()
  		  (define-key ess-mode-map "_" 'self-insert-command)
  		  (define-key ess-mode-map "\C-xn" 'other-window)
  		  (define-key ess-mode-map "\C-cn" 'ess-narrow-to-defun)
  		  (define-key ess-mode-map "\C-cw" 'widen)
  		  ))
  (add-hook 'inferior-ess-mode-hook
  	       '(lambda ()
  		  (define-key inferior-ess-mode-map "_" 'self-insert-command)
  		  ))

  ; (setq ess-dialect "S") ; commented that out 3/30/04, not sure what it did

  ; Use the version of this function which is defined in essd-sp6.el
  ; rather than version defined in essdsp6w.el; latter fails because 
  ; executable-find doesn't exist.
  (defun S+6 (&optional proc-name)
    "Call 'Splus6', based on S version 4, from Bell Labs.
  New way to do it."
    (interactive)
    (setq ess-customize-alist S+6-customize-alist)
    (ess-write-to-dribble-buffer
     (format "\n(S+6): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
    (inferior-ess)
    (if inferior-ess-language-start
    	(ess-eval-linewise inferior-ess-language-start)))
  
  
  ; This seems to be needed since I installed new ESS (coincidence?)
  (load "compare-w")
))




More information about the ESS-help mailing list