1
1
;;; essdsp6w.el --- S-PLUS 6.x for Windows customization
2
;;; copied and edited from essd-sp4.el
3
;;; Richard M. Heiberger, April 2001
3
;;; copied and edited from essd-sp4.el - Richard M. Heiberger, April 2001
5
5
;; Copyright (C) 2001 Richard M. Heiberger <rmh@sbm.temple.edu>
6
;; Copyright (C) 2002--2004 A.J. Rossini, Rich M. Heiberger, Martin
7
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
7
;; Author: Richard M. Heiberger <rmh@sbm.temple.edu>
8
;; Maintainer: Richard M. Heiberger <rmh@sbm.temple.edu>
9
;; Original Author: Richard M. Heiberger <rmh@sbm.temple.edu>
9
10
;; Created: April 2001
10
;; Modified: $Date: 2002/06/24 13:24:12 $
11
;; Version: $Revision: 5.16 $
12
;; RCS: $Id: essdsp6w.el,v 5.16 2002/06/24 13:24:12 maechler Exp $
11
;; Maintainers: ESS-core <ESS-core@stat.math.ethz.ch>
14
13
;; Keywords: start up, configuration.
16
15
;; This file is part of ESS.
48
47
"Name of 'dialect' for S-PLUS 6.x.
49
48
Easily changeable in a user's `.emacs'.")
50
(defvar inferior-S+6-start-args " "
51
"Default is empty. Can be used for license manager information, for example
52
`(setq inferior-S+6-start-args \" S_ELMHOST=\\\\\\\\@123.456.789.012 ELMTIMEOUT=60 \")'."
53
;; (setq inferior-S+6-start-args " S_ELMHOST=\\\\@123.456.789.012 ELMTIMEOUT=60 ") ;; use this line as the model for your site-start.el
56
(defvar inferior-Sqpe-start-args " "
57
"Default is empty. Can be used for license manager information, for example
58
`(setq inferior-Sqpe-start-args \" S_ELMHOST=@123.456.789.012 ELMTIMEOUT=60 \")'."
59
;; (setq inferior-Sqpe-start-args " S_ELMHOST=@123.456.789.012 ELMTIMEOUT=60 ") ;; use this line as the model for your site-start.el
51
62
(defvar inferior-S+6-multipleinstances "/MULTIPLEINSTANCES"
52
63
"Default \"/MULTIPLEINSTANCES\" opens up a new instance of S+6 in a
53
64
GUI window and connects it to the '(ddeESS [S+6])' window. The
59
70
(ess-language . "S")
60
71
(ess-dialect . S+6-dialect-name)
62
(ess-dump-filename-template . (concat (user-login-name)
65
73
(ess-mode-editing-alist . S-editing-alist)
66
74
(ess-mode-syntax-table . S-syntax-table)
67
75
(ess-help-sec-regex . ess-help-S+-sec-regex)
68
76
(ess-help-sec-keys-alist . S+-help-sec-keys-alist)
69
(ess-loop-timeout . 500000 )
77
(ess-loop-timeout . ess-S-loop-timeout)
70
78
(ess-object-name-db-file . "ess-sp6-namedb.el" )
71
79
(ess-retr-lastvalue-command
72
80
. ".Last.value <- get(\".ess.lvsave\",frame=0)\n")
171
183
"/../../versions") t))
172
184
(toggle-read-only 1)
174
(if (not (search-backward "6.1" (point-min) t))
186
(if (not (search-backward-regexp "6.[1-9]" (point-min) t))
175
187
(if (search-backward "6.0" (point-min) t)
176
188
(error "S-Plus 6.0 for Microsoft Windows has a bug that
177
189
prevents it from being started by emacs. Instead, you must start it
178
190
by double-clicking an icon. Then you can connect to it with
179
`S+6-existing'. You should consider upgrading to S-Plus 6.1.")
191
`S+6-existing'. You should consider upgrading to S-Plus 6.1 or higher.")
180
192
(error "The emacs variable `inferior-S+6-program-name' does
181
not point to S-Plus 6. Please add `splus61/cmd' to your `exec-path' or
193
not point to S-Plus 6. Please add `splus6?/cmd'
194
(expand the `?' to match your setup) to your `exec-path' or
182
195
specify the complete path to `Splus.exe' in the variable
183
196
`inferior-S+6-program-name' in your `.emacs' file."))))
184
197
(S+6-initiate proc-name)) ;; normal start
481
494
(toggle-read-only t) ; restore ESS buffer to be read-only
497
(defun ess-sqpe-versions-create ()
498
"Generate the `M-x splusxy' functions for starting other versions of
499
Sqpe. See `ess-sqpe-versions' for strings that determine which
500
functions are created. This works by creating a temp buffer where the
501
template function `Sqpe+template' is edited by replacing the string
502
'Sqpe+template' by the version name. The list of functions actually
503
created appears in the *ESS* buffer.
505
The result `ess-sqpe-versions-created' will store a list of the new
506
Sqpe defuns, if any, that were created. The defuns will normally be
507
placed on the menubar upon ESS initialisation."
511
(eval-buf (get-buffer-create "*ess-temp-sqpe-evals*"))
512
(ess-sqpe-versions-created)
516
(set-buffer eval-buf)
518
(delete-region (point-min) (point-max))
520
;; Find which versions of Sqpe we want.
521
(setq versions (ess-uniq-list ess-SHOME-versions))
522
;; Iterate over each string in VERSIONS, creating a new defun each time.
524
(setq version (car versions)
525
versions (cdr versions))
526
(if (file-executable-p version)
529
(prin1 (symbol-function 'Sqpe+template) eval-buf)
532
(while (search-forward "lambda" nil t 1)
534
(concat "defun " (file-name-nondirectory version))
536
(while (search-forward "ess-SHOME" nil t)
537
(replace-match version t t))
538
(goto-char (point-max))
539
(setq ess-sqpe-versions-created
540
(cons (file-name-nondirectory version)
541
ess-sqpe-versions-created))
542
(ess-write-to-dribble-buffer
544
"(Sqpe): ess-sqpe-versions-create making M-x defun %s for %s \n"
545
(file-name-nondirectory version) version))
547
;; buffer has now been created with defuns, so eval them!
549
(kill-buffer eval-buf))
550
ess-sqpe-versions-created))
552
;; template function used by ess-sqpe-versions-create
553
(defun Sqpe+template (&optional proc-name)
554
"Call 'Sqpe' from 'S-PLUS for Windows ess-SHOME',
555
the 'Real Thing' from StatSci.
556
This function was generated by `ess-sqpe-versions-create'."
558
(setq ess-customize-alist Sqpe+6-customize-alist)
559
(let* ((shome-old (getenv "SHOME"))
560
(inferior-Sqpe+6-SHOME-name "ess-SHOME")
561
(inferior-Sqpe+6-program-name (concat "ess-SHOME" "/cmd/sqpe.exe")))
562
(setenv "SHOME" "ess-SHOME")
563
(ess-write-to-dribble-buffer
564
(format "\n(Sqpe+template): ess-dialect=%s, buf=%s\n" ess-dialect
566
(setq ess-customize-alist ; change inferior-ess-primary-prompt
567
(append ess-customize-alist
568
'((inferior-ess-primary-prompt . "^"))))
570
(setq ess-customize-alist Sqpe+6-customize-alist) ; restore i-e-p-p in alist
571
(ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer
572
(setq inferior-ess-prompt ; define with correct i-e-p-p
573
;; Do not anchor to bol with `^' ; (copied from ess-inf.el)
575
inferior-ess-primary-prompt
577
inferior-ess-secondary-prompt
579
(setq comint-prompt-regexp (concat "^" inferior-ess-prompt))
580
; define with correct i-e-p-p
581
(setq comint-input-sender 'inferior-ess-input-sender)
582
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
583
(goto-char (point-max))
584
(insert "options(interactive=T)")
585
(inferior-ess-send-input)
586
(setq mode-name "iESS(Sqpe)")
587
;; (ess-eval-linewise inferior-S+6-editor-pager-command)
588
(if inferior-ess-language-start
589
(ess-eval-linewise inferior-ess-language-start))
590
(setenv "SHOME" shome-old)))
484
593
; Provide package
486
595
(provide 'essdsp6w)