1
1
;;; ess-s4-d.el --- S4 customization
3
3
;; Copyright (C) 1997--2004 A.J. Rossini, Rich M. Heiberger, Martin
4
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
4
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6
;; Original Author: A.J. Rossini <rossini@stat.sc.edu>
6
;; Author: A.J. Rossini <rossini@stat.sc.edu>
7
7
;; Created: 12 Jun 1997
8
;; Maintainers: ESS-core <ESS-core@r-project.org>
8
;; Maintainer: ESS-core <ESS-core@r-project.org>
10
;; Keywords: start up, configuration.
10
;; Keywords: languages
12
12
;; This file is part of ESS.
26
26
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29
;;; DB contributed the changes from ess-s3-d.el to
30
;;; ess-s4-d.el (removed the old ugly approach).
31
;;; This file defines S4 customizations for ess-mode. Lots of thanks
32
;;; to RMH and JMC for code and suggestions
30
;; DB contributed the changes from ess-s3-d.el to
31
;; ess-s4-d.el (removed the old ugly approach).
32
;; This file defines S4 customizations for ess-mode. Lots of thanks
33
;; to RMH and JMC for code and suggestions
37
(autoload 'inferior-ess "ess-inf" "Run an ESS process.")
38
(autoload 'inferior-ess "ess-inf" "Run an ESS process.")
42
41
;; Some of this is based on files from:
43
42
;; Copyright (C) 1996, John M. Chambers.
45
44
(defvar S4-customize-alist
47
'((ess-local-customize-alist . 'S4-customize-alist)
49
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
50
(ess-change-sp-regexp . ess-S-change-sp-regexp)
51
(ess-help-sec-keys-alist . ess-help-S3-sec-keys-alist)
52
(ess-object-name-db-file . "ess-s4-namedb.el")
53
(inferior-ess-program . inferior-S4-program-name)
54
(inferior-ess-objects-command . ".SmodeObs(%d, pattern=\"%s\")\n")
55
;;(inferior-ess-objects-pattern . ".*") ; for new s4 stuff
56
(inferior-ess-help-command . "help(\"%s\")\n")
46
'((ess-local-customize-alist . 'S4-customize-alist)
48
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
49
(ess-change-sp-regexp . ess-S-change-sp-regexp)
50
(ess-help-sec-keys-alist . ess-help-S3-sec-keys-alist)
51
(ess-object-name-db-file . "ess-s4-namedb.el")
52
(inferior-ess-program . inferior-S4-program-name)
53
(inferior-ess-objects-command . ".SmodeObs(%d, pattern=\"%s\")\n")
54
;;(inferior-ess-objects-pattern . ".*") ; for new s4 stuff
55
(inferior-ess-help-command . "help(\"%s\")\n")
57
56
(inferior-ess-help-filetype . nil)
58
(inferior-ess-search-list-command . ".SmodePaths()\n")
59
(inferior-ess-load-command . ".SmodeLoad(\"%s\")\n")
60
(inferior-ess-dump-command . ".SmodeDump(\"%s\", \"%s\")\n")
57
(inferior-ess-search-list-command . ".SmodePaths()\n")
58
(inferior-ess-load-command . ".SmodeLoad(\"%s\")\n")
59
(inferior-ess-dump-command . ".SmodeDump(\"%s\", \"%s\")\n")
62
(inferior-ess-start-file . nil) ;"~/.ess-S3")
61
(inferior-ess-start-file . nil) ;"~/.ess-S3")
63
62
(inferior-ess-start-args . "")
64
63
(ess-STERM . "iESS")
70
69
;; For loading up the S code required for the above.
71
70
;;(add-hook 'ess-post-run-hook
75
;; "if(exists(\"Sversion\")) library(emacs) else source(\""
78
;; (if ess-mode-run-file2
80
;; (concat "source(\"" ess-mode-run-file2 "\")\n")))))
74
;; "if(exists(\"Sversion\")) library(emacs) else source(\""
77
;; (if ess-mode-run-file2
79
;; (concat "source(\"" ess-mode-run-file2 "\")\n")))))
119
118
;;; S-help.file line 270
120
119
;;(defun S-get-help-files-list nil
123
;; (mapcar (lambda (dirname)
124
;; (if (file-directory-p dirname)
125
;; (directory-files dirname)))
126
;; (mapcar (lambda (str) (concat str "/__Help"))
127
;; (S-search-list))))))
122
;; (mapcar (lambda (dirname)
123
;; (if (file-directory-p dirname)
124
;; (directory-files dirname)))
125
;; (mapcar (lambda (str) (concat str "/__Help"))
126
;; (S-search-list))))))
130
129
;;;;; additional font-lock-keywords for S4
132
131
;;;;*;; based on S-inf.el line 107
133
132
;;;;(add-to-list 'S-inf-font-lock-keywords
134
;;;; '("\\<\\(^Problem\\|^Warning\\|^Error\\|Debug ?\\|Browsing in frame of\\|Local Variables\\)\\>" . font-lock-reference-face) ; S-inf problems
133
;;;; '("\\<\\(^Problem\\|^Warning\\|^Error\\|Debug ?\\|Browsing in frame of\\|Local Variables\\)\\>" . font-lock-reference-face) ; S-inf problems
136
135
;;;;(add-to-list 'S-inf-font-lock-keywords
137
;;;; '("^R>" . font-lock-keyword-face) ; debug prompt
136
;;;; '("^R>" . font-lock-keyword-face) ; debug prompt
139
138
;;(inferior-S-mode)
178
177
;; (sprocess (get-S-process S-current-process-name))
179
178
;; (sbuffer (process-buffer sprocess))
182
181
;; (set-buffer sbuffer)
184
;; (if (not (eq (process-status sprocess) 'run))
185
;; (S-error "S process has died unexpectedly.")
186
;; (if (> (setq timeout (1+ timeout)) S-loop-timeout)
187
;; (S-error "Timeout waiting for prompt. Check inferior-S-prompt or S-loop-timeout."))
188
;; (accept-process-output)
189
;; (goto-char (point-max))
183
;; (if (not (eq (process-status sprocess) 'run))
184
;; (S-error "S process has died unexpectedly.")
185
;; (if (> (setq timeout (1+ timeout)) S-loop-timeout)
186
;; (S-error "Timeout waiting for prompt. Check inferior-S-prompt or S-loop-timeout."))
187
;; (accept-process-output)
188
;; (goto-char (point-max))
190
189
;;(setq end (point))
191
;; (beginning-of-line)
190
;; (beginning-of-line)
192
191
;;(setq e (buffer-substring (point) end))
193
192
;;(if (equal e inferior-S-debug-prompt)
194
193
;; (S-error "Debug prompt"))
195
;; (setq r (looking-at inferior-S-prompt))
196
;; (not (or r (looking-at ".*\\?\\s *"))))))
194
;; (setq r (looking-at inferior-S-prompt))
195
;; (not (or r (looking-at ".*\\?\\s *"))))))
197
196
;; (goto-char (point-max))
198
197
;; (set-buffer cbuffer)
199
198
;; (symbol-value r)))
216
215
;; (goto-char (point-max))
218
217
;; (re-search-backward ", file \"" nil t)
219
;; (let* ((beg-pos (progn (re-search-forward "\"" nil t) (point)))
220
;; (end-pos (progn (re-search-forward "\"" nil t) (- (point) 1)))
221
;; (filename (buffer-substring beg-pos end-pos))
218
;; (let* ((beg-pos (progn (re-search-forward "\"" nil t) (point)))
219
;; (end-pos (progn (re-search-forward "\"" nil t) (- (point) 1)))
220
;; (filename (buffer-substring beg-pos end-pos))
222
221
;; (fbuffer (get-file-buffer filename))
223
222
;; (linenum (string-to-number
224
;; (progn (re-search-backward "," nil t)
223
;; (progn (re-search-backward "," nil t)
227
226
;; (beg-pos (progn (goto-char (point-min))
228
;; (re-search-forward ":" nil t)
227
;; (re-search-forward ":" nil t)
230
229
;; (errmess (buffer-substring beg-pos end-pos))
233
232
;; (S-display-temp-buffer errbuff)
234
233
;; (if fbuffer nil
251
250
;; (if start-of-output nil (setq start-of-output (point-min)))
252
251
;; (save-excursion
254
;; ;; get output if there is some ready
255
;; (accept-process-output proc 0 500)
256
;; (goto-char (marker-position (process-mark proc)))
257
;; (beginning-of-line)
259
;; (if (re-search-forward inferior-S-debug-prompt nil t)
260
;; (if (equal (get-buffer S-error-buffer-name)
261
;; (get-buffer S-error-buffer-name))
262
;; (let* ((sprocess (get-S-process S-current-process-name))
263
;; (sbuffer (process-buffer sprocess)))
264
;; (set-buffer sbuffer)
265
;; (process-send-string sprocess "n\n")
266
;; (accept-process-output sprocess)
267
;; (beginning-of-line); delete inferior-S-debug-prompt
271
;; (if (< (point) start-of-output) (goto-char start-of-output))
272
;; (not (looking-at inferior-S-primary-prompt)))))))
253
;; ;; get output if there is some ready
254
;; (accept-process-output proc 0 500)
255
;; (goto-char (marker-position (process-mark proc)))
256
;; (beginning-of-line)
258
;; (if (re-search-forward inferior-S-debug-prompt nil t)
259
;; (if (equal (get-buffer S-error-buffer-name)
260
;; (get-buffer S-error-buffer-name))
261
;; (let* ((sprocess (get-S-process S-current-process-name))
262
;; (sbuffer (process-buffer sprocess)))
263
;; (set-buffer sbuffer)
264
;; (process-send-string sprocess "n\n")
265
;; (accept-process-output sprocess)
266
;; (beginning-of-line); delete inferior-S-debug-prompt
270
;; (if (< (point) start-of-output) (goto-char start-of-output))
271
;; (not (looking-at inferior-S-primary-prompt)))))))