~ubuntu-branches/ubuntu/raring/ess/raring-proposed

« back to all changes in this revision

Viewing changes to lisp/ess-sp4-d.el

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2012-05-09 08:00:38 UTC
  • mfrom: (1.2.23)
  • Revision ID: package-import@ubuntu.com-20120509080038-7an3nhbtgaj02a17
Tags: 12.04-1-1
New upstream patch version released today

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
;; Copyright (C) 1998--2002 Richard M. Heiberger <rmh@temple.edu>
4
4
;; Copyright (C) 2003--2004 A.J. Rossini, Rich M. Heiberger, Martin
5
 
;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
 
5
;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6
6
 
7
 
;; Original Author: Richard M. Heiberger <rmh@temple.edu>
 
7
;; Author: Richard M. Heiberger <rmh@temple.edu>
8
8
;; Created: December 1998
9
 
;; Maintainers: ESS-core <ESS-core@r-project.org>
 
9
;; Maintainer: ESS-core <ESS-core@r-project.org>
10
10
 
11
 
;; Keywords: start up, configuration.
 
11
;; Keywords: languages
12
12
 
13
13
;; This file is part of ESS.
14
14
 
19
19
 
20
20
;; This file is distributed in the hope that it will be useful,
21
21
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
23
;; GNU General Public License for more details.
24
24
 
25
25
;; You should have received a copy of the GNU General Public License
26
 
;; along with GNU Emacs; see the file COPYING.  If not, write to
 
26
;; along with GNU Emacs; see the file COPYING.  If not, write to
27
27
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28
28
 
29
29
;;; Commentary:
30
 
;;; This file defines all the S-PLUS 4.x customizations for ess-mode
31
 
;;; with ddeclient.
 
30
 
 
31
;; This file defines all the S-PLUS 4.x customizations for ess-mode
 
32
;; with ddeclient.
 
33
 
 
34
;;; Code:
32
35
 
33
36
;;; Requires and Autoloads:
34
37
 
36
39
;;NO: this is autoloaded from other places (require 'ess-dde)
37
40
 
38
41
(autoload 'inferior-ess "ess-inf" "Run an ESS process.")
39
 
(autoload 'ess-mode     "ess-mode" "Edit an ESS process.")
40
 
 
41
 
;;; Code:
 
42
(autoload 'ess-mode     "ess-mode" "Edit an ESS process.")
42
43
 
43
44
(defvar S+4-dialect-name "S+4"
44
45
  "Name of 'dialect' for S-PLUS 4.x.");easily changeable in a user's .emacs
51
52
 
52
53
(defvar S+4-customize-alist
53
54
  (append
54
 
   '((ess-local-customize-alist         . 'S+4-customize-alist)
55
 
     (ess-dialect                       . S+4-dialect-name)
56
 
     (ess-loop-timeout                  . ess-S-loop-timeout);fixme: dialect spec.
57
 
     (ess-object-name-db-file           . "ess-sp4-namedb.el" )
58
 
     (inferior-ess-program              . inferior-S+4-program-name)
59
 
     (inferior-ess-help-command         . "help(\"%s\")\n")
 
55
   '((ess-local-customize-alist         . 'S+4-customize-alist)
 
56
     (ess-dialect                       . S+4-dialect-name)
 
57
     (ess-loop-timeout                  . ess-S-loop-timeout);fixme: dialect spec.
 
58
     (ess-object-name-db-file           . "ess-sp4-namedb.el" )
 
59
     (inferior-ess-program              . inferior-S+4-program-name)
 
60
     (inferior-ess-help-command         . "help(\"%s\")\n")
60
61
     (inferior-ess-help-filetype . "chm")
61
62
 
62
 
     (inferior-ess-start-file           . nil) ;"~/.ess-S+4")
63
 
     (inferior-ess-start-args           . (concat
64
 
                                           inferior-S+4-multipleinstances " "
65
 
                                           inferior-S+4-print-command
66
 
                                           " S_PROJ="
67
 
                                           (directory-file-name default-directory)))
68
 
     ;;    (inferior-ess-ddeclient      . "ddeclient")
69
 
     ;;    (inferior-ess-client-name    . "S-PLUS")
70
 
     ;;    (inferior-ess-client-command . "SCommand")
71
 
     (ess-STERM  . "ddeESS")
 
63
     (inferior-ess-start-file           . nil) ;"~/.ess-S+4")
 
64
     (inferior-ess-start-args           . (concat
 
65
                                           inferior-S+4-multipleinstances " "
 
66
                                           inferior-S+4-print-command
 
67
                                           " S_PROJ="
 
68
                                           (directory-file-name default-directory)))
 
69
     ;;    (inferior-ess-ddeclient      . "ddeclient")
 
70
     ;;    (inferior-ess-client-name    . "S-PLUS")
 
71
     ;;    (inferior-ess-client-command . "SCommand")
 
72
     (ess-STERM  . "ddeESS")
72
73
     )
73
74
   S+common-cust-alist)
74
75
 
76
77
 
77
78
(defvar Sqpe+4-customize-alist
78
79
  (append
79
 
   '((ess-local-customize-alist         . 'Sqpe+4-customize-alist)
80
 
     (ess-dialect                       . S+4-dialect-name)
81
 
     (ess-loop-timeout                  . 500000 );fixme: dialect specific custom.v
82
 
     (ess-object-name-db-file           . "ess-sp4-namedb.el" )
83
 
     (inferior-ess-program              . inferior-Sqpe+4-program-name)
84
 
     (inferior-ess-help-command         . "help(\"%s\")\n")
 
80
   '((ess-local-customize-alist         . 'Sqpe+4-customize-alist)
 
81
     (ess-dialect                       . S+4-dialect-name)
 
82
     (ess-loop-timeout                  . 500000 );fixme: dialect specific custom.v
 
83
     (ess-object-name-db-file           . "ess-sp4-namedb.el" )
 
84
     (inferior-ess-program              . inferior-Sqpe+4-program-name)
 
85
     (inferior-ess-help-command         . "help(\"%s\")\n")
85
86
     (inferior-ess-help-filetype . "chm")
86
 
     (inferior-ess-search-list-command  . "searchPaths()\n")
87
 
     (inferior-ess-start-file           . nil) ;"~/.ess-S+4")
 
87
     (inferior-ess-search-list-command  . "searchPaths()\n")
 
88
     (inferior-ess-start-file           . nil) ;"~/.ess-S+4")
88
89
     (inferior-ess-language-start . (concat
89
 
                                     "options("
90
 
                                     "STERM='" ess-STERM "'"
91
 
                                     (if ess-editor
92
 
                                         (concat ", editor='" ess-editor "'"))
93
 
                                     (if ess-pager
94
 
                                         (concat ", pager='"  ess-pager  "'"))
95
 
                                     ")"))
96
 
     (ess-STERM  . "iESS")
 
90
                                     "options("
 
91
                                     "STERM='" ess-STERM "'"
 
92
                                     (if ess-editor
 
93
                                         (concat ", editor='" ess-editor "'"))
 
94
                                     (if ess-pager
 
95
                                         (concat ", pager='"  ess-pager  "'"))
 
96
                                     ")"))
 
97
     (ess-STERM  . "iESS")
97
98
     )
98
99
   S+common-cust-alist)
99
100
 
103
104
;;; There are extra complications in S+4 (compared to S+3) because
104
105
;;;
105
106
;;; (1) The StatSci supplied Splus.exe doesn't work in an emacs
106
 
;;;     buffer.  It works as as a GUI window and we must send commands
107
 
;;;     to it through ddeclient.  Nonetheless, we need to give it a
108
 
;;;     process name and be sure that that there is a valid running
109
 
;;;     process in the '(ddeESS [S+4])' buffer.  Therefore we create an
110
 
;;;     ESS process in the buffer as a placeholder and start a shell
111
 
;;;     in the ESS buffer.  From the shell we start Splus.  Once Splus
112
 
;;;     finishes initializing and kills the original shell, we start
113
 
;;;     another shell.  We have a buffer-local variable
114
 
;;;     inferior-ess-ddeclient, initialized to nil.  When there is a
115
 
;;;     non-nil value of inferior-ess-ddeclient we send lines to
116
 
;;;     inferior-ess-ddeclient rather than to the Splus process.
 
107
;;;     buffer.  It works as as a GUI window and we must send commands
 
108
;;;     to it through ddeclient.  Nonetheless, we need to give it a
 
109
;;;     process name and be sure that that there is a valid running
 
110
;;;     process in the '(ddeESS [S+4])' buffer.  Therefore we create an
 
111
;;;     ESS process in the buffer as a placeholder and start a shell
 
112
;;;     in the ESS buffer.  From the shell we start Splus.  Once Splus
 
113
;;;     finishes initializing and kills the original shell, we start
 
114
;;;     another shell.  We have a buffer-local variable
 
115
;;;     inferior-ess-ddeclient, initialized to nil.  When there is a
 
116
;;;     non-nil value of inferior-ess-ddeclient we send lines to
 
117
;;;     inferior-ess-ddeclient rather than to the Splus process.
117
118
;;; (2) There is no Splus process running in the '(ddeESS [S+4])'
118
 
;;;     buffer.  Therefore inferior-ess will never see a prompt,
119
 
;;;     unless we first change it to the null prompt "^".  Then once
120
 
;;;     the process has started, we change it back.
 
119
;;;     buffer.  Therefore inferior-ess will never see a prompt,
 
120
;;;     unless we first change it to the null prompt "^".  Then once
 
121
;;;     the process has started, we change it back.
121
122
;;; (3) When M-x S+4 starts Splus by a shell command, then Splus is an
122
 
;;;     independent process and will be survive if the '(ddeESS [S+4])'
123
 
;;;     buffer is killed (or emacs is quit).  The '(ddeESS [S+4])' is
124
 
;;;     made read-only and a warning is placed in it saying that "You
125
 
;;;     can't type anything here."  Actually, if the standalone Splus
126
 
;;;     is killed and the '(ddeESS [S+4])' is made writable (C-x C-q),
127
 
;;;     then '(ddeESS [S+4])' becomes a shell buffer.
 
123
;;;     independent process and will be survive if the '(ddeESS [S+4])'
 
124
;;;     buffer is killed (or emacs is quit).  The '(ddeESS [S+4])' is
 
125
;;;     made read-only and a warning is placed in it saying that "You
 
126
;;;     can't type anything here."  Actually, if the standalone Splus
 
127
;;;     is killed and the '(ddeESS [S+4])' is made writable (C-x C-q),
 
128
;;;     then '(ddeESS [S+4])' becomes a shell buffer.
128
129
;;;
129
130
(defun S+4 (&optional proc-name)
130
131
  "Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci.  Put S-Plus in an
132
133
window is killed in emacs).  Do this by creating a comint process that
133
134
calls sh.  Send a shell command in that sh buffer to call Splus.  When
134
135
it completes set up a shell as a placeholder in the '(ddeESS [S+4])'
135
 
buffer.  The S-Plus options are correctly set.  In particular, the
 
136
buffer.  The S-Plus options are correctly set.  In particular, the
136
137
S-Plus Commands window is opened if the Options/General
137
138
Settings/Startup menu says it should be.  There is a 30 second delay
138
139
during startup in which the screen will not be refreshed.  This delay
142
143
    (setq ess-customize-alist S+4-customize-alist)
143
144
    (ess-write-to-dribble-buffer
144
145
     (format "\n(S+4): ess-dialect=%s, buf=%s\n" ess-dialect
145
 
             (current-buffer)))
146
 
    (setq ess-customize-alist           ; change inferior-ess-program
147
 
          (append ess-customize-alist '((inferior-ess-program   . "sh"))))
148
 
    (setq ess-customize-alist           ; change inferior-ess-primary-prompt
149
 
          (append ess-customize-alist '((inferior-ess-primary-prompt   . "^"))))
150
 
    (setq ess-customize-alist           ; change inferior-ess-start-args
151
 
          (append ess-customize-alist '((inferior-ess-start-args   . "-i"))))
 
146
             (current-buffer)))
 
147
    (setq ess-customize-alist           ; change inferior-ess-program
 
148
          (append ess-customize-alist '((inferior-ess-program   . "sh"))))
 
149
    (setq ess-customize-alist           ; change inferior-ess-primary-prompt
 
150
          (append ess-customize-alist '((inferior-ess-primary-prompt   . "^"))))
 
151
    (setq ess-customize-alist           ; change inferior-ess-start-args
 
152
          (append ess-customize-alist '((inferior-ess-start-args   . "-i"))))
152
153
    (let ((s-proj (getenv "S_PROJ"))
153
 
          (manpath (getenv "MANPATH")))
 
154
          (manpath (getenv "MANPATH")))
154
155
      (cd (w32-short-file-name (directory-file-name default-directory)))
155
156
      (setenv "S_PROJ" default-directory)
156
157
      ;; I don't know why this PATH/MANPATH game is needed,
158
159
      (setenv "MANPATH" (getenv "PATH"))
159
160
      (inferior-ess)
160
161
      (sleep-for 2) ; need to wait, else working too fast!  The Splus
161
 
                    ; command in '(ddeESS [S+4])' should follow the "$"
162
 
                    ; prompt.  If not, then increase the sleep-for time!
 
162
                                        ; command in '(ddeESS [S+4])' should follow the "$"
 
163
                                        ; prompt.  If not, then increase the sleep-for time!
163
164
      (setenv "MANPATH" manpath)
164
165
      (setenv "S_PROJ" s-proj))
165
166
    (setq ess-customize-alist S+4-customize-alist)
166
167
    (ess-setq-vars-local ess-customize-alist)
167
168
;;; the next three lines belong in customize-alist, but can't be there
168
169
;;; because of the broken ess-setq-vars-default usage in ess-inf.el
169
 
    (setq inferior-ess-ddeclient         "ddeclient")
170
 
    (setq inferior-ess-client-name       "S-PLUS")
171
 
    (setq inferior-ess-client-command    "SCommand")
 
170
    (setq inferior-ess-ddeclient         "ddeclient")
 
171
    (setq inferior-ess-client-name       "S-PLUS")
 
172
    (setq inferior-ess-client-command    "SCommand")
172
173
;;; end of what belongs in customize-alist
173
174
    (setq comint-process-echoes nil)
174
175
    (setq comint-input-sender 'comint-simple-send)
175
176
    (goto-char (point-max))
176
177
    (insert (concat inferior-S+4-program-name " "
177
 
                    inferior-ess-start-args)) ; Note: there is no final "&".
178
 
    ;; Without the "&", the results of  !system.command  come to '(ddeESS [S+4])'
 
178
                    inferior-ess-start-args)) ; Note: there is no final "&".
 
179
    ;; Without the "&", the results of  !system.command  come to '(ddeESS [S+4])'
179
180
    ;; With the "&", the results of  !system.command  in S get lost.
180
181
    (inferior-ess-send-input)
181
182
    (sleep-for 30) ; Need to wait, else working too fast!
182
 
                   ; If the ess-current-process-name doesn't appear in the
183
 
                   ; Splus Commands window increase the sleep-for time!
 
183
                                        ; If the ess-current-process-name doesn't appear in the
 
184
                                        ; Splus Commands window increase the sleep-for time!
184
185
    (setq ess-local-process-name ess-current-process-name)
185
186
    (ess-eval-linewise (concat "#" ess-current-process-name))
186
187
    (goto-char (point-min))
194
195
Splus/Window/Commands Window).\n
195
196
Any results of the   !system.command   typed at the S prompt in the
196
197
Splus Commands window appear in this buffer.\n\n")
197
 
    (goto-char (point-max))             ; comint-mode-map makes '(ddeESS [S+4])'
198
 
;;  (use-local-map comint-mode-map)     ;a shell buffer after Splus is finished.
 
198
    (goto-char (point-max))             ; comint-mode-map makes '(ddeESS [S+4])'
 
199
    ;;  (use-local-map comint-mode-map) ;a shell buffer after Splus is finished.
199
200
    (set-buffer-process-coding-system 'raw-text-dos 'raw-text-unix)
200
 
    (toggle-read-only t)                ; force buffer to be read-only
 
201
    (toggle-read-only t)                ; force buffer to be read-only
201
202
    (setq mode-name "ddeESS")
202
 
;;  (ess-eval-linewise inferior-S+4-editor-pager-command)
 
203
    ;;  (ess-eval-linewise inferior-S+4-editor-pager-command)
203
204
    (if inferior-ess-language-start
204
 
        (ess-eval-linewise inferior-ess-language-start))
 
205
        (ess-eval-linewise inferior-ess-language-start))
205
206
    ))
206
207
 
207
208
 
222
223
    ;; It doesn't know about us, so nothing comes back.
223
224
    (S+4 proc-name))
224
225
  (save-excursion
225
 
    (set-buffer (car (buffer-list)))    ; get the ESS buffer just created
226
 
    (toggle-read-only nil)              ; permit writing in ESS buffer
 
226
    (set-buffer (car (buffer-list)))    ; get the ESS buffer just created
 
227
    (toggle-read-only nil)              ; permit writing in ESS buffer
227
228
    (goto-char (point-max))
228
229
    (beginning-of-line)
229
230
    (forward-line -1)
230
231
    (insert
231
232
     "This is S+4-existing.
232
 
Results of the   !system.command   typed at the S prompt in the
 
233
Results of the   !system.command   typed at the S prompt in the
233
234
Splus Commands window blink a DOS window and you won't see them.\n\n")
234
 
    (toggle-read-only t)                ; restore ESS buffer to be read-only
 
235
    (toggle-read-only t)                ; restore ESS buffer to be read-only
235
236
    ))
236
237
 
237
238
 
238
239
;;; There are extra complications in Sqpe+4 (compared to S+3) because
239
240
;;; (1) The StatSci supplied Sqpe.exe won't work without SHOME as an
240
 
;;;     environment variable and Sqpe does not take command line
241
 
;;;     arguments and
 
241
;;;     environment variable and Sqpe does not take command line
 
242
;;;     arguments and
242
243
;;; (2) Sqpe.exe comes up with options(interactive=F), which means it
243
 
;;;     doesn't provide prompts by default, and we must change it to T so
244
 
;;;     it will provide prompts.
 
244
;;;     doesn't provide prompts by default, and we must change it to T so
 
245
;;;     it will provide prompts.
245
246
;;;
246
247
(defun Sqpe+4 (&optional proc-name)
247
248
  "Call 'Sqpe' from 'S-PLUS 4.x', the 'Real Thing'  from StatSci."
251
252
    (if shome-nil-p (setenv "SHOME" inferior-Sqpe+4-SHOME-name))
252
253
    (ess-write-to-dribble-buffer
253
254
     (format "\n(Sqpe+4): ess-dialect=%s, buf=%s\n" ess-dialect
254
 
             (current-buffer)))
255
 
    (setq ess-customize-alist           ; change inferior-ess-primary-prompt
256
 
          (append ess-customize-alist '((inferior-ess-primary-prompt   . "^"))))
 
255
             (current-buffer)))
 
256
    (setq ess-customize-alist           ; change inferior-ess-primary-prompt
 
257
          (append ess-customize-alist '((inferior-ess-primary-prompt   . "^"))))
257
258
    (inferior-ess)
258
259
    (setq ess-customize-alist Sqpe+4-customize-alist) ; restore i-e-p-p in alist
259
 
    (ess-setq-vars-local ess-customize-alist)    ; restore i-e-p-p in buffer
260
 
    (setq inferior-ess-prompt                    ; define with correct i-e-p-p
261
 
          ;; Do not anchor to bol with `^'       ; (copied from ess-inf.el)
262
 
          (concat "\\("
263
 
                  inferior-ess-primary-prompt
264
 
                  "\\|"
265
 
                  inferior-ess-secondary-prompt
266
 
                  "\\)"))
 
260
    (ess-setq-vars-local ess-customize-alist)    ; restore i-e-p-p in buffer
 
261
    (setq inferior-ess-prompt                    ; define with correct i-e-p-p
 
262
          ;; Do not anchor to bol with `^'       ; (copied from ess-inf.el)
 
263
          (concat "\\("
 
264
                  inferior-ess-primary-prompt
 
265
                  "\\|"
 
266
                  inferior-ess-secondary-prompt
 
267
                  "\\)"))
267
268
    (setq comint-prompt-regexp (concat "^" inferior-ess-prompt))
268
 
                                                ; define with correct i-e-p-p
 
269
                                        ; define with correct i-e-p-p
269
270
    (setq comint-input-sender 'inferior-ess-input-sender)
270
271
    (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
271
272
    (goto-char (point-max))
272
273
    (insert "options(interactive=T)")
273
274
    (inferior-ess-send-input)
274
275
    (setq mode-name "iESS(Sqpe)")
275
 
;;  (ess-eval-linewise inferior-S+4-editor-pager-command)
 
276
    ;;  (ess-eval-linewise inferior-S+4-editor-pager-command)
276
277
    (if inferior-ess-language-start
277
 
        (ess-eval-linewise inferior-ess-language-start))
 
278
        (ess-eval-linewise inferior-ess-language-start))
278
279
    (if shome-nil-p (setenv "SHOME" nil))))
279
280
 
280
281
 
298
299
window is killed in emacs).  Do this by creating a comint process that
299
300
calls sh.  Send a shell command in that sh buffer to call Splus.  When
300
301
it completes set up a shell as a placeholder in the '(ddeESS [S+4])'
301
 
buffer.  The S-Plus options are correctly set.  In particular, the
 
302
buffer.  The S-Plus options are correctly set.  In particular, the
302
303
S-Plus Commands window is opened if the Options/General
303
304
Settings/Startup menu says it should be.  There is a 30 second delay
304
305
during startup in which the screen will not be refreshed.  This delay
308
309
    (setq ess-customize-alist S+4-customize-alist)
309
310
    (ess-write-to-dribble-buffer
310
311
     (format "\n(S+4): ess-dialect=%s, buf=%s\n" ess-dialect
311
 
             (current-buffer)))
312
 
    (setq ess-customize-alist           ; change inferior-ess-program
313
 
          (append ess-customize-alist '((inferior-ess-program
314
 
                                         . (getenv "COMSPEC")))))
315
 
    (setq ess-customize-alist           ; change inferior-ess-primary-prompt
316
 
          (append ess-customize-alist '((inferior-ess-primary-prompt   . "^"))))
317
 
    (setq ess-customize-alist           ; change inferior-ess-start-args
318
 
          (append ess-customize-alist '((inferior-ess-start-args   . ""))))
 
312
             (current-buffer)))
 
313
    (setq ess-customize-alist           ; change inferior-ess-program
 
314
          (append ess-customize-alist '((inferior-ess-program
 
315
                                         . (getenv "COMSPEC")))))
 
316
    (setq ess-customize-alist           ; change inferior-ess-primary-prompt
 
317
          (append ess-customize-alist '((inferior-ess-primary-prompt   . "^"))))
 
318
    (setq ess-customize-alist           ; change inferior-ess-start-args
 
319
          (append ess-customize-alist '((inferior-ess-start-args   . ""))))
319
320
    (let ((s-proj (getenv "S_PROJ")))
320
321
      (cd (w32-short-file-name (directory-file-name default-directory)))
321
322
      (setenv "S_PROJ" default-directory)
322
323
      (inferior-ess)
323
324
      (sleep-for 2) ; need to wait, else working too fast!  The Splus
324
 
                    ; command in '(ddeESS [S+4])' should follow the "$"
325
 
                    ; prompt.  If not, then increase the sleep-for time!
 
325
                                        ; command in '(ddeESS [S+4])' should follow the "$"
 
326
                                        ; prompt.  If not, then increase the sleep-for time!
326
327
      (setenv "S_PROJ" s-proj))
327
328
    (setq ess-customize-alist S+4-customize-alist)
328
329
    (ess-setq-vars-local ess-customize-alist)
329
330
;;; the next three lines belong in customize-alist, but can't be there
330
331
;;; because of the broken ess-setq-vars-default usage in ess-inf.el
331
 
    (setq inferior-ess-ddeclient         "ddeclient")
332
 
    (setq inferior-ess-client-name       "S-PLUS")
333
 
    (setq inferior-ess-client-command    "SCommand")
 
332
    (setq inferior-ess-ddeclient         "ddeclient")
 
333
    (setq inferior-ess-client-name       "S-PLUS")
 
334
    (setq inferior-ess-client-command    "SCommand")
334
335
;;; end of what belongs in customize-alist
335
336
    (setq comint-input-sender 'comint-simple-send)
336
337
    (setq comint-process-echoes nil)
337
338
    (set-buffer-process-coding-system 'raw-text-dos 'raw-text-dos)
338
339
    (goto-char (point-max))
339
340
    (insert (concat inferior-S+4-program-name " "
340
 
                    inferior-ess-start-args)) ; Note: there is no final "&".
341
 
; Without the "&", the results of  !system.command  come to '(ddeESS [S+4])'
342
 
; With the "&", the results of  !system.command  in S get lost.
 
341
                    inferior-ess-start-args)) ; Note: there is no final "&".
 
342
                                        ; Without the "&", the results of  !system.command  come to '(ddeESS [S+4])'
 
343
                                        ; With the "&", the results of  !system.command  in S get lost.
343
344
    (inferior-ess-send-input)
344
345
    (sleep-for 30) ; Need to wait, else working too fast!
345
 
                   ; If the ess-current-process-name doesn't appear in the
346
 
                   ; Splus Commands window increase the sleep-for time!
 
346
                                        ; If the ess-current-process-name doesn't appear in the
 
347
                                        ; Splus Commands window increase the sleep-for time!
347
348
;;; from msdos-minor-mode
348
 
  (setq comint-process-echoes t)
349
 
  (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
 
349
    (setq comint-process-echoes t)
 
350
    (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
350
351
;;; end from msdos-minor-mode
351
352
    (setq ess-local-process-name ess-current-process-name)
352
353
    (ess-eval-linewise (concat "#" ess-current-process-name))
363
364
emacs screen will be partially blank.\n
364
365
Remember to
365
366
`q()' from S-Plus and
366
 
 then C-x C-q exit from the `'(ddeESS [S+4])'' buffer,
 
367
then C-x C-q exit from the `'(ddeESS [S+4])'' buffer,
367
368
or take the risk of not being able to shut down your computer
368
369
and suffering through scandisk.\n
369
370
Any results of the   !system.command   typed at the S prompt in the
370
371
Splus Commands window (are supposed to) appear in this buffer.\n\n")
371
 
    (goto-char (point-max))            ; comint-mode-map makes '(ddeESS [S+4])'
 
372
    (goto-char (point-max))            ; comint-mode-map makes '(ddeESS [S+4])'
372
373
    (use-local-map comint-mode-map)    ; a shell buffer after Splus is finished.
373
 
    (toggle-read-only t)               ; force buffer to be read-only
 
374
    (toggle-read-only t)               ; force buffer to be read-only
374
375
    (setq mode-name "ddeESS")
375
376
;;  (ess-eval-linewise inferior-S+4-editor-pager-command)
376
377
    (if inferior-ess-language-start
388
389
  (let* ((inferior-S+4-multipleinstances ""))
389
390
    (S+4-msdos proc-name))
390
391
  (save-excursion
391
 
    (set-buffer (car (buffer-list)))    ; get the ESS buffer just created
392
 
    (toggle-read-only nil)              ; permit writing in ESS buffer
 
392
    (set-buffer (car (buffer-list)))    ; get the ESS buffer just created
 
393
    (toggle-read-only nil)              ; permit writing in ESS buffer
393
394
    (goto-char (point-max))
394
395
    (beginning-of-line)
395
396
    (forward-line -1)
396
397
    (insert
397
398
     "This is S+4-msdos-existing.
398
 
Results of the   !system.command   typed at the S prompt in the
 
399
Results of the   !system.command   typed at the S prompt in the
399
400
Splus Commands window blink a DOS window and you won't see them.\n\n")
400
 
    (toggle-read-only t)                ; restore ESS buffer to be read-only
 
401
    (toggle-read-only t)                ; restore ESS buffer to be read-only
401
402
    ))
402
403
 
403
404
 ; Provide package
408
409
 
409
410
;;; This file is automatically placed in Outline minor mode.
410
411
;;; The file is structured as follows:
411
 
;;; Chapters:     ^L ;
412
 
;;; Sections:    ;;*;;
 
412
;;; Chapters:     ^L ;
 
413
;;; Sections:    ;;*;;
413
414
;;; Subsections: ;;;*;;;
414
 
;;; Components:  defuns, defvars, defconsts
415
 
;;;              Random code beginning with a ;;;;* comment
 
415
;;; Components:  defuns, defvars, defconsts
 
416
;;;              Random code beginning with a ;;;;* comment
416
417
 
417
418
;;; Local variables:
418
419
;;; mode: emacs-lisp