~ubuntu-branches/ubuntu/hardy/ess/hardy

« back to all changes in this revision

Viewing changes to lisp/ess-cust.el

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2005-03-22 13:48:07 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050322134807-9mpmbb799jugf248
Tags: 5.2.6-1
* New upstream release
* chmod -R u+w on orig source

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
;;;;; ess-cust.el --- Customization for ESS.
2
 
 
3
 
;; Copyright (C) 1997--2001 A.J. Rossini, Martin Maechler,
4
 
;; Kurt Hornik, Richard M. Heiberger, and Rodney Sparapani.
5
 
 
6
 
;; Author: A.J. Rossini <rossini@u.washington.edu>
7
 
;; Maintainer: A.J. Rossini <rossini@u.washington.edu>
 
1
;;; ess-cust.el --- Customize variables for ESS
 
2
 
 
3
;; Copyright (C) 1997--2005 A.J. Rossini, Rich M. Heiberger, Martin
 
4
;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
 
5
 
 
6
;; Original Author: A.J. Rossini <rossini@u.washington.edu>
8
7
;; Created: 05 June 2000
9
 
;; Modified: $Date: 2002/01/20 06:14:36 $
10
 
;; Version: $Revision: 1.28 $
11
 
;; RCS: $Id: ess-cust.el,v 1.28 2002/01/20 06:14:36 rmh Exp $
 
8
;; Maintainers: ESS-core <ESS-core@stat.math.ethz.ch>
12
9
 
13
10
;; Keywords: editing and process modes.
14
11
 
58
55
  :group 'local)
59
56
 
60
57
(defgroup ess-edit nil
61
 
  "ESS: editing behavior."
 
58
  "ESS: editing behavior, including coments/indentation."
62
59
  :group 'ess
63
60
  :prefix "ess-")
64
61
 
72
69
  :group 'ess
73
70
  :prefix "ess-")
74
71
 
 
72
(defgroup ess-help nil
 
73
  "ESS: help functions."
 
74
  :group 'ess
 
75
  :prefix "ess-")
 
76
 
75
77
(defgroup ess-hooks nil
76
78
  "ESS: hooks for customization."
77
79
  :group 'ess
97
99
  :group 'ess-S
98
100
  :prefix "ess-")
99
101
 
100
 
(defgroup ess-SAS nil
 
102
(defgroup ess-sas nil
101
103
  "ESS: SAS."
102
104
  :group 'ess
103
105
  :prefix "ess-")
112
114
  :group 'ess
113
115
  :prefix "ess-")
114
116
 
115
 
(defgroup ess-XLS nil
 
117
(defgroup ess-OMG nil
116
118
  "ESS: Omegahat."
117
119
  :group 'ess
118
120
  :prefix "ess-")
124
126
 
125
127
;; Variables (not user-changeable)
126
128
 
127
 
(defcustom ess-version "5.1.20"
128
 
  "Version of ESS currently loaded."
129
 
  :group 'ess
130
 
  :type 'string)
 
129
(defvar ess-version "5.2.6"
 
130
  "Version of ESS currently loaded.")
131
131
 
132
132
(defvar no-doc
133
133
  "This function is part of ESS, but has not yet been loaded.
146
146
 
147
147
;;*;; Options and Initialization
148
148
 
149
 
(defcustom ess-use-menus (featurep 'imenu)
150
 
  "If t, use the menu system with an extra [Imenu] entry.
151
 
 Absolutely requires 'imenu."
152
 
  :group 'ess
153
 
  :type 'boolean)
 
149
;; Menus and pulldowns.
 
150
 
 
151
(defcustom ess-funcmenu-use-p (fboundp 'func-menu)
 
152
  "If t, funcmenu is present."
 
153
  :group 'ess
 
154
  :type  'boolean)
 
155
 
 
156
(defcustom ess-speedbar-use-p (fboundp 'speedbar)
 
157
  "If t, speedbar is present."
 
158
  :group 'ess
 
159
  :type  'boolean)
 
160
 
 
161
(defcustom ess-imenu-use-p (fboundp 'imenu)
 
162
  "Use imenu facility if it exists.
 
163
This value can be overridden by mode-specific variables, such
 
164
as `ess-imenu-use-S'."
 
165
  :group 'ess
 
166
  :type  'boolean)
 
167
 
 
168
;;
154
169
 
155
170
(defcustom ess-ask-for-ess-directory t
156
 
  "*If non-nil, the process directory will be requested each time S is run"
 
171
  "*If non-nil, the process directory will be requested each time S is run."
157
172
  :group 'ess
158
173
  :type 'boolean)
159
174
 
160
175
(defcustom ess-ask-about-transfile nil
161
 
  "*If non-nil, asks about a transcript file before running ess"
 
176
  "*If non-nil, asks about a transcript file before running ESS."
162
177
  :group 'ess
163
178
  :type 'boolean)
164
179
 
177
192
(make-variable-buffer-local 'ess-language)
178
193
(setq-default ess-language "Initial")
179
194
 
180
 
(defcustom ess-dialect nil
 
195
(defvar ess-dialect nil
181
196
  "String version of the dialect being run for the inferior process.
182
197
This, plus `ess-language', should be able to determine the exact
183
198
version of the statistical package being executed in the particular
184
199
buffer.
185
200
 
186
201
Current values could include:
187
 
for `ess-dialect' = S3, S4, S+3, S+4, S+5, S+6, R, XLS, SAS, STA
 
202
for `ess-dialect' = S3, S4, Sp3, Sp4, Sp5, Sp6, R, XLS, SAS, STA
188
203
 
189
 
Used to adjust for changes in versions of the program"
190
 
  :group 'ess
191
 
  :type '(choice (const :tag "None"   :value nil)
192
 
                 (const :tag "S3"     :value "S3")
193
 
                 (const :tag "Sp3"    :value "Sp3")
194
 
                 (const :tag "S4"     :value "S4")
195
 
                 (const :tag "Sp4"    :value "Sp4")
196
 
                 (const :tag "Sp5"    :value "Sp5")
197
 
                 (const :tag "Sp6"    :value "Sp6")
198
 
                 (const :tag "XLS"    :value "XLS")
199
 
                 (const :tag "SAS"    :value "SAS")
200
 
                 (const :tag "Runix"  :value "Runix")
201
 
                 (const :tag "Rwin"   :value "Rwin")))
 
204
Used to adjust for changes in versions of the program.")
202
205
 
203
206
(make-variable-buffer-local 'ess-dialect)
204
 
(setq-default ess-dialect "Initial-dialect")
 
207
;;(setq-default ess-dialect "Initial-dialect")
 
208
(setq-default ess-dialect nil)
 
209
;;; SJE -- why use "Initial-dialect"?  If we use nil, it matches "None"
 
210
;;; in the custom choice.
 
211
 
 
212
;; (defcustom ess-etc-directory
 
213
;;   (expand-file-name (concat ess-lisp-directory "/../etc/"))
 
214
;;   "*Location of the ESS etc/ directory.
 
215
;; The ESS etc directory stores various auxillary files that are useful
 
216
;; for ESS, such as icons."
 
217
;;   :group 'ess
 
218
;;   :type 'directory)
205
219
 
206
220
(defcustom ess-directory-function nil
207
221
  "*Function to return the directory that ESS is run from.
208
 
If nil or or if returns nil then you get `ess-directory'."
209
 
  :group 'ess
210
 
  :type 'directory)
 
222
If nil or if the function returns nil then you get `ess-directory'."
 
223
  :group 'ess
 
224
  :type '(choice (const nil) function))
 
225
 
 
226
(defcustom ess-setup-directory-function nil
 
227
  "*Function to setup the directory that ESS is run from.
 
228
This function can be called to set environment variables or to create
 
229
a workspace."
 
230
  :group 'ess
 
231
  :type '(choice (const nil) function))
211
232
 
212
233
(defcustom ess-directory nil
213
234
  "*The directory ESS is run from.  It must end in a slash.
216
237
Buffer-local: in process buffers, this contains the directory ESS was
217
238
run from."
218
239
  :group 'ess
219
 
  :type 'directory)
 
240
  :type '(choice (const nil) directory))
 
241
 
 
242
(defcustom ess-history-directory nil
 
243
  "*Directory to pick up `ess-history-file' from.
 
244
If this is nil, the history file is relative to `ess-directory'."
 
245
  :group 'ess
 
246
  :type '(choice (const nil) directory))
220
247
 
221
248
(defcustom ess-history-file nil
222
249
  "*File to pick up history from.
223
 
If this is a relative file name, it is relative to ess-directory."
 
250
If this is a relative file name, it is relative to `ess-history-directory'."
224
251
  :group 'ess
225
 
  :type 'file)
 
252
  :type '(choice (const nil) file))
226
253
 
227
254
(defcustom ess-plain-first-buffername t
228
255
  "*No fancy process buffname for the first process of each type (novice mode)."
231
258
 
232
259
(defcustom ess-S-assign " <- "
233
260
  "*String to be used for left assignment in all S dialects.
234
 
 Currently only activated by \\[ess-add-MM-keys]."
 
261
 Used by \\[ess-smart-underscore]."
235
262
  :group 'ess-S
236
263
  :type 'string)
237
264
 
245
272
  :group 'ess-edit
246
273
  :type 'boolean)
247
274
 
 
275
;;; SJE -- this is set in ess-site.el to be "always", so I changed
 
276
;;; value t to be "always", so that ess-site.el does not need editing.
 
277
;;; However, this is a bit messy, and would be nicer if ess-site.el
 
278
;;; value was t rather than "always".
248
279
(defcustom ess-keep-dump-files 'ask
249
280
  "*Variable controlling whether to delete dump files after a successful load.
250
281
If nil: always delete.  If `ask', confirm to delete.  If `check', confirm
251
282
to delete, except for files created with ess-dump-object-into-edit-buffer.
252
283
Anything else, never delete.  This variable only affects the behaviour
253
 
of ess-load-file.  Dump files are never deleted if an error occurs
 
284
of `ess-load-file'.  Dump files are never deleted if an error occurs
254
285
during the load. "
255
286
  :group 'ess-edit
256
287
  :type '(choice (const :tag "Check" :value  'check)
257
288
                 (const :tag "Ask"   :value  'ask)
258
 
                 (const :tag "Keep"   :value 't)))
 
289
                 (const :tag "Always keep"   :value "always")
 
290
                 (const :tag "Always delete"   :value nil)
 
291
                 ))
259
292
 
260
293
 
261
294
(defcustom ess-delete-dump-files nil
288
321
;;; From ess-mode:
289
322
 
290
323
(defcustom ess-mode-silently-save t
291
 
  "*If non-nil, automatically save ESS source buffers before loading"
 
324
  "*If non-nil, automatically save ESS source buffers before loading."
292
325
  :group 'ess-edit
293
326
  :type 'boolean)
294
327
 
310
343
 
311
344
;;;*;;; Indentation parameters
312
345
 
313
 
(defvar ess-auto-newline nil
 
346
(defcustom ess-auto-newline nil
314
347
  "*Non-nil means automatically newline before and after braces
315
 
inserted in S code.")
 
348
inserted in S code."
 
349
  :type 'boolean
 
350
  :group 'ess-edit)
316
351
 
317
 
(defvar ess-tab-always-indent t
 
352
(defcustom ess-tab-always-indent t
318
353
  "*Non-nil means TAB in S mode should always reindent the current line,
319
 
regardless of where in the line point is when the TAB command is used.")
320
 
 
321
 
(defvar ess-indent-level 2
322
 
  "*Indentation of S statements with respect to containing block.")
323
 
 
324
 
(defvar ess-brace-imaginary-offset 0
325
 
  "*Imagined indentation of an open brace following a statement.")
326
 
 
327
 
(defvar ess-brace-offset 0
 
354
regardless of where in the line point is when the TAB command is used."
 
355
  :type 'boolean
 
356
  :group 'ess-edit)
 
357
 
 
358
(defcustom ess-indent-level 2
 
359
  "*Indentation of S statements with respect to containing block."
 
360
  :type 'integer
 
361
  :group 'ess-edit)
 
362
 
 
363
(defcustom ess-brace-imaginary-offset 0
 
364
  "*Imagined indentation of an open brace following a statement."
 
365
  :type 'integer
 
366
  :group 'ess-edit)
 
367
 
 
368
(defcustom ess-brace-offset 0
328
369
  "*Extra indentation for open braces.
329
 
Compares with other text in same context.")
330
 
 
331
 
(defvar ess-continued-statement-offset 2
332
 
  "*Extra indent for lines not starting new statements.")
333
 
 
334
 
(defvar ess-continued-brace-offset 0
 
370
Compares with other text in same context."
 
371
  :type 'integer
 
372
  :group 'ess-edit)
 
373
 
 
374
(defcustom ess-continued-statement-offset 2
 
375
  "*Extra indent for lines not starting new statements."
 
376
  :type 'integer
 
377
  :group 'ess-edit)
 
378
 
 
379
(defcustom ess-continued-brace-offset 0
335
380
  "*Extra indent for substatements that start with open-braces.
336
 
This is in addition to ess-continued-statement-offset.")
 
381
This is in addition to ess-continued-statement-offset."
 
382
  :type 'integer
 
383
  :group 'ess-edit)
337
384
 
338
 
(defvar ess-arg-function-offset 2
 
385
(defcustom ess-arg-function-offset 2
339
386
  "*Extra indent for internal substatements of function `foo' that called
340
387
in `arg=foo(...)' form.
341
 
If not number, the statements are indented at open-parenthesis following foo.")
342
 
 
343
 
;;added rmh 2Nov97 at request of Terry Therneau
344
 
(defvar ess-close-brace-offset 0
345
 
  "*Extra indentation for closing braces.")
346
 
 
347
 
;;added rmh 2Nov97 at request of Terry Therneau
348
 
(defvar ess-fancy-comments t
349
 
  "*Non-nil means distiguish between #, ##, and ### for indentation.")
 
388
If not number, the statements are indented at open-parenthesis following foo."
 
389
  :type 'integer
 
390
  :group 'ess-edit)
 
391
 
 
392
;;added rmh 2Nov97 at request of Terry Therneau
 
393
(defcustom ess-close-brace-offset 0
 
394
  "*Extra indentation for closing braces."
 
395
  :type 'integer
 
396
  :group 'ess-edit)
 
397
 
 
398
;;added rmh 2Nov97 at request of Terry Therneau
 
399
(defcustom ess-fancy-comments t
 
400
  "*Non-nil means distiguish between #, ##, and ### for indentation."
 
401
  :type 'boolean
 
402
  :group 'ess-edit)
350
403
 
351
404
 
352
405
;; PeterDalgaard, 1Apr97 :
353
406
;;The default ess-else-offset should be 0, not 2 IMHO (try looking at
354
407
;;the ls() function, for instance).  Was 2.
355
 
(defvar ess-else-offset 0
356
 
  "*Extra indent for `else' lines.")
 
408
(defcustom ess-else-offset 0
 
409
  "*Extra indent for `else' lines."
 
410
  :type 'integer
 
411
  :group 'ess-edit)
357
412
 
358
 
(defvar ess-expression-offset 4
 
413
(defcustom ess-expression-offset 4
359
414
  "*Extra indent for internal substatements of `expression' that specified
360
415
in `obj <- expression(...)' form.
361
416
If not number, the statements are indented at open-parenthesis following
362
 
`expression'.")
 
417
`expression'."
 
418
  :type 'integer
 
419
  :group 'ess-edit)
363
420
 
364
421
;;;*;;; Editing styles
365
422
 
366
423
;;; **FIXME**  The following NEEDS to be customized.
367
 
 
 
424
;; SJE: I disagree; this variable should not be customized; individual vars,
 
425
;; such as ess-indent-level are already customizable.
368
426
(defvar ess-default-style-list
369
427
  (list 'DEFAULT
370
428
        (cons 'ess-indent-level ess-indent-level)
408
466
               (ess-expression-offset . 4)
409
467
               (ess-else-offset . 0)
410
468
               (ess-close-brace-offset . 0))
 
469
          ;; R added ajr 17Feb04 to match "common R" use
 
470
          (RRR (ess-indent-level . 4)
 
471
               (ess-continued-statement-offset . 4)
 
472
               (ess-brace-offset . 0)
 
473
               (ess-arg-function-offset . 4)
 
474
               (ess-expression-offset . 4)
 
475
               (ess-else-offset . 0)
 
476
               (ess-close-brace-offset . 0))
411
477
          ;; CLB added rmh 2Nov97 at request of Terry Therneau
412
478
          (CLB (ess-indent-level . 2)
413
479
               (ess-continued-statement-offset . 4)
416
482
               (ess-expression-offset . 4)
417
483
               (ess-else-offset . 0)
418
484
               (ess-close-brace-offset . 2))))
419
 
  "Predefined formatting styles for ess code")
 
485
  "Predefined formatting styles for ESS code.
 
486
Values for all groups, except DEFAULT, are fixed.
 
487
To change the value of variables in the DEFAULT group, change
 
488
the corresponding variables, e.g. `ess-indent-level'.
 
489
The default style in use is controlled by `ess-default-style'.")
420
490
 
421
 
(defvar ess-default-style 'DEFAULT
422
 
  "*The default value of `ess-style'.")
 
491
(defcustom ess-default-style 'DEFAULT
 
492
  "*The default value of `ess-style'.
 
493
See the variable `ess-style-alist' for how these groups (DEFAULT,
 
494
GNU, BSD, ...) map onto different settings for variables."
 
495
  :type '(choice (const DEFAULT)
 
496
                 (const GNU)
 
497
                 (const BSD)
 
498
                 (const K&R)
 
499
                 (const C++)
 
500
                 (const :tag "Common R" :value 'RRR)
 
501
                 (const CLB))
 
502
  :group 'ess-edit)
423
503
 
424
504
(defvar ess-style ess-default-style
425
505
  "*The buffer specific ESS indentation style.")
431
511
This can be a string (an absolute directory name ending in a slash) or
432
512
a lambda expression of no arguments which will return a suitable string
433
513
value.  The lambda expression is evaluated with the process buffer as the
434
 
current buffer."
 
514
current buffer.
 
515
 
 
516
Possible value:
 
517
 
 
518
 '(lambda () (file-name-as-directory
 
519
              (expand-file-name (concat (car ess-search-list) \"/.Src\"))))
 
520
 
 
521
This always dumps to a sub-directory (\".Src\") of the current ess
 
522
working directory (i.e. first elt of search list)."
435
523
  :group 'ess-edit
436
524
  :type 'directory)
437
525
 
438
 
;;; Possible value:
439
 
;;; '(lambda () (file-name-as-directory
440
 
;;;           (expand-file-name (concat (car ess-search-list) "/.Src"))))
441
 
;;; This always dumps to a sub-directory (".Src") of the current ess
442
 
;;; working directory (i.e. first elt of search list)
443
 
 
444
 
(defcustom ess-dump-filename-template (concat (user-login-name) ".%s.S")
445
 
  "*Template for filenames of dumped objects.
446
 
%s is replaced by the object name.
447
 
 
448
 
This gives filenames like `user.foofun.S', so as not to clash with
 
526
 
 
527
(defcustom ess-dump-filename-template-proto (concat (user-login-name) ".%s.S")
 
528
  "*Prototype template for filenames of dumped objects.
 
529
The ending `S' is replaced by the current \\[ess-suffix], to give
 
530
\\[ess-dump-filename-template] when an inferior ESS process starts.
 
531
 
 
532
By default, gives filenames like `user.foofun.S', so as not to clash with
449
533
other users if you are using a shared directory. Other alternatives:
450
534
\"%s.S\" ; Don't bother uniquifying if using your own directory(ies)
451
 
\"dump\" ; Always dump to a specific filename. This makes it impossible
 
535
\"dumpdir\"; Always dump to a specific filename. This makes it impossible
452
536
         to edit more than one object at a time, though.
453
537
(make-temp-name \"scr.\") ; Another way to uniquify"
 
538
  ;; MM: The last 3-4 lines above suck (I don't understand them) -- FIXME --
 
539
 
454
540
  :group 'ess-edit
455
541
  :type 'string)
456
542
 
 
543
 
457
544
;;*;; Hooks
458
545
 
459
546
(defcustom ess-mode-hook nil
479
566
  :type 'hook)
480
567
 
481
568
(defcustom inferior-ess-mode-hook nil
482
 
  "*Hook for customizing inferior ess mode.  Called after
 
569
  "*Hook for customizing inferior ESS mode.  Called after
483
570
`inferior-ess-mode' is entered and variables have been initialised."
484
571
  :group 'ess-hooks
485
572
  :type 'hook)
489
576
(put 'inferior-ess-mode 'mode-class 'special)
490
577
;; FIXME AJR: Should the above be there?  I don't think so!
491
578
;;       MM : the functionality should be, right? Move statement to ./ess.el ?
 
579
;;       AJR: No, we should move the statement to ./ess-inf.el
492
580
 
493
581
(defcustom ess-help-mode-hook nil
494
582
  "Functions to call when entering `ess-help-mode'. "
508
596
 ; System variables
509
597
 
510
598
(defcustom ess-local-process-name nil
511
 
  "The name of the ess process associated with the current buffer."
 
599
  "The name of the ESS process associated with the current buffer."
512
600
  :group 'ess
513
 
  :type 'string)
 
601
  :type '(choice (const nil) string))
514
602
 
515
603
(make-variable-buffer-local 'ess-local-process-name)
516
604
 
517
605
 
 
606
(defcustom ess-kermit-command "gkermit -T"
 
607
    "*Kermit command invoked by `ess-kermit-get' and `ess-kermit-send'."
 
608
    :group 'ess
 
609
    :type  'string
 
610
)
 
611
 
 
612
(defcustom ess-kermit-prefix "#"
 
613
    "*String files must begin with to use kermit file transfer."
 
614
    :group 'ess
 
615
    :type  'string
 
616
)
 
617
 
 
618
(defcustom ess-kermit-remote-directory "."
 
619
    "*Buffer local variable that designates remote directory of file."
 
620
    :group 'ess
 
621
    :type  'string
 
622
)
 
623
 
 
624
(make-variable-buffer-local 'ess-kermit-remote-directory)
 
625
 
518
626
;;*;; Regular expressions
519
627
 
520
628
;; FIXME : This is just for the S dialects;  need to define this for others,
521
629
;; -----
522
630
;;  {however  "XLS-mode" should just use standard lisp "beginning of function"}
523
 
(defcustom ess-function-pattern
524
 
  (concat
525
 
;;-    "\\(" ; EITHER
526
 
;;-    "\\s\"" ; quote
527
 
;;-    "\\(\\sw\\|\\s_\\)+" ; symbol
528
 
;;-    "\\s\"" ; quote
529
 
;;-    "\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*" ; whitespace, assign, whitespace/nl
530
 
;;-    "function\\s-*(" ; function keyword, parenthesis
531
 
;;-    "\\)\\|\\(" ; OR
532
 
;;-    "\\<\\(\\sw\\|\\s_\\)+" ; symbol
533
 
;;-    "\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*" ; whitespace, assign, whitespace/nl
534
 
;;-    "function\\s-*(" ; function keyword, parenthesis
535
 
;;-    "\\)")
536
 
   ;;----- new version by  "Stephen C. Pope" <scp@predict.com> :
 
631
 
 
632
(defcustom ess-R-function-pattern
 
633
  (concat
 
634
   "\\(\\(" ; EITHER
 
635
   "\\s\"" ; quote
 
636
   "\\(\\sw\\|\\s_\\)+\\(<-\\)?" ; symbol (replacement?)
 
637
   "\\s\"" ; quote
 
638
   "\\)\\|\\(" ; OR
 
639
   "\\(^\\|[ ]\\)" ; beginning of name
 
640
   "\\(\\sw\\|\\s_\\)+" ; symbol
 
641
   "\\)\\)" ; END EITHER OR
 
642
   "\\s-*\\(<-\\|=\\)" ; whitespace, assign, whitespace/nl
 
643
   "\\(\\(\\s-\\|\n\\)*\\s<.*\\s>\\)*" ; whitespace, comment
 
644
   "\\(\\s-\\|\n\\)*function\\s-*(" ; whitespace, function keyword, parenthesis
 
645
   )
 
646
  "The regular expression for matching the beginning of an R function."
 
647
  :group 'ess
 
648
  :type 'regexp)
 
649
 
 
650
(defcustom ess-S-function-pattern
 
651
  ;; the same as "R" - but allowing "_" in assign
 
652
  (concat
537
653
   "\\(\\(" ; EITHER
538
654
   "\\s\"" ; quote
539
655
   "\\(\\sw\\|\\s_\\)+\\(<-\\)?" ; symbol (replacement?)
552
668
  :group 'ess
553
669
  :type 'regexp)
554
670
 
 
671
 
555
672
;; Fixme: the following is just for S dialects :
556
673
(defcustom ess-dumped-missing-re
557
674
  "\\(<-\nDumped\n\\'\\)\\|\\(<-\\(\\s \\|\n\\)*\\'\\)"
568
685
  :type 'regexp)
569
686
 
570
687
;;;; This is tested for S dialects (actually only for R) -- be careful with it!
571
 
;;(defcustom ess-help-arg-regexp "\\(['\"]?\\)\\([^,=)'\"]*\\)\\1"
572
 
;;  "Reg(ular) Ex(pression) of help(.) arguments.  MUST: 2nd \\(.\\) = arg."
573
 
;;  :group 'ess
574
 
;;  :type  'regexp)
575
 
 
576
688
(defvar ess-help-arg-regexp "\\(['\"]?\\)\\([^,=)'\"]*\\)\\1"
577
689
  "Reg(ular) Ex(pression) of help(.) arguments.  MUST: 2nd \\(.\\) = arg.")
578
690
 
585
697
;; Keep a copy of your revised ess-site.el to use as a starting point
586
698
;; for upgrades of ESS.
587
699
 
588
 
(defvar inferior-R-program-name
 
700
(defcustom inferior-ess-own-frame nil
 
701
  "*Non-nil means that inferior ESS buffers should start in their own frame.
 
702
The parameters of this frame are stored in `inferior-ess-frame-alist'."
 
703
  :group 'ess-proc
 
704
  :type 'boolean)
 
705
 
 
706
(defcustom inferior-ess-frame-alist default-frame-alist
 
707
  "*Alist of frame parameters used to create new frames for iESS buffers.
 
708
This defaults to `default-frame-alist' and is used only when
 
709
the variable `inferior-ess-own-frame' is non-nil."
 
710
  :group 'ess-proc
 
711
  :type 'alist)
 
712
 
 
713
(defcustom inferior-ess-same-window t
 
714
  "*Non-nil indicates new inferior ESS process appears in current window.
 
715
Otherwise, the new inferior ESS buffer is shown in another window in the
 
716
current frame.  This variable is ignored if `inferior-ess-own-frame' is
 
717
non-nil."
 
718
  :group 'ess-proc
 
719
  :type 'boolean)
 
720
 
 
721
(defcustom inferior-R-program-name
589
722
  (if ess-microsoft-p "Rterm"  "R")
590
 
  "*Program name for invoking an inferior ESS with \\[R].")
591
 
 
 
723
  "*Program name for invoking an inferior ESS with \\[R]."
 
724
  :group 'ess-R
 
725
  :type 'string)
 
726
 
 
727
(defcustom inferior-R-args ""
 
728
  "*String of arguments used when starting R.
 
729
These arguments are currently not passed to other versions of R that have
 
730
been created using the variable `ess-r-versions'."
 
731
  :group 'ess-R
 
732
  :type 'string)
 
733
 
 
734
(defcustom inferior-R-objects-command "objects(pos=%d, all.names=TRUE)\n"
 
735
  "Format string for R command to get a list of objects at position %d.
 
736
Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
 
737
  :group 'ess-command
 
738
  :type 'string)
 
739
 
 
740
(defcustom ess-r-versions '( "R-1" "R-2")
 
741
  "*List of partial strings for versions of R to access within ESS.
 
742
Each string specifies the start of a filename.  If a filename
 
743
beginning with one of these strings is found on `exec-path', a M-x
 
744
command for that version of R is made available.  For example, if the
 
745
file \"R-1.8.1\" is found and this variable includes the string
 
746
\"R-1\", a function called `M-x R-1.8.1' will be available to run that
 
747
version of R.
 
748
If duplicate versions of the same program are found (which happens if
 
749
the same path is listed on `exec-path' more than once), they are
 
750
ignored by calling `ess-uniq-list'."
 
751
  :group 'ess-R
 
752
  :type '(repeat string))
 
753
 
 
754
 
 
755
(defcustom ess-rterm-versions nil
 
756
"*Construct ess-rterm-versions.  If you have versions of R in
 
757
locations other than in ../../rw*/bin/Rterm.exe, relative to the
 
758
directory in the `exec-path' variable containing your default location
 
759
of Rterm, you will need to redefine this variable with a
 
760
`custom-set-variables' statement in your site-start.el or .emacs
 
761
file."
 
762
  :group 'ess-R
 
763
  :type '(repeat string))
 
764
 
 
765
(defcustom ess-SHOME-versions
 
766
  '("c:/progra~1/Insightful/splus62"
 
767
    "c:/progra~1/Insightful/splus61"
 
768
    "c:/progra~1/MathSoft/splus6"
 
769
    "c:/progra~1/spls45se"
 
770
    "c:/progra~1/Insightful/splus62netclient"
 
771
    "c:/progra~1/Insightful/splus62net/server"
 
772
    "c:/progra~1/Insightful/splus61netclient"
 
773
    "c:/progra~1/Insightful/splus61net/server"
 
774
    "c:/progra~1/Insightful/splus6se"
 
775
    "c:/progra~1/Insightful/splus61se"
 
776
    "c:/progra~1/Insightful/splus62se"
 
777
    "c:/progra~1/Insightful/splus70"
 
778
    "c:/progra~1/Insightful/splus71")
 
779
  "*List of possible values of the environment variable SHOME for recent
 
780
releases of S-Plus.  These are the default locations for several
 
781
current and recent releases of S-Plus.  If any of these pathnames
 
782
correspond to a directory on your machine, running the function
 
783
`ess-sqpe-versions-create' will create a function, for example, `M-x
 
784
splus62', that will start the corresponding version Sqpe inside an
 
785
emacs buffer in iESS[S] mode.  If you have versions of S-Plus in
 
786
locations other than these default values, redefine this variable with
 
787
a `custom-set-variables' statement in your site-start.el or .emacs
 
788
file.  The list of functions actually created appears in the *ESS*
 
789
buffer and should appear in the \"ESS / Start Process / Other\"
 
790
menu."
 
791
  :group 'ess-S
 
792
  :type '(repeat string))
592
793
 
593
794
(defcustom inferior-S3-program-name "/disk05/s/S"
594
795
  "*Program name for invoking an inferior ESS with S3()."
627
828
  :group 'ess-S
628
829
  :type 'string)
629
830
 
630
 
(defcustom inferior-Sqpe+4-SHOME-name 
631
 
  (if ess-microsoft-p "c:/progra~1/spls45se" nil)
 
831
;;; SJE - avoid mismatch by changing default nil to ""
 
832
(defcustom inferior-Sqpe+4-SHOME-name
 
833
  (if ess-microsoft-p "c:/progra~1/spls45se" "")
632
834
  "*SHOME name for invoking an inferior ESS with Sqpe+4().
633
835
The default value is correct for a default installation of
634
836
S-Plus 4.5 Student Edition.  For any other version or location,
690
892
    :group 'ess-S
691
893
    :type 'string))
692
894
 
 
895
(defcustom inferior-Splus-args ""
 
896
  "*String of arguments used when starting S.
 
897
These arguments are currently passed only to S+6."
 
898
  :group 'ess-S
 
899
  :type 'string)
 
900
 
 
901
(defcustom inferior-Splus-objects-command "objects(where=%d)\n"
 
902
  "Format string for R command to get a list of objects at position %d.
 
903
Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
 
904
  :group 'ess-command
 
905
  :type 'string)
 
906
 
693
907
(defcustom inferior-S+6-print-command "S_PRINT_COMMAND=gnuclientw.exe"
694
908
  "*Destination of print icon in S+6 for Windows Commands window."
695
909
  :group 'ess-S
708
922
  :group 'ess-S
709
923
  :type 'string)
710
924
 
 
925
;;; SJE - avoid mismatch by changing default nil to ""
711
926
(defcustom inferior-Sqpe+6-SHOME-name
712
 
  (if ess-microsoft-p "c:/progra~1/insigh~1/splus6" nil)
 
927
  (if ess-microsoft-p "c:/progra~1/insigh~1/splus6" "")
713
928
  "*SHOME name for invoking an inferior ESS with Sqpe+6() for Windows.
714
929
The default value is correct for a default installation of
715
930
S-Plus 6.0.3 Release 2.  For any other version or location,
733
948
;;              (setq SHOME (expand-file-name (concat pathname "/../..")))))))
734
949
;;      (setq-default inferior-Sqpe+6-SHOME-name SHOME)))
735
950
 
 
951
(defcustom ess-S-quit-kill-buffers-p nil
 
952
  "Controls whether S buffers should also be killed once a process is killed.
 
953
This is used only when an iESS process is killed using C-c C-q.
 
954
Possible values:
 
955
nil - do not kill any S buffers associated with the process.
 
956
t - kill S buffers associated with the process.
 
957
ask - ask the user whether the S buffers should be killed."
 
958
  :group 'ess-S
 
959
  :type '(choice (const nil) (const t) (const ask)))
 
960
 
736
961
(defcustom inferior-XLS-program-name "xlispstat"
737
962
  "*Program name for invoking an inferior ESS with \\[XLS]."
738
963
  :group 'ess-XLS
750
975
 
751
976
(defcustom inferior-SAS-program-name "sas"
752
977
  "*Program name for invoking an inferior ESS with SAS()."
753
 
  :group 'ess-SAS
 
978
  :group 'ess-sas
754
979
  :type 'string)
755
980
 
756
981
(defcustom inferior-STA-program-name "env"
774
999
;;; ess-editor and ess-pager,
775
1000
;;; and inferior-ess-language-start
776
1001
;;; apply in principle to the 15 files essd[s-]*.el
777
 
;;; Several of the files (essd-sp4.el and essdsp6w.el) have more
 
1002
;;; Several of the files (essd-sp4.el and essd-sp6w.el) have more
778
1003
;;; than one *-customize-alist.
779
1004
;;; These variables are currently used only with the S language files for
780
1005
;;; S S-Plus R.
781
1006
 
782
 
(defcustom R-editor 
 
1007
(defcustom R-editor
783
1008
  (if ess-microsoft-p "gnuclient.exe"
784
1009
    (if (equal system-type 'Apple-Macintosh) nil
785
 
      "emacslient")) ;; unix
 
1010
      (if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
786
1011
  "*Editor called by R process with 'edit()' command."
787
 
:group 'ess
788
 
:type "string")
 
1012
  :group 'ess
 
1013
  :type 'string)
789
1014
 
790
 
(defcustom R-pager  nil ; Usually nil is correct as ESS and page() cooperate.
 
1015
(defcustom R-pager 'nil ; Usually nil is correct as ESS and page() cooperate.
791
1016
  "*Pager called by R process with 'page()' command."
792
 
:group 'ess
793
 
:type "string")
 
1017
  :group 'ess
 
1018
  :type '(choice (const nil) string))
794
1019
 
795
1020
(defcustom S-editor
796
1021
  (if ess-microsoft-p "gnuclient.exe"
797
1022
    (if (equal system-type 'Apple-Macintosh) nil
798
 
      "emacslient")) ;; unix
 
1023
      (if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
799
1024
  "*Editor called by S process with 'edit()' command."
800
 
:group 'ess
801
 
:type "string")
 
1025
  :group 'ess
 
1026
  :type 'string)
802
1027
 
803
1028
(defcustom S-pager
804
1029
  (if ess-microsoft-p "gnuclientw.exe"
805
1030
    (if (equal system-type 'Apple-Macintosh) nil
806
 
      "emacslient")) ;; unix
 
1031
      (if (featurep 'xemacs) "gnuclient -q" "emacsclient")))
807
1032
  "*Pager called by S process with 'page()' command."
808
 
:group 'ess
809
 
:type "string")
 
1033
  ;; Change made to provide a better help(function) experience with
 
1034
  ;; S+6 and xemacs
 
1035
  ;; gnuclient -q will open a buffer with an HTML help file
 
1036
  ;; you can view it with M-x browse-url-of-buffer
 
1037
  :group 'ess
 
1038
  :type 'string)
810
1039
 
811
 
(defcustom ess-editor nil
 
1040
(defvar ess-editor nil
812
1041
  "*Editor by which the process sends information to an emacs buffer
813
 
for editing and then to be returned to the process."
814
 
  :group 'ess-proc
815
 
  :type 'string)
816
 
 
817
 
(defcustom ess-pager nil
818
 
  "*Pager by which the process sends information to an emacs buffer."
819
 
  :group 'ess-proc
820
 
  :type 'string)
821
 
 
822
 
(defcustom inferior-ess-language-start nil
823
 
  "*Initialization commands sent to the ess process."
824
 
  :group 'ess-proc
825
 
  :type 'string)
 
1042
for editing and then to be returned to the process.")
 
1043
 
 
1044
(defvar ess-pager nil
 
1045
  "*Pager by which the process sends information to an emacs buffer.")
 
1046
 
 
1047
(defvar inferior-ess-language-start nil
 
1048
  "*Initialization commands sent to the ESS process.")
826
1049
 
827
1050
(make-variable-buffer-local 'ess-editor)
828
1051
(make-variable-buffer-local 'ess-pager)
847
1070
(make-variable-buffer-local 'inferior-ess-client-name)
848
1071
 
849
1072
(defcustom inferior-ess-client-command nil
850
 
  "*ddeclient command sent to the ESS program")
 
1073
  "*ddeclient command sent to the ESS program."
 
1074
  :group 'ess-proc
 
1075
  :type '(choice (const nil) string))
851
1076
 
852
1077
(make-variable-buffer-local 'inferior-ess-client-command)
853
1078
 
854
1079
;;;;; user settable defaults
855
1080
(defvar inferior-S-program-name  inferior-S+3-program-name
856
1081
  "*Program name for invoking an inferior ESS with S().")
 
1082
;;- (setq inferior-S-program
 
1083
;;-       (cond ((string= S-proc-prefix "S") "Splus")
 
1084
;;-         ((string= S-proc-prefix "R") "R")
 
1085
;;-         (t "S")
 
1086
;;-         ))
 
1087
;;(make-local-variable 'inferior-S-program)
857
1088
 
858
1089
(defvar inferior-ess-program nil ;inferior-S-program-name
859
1090
  "*Default program name for invoking inferior-ess().
860
1091
The other variables ...-program-name should be changed, for the
861
1092
corresponding program.")
862
1093
 
863
 
;;(make-local-variable 'inferior-S-program)
864
1094
(make-variable-buffer-local 'inferior-ess-program)
865
1095
(setq-default inferior-ess-program inferior-S-program-name)
866
 
;;- (setq inferior-S-program
867
 
;;-       (cond ((string= S-proc-prefix "S") "Splus")
868
 
;;-         ((string= S-proc-prefix "R") "R")
869
 
;;-         (t "S")
870
 
;;-         ))
871
 
 
872
 
 
873
 
(defcustom inferior-ess-start-args ""
874
 
  "*String of arguments passed to the ESS process.
875
 
Useful for R and SAS.  This is generic."
876
 
  :group 'ess-proc
877
 
  :type 'string)
 
1096
 
 
1097
 
 
1098
(defvar inferior-ess-start-args ""
 
1099
  "String of arguments passed to the ESS process.
 
1100
If you wish to pass arguments to a process, see e.g. `inferior-R-args'.")
878
1101
 
879
1102
(defcustom inferior-ess-start-file nil
880
1103
  "*File dumped into process, if non-nil."
881
1104
  :group 'ess-proc
882
 
  :type 'file)
 
1105
  :type '(choice (const nil) file))
883
1106
 
884
1107
(defcustom inferior-ess-pager "cat"
885
1108
  "*Pager to use for reporting help files and similar things."
922
1145
  :type 'boolean)
923
1146
 
924
1147
(defcustom ess-synchronize-evals nil
925
 
  "*If t, then all evaluations will synchronize with the ess process. This
 
1148
  "*If t, then all evaluations will synchronize with the ESS process. This
926
1149
means ess-mode will wait for S to dent a prompt before sending the next
927
1150
line of code. This allows users of Emacs version 18.57 or less to
928
1151
evaluate large regions of code without causing an error.  Users of newer
937
1160
  :group 'ess-proc
938
1161
  :type 'boolean)
939
1162
 
940
 
(defcustom ess-save-lastvalue-command nil
941
 
  "Default depends on the ESS language/dialect.
942
 
 
943
 
This is the command to save the last value.  See S section for more details.
944
 
 
945
 
Might have to:"
946
 
;;(make-variable-buffer-local 'ess-save-lastvalue-command)
947
 
;;(setq-default ess-save-lastvalue-command
948
 
;;            "assign(\"smode.lvsave\",.Last.value,frame=0)\n")
949
 
  :group 'ess-command
950
 
  :type 'string)
951
 
 
952
 
(defcustom ess-retr-lastvalue-command nil
953
 
  "Default is currently the S+ version."
954
 
  :group 'ess-command
955
 
  :type 'string)
956
 
 
957
 
;;(make-variable-buffer-local 'ess-retr-lastvalue-command)
958
 
;;(setq-default ess-retr-lastvalue-command
959
 
;;            ".Last.value <- get(\"smode.lvsave\",frame=0)\n")
960
 
 
961
1163
 ; System variables
962
1164
 
963
1165
;;*;; Variables relating to multiple processes
965
1167
(defcustom ess-current-process-name nil
966
1168
  "Name of the current S process."
967
1169
  :group 'ess-proc
968
 
  :type 'string)
 
1170
  :type '(choice (const nil) string))
969
1171
 
970
1172
;; defconst ess-local-process-name now done in S.el
971
1173
 
972
1174
(defcustom ess-process-name-list nil
973
 
  "Alist of active ess processes.")
 
1175
  "Alist of active ESS processes.")
974
1176
 
975
 
;;*;; Inferior ess commands
 
1177
;;*;; Inferior ESS commands
976
1178
 
977
1179
(defcustom inferior-ess-load-command "source(\"%s\")\n"
978
1180
  "Format-string for building the ess command to load a file.
979
1181
 
980
1182
This format string should use %s to substitute a file name and should
981
 
result in an ess expression that will command the inferior ess to load
 
1183
result in an ESS expression that will command the inferior ESS to load
982
1184
that file."
983
1185
  :group 'ess-command
984
1186
  :type 'string)
992
1194
  :type 'string)
993
1195
 
994
1196
(defcustom inferior-ess-help-command "help(\"%s\")\n"
995
 
  "Format-string for building the ess command to ask for help on an object.
 
1197
  "Format-string for building the ESS command to ask for help on an object.
996
1198
 
997
1199
This format string should use %s to substitute an object name."
998
1200
  :group 'ess-command
1006
1208
 
1007
1209
This format string should use %s to substitute an object name."
1008
1210
  :group 'ess-command
1009
 
  :type 'ess-string)
 
1211
  :type 'string)
1010
1212
 
1011
1213
(make-variable-buffer-local 'inferior-ess-exit-command)
1012
1214
(setq-default inferior-ess-exit-command "q()\n")
1013
1215
 
1014
 
(defcustom inferior-ess-search-list-command "search()\n"
 
1216
(defvar inferior-ess-search-list-command nil
1015
1217
  "`ess-language' command that prints out the search list;
1016
1218
i.e. the list of directories and (recursive) objects that `ess-language' uses
1017
1219
when it searches for objects.
1018
1220
 
1019
 
Really set in <ess-lang>-customize-alist in ess[dl]-*.el"
1020
 
  :group 'ess-command
1021
 
  :type 'string)
1022
 
 
 
1221
Really set in <ess-lang>-customize-alist in ess[dl]-*.el")
 
1222
;; and hence made buffer-local via that scheme...
1023
1223
 
1024
1224
(defcustom inferior-ess-names-command "names(%s)\n"
1025
 
  "Format string for ess command to extract names from an object.
 
1225
  "Format string for ESS command to extract names from an object.
1026
1226
 
1027
1227
%s is replaced by the object name -- usually a list or data frame."
1028
1228
  :group 'ess-command
1029
1229
  :type 'string)
1030
1230
 
1031
 
(defcustom inferior-ess-objects-command "ls()\n" ;; others: in (S) or (R)
1032
 
  "Format string for ess command to get a list of objects at position %d
1033
 
 
1034
 
Don't include a newline at the end! Used in ess-execute-objects."
1035
 
  :group 'ess-command
1036
 
  :type 'string)
1037
 
 
1038
 
(make-variable-buffer-local 'inferior-ess-objects-command)
1039
 
(setq-default inferior-ess-objects-command "ls()\n")
1040
 
 
1041
1231
(defcustom inferior-ess-get-prompt-command "options()$prompt\n"
1042
1232
  "Command to find the value of the current S prompt."
1043
1233
  :group 'ess-command
1044
1234
  :type 'string)
1045
1235
 
 
1236
(defvar ess-cmd-delay nil
 
1237
  "*Set to a positive number if ESS will include delays proportional to
 
1238
`ess-cmd-delay'  in some places. These delays are introduced to
 
1239
prevent timeouts in certain processes, such as completion.")
 
1240
(make-variable-buffer-local 'ess-cmd-delay)
 
1241
 
 
1242
(defcustom ess-R-cmd-delay nil
 
1243
  "used to initialize `ess-cmd-delay'."
 
1244
  :group 'ess-command
 
1245
  :type '(choice (const nil) number))
 
1246
 
 
1247
(defcustom ess-S+-cmd-delay 1.0
 
1248
  "used to initialize `ess-cmd-delay'."
 
1249
  :group 'ess-command
 
1250
  :type '(choice (const nil) number))
 
1251
 
1046
1252
;;*;; Regular expressions
1047
1253
 
1048
 
(defcustom inferior-ess-prompt nil
 
1254
(defvar inferior-ess-prompt nil
1049
1255
  "The regular expression inferior ess mode uses for recognizing prompts.
1050
1256
 Constructed at run time from `inferior-ess-primary-prompt' and
1051
 
`inferior-ess-secondary-prompt'."
1052
 
  :group 'ess-proc
1053
 
  :type 'string)
 
1257
`inferior-ess-secondary-prompt' within `inferior-ess-mode'.")
1054
1258
 
1055
1259
(make-variable-buffer-local 'inferior-ess-prompt)
1056
1260
 
1057
 
(defcustom ess-change-sp-regexp
1058
 
  "\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|require(\\|source(\\)"
1059
 
  "The regexp for matching the ess commands that change the search path."
1060
 
  :group 'ess-proc
1061
 
  :type 'regexp)
 
1261
(defvar ess-change-sp-regexp ""
 
1262
  "The regexp for matching the S/R/.. commands that change the search path.")
 
1263
(make-variable-buffer-local 'ess-change-sp-regexp)
 
1264
 
 
1265
(defcustom ess-S+-change-sp-regexp
 
1266
  "\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|module(\\|source(\\)"
 
1267
  "The regexp for matching the S-plus commands that change the search path."
 
1268
  :group 'ess-proc
 
1269
  :type 'regexp)
 
1270
 
 
1271
(defcustom ess-S-change-sp-regexp
 
1272
  "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)"
 
1273
  "The regexp for matching the S commands that change the search path."
 
1274
  :group 'ess-proc
 
1275
  :type 'regexp)
 
1276
 
 
1277
(defcustom ess-R-change-sp-regexp
 
1278
  "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)"
 
1279
  "The regexp for matching the R commands that change the search path."
 
1280
  :group 'ess-proc
 
1281
  :type 'regexp)
 
1282
 
1062
1283
 
1063
1284
;;*;; Process-dependent variables
1064
1285
 
1065
1286
(defvar ess-search-list nil
1066
 
  "Cache of list of directories and objects to search for ess objects.")
 
1287
  "Cache of list of directories and objects to search for ESS objects.")
1067
1288
 
1068
1289
(make-variable-buffer-local 'ess-search-list)
1069
1290
 
1109
1330
 
1110
1331
(defvar ess-mode-minibuffer-map nil)
1111
1332
 
1112
 
(defcustom ess-object-name-db-file "ess-namedb"
1113
 
  "File containing definitions for `ess-object-name-db'."
1114
 
  :group 'ess
1115
 
  :type 'file)
 
1333
;; SJE: Wed 29 Dec 2004 - following 3 ess-object* variables can be removed
 
1334
;; soon if no-one needs the completion code.
 
1335
(defvar ess-object-name-db-file "ess-namedb"
 
1336
  "File containing definitions for `ess-object-name-db'.")
1116
1337
 
1117
1338
(defvar ess-object-name-db-file-loaded '()
1118
1339
  "List of programs whose name-db file has been loaded.")
1125
1346
(make-variable-buffer-local 'ess-object-name-db)
1126
1347
(setq-default ess-object-name-db nil)
1127
1348
 
1128
 
(defcustom ess-loop-timeout 500000
1129
 
  "Integer specifying how many loops ess-mode will wait for the prompt
1130
 
before signaling an error.   This is important for S-PLUS and R, not so
1131
 
important for XLispStat.  Increase this, if you have a fast(er) machine."
1132
 
  :group 'ess-proc
1133
 
  :type 'integer)
1134
 
 
1135
 
(make-variable-buffer-local 'ess-loop-timeout)
1136
 
;;all dialects set this in their alist: (setq-default ess-loop-timeout 500000)
 
1349
(defcustom ess-S-loop-timeout 2000000
 
1350
  "Integer specifying how many loops ess-mode will wait for the prompt
 
1351
before signaling an error. Will be set to `ess-loop-timeout' in the S dialects'
 
1352
alists.  Increase this, if you have a fast(er) machine."
 
1353
  :group 'ess-proc
 
1354
  :type 'integer)
 
1355
 
 
1356
(defcustom ess-XLS-loop-timeout 50000
 
1357
  "Integer specifying how many loops ess-mode will wait for the prompt
 
1358
before signaling an error. Will be set to `ess-loop-timeout' in the XLispStat
 
1359
dialects' alists.  Increase this, if you have a fast(er) machine."
 
1360
  :group 'ess-proc
 
1361
  :type 'integer)
 
1362
 
 
1363
;; NOTA BENE: Other languages/dialect currently set `ess-loop-timeout'
 
1364
;;            **directly** in their essd-*.el alist !!
1137
1365
 
1138
1366
;;;*;;; Font-lock support
1139
1367
 
1145
1373
  :group 'ess
1146
1374
  :type 'boolean)
1147
1375
 
1148
 
(defvar ess-mode-font-lock-keywords
1149
 
  '(("<<-\\|<-\\|_\\|->"
1150
 
     . font-lock-reference-face)
1151
 
    ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>"
1152
 
     . font-lock-type-face)
1153
 
    ("\\<\\(library\\|attach\\|detach\\|source\\)\\>"
1154
 
     . font-lock-reference-face)
1155
 
    ("\\<\\(while\\|for\\|in\\|repeat\\|if\\|else\\|switch\\|break\\|next\\|return\\|stop\\|warning\\|function\\)\\>"
1156
 
     . font-lock-keyword-face)
1157
 
    ("\\s\"?\\(\\(\\sw\\|\\s_\\)+\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*function"
1158
 
     1 font-lock-function-name-face t))
1159
 
  "Font-lock patterns used in `ess-mode' buffers.")
1160
 
 
1161
 
(defvar inferior-ess-font-lock-keywords
1162
 
  '(("<<-\\|<-\\|_\\|->"
1163
 
     . font-lock-reference-face)                ; assign
1164
 
    ("^\\*\\*\\*.*\\*\\*\\*\\s *$"
1165
 
     . font-lock-comment-face) ; ess-mode msg
1166
 
    ("\\[,?[1-9][0-9]*,?\\]"
1167
 
     . font-lock-reference-face)        ; Vector/matrix labels
1168
 
    ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>"
1169
 
     . font-lock-type-face) ; keywords
1170
 
    ("\\<\\(library\\|attach\\|detach\\|source\\)\\>"
1171
 
     . font-lock-reference-face) ; modify search list or source new definitions
1172
 
    ("^Syntax error:"
1173
 
     . font-lock-reference-face);inferior-ess problems or errors
1174
 
    ("^Error:"
1175
 
     . font-lock-reference-face)
1176
 
    ("^Error in"
1177
 
     . font-lock-reference-face)
1178
 
    ("^Dumped"
1179
 
     . font-lock-reference-face)
1180
 
    ("^Warning messages:"
1181
 
     . font-lock-reference-face)
1182
 
    ("#"
1183
 
     . font-lock-comment-face) ; comment
1184
 
    ("^[^#]*#\\(.*$\\)"
1185
 
     (1 font-lock-comment-face keep t)) ; comments
1186
 
    ("\\s\"?\\(\\(\\sw\\|\\s_\\)+\\)\\s\"?\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*function"
1187
 
     1 font-lock-function-name-face t) ; function name
1188
 
    ("\\<\\(while\\|for\\|in\\|repeat\\|if\\|else\\|switch\\|break\\|next\\|return\\|stop\\|warning\\|function\\)\\>"
1189
 
     . font-lock-keyword-face) ; keywords
1190
 
    )
1191
 
  "Font-lock patterns used in inferior-ess-mode buffers.")
1192
 
 
1193
 
;; add-to-list() places keywords in front of the previous keywords
1194
 
;; input and prompt must appear in inferior-ess-font-lock-keywords
1195
 
;; in the order  prompt error, hence they appear here in the reverse
1196
 
;; order.
1197
 
 
1198
 
(if (not inferior-ess-font-lock-input)
1199
 
    (add-to-list 'inferior-ess-font-lock-keywords
1200
 
                 '("^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1201
 
                   (1 font-lock-variable-name-face keep t));don't font-lock input
1202
 
                 ))
1203
 
(add-to-list 'inferior-ess-font-lock-keywords
1204
 
             '("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face))  ; prompt
1205
 
 
1206
 
(defvar ess-trans-font-lock-keywords
1207
 
 inferior-ess-font-lock-keywords
1208
 
 "Font-lock patterns used in `ess-transcript-mode' buffers.")
1209
 
 
1210
 
;;
1211
 
;;(defvar ess-mode-font-lock-keywords
1212
 
;; '(("\\s\"?\\(\\(\\sw\\|\\s_\\)+\\)\\s\"?\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*function" 1 font-lock-function-name-face t)
1213
 
;;   ("<<?-\\|_" . font-lock-reference-face)
1214
 
;;   ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>" . font-lock-type-face)
1215
 
;;   ("\\<\\(library\\|attach\\|detach\\|source\\)\\>" . font-lock-reference-face)
1216
 
;;   "\\<\\(while\\|for\\|in\\|repeat\\|if\\|else\\|switch\\|break\\|next\\|return\\|stop\\|warning\\|function\\)\\>")
1217
 
;; "Font-lock patterns used in ess-mode bufffers.")
1218
 
;;
1219
 
;;(defvar essd-S-inferior-font-lock-keywords
1220
 
;; '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)    ; prompt
1221
 
;;   ("^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1222
 
;;    (1 font-lock-variable-name-face keep t)) ; input
1223
 
;;   ("<-\\|_" . font-lock-reference-face)              ; assign
1224
 
;;   ("^\\*\\*\\\*.*\\*\\*\\*\\s *$" . font-lock-comment-face) ; ess-mode msg
1225
 
;;   ("\\[,?[1-9][0-9]*,?\\]" . font-lock-reference-face)       ; Vector/matrix labels
1226
 
;;   ("^Syntax error:" . font-lock-reference-face) ; error message
1227
 
;;   ("^Error:" . font-lock-reference-face) ; error message
1228
 
;;   ("^Error in" . font-lock-reference-face) ; error message
1229
 
;;   ("^Dumped" . font-lock-reference-face) ; error message
1230
 
;;   ("^Warning:" . font-lock-reference-face) ; warning message
1231
 
;;   ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>"
1232
 
;;    . font-lock-type-face)) ; keywords
1233
 
;; "Font-lock patterns for dialects of S, used in highlighting process
1234
 
;; buffers and transcripts.")
1235
 
;;
1236
 
;;(defvar inferior-ess-font-lock-keywords
1237
 
;;  essd-S-inferior-font-lock-keywords
1238
 
;; "Font-lock patterns used in inferior-ess-mode buffers.")
1239
 
;;
1240
 
;;(defvar ess-trans-font-lock-keywords
1241
 
;;  essd-S-inferior-font-lock-keywords
1242
 
;; "Font-lock patterns used in ess-transcript-mode buffers.")
 
1376
(defvar ess-R-constants
 
1377
  '("TRUE" "FALSE" "NA" "NULL" "Inf" "NaN"))
 
1378
 
 
1379
(defvar ess-S-constants
 
1380
  (append ess-R-constants '("T" "F")))
 
1381
 
 
1382
;; first the common ones
 
1383
(defvar ess-S-modifyiers
 
1384
  '("library" "attach" "detach" "source" "module"))
 
1385
(defvar ess-R-modifyiers
 
1386
  '("library" "attach" "detach" "source" "require"))
 
1387
 
 
1388
(defvar ess-R-keywords
 
1389
  '("while" "for" "in" "repeat" "if" "else" "switch" "break" "next"
 
1390
    "function" "return" "message" "warning" "stop"))
 
1391
(defvar ess-S-keywords
 
1392
  (append ess-R-keywords '("terminate")))
 
1393
 
 
1394
(defvar ess-R-message-prefixes
 
1395
  '("Error:" "Error in"
 
1396
    "Warning:" "Warning in"
 
1397
    "Warning messages?"))
 
1398
(defvar ess-S-message-prefixes
 
1399
  (append ess-R-message-prefixes
 
1400
          '("Syntax error:" "Dumped")))
 
1401
 
 
1402
;;
 
1403
(defvar ess-R-assign-ops
 
1404
  '("<<-" "<-" "->") ; don't want "=" here which is not only for assign
 
1405
)
 
1406
(defvar ess-S-assign-ops
 
1407
  '("<<-" "<-" "_" "->") ; don't want "=" here which is not only for assign
 
1408
)
 
1409
 
 
1410
(defvar ess-R-function-name-regexp
 
1411
  (concat "\\s\"?\\(\\(\\sw\\|\\s_\\)+"
 
1412
          "\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\)"
 
1413
          "\\(\\s-\\|\n\\)*function")
 
1414
)
 
1415
(defvar ess-S-function-name-regexp
 
1416
  ess-R-function-name-regexp ; since "_" is deprecated for S-plus as well
 
1417
)
 
1418
 
 
1419
 
 
1420
(defvar ess-R-mode-font-lock-keywords
 
1421
  (list
 
1422
   (cons (regexp-opt ess-R-assign-ops)
 
1423
         'font-lock-reference-face)     ; assign
 
1424
   (cons (concat "\\<" (regexp-opt ess-R-constants 'enc-paren) "\\>")
 
1425
         'font-lock-type-face)          ; constants
 
1426
   (cons (concat "\\<" (regexp-opt ess-R-modifyiers 'enc-paren) "\\>")
 
1427
         'font-lock-reference-face)     ; modify search list or source
 
1428
                                        ; new definitions
 
1429
   (cons (concat "\\<" (regexp-opt ess-R-keywords 'enc-paren) "\\>")
 
1430
         'font-lock-keyword-face)       ; keywords
 
1431
   (cons ess-R-function-name-regexp
 
1432
         '(1 font-lock-function-name-face t))
 
1433
                                        ; function name
 
1434
   )
 
1435
  "Font-lock patterns used in `R-mode' buffers.")
 
1436
 
 
1437
(defvar ess-S-mode-font-lock-keywords
 
1438
  (list
 
1439
   (cons (regexp-opt ess-S-assign-ops)
 
1440
         'font-lock-reference-face)     ; assign
 
1441
   (cons (concat "\\<" (regexp-opt ess-S-constants 'enc-paren) "\\>")
 
1442
         'font-lock-type-face)          ; constants
 
1443
   (cons (concat "\\<" (regexp-opt ess-S-modifyiers 'enc-paren) "\\>")
 
1444
         'font-lock-reference-face)     ; modify search list or source
 
1445
                                        ; new definitions
 
1446
   (cons (concat "\\<" (regexp-opt ess-S-keywords 'enc-paren) "\\>")
 
1447
         'font-lock-keyword-face)       ; keywords
 
1448
   (cons ess-S-function-name-regexp
 
1449
         '(1 font-lock-function-name-face t))
 
1450
                                        ; function name
 
1451
   )
 
1452
  "Font-lock patterns used in `S-mode' buffers.")
 
1453
 
 
1454
 
 
1455
 
 
1456
 
 
1457
(defvar inferior-ess-R-font-lock-keywords
 
1458
  (append
 
1459
   '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
 
1460
 
 
1461
   (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
 
1462
       (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
 
1463
                   '(1 font-lock-variable-name-face keep t))) )
 
1464
 
 
1465
   ess-R-mode-font-lock-keywords
 
1466
 
 
1467
   (list
 
1468
    (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face); ess-mode msg
 
1469
    (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
 
1470
    (cons (concat "^" (regexp-opt ess-R-message-prefixes 'enc-paren))
 
1471
          'font-lock-reference-face) ; inferior-ess problems or errors
 
1472
    (cons "#"   'font-lock-comment-face) ; comment
 
1473
    (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
 
1474
    ))
 
1475
  "Font-lock patterns used in inferior-R-mode buffers.")
 
1476
 
 
1477
(defvar inferior-ess-S-font-lock-keywords
 
1478
  (append
 
1479
   '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
 
1480
 
 
1481
   (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
 
1482
       (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
 
1483
                   '(1 font-lock-variable-name-face keep t))) )
 
1484
 
 
1485
   ess-S-mode-font-lock-keywords
 
1486
 
 
1487
   (list
 
1488
    (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face) ; ess-mode msg
 
1489
    (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
 
1490
    (cons (concat "^" (regexp-opt ess-S-message-prefixes 'enc-paren))
 
1491
          'font-lock-reference-face) ; inferior-ess problems or errors
 
1492
    (cons "#" 'font-lock-comment-face)  ; comment
 
1493
    (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
 
1494
    ))
 
1495
  "Font-lock patterns used in inferior-S-mode buffers.")
 
1496
 
 
1497
;; use the inferior-* ones directly in ess-trns.el
 
1498
;; (defvar ess-trans-font-lock-keywords
 
1499
;;   inferior-ess-font-lock-keywords
 
1500
;;   "Font-lock patterns used in `ess-transcript-mode' buffers.")
1243
1501
 
1244
1502
 
1245
1503
;;;*;;; ess-help variables
1250
1508
 
1251
1509
;;*;; Variables relating to ess-help-mode
1252
1510
 
1253
 
(defconst ess-help-S-sec-regex "^[A-Z. ---]+:$"
1254
 
  "Reg(ular) Ex(pression) of section headers in help file")
1255
 
 
 
1511
(defcustom ess-help-own-frame nil
 
1512
  "*Controls whether ESS help buffers should start in a different frame.
 
1513
 
 
1514
Possible values are:
 
1515
   nil: Display help in current frame.
 
1516
  'one: All help buffers are shown in one dedicated frame.
 
1517
     t: Each help buffer gets its own frame.
 
1518
 
 
1519
The parameters of this frame are stored in `ess-help-frame-alist'.
 
1520
See also `inferior-ess-own-frame'."
 
1521
  :group 'ess-help
 
1522
  :type '(choice (const nil) (const one) (const t)))
 
1523
 
 
1524
(defcustom ess-help-frame-alist special-display-frame-alist
 
1525
  "*Alist of frame parameters used to create help frames.
 
1526
This defaults to `special-display-frame-alist' and is used only when
 
1527
the variable `ess-help-own-frame' is non-nil."
 
1528
  :group 'ess-help
 
1529
  :type 'alist)
1256
1530
 
1257
1531
 
1258
1532
 ; User changeable variables
1263
1537
 
1264
1538
(defcustom ess-help-kill-bogus-buffers nil
1265
1539
  "*If non-nil, kill ESS help buffers immediately if they are \"bogus\"."
1266
 
  :group 'ess
 
1540
  :group 'ess-help
1267
1541
  :type 'boolean)
1268
1542
 
1269
1543
(defvar ess-help-form 'separate-buffer
1286
1560
 
1287
1561
;;*;; Variables relating to ess-help-mode
1288
1562
 
1289
 
;;-- ess-help-S-.. and  ess-help-R-.. constants now  in   S.el (are used in ess-inf).
 
1563
;;-- ess-help-S-.. and  ess-help-R-.. : in  essl-s.el (are used in ess-inf).
1290
1564
 
1291
1565
(defvar ess-help-sec-keys-alist nil
1292
1566
  "Alist of (key . string) pairs for use in section searching.")
1320
1594
  :group 'ess-proc
1321
1595
  :type 'string)
1322
1596
 
 
1597
(defcustom ess-verbose nil
 
1598
  "if non-nil, write more information to `ess-dribble-buffer' than usual."
 
1599
  :group 'ess-proc
 
1600
  :type 'boolean)
 
1601
 
1323
1602
(defvar ess-dribble-buffer (generate-new-buffer "*ESS*")
1324
1603
  "Buffer for temporary use for setting default variable values.
1325
1604
Used for recording status of the program, mainly for debugging.")