1
1
;;; ess.el --- Emacs Speaks Statistics: statistical programming within Emacs
3
3
;; Copyright (C) 1989--1996 Bates, Kademan, Ritter and Smith
4
;; Copyright (C) 1996--2001 Rossini, Heiberger, Hornik, Maechler and
4
;; Copyright (C) 1997--2005 A.J. Rossini, Rich M. Heiberger, Martin
5
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
7
;; Author: Doug Bates, Ed Kademan, Frank Ritter, David Smith
8
;; Maintainer(s): A.J. Rossini <rossini@biostat.washington.edu>
9
;; Martin Maechler <maechler@stat.math.ethz.ch>
10
;; Kurt Hornik <hornik@ci.tuwien.ac.at>
11
;; Richard M. Heiberger <rmh@fisher.stat.temple.edu>
12
;; Rodney Sparapani <rsparapa@mcw.edu>
7
;; Original Authors: Doug Bates, Ed Kademan, Frank Ritter, David Smith
13
8
;; Created: October 14, 1991
14
;; Version: $Id: ess.el,v 5.26 2001/08/10 13:46:43 maechler Exp $
9
;; Maintainers: ESS-core <ESS-core@stat.math.ethz.ch>
15
11
;; Keywords: statistical support
16
12
;; Summary: general functions for ESS
18
;; Lisp-dir-entry : ESS |
19
;; R. M. Heiberger, K. Hornik, M. Maechler, A.J. Rossini|
20
;; ess-bugs@stat.math.ethz.ch|
21
;; General Interface for Statistical Software Packages|
24
;; ftp://ess.stat.wisc.edu/pub/ESS/ESS-5.0.tar.gz
26
14
;; This file is part of ESS
28
16
;; This file is free software; you can redistribute it and/or modify
33
21
;; This file is distributed in the hope that it will be useful,
34
22
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
35
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36
24
;; GNU General Public License for more details.
38
26
;; You should have received a copy of the GNU General Public License
39
;; along with GNU Emacs; see the file COPYING. If not, write to
27
;; along with GNU Emacs; see the file COPYING. If not, write to
40
28
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
42
30
;; In short: you may use this code any way you like, as long as you
43
31
;; don't charge money for it, remove this notice, or hold anyone liable
44
32
;; for its results.
46
;; Copyright 1989--92,1997 Doug Bates bates@stat.wisc.edu
47
;; 1993, 1994 Ed Kademan kademan@stat.wisc.edu
48
;; Frank Ritter ritter@psychology.nottingham.ac.uk
49
;; 1994--1997 David Smith <maa036@lancaster.ac.uk>
51
;; 1996--2000 Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
52
;; 1996--2001 Martin Maechler <maechler@stat.math.ethz.ch>
53
;; 1996--2000 A.J. Rossini <rossini@stat.sc.edu>,
54
;; 1998--2001 <rossini@biostat.washington.edu>
55
;; 1996--2001 Richard M. Heiberger <rmh@astro.ocis.temple.edu>
56
;; 1999--2001 Rodney Sparapani <rsparapa@mcw.edu>
63
38
;;; Interface to the S, SAS, and XLisp dialects of statistical
64
39
;;; programming languages, with potential extensions to other
65
;;; languages. Designed to be extendable to most other interactive
40
;;; languages. Designed to be extendable to most other interactive
66
41
;;; statistical programming situations.
89
64
;;; command history editing and job control, inferior S mode
90
65
;;; allows you to dump and load S objects into and from external
91
66
;;; files, and to display help on functions. It also provides
92
;;; name completion while you do these. For more detailed
67
;;; name completion while you do these. For more detailed
93
68
;;; information see the documentation strings for inferior-ess,
94
69
;;; inferior-ess-mode, ess-mode, and comint-mode. There are also
95
70
;;; many variables and hooks available for customizing (see
136
111
(require 'ess-emcs)
138
;; The following should take care of all cases. Currently, seems to
140
;;(if ess-local-custom-available
141
;; (eval-and-compile ; was progn
142
;; (ess-message "--++ LOADING CUSTOM ++--")
143
;; (require 'ess-cust))
144
;; (eval-and-compile ; was progn
145
;; (ess-message "--++ NOT NOT NOT loading custom ++--")
146
;; (require 'ess-vars)))
148
;; The above was commented out to verify that it would work on
149
;; versions w/o customize. Remove after verification.
150
113
(eval-and-compile
151
114
(require 'ess-cust))
164
127
(autoload 'ess-load-file "ess-inf" "Source a file into S.")
166
(autoload 'inside-string/comment-p "ess-utils"
129
(autoload 'ess-inside-string-or-comment-p "ess-utils"
167
130
"Non-nil, if inside string or comment." t)
131
(autoload 'ess-inside-string-p "ess-utils" "Non-nil if inside string." t)
133
(autoload 'ess-do-auto-fill "ess-utils" "substitute for \\[do-auto-fill]." t)
168
135
(autoload 'ess-rep-regexp "ess-utils" "Replace, but not in string/comment." t)
170
137
(autoload 'ess-time-string "ess-utils" "Return time-stamp string." t)
172
(autoload 'nuke-trailing-whitespace "ess-utils"
139
(autoload 'ess-nuke-trailing-whitespace "ess-utils"
173
140
"Maybe get rid of trailing blanks." t)
175
142
; ess-transcript-mode: editing ``outputs'
233
200
; Buffer local customization stuff
235
202
;; Parse a line into its constituent parts (words separated by
236
;; whitespace). Return a list of the words.
203
;; whitespace). Return a list of the words.
237
204
;; Taken from rlogin.el, from the comint package, from XEmacs 20.3.
238
205
(defun ess-line-to-list-of-words (line)
241
;; (match-data (match-data)))
208
;; (match-data (match-data)))
242
209
(while (string-match "[^ \t\n]+" line posn)
243
210
(setq list (cons (substring line (match-beginning 0) (match-end 0))
245
212
(setq posn (match-end 0)))
246
213
(store-match-data (match-data))
247
214
(nreverse list)))
249
216
(defun ess-write-to-dribble-buffer (text)
250
217
"Write TEXT to dribble buffer."
219
(if (not (buffer-live-p ess-dribble-buffer))
220
;; ESS dribble buffer must be re-created.
221
(setq ess-dribble-buffer (get-buffer-create "*ESS*")))
252
222
(set-buffer ess-dribble-buffer)
253
223
(goto-char (point-max))
254
224
(insert-string text)))
258
228
(if buf (set-buffer buf))
259
229
(mapcar (lambda (pair)
260
230
(make-local-variable (car pair))
261
(set (car pair) (eval (cdr pair))))
232
(set (car pair) (eval (cdr pair)))))
263
234
(ess-write-to-dribble-buffer
264
235
(format "(ess-setq-vars-LOCAL): language=%s, dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n"
265
ess-language ess-dialect buf comint-process-echoes comint-input-sender)))
236
ess-language ess-dialect buf comint-process-echoes comint-input-sender)))
267
238
(defun ess-setq-vars-default (alist &optional buf)
268
239
"Set language variables from ALIST, in buffer BUF, if desired."
269
240
(ess-write-to-dribble-buffer
270
241
(format "ess-setq-vars-default 0: ess-language=%s, -dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n"
271
ess-language ess-dialect buf comint-process-echoes comint-input-sender))
242
ess-language ess-dialect buf comint-process-echoes comint-input-sender))
272
243
(if buf (set-buffer buf))
273
244
(mapcar (lambda (pair)
274
(set-default (car pair) (eval (cdr pair))))
245
(set-default (car pair) (eval (cdr pair))))
276
247
(ess-write-to-dribble-buffer
277
248
(format "ess-setq-vars-default 1: ess-language=%s, -dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n"
278
ess-language ess-dialect buf comint-process-echoes comint-input-sender))
249
ess-language ess-dialect buf comint-process-echoes comint-input-sender))
281
252
;;--- emacs 19.34 compatibility [MM]:
315
286
;; Toby Speight <Toby.Speight@ansa.co.uk>
317
;;> (let ((l R-customize-alist)) ; or whatever
288
;;> (let ((l R-customize-alist)) ; or whatever
319
;;> (set (car (car l)) (cdr (car l))) ; set, not setq!
320
;;> (setq l (cdr l))))
290
;;> (set (car (car l)) (cdr (car l))) ; set, not setq!
291
;;> (setq l (cdr l))))
323
294
;;If they are to be buffer-local, you may need to
326
;;> (set (make-local-variable (car (car l))) (cdr (car l)))
297
;;> (set (make-local-variable (car (car l))) (cdr (car l)))
330
301
;; Erik Naggum <erik@naggum.no>
332
303
;;(mapcar (lambda (pair) (set (car pair) (cdr pair)))
333
;; R-customize-alist)
304
;; R-customize-alist)
335
306
;;if you want to evaluate these things along the way, which it appears that
338
309
;;(mapcar (lambda (pair) (set (car pair) (eval (cdr pair))))
339
;; R-customize-alist)
310
;; R-customize-alist)
341
312
;; jsa@alexandria.organon.com (Jon S Anthony)
342
313
;;(mapcar #'(lambda (x)
344
315
;; R-customize-alist)
347
;; The following code causes the *ESS* buffer to be recreated (if necessary)
348
;; before it is used; Jeff Mincy <jeff@delphioutpost.com>, 27 Jul 2001.
349
(defadvice ess-write-to-dribble-buffer
350
(before get-dribble-buffer first activate)
351
(setq ess-dribble-buffer (get-buffer-create "*ESS*")))
353
319
; Run load hook and provide package
361
327
;;; This file is automatically placed in Outline minor mode.
362
328
;;; The file is structured as follows:
365
331
;;; Subsections: ;;;*;;;
366
;;; Components: defuns, defvars, defconsts
367
;;; Random code beginning with a ;;;;* comment
332
;;; Components: defuns, defvars, defconsts
333
;;; Random code beginning with a ;;;;* comment
369
335
;;; Local variables:
370
336
;;; mode: emacs-lisp