(ess-r-versions): Moved this variable from ess-cust.el. (As a custom
[ess.git] / lisp / ess-cust.el
blob52a90a0be00b41dc9e025f817b2bf16c58cedadf
1 ;;; ess-cust.el --- Customize variables for ESS
3 ;; Copyright (C) 1997--2005 A.J. Rossini, Rich M. Heiberger, Martin
4 ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6 ;; Original Author: A.J. Rossini <rossini@u.washington.edu>
7 ;; Created: 05 June 2000
8 ;; Maintainers: ESS-core <ESS-core@stat.math.ethz.ch>
10 ;; Keywords: editing and process modes.
12 ;; This file is part of ESS
14 ;; This file is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; any later version.
19 ;; This file is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to
26 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;; In short: you may use this code any way you like, as long as you
29 ;; don't charge more than a distribution fee for it, do distribute the
30 ;; source with any binaries, remove this notice, or hold anyone liable
31 ;; for its results.
33 ;;; Code:
35 ;; Stolen from w3-cus.el (via Per Abrahamsen's advice on the widgets page).
36 ;; This code provides compatibility with non-customized Emacsen.
37 (eval-and-compile
38 (condition-case ()
39 (require 'custom)
40 (error nil))
41 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
42 nil ;; We've got what we needed
43 ;; We have the old custom-library, hack around it!
44 (defmacro defgroup (&rest args)
45 nil)
46 (defmacro defface (var values doc &rest args)
47 (` (make-face (, var))))
48 (defmacro defcustom (var value doc &rest args)
49 (` (defvar (, var) (, value) (, doc))))))
51 ;; Customization Groups
53 (defgroup ess nil
54 "ESS: Emacs Speaks Statistics."
55 :group 'local)
57 (defgroup ess-edit nil
58 "ESS: editing behavior, including coments/indentation."
59 :group 'ess
60 :prefix "ess-")
62 (defgroup ess-proc nil
63 "ESS: process control."
64 :group 'ess
65 :prefix "ess-")
67 (defgroup ess-command nil
68 "ESS: Commands for various things."
69 :group 'ess
70 :prefix "ess-")
72 (defgroup ess-help nil
73 "ESS: help functions."
74 :group 'ess
75 :prefix "ess-")
77 (defgroup ess-hooks nil
78 "ESS: hooks for customization."
79 :group 'ess
80 :prefix "ess-")
82 (defgroup ess-S nil
83 "ESS: S Languages."
84 :group 'ess
85 :prefix "ess-")
87 (defgroup ess-origS nil
88 "ESS: Original S Dialect from Bell Labs/AT&T."
89 :group 'ess-S
90 :prefix "ess-")
92 (defgroup ess-SPLUS nil
93 "ESS: S-PLUS Dialect of S."
94 :group 'ess-S
95 :prefix "ess-")
97 (defgroup ess-R nil
98 "ESS: R Dialect of S."
99 :group 'ess-S
100 :prefix "ess-")
102 (defgroup ess-sas nil
103 "ESS: SAS."
104 :group 'ess
105 :prefix "ess-")
107 (defgroup ess-Stata nil
108 "ESS: Stata."
109 :group 'ess
110 :prefix "ess-")
112 (defgroup ess-XLS nil
113 "ESS: XLispStat."
114 :group 'ess
115 :prefix "ess-")
117 (defgroup ess-OMG nil
118 "ESS: Omegahat."
119 :group 'ess
120 :prefix "ess-")
122 (defgroup ess-mouse nil ;; FIXME: this is not used yet <--> ./ess-mous.el
123 "ESS: Mouse."
124 :group 'ess
125 :prefix "ess-")
127 ;; Variables (not user-changeable)
129 (defvar ess-version "5.2.9"
130 "Version of ESS currently loaded.")
132 (defvar no-doc
133 "This function is part of ESS, but has not yet been loaded.
134 Full documentation will be available after autoloading the function."
135 "Documentation for autoload functions.")
138 \f ; User changeable variables
140 ;;; Common user changeable variable are described and documented in
141 ;;; ess-site.el. Please check there first!
142 ;;;=====================================================
143 ;;; In general: Variables with document strings starting with a * are
144 ;;; the ones you can generally change safely, and may have to upon
145 ;;; occasion.
147 ;;*;; Options and Initialization
149 ;; Menus and pulldowns.
151 (defcustom ess-funcmenu-use-p (fboundp 'func-menu)
152 "If t, funcmenu is present."
153 :group 'ess
154 :type 'boolean)
156 (defcustom ess-speedbar-use-p (fboundp 'speedbar)
157 "If t, speedbar is present."
158 :group 'ess
159 :type 'boolean)
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)
170 (defcustom ess-ask-for-ess-directory t
171 "*If non-nil, the process directory will be requested each time S is run."
172 :group 'ess
173 :type 'boolean)
175 (defcustom ess-ask-about-transfile nil
176 "*If non-nil, asks about a transcript file before running ESS."
177 :group 'ess
178 :type 'boolean)
180 (defcustom ess-language nil
181 "*Prefix of all ESS processes, and defines the dialect in use.
182 Currently acceptable values are `S', `XLS', `SAS'.
183 Can be changed, e.g., to `R'. Use `setq-default' if setting it in
184 .emacs (also see ess-site.el)."
185 :group 'ess
186 :type '(choice (const :tag "Initial" :value "Initial")
187 (const :tag "S" :value "S")
188 (const :tag "XLS" :value "XLS")
189 (const :tag "SAS" :value "SAS")
190 (const :tag "R" :value "R")))
192 (make-variable-buffer-local 'ess-language)
193 (setq-default ess-language "Initial")
195 (defvar ess-dialect nil
196 "String version of the dialect being run for the inferior process.
197 This, plus `ess-language', should be able to determine the exact
198 version of the statistical package being executed in the particular
199 buffer.
201 Current values could include:
202 for `ess-dialect' = S3, S4, Sp3, Sp4, Sp5, Sp6, R, XLS, SAS, STA
204 Used to adjust for changes in versions of the program.")
206 (make-variable-buffer-local 'ess-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.
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)
220 (defcustom ess-directory-function nil
221 "*Function to return the directory that ESS is run from.
222 If nil or if the function returns nil then you get `ess-directory'."
223 :group 'ess
224 :type '(choice (const nil) function))
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))
233 (defcustom ess-directory nil
234 "*The directory ESS is run from. It must end in a slash.
235 Provided as a default if `ess-ask-for-ess-directory' is non-nil.
236 A nil value means use the current buffer's default directory.
237 Buffer-local: in process buffers, this contains the directory ESS was
238 run from."
239 :group 'ess
240 :type '(choice (const nil) directory))
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))
248 (defcustom ess-history-file nil
249 "*File to pick up history from.
250 If this is a relative file name, it is relative to `ess-history-directory'."
251 :group 'ess
252 :type '(choice (const nil) file))
254 (defcustom ess-plain-first-buffername t
255 "*No fancy process buffname for the first process of each type (novice mode)."
256 :group 'ess
257 :type 'boolean)
259 (defcustom ess-S-assign " <- "
260 "*String to be used for left assignment in all S dialects.
261 Used by \\[ess-smart-underscore]."
262 :group 'ess-S
263 :type 'string)
265 ;;*;; Variables concerning editing behaviour
267 (defcustom ess-filenames-map t
268 "Declares if the filenames in an attached directory are the same
269 as objects in that directory (when t). This is not true for DOS and
270 other OS's with limited filename lengths. Even if this is set
271 incorrectly, the right things will probably still happen, however."
272 :group 'ess-edit
273 :type 'boolean)
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".
279 (defcustom ess-keep-dump-files 'ask
280 "*Variable controlling whether to delete dump files after a successful load.
281 If nil: always delete. If `ask', confirm to delete. If `check', confirm
282 to delete, except for files created with ess-dump-object-into-edit-buffer.
283 Anything else, never delete. This variable only affects the behaviour
284 of `ess-load-file'. Dump files are never deleted if an error occurs
285 during the load. "
286 :group 'ess-edit
287 :type '(choice (const :tag "Check" :value 'check)
288 (const :tag "Ask" :value 'ask)
289 (const :tag "Always keep" :value "always")
290 (const :tag "Always delete" :value nil)
294 (defcustom ess-delete-dump-files nil
295 "*If non-nil, delete dump files after they are created. This
296 applies to dump files created with `ess-dump-object-into-edit-buffer',
297 only.
299 Boolean flag which determines what to do with the dump files
300 generated by \\[ess-dump-object-into-edit-buffer], as follows:
302 If nil: dump files are deleted after each use, and so appear
303 only transiently. The one exception to this is when a loading error
304 occurs, in which case the file is retained until the error is
305 corrected and the file re-loaded.
307 If non-nil: dump files are not deleted, and backups are kept
308 as usual. This provides a simple method for keeping an archive of S
309 functions in text-file form.
311 Auto-save is always enabled in dump-file buffers to enable recovery
312 from crashes.
314 This is useful to prevent sources file being created for objects
315 you don't actually modify. Once the buffer is modified and saved
316 however, the file is not subsequently unless `ess-keep-dump-files' is
317 nil, and the file is successfully loaded back into S."
318 :group 'ess-edit
319 :type 'boolean)
321 ;;; From ess-mode:
323 (defcustom ess-mode-silently-save t
324 "*If non-nil, automatically save ESS source buffers before loading."
325 :group 'ess-edit
326 :type 'boolean)
328 ;;*;; Variables controlling editing
330 ;;;*;;; Edit buffer processing
331 (defcustom ess-function-template " <- function( )\n{\n\n}\n"
332 "If non-nil, function template used when editing nonexistent objects.
334 The edit buffer will contain the object name in quotes, followed by
335 this string. Point will be placed after the first parenthesis or
336 bracket."
337 :group 'ess-edit
338 :type 'string)
340 ;;; By K.Shibayama 5.14.1992
341 ;;; Setting any of the following variables in your .emacs is equivalent
342 ;;; to modifying the DEFAULT style.
344 ;;;*;;; Indentation parameters
346 (defcustom ess-auto-newline nil
347 "*Non-nil means automatically newline before and after braces
348 inserted in S code."
349 :type 'boolean
350 :group 'ess-edit)
352 (defcustom ess-tab-always-indent t
353 "*Non-nil means TAB in S mode should always reindent the current line,
354 regardless of where in the line point is when the TAB command is used."
355 :type 'boolean
356 :group 'ess-edit)
358 (defcustom ess-indent-level 2
359 "*Indentation of S statements with respect to containing block."
360 :type 'integer
361 :group 'ess-edit)
363 (defcustom ess-brace-imaginary-offset 0
364 "*Imagined indentation of an open brace following a statement."
365 :type 'integer
366 :group 'ess-edit)
368 (defcustom ess-brace-offset 0
369 "*Extra indentation for open braces.
370 Compares with other text in same context."
371 :type 'integer
372 :group 'ess-edit)
374 (defcustom ess-continued-statement-offset 2
375 "*Extra indent for lines not starting new statements."
376 :type 'integer
377 :group 'ess-edit)
379 (defcustom ess-continued-brace-offset 0
380 "*Extra indent for substatements that start with open-braces.
381 This is in addition to ess-continued-statement-offset."
382 :type 'integer
383 :group 'ess-edit)
385 (defcustom ess-arg-function-offset 2
386 "*Extra indent for internal substatements of function `foo' that called
387 in `arg=foo(...)' form.
388 If not number, the statements are indented at open-parenthesis following foo."
389 :type 'integer
390 :group 'ess-edit)
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)
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)
405 ;; PeterDalgaard, 1Apr97 :
406 ;;The default ess-else-offset should be 0, not 2 IMHO (try looking at
407 ;;the ls() function, for instance). Was 2.
408 (defcustom ess-else-offset 0
409 "*Extra indent for `else' lines."
410 :type 'integer
411 :group 'ess-edit)
413 (defcustom ess-expression-offset 4
414 "*Extra indent for internal substatements of `expression' that specified
415 in `obj <- expression(...)' form.
416 If not number, the statements are indented at open-parenthesis following
417 `expression'."
418 :type 'integer
419 :group 'ess-edit)
421 ;;;*;;; Editing styles
423 ;;; **FIXME** The following NEEDS to be customized.
424 ;; SJE: I disagree; this variable should not be customized; individual vars,
425 ;; such as ess-indent-level are already customizable.
426 (defvar ess-default-style-list
427 (list 'DEFAULT
428 (cons 'ess-indent-level ess-indent-level)
429 (cons 'ess-continued-statement-offset ess-continued-statement-offset)
430 (cons 'ess-brace-offset ess-brace-offset)
431 (cons 'ess-expression-offset ess-expression-offset)
432 (cons 'ess-else-offset ess-else-offset)
433 (cons 'ess-brace-imaginary-offset ess-brace-imaginary-offset)
434 (cons 'ess-continued-brace-offset ess-continued-brace-offset)
435 (cons 'ess-arg-function-offset ess-arg-function-offset)
436 (cons 'ess-close-brace-offset ess-close-brace-offset))
437 "Default style constructed from initial values of indentation variables.")
439 (defvar ess-style-alist
440 (cons ess-default-style-list
441 '((GNU (ess-indent-level . 2)
442 (ess-continued-statement-offset . 2)
443 (ess-brace-offset . 0)
444 (ess-arg-function-offset . 4)
445 (ess-expression-offset . 2)
446 (ess-else-offset . 0)
447 (ess-close-brace-offset . 0))
448 (BSD (ess-indent-level . 8)
449 (ess-continued-statement-offset . 8)
450 (ess-brace-offset . -8)
451 (ess-arg-function-offset . 0)
452 (ess-expression-offset . 8)
453 (ess-else-offset . 0)
454 (ess-close-brace-offset . 0))
455 (K&R (ess-indent-level . 5)
456 (ess-continued-statement-offset . 5)
457 (ess-brace-offset . -5)
458 (ess-arg-function-offset . 0)
459 (ess-expression-offset . 5)
460 (ess-else-offset . 0)
461 (ess-close-brace-offset . 0))
462 (C++ (ess-indent-level . 4)
463 (ess-continued-statement-offset . 4)
464 (ess-brace-offset . -4)
465 (ess-arg-function-offset . 0)
466 (ess-expression-offset . 4)
467 (ess-else-offset . 0)
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))
477 ;; CLB added rmh 2Nov97 at request of Terry Therneau
478 (CLB (ess-indent-level . 2)
479 (ess-continued-statement-offset . 4)
480 (ess-brace-offset . 0)
481 (ess-arg-function-offset . 0)
482 (ess-expression-offset . 4)
483 (ess-else-offset . 0)
484 (ess-close-brace-offset . 2))))
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'.")
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)
504 (defvar ess-style ess-default-style
505 "*The buffer specific ESS indentation style.")
507 ;;*;; Variables controlling behaviour of dump files
509 (defcustom ess-source-directory "/tmp/"
510 "*Directory in which to place dump files.
511 This can be a string (an absolute directory name ending in a slash) or
512 a lambda expression of no arguments which will return a suitable string
513 value. The lambda expression is evaluated with the process buffer as the
514 current buffer.
516 Possible value:
518 '(lambda () (file-name-as-directory
519 (expand-file-name (concat (car ess-search-list) \"/.Src\"))))
521 This always dumps to a sub-directory (\".Src\") of the current ess
522 working directory (i.e. first elt of search list)."
523 :group 'ess-edit
524 :type 'directory)
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.
532 By default, gives filenames like `user.foofun.S', so as not to clash with
533 other users if you are using a shared directory. Other alternatives:
534 \"%s.S\" ; Don't bother uniquifying if using your own directory(ies)
535 \"dumpdir\"; Always dump to a specific filename. This makes it impossible
536 to edit more than one object at a time, though.
537 (make-temp-name \"scr.\") ; Another way to uniquify"
538 ;; MM: The last 3-4 lines above suck (I don't understand them) -- FIXME --
540 :group 'ess-edit
541 :type 'string)
544 ;;*;; Hooks
546 (defcustom ess-mode-hook nil
547 "*Hook for customizing ESS each time it is entered."
548 :group 'ess-hooks
549 :type 'hook)
551 (defcustom ess-mode-load-hook nil
552 "*Hook to call when ess.el is loaded."
553 :group 'ess-hooks
554 :type 'hook)
556 (defcustom ess-pre-run-hook nil
557 "*Hook to call before starting up ESS.
558 Good for setting up your directory."
559 :group 'ess-hooks
560 :type 'hook)
562 (defcustom ess-post-run-hook nil
563 "*Hook to call just after the ESS process starts up.
564 Good for evaluating ESS code."
565 :group 'ess-hooks
566 :type 'hook)
568 (defcustom inferior-ess-mode-hook nil
569 "*Hook for customizing inferior ESS mode. Called after
570 `inferior-ess-mode' is entered and variables have been initialised."
571 :group 'ess-hooks
572 :type 'hook)
574 ;;; make it possible to save an inferior-ess-mode buffer without losing
575 ;;; the connection to the running ESS process.
576 (put 'inferior-ess-mode 'mode-class 'special)
577 ;; FIXME AJR: Should the above be there? I don't think so!
578 ;; MM : the functionality should be, right? Move statement to ./ess.el ?
579 ;; AJR: No, we should move the statement to ./ess-inf.el
581 (defcustom ess-help-mode-hook nil
582 "Functions to call when entering `ess-help-mode'. "
583 :group 'ess-hooks
584 :type 'hook)
586 (defcustom ess-send-input-hook nil
587 "Hook called just before line input is sent to the process."
588 :group 'ess-hooks
589 :type 'hook)
591 (defcustom ess-transcript-mode-hook nil
592 "Hook for customizing ESS transcript mode."
593 :group 'ess-hooks
594 :type 'hook)
596 \f ; System variables
598 (defcustom ess-local-process-name nil
599 "The name of the ESS process associated with the current buffer."
600 :group 'ess
601 :type '(choice (const nil) string))
603 (make-variable-buffer-local 'ess-local-process-name)
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
612 (defcustom ess-kermit-prefix "#"
613 "*String files must begin with to use kermit file transfer."
614 :group 'ess
615 :type 'string
618 (defcustom ess-kermit-remote-directory "."
619 "*Buffer local variable that designates remote directory of file."
620 :group 'ess
621 :type 'string
624 (make-variable-buffer-local 'ess-kermit-remote-directory)
626 ;;*;; Regular expressions
628 ;; -- Note: Some variables not-to-customize moved to ./ess-mode.el :
629 ;; ess-set-function-start
631 ;; Fixme: the following is just for S dialects :
632 (defcustom ess-dumped-missing-re
633 "\\(<-\nDumped\n\\'\\)\\|\\(<-\\(\\s \\|\n\\)*\\'\\)"
634 "If a dumped object's buffer matches this re, then it is replaced
635 by `ess-function-template'."
636 :group 'ess
637 :type 'regexp)
639 (defcustom ess-dump-error-re
640 (if (string= ess-language "S") "\nDumped\n\\'"
641 "[Ee]rror")
642 "Regexp used to detect an error when loading a file."
643 :group 'ess
644 :type 'regexp)
646 ;;;; This is tested for S dialects (actually only for R) -- be careful with it!
647 (defvar ess-help-arg-regexp "\\(['\"]?\\)\\([^,=)'\"]*\\)\\1"
648 "Reg(ular) Ex(pression) of help(.) arguments. MUST: 2nd \\(.\\) = arg.")
650 \f ; ess-inf: variables for inferior-ess.
652 ;;*;; System dependent variables
654 ;; If you need to change the *-program-name variables, do so in
655 ;; ess-site.el. Do NOT make the changes here!!
656 ;; Keep a copy of your revised ess-site.el to use as a starting point
657 ;; for upgrades of ESS.
659 (defcustom inferior-ess-own-frame nil
660 "*Non-nil means that inferior ESS buffers should start in their own frame.
661 The parameters of this frame are stored in `inferior-ess-frame-alist'."
662 :group 'ess-proc
663 :type 'boolean)
665 (defcustom inferior-ess-frame-alist default-frame-alist
666 "*Alist of frame parameters used to create new frames for iESS buffers.
667 This defaults to `default-frame-alist' and is used only when
668 the variable `inferior-ess-own-frame' is non-nil."
669 :group 'ess-proc
670 :type 'alist)
672 (defcustom inferior-ess-same-window t
673 "*Non-nil indicates new inferior ESS process appears in current window.
674 Otherwise, the new inferior ESS buffer is shown in another window in the
675 current frame. This variable is ignored if `inferior-ess-own-frame' is
676 non-nil."
677 :group 'ess-proc
678 :type 'boolean)
680 (defcustom inferior-R-program-name
681 (if ess-microsoft-p "Rterm" "R")
682 "*Program name for invoking an inferior ESS with \\[R]."
683 :group 'ess-R
684 :type 'string)
686 (defcustom inferior-R-args ""
687 "*String of arguments used when starting R.
688 These arguments are currently not passed to other versions of R that have
689 been created using the variable `ess-r-versions'."
690 :group 'ess-R
691 :type 'string)
693 (defcustom inferior-R-objects-command "objects(pos=%d, all.names=TRUE)\n"
694 "Format string for R command to get a list of objects at position %d.
695 Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
696 :group 'ess-command
697 :type 'string)
699 (defcustom ess-rterm-versions nil
700 "*Construct ess-rterm-versions. If you have versions of R in
701 locations other than in ../../rw*/bin/Rterm.exe, relative to the
702 directory in the `exec-path' variable containing your default location
703 of Rterm, you will need to redefine this variable with a
704 `custom-set-variables' statement in your site-start.el or .emacs
705 file."
706 :group 'ess-R
707 :type '(repeat string))
709 (defcustom ess-SHOME-versions
710 '("c:/progra~1/Insightful/splus62"
711 "c:/progra~1/Insightful/splus61"
712 "c:/progra~1/MathSoft/splus6"
713 "c:/progra~1/spls45se"
714 "c:/progra~1/Insightful/splus62netclient"
715 "c:/progra~1/Insightful/splus62net/server"
716 "c:/progra~1/Insightful/splus61netclient"
717 "c:/progra~1/Insightful/splus61net/server"
718 "c:/progra~1/Insightful/splus6se"
719 "c:/progra~1/Insightful/splus61se"
720 "c:/progra~1/Insightful/splus62se"
721 "c:/progra~1/Insightful/splus70"
722 "c:/progra~1/Insightful/splus71")
723 "*List of possible values of the environment variable SHOME for recent
724 releases of S-Plus. These are the default locations for several
725 current and recent releases of S-Plus. If any of these pathnames
726 correspond to a directory on your machine, running the function
727 `ess-sqpe-versions-create' will create a function, for example, `M-x
728 splus62', that will start the corresponding version Sqpe inside an
729 emacs buffer in iESS[S] mode. If you have versions of S-Plus in
730 locations other than these default values, redefine this variable with
731 a `custom-set-variables' statement in your site-start.el or .emacs
732 file. The list of functions actually created appears in the *ESS*
733 buffer and should appear in the \"ESS / Start Process / Other\"
734 menu."
735 :group 'ess-S
736 :type '(repeat string))
738 (defcustom inferior-S3-program-name "/disk05/s/S"
739 "*Program name for invoking an inferior ESS with S3()."
740 :group 'ess-S
741 :type 'string)
743 (defcustom inferior-S+3-program-name "Splus"
744 "*Program name for invoking an inferior ESS with S+3()."
745 :group 'ess-S
746 :type 'string)
748 (defcustom inferior-S+4-program-name "c:/progra~1/spls45se/cmd/Splus.exe"
749 "*Program name for invoking an external GUI S+4.
750 The default value is correct for a default installation of
751 S-Plus 4.5 Student Edition and with bash as the shell.
752 For any other version or location, change this value in ess-site.el or
753 site-start.el. Use the 8.3 version of the pathname.
754 Use double backslashes if you use the msdos shell."
755 :group 'ess-S
756 :type 'string)
758 (defcustom inferior-S+4-print-command "S_PRINT_COMMAND=gnuclientw.exe"
759 "*Destination of print icon in S+4 Commands window."
760 :group 'ess-S
761 :type 'string)
763 (defcustom inferior-S+4-editor-pager-command
764 "options(editor='gnuclient.exe', pager='gnuclientw.exe')"
765 "*Programs called by the editor() and pager() functions
766 in S+4 Commands window and in Sqpe+4 buffer."
767 :group 'ess-S
768 :type 'string)
770 (defcustom inferior-Sqpe+4-program-name "c:/progra~1/spls45se/cmd/Sqpe.exe"
771 "*Program name for invoking an inferior ESS with Sqpe+4()."
772 :group 'ess-S
773 :type 'string)
775 ;;; SJE - avoid mismatch by changing default nil to ""
776 (defcustom inferior-Sqpe+4-SHOME-name
777 (if ess-microsoft-p "c:/progra~1/spls45se" "")
778 "*SHOME name for invoking an inferior ESS with Sqpe+4().
779 The default value is correct for a default installation of
780 S-Plus 4.5 Student Edition. For any other version or location,
781 change this value in ess-site.el or site-start.el. Use the 8.3
782 version of the pathname."
783 :group 'ess-S
784 :type 'string)
785 ;;(if ess-microsoft-p
786 ;; (let* ((SHOME (getenv "SHOME"))
787 ;; (PATH (getenv "PATH"))
788 ;; (split-PATH (split-string PATH ";")) ;; Unix uses ":"
789 ;; (num 0)
790 ;; pathname)
791 ;; (if (not SHOME)
792 ;; (while (< num (length split-PATH))
793 ;; (setq pathname (concat (nth num split-PATH) "/Sqpe.exe"))
794 ;; (if (not (file-exists-p pathname))
795 ;; (setq num (1+ num))
796 ;; (progn
797 ;; (setq num (length split-PATH))
798 ;; (setq SHOME (expand-file-name (concat pathname "/../..")))))))
799 ;; (setq-default inferior-Sqpe+4-SHOME-name SHOME)))
802 (defcustom inferior-S-elsewhere-program-name "sh"
803 "*Program name for invoking an inferior ESS with S on a different computer."
804 :group 'ess-proc
805 :type 'string)
807 (defcustom inferior-ESS-elsewhere-program-name "sh"
808 "*Program name for invoking an inferior ESS with program on a
809 different computer."
810 :group 'ess-proc
811 :type 'string)
813 (defcustom inferior-S4-program-name "S4"
814 "*Program name for invoking an inferior ESS with S4()."
815 :group 'ess-S
816 :type 'string)
818 (defcustom inferior-S+5-program-name "Splus5"
819 "*Program name for invoking an inferior ESS with S+5()."
820 :group 'ess-S
821 :type 'string)
823 (if ess-microsoft-p
824 (defcustom inferior-S+6-program-name
825 "c:/progra~1/insigh~1/splus6/cmd/Splus.exe"
826 "*Program name for invoking an external GUI S+6 for Windows.
827 The default value is correct for a default installation of
828 S-Plus 6.0.3 Release 2 and with bash as the shell.
829 For any other version or location, change this value in ess-site.el or
830 site-start.el. Use the 8.3 version of the pathname.
831 Use double backslashes if you use the msdos shell."
832 :group 'ess-S
833 :type 'string)
834 (defcustom inferior-S+6-program-name "Splus6"
835 "*Program name for invoking an inferior ESS with S+6() for Unix."
836 :group 'ess-S
837 :type 'string))
839 (defcustom inferior-Splus-args ""
840 "*String of arguments used when starting S.
841 These arguments are currently passed only to S+6."
842 :group 'ess-S
843 :type 'string)
845 (defcustom inferior-Splus-objects-command "objects(where=%d)\n"
846 "Format string for R command to get a list of objects at position %d.
847 Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
848 :group 'ess-command
849 :type 'string)
851 (defcustom inferior-S+6-print-command "S_PRINT_COMMAND=gnuclientw.exe"
852 "*Destination of print icon in S+6 for Windows Commands window."
853 :group 'ess-S
854 :type 'string)
856 (defcustom inferior-S+6-editor-pager-command
857 "options(editor='gnuclient.exe', pager='gnuclientw.exe')"
858 "*Programs called by the editor() and pager() functions
859 in S+6 for Windows Commands window and in Sqpe+6 for Windows buffer."
860 :group 'ess-S
861 :type 'string)
863 (defcustom inferior-Sqpe+6-program-name
864 "c:/progra~1/insigh~1/splus6/cmd/Sqpe.exe"
865 "*Program name for invoking an inferior ESS with Sqpe+6() for Windows."
866 :group 'ess-S
867 :type 'string)
869 ;;; SJE - avoid mismatch by changing default nil to ""
870 (defcustom inferior-Sqpe+6-SHOME-name
871 (if ess-microsoft-p "c:/progra~1/insigh~1/splus6" "")
872 "*SHOME name for invoking an inferior ESS with Sqpe+6() for Windows.
873 The default value is correct for a default installation of
874 S-Plus 6.0.3 Release 2. For any other version or location,
875 change this value in ess-site.el or site-start.el. Use the 8.3
876 version of the pathname."
877 :group 'ess-S
878 :type 'string)
879 ;;(if ess-microsoft-p
880 ;; (let* ((SHOME (getenv "SHOME"))
881 ;; (PATH (getenv "PATH"))
882 ;; (split-PATH (split-string PATH ";")) ;; Unix uses ":"
883 ;; (num 0)
884 ;; pathname)
885 ;; (if (not SHOME)
886 ;; (while (< num (length split-PATH))
887 ;; (setq pathname (concat (nth num split-PATH) "/Sqpe.exe"))
888 ;; (if (not (file-exists-p pathname))
889 ;; (setq num (1+ num))
890 ;; (progn
891 ;; (setq num (length split-PATH))
892 ;; (setq SHOME (expand-file-name (concat pathname "/../..")))))))
893 ;; (setq-default inferior-Sqpe+6-SHOME-name SHOME)))
895 (defcustom ess-S-quit-kill-buffers-p nil
896 "Controls whether S buffers should also be killed once a process is killed.
897 This is used only when an iESS process is killed using C-c C-q.
898 Possible values:
899 nil - do not kill any S buffers associated with the process.
900 t - kill S buffers associated with the process.
901 ask - ask the user whether the S buffers should be killed."
902 :group 'ess-S
903 :type '(choice (const nil) (const t) (const ask)))
905 (defcustom inferior-XLS-program-name "xlispstat"
906 "*Program name for invoking an inferior ESS with \\[XLS]."
907 :group 'ess-XLS
908 :type 'string)
910 (defcustom inferior-VST-program-name "vista"
911 "*Program name for invoking an inferior ESS with \\[ViSta]."
912 :group 'ess-XLS
913 :type 'string)
915 (defcustom inferior-ARC-program-name "arc"
916 "*Program name for invoking an inferior ESS with \\[ARC]."
917 :group 'ess-XLS
918 :type 'string)
920 (defcustom inferior-SAS-program-name "sas"
921 "*Program name for invoking an inferior ESS with SAS()."
922 :group 'ess-sas
923 :type 'string)
925 (defcustom inferior-STA-program-name "env"
926 "*Program name for invoking an inferior ESS with stata().
927 This is NOT Stata, because we need to call stata with TERM=emacs in
928 order for it to work right. And Emacs is too smart for it."
929 :group 'ess-Stata
930 :type 'string)
932 (defcustom inferior-OMG-program-name "omegahat"
933 "*Program name for invoking an inferior ESS with omegahat()."
934 :group 'ess-OMG
935 :type 'string)
938 ;;;;; names for setting the pager and editor options of the
939 ;;;;; inferior-ess-process
941 ;;; S-editor and S-pager,
942 ;;; R-editor and R-pager,
943 ;;; ess-editor and ess-pager,
944 ;;; and inferior-ess-language-start
945 ;;; apply in principle to the 15 files essd[s-]*.el
946 ;;; Several of the files (essd-sp4.el and essd-sp6w.el) have more
947 ;;; than one *-customize-alist.
948 ;;; These variables are currently used only with the S language files for
949 ;;; S S-Plus R.
951 (defcustom R-editor
952 (if ess-microsoft-p "gnuclient.exe"
953 (if (equal system-type 'Apple-Macintosh) nil
954 (if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
955 "*Editor called by R process with 'edit()' command."
956 :group 'ess
957 :type 'string)
959 (defcustom R-pager 'nil ; Usually nil is correct as ESS and page() cooperate.
960 "*Pager called by R process with 'page()' command."
961 :group 'ess
962 :type '(choice (const nil) string))
964 (defcustom S-editor
965 (if ess-microsoft-p "gnuclient.exe"
966 (if (equal system-type 'Apple-Macintosh) nil
967 (if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
968 "*Editor called by S process with 'edit()' command."
969 :group 'ess
970 :type 'string)
972 (defcustom S-pager
973 (if ess-microsoft-p "gnuclientw.exe"
974 (if (equal system-type 'Apple-Macintosh) nil
975 (if (featurep 'xemacs) "gnuclient -q" "emacsclient")))
976 "*Pager called by S process with 'page()' command."
977 ;; Change made to provide a better help(function) experience with
978 ;; S+6 and xemacs
979 ;; gnuclient -q will open a buffer with an HTML help file
980 ;; you can view it with M-x browse-url-of-buffer
981 :group 'ess
982 :type 'string)
984 (defvar ess-editor nil
985 "*Editor by which the process sends information to an emacs buffer
986 for editing and then to be returned to the process.")
988 (defvar ess-pager nil
989 "*Pager by which the process sends information to an emacs buffer.")
991 (defvar inferior-ess-language-start nil
992 "*Initialization commands sent to the ESS process.")
994 (make-variable-buffer-local 'ess-editor)
995 (make-variable-buffer-local 'ess-pager)
996 (make-variable-buffer-local 'inferior-ess-language-start)
1000 ;;;;; names for communication using MS-Windows 9x/NT ddeclient mechanism
1002 (defcustom inferior-ess-ddeclient nil
1003 "*ddeclient is the intermediary between emacs and the stat program."
1004 :group 'ess-proc
1005 :type 'string)
1007 (make-variable-buffer-local 'inferior-ess-ddeclient)
1009 (defcustom inferior-ess-client-name nil
1010 "*Name of ESS program ddeclient talks to."
1011 :group 'ess-proc
1012 :type 'string)
1014 (make-variable-buffer-local 'inferior-ess-client-name)
1016 (defcustom inferior-ess-client-command nil
1017 "*ddeclient command sent to the ESS program."
1018 :group 'ess-proc
1019 :type '(choice (const nil) string))
1021 (make-variable-buffer-local 'inferior-ess-client-command)
1023 ;;;;; user settable defaults
1024 (defvar inferior-S-program-name inferior-S+3-program-name
1025 "*Program name for invoking an inferior ESS with S().")
1026 ;;- (setq inferior-S-program
1027 ;;- (cond ((string= S-proc-prefix "S") "Splus")
1028 ;;- ((string= S-proc-prefix "R") "R")
1029 ;;- (t "S")
1030 ;;- ))
1031 ;;(make-local-variable 'inferior-S-program)
1033 (defvar inferior-ess-program nil ;inferior-S-program-name
1034 "*Default program name for invoking inferior-ess().
1035 The other variables ...-program-name should be changed, for the
1036 corresponding program.")
1038 (make-variable-buffer-local 'inferior-ess-program)
1039 (setq-default inferior-ess-program inferior-S-program-name)
1042 (defvar inferior-ess-start-args ""
1043 "String of arguments passed to the ESS process.
1044 If you wish to pass arguments to a process, see e.g. `inferior-R-args'.")
1046 (defcustom inferior-ess-start-file nil
1047 "*File dumped into process, if non-nil."
1048 :group 'ess-proc
1049 :type '(choice (const nil) file))
1051 (defcustom inferior-ess-pager "cat"
1052 "*Pager to use for reporting help files and similar things."
1053 :group 'ess-proc
1054 :type 'string)
1056 (defcustom inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?"
1057 "Regular expression used by `ess-mode' to detect the primary prompt.
1058 Do not anchor to bol with `^'.")
1060 (make-variable-buffer-local 'inferior-ess-primary-prompt)
1061 (setq-default inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?")
1063 (defcustom inferior-ess-secondary-prompt "+ ?"
1064 "Regular expression used by ess-mode to detect the secondary prompt.
1065 (This is issued by S to continue an incomplete expression). Do not
1066 anchor to bol with `^'.")
1068 (make-variable-buffer-local 'inferior-ess-secondary-prompt)
1069 (setq-default inferior-ess-secondary-prompt "+ ?")
1071 ;;*;; Variables controlling interaction with the ESS process
1073 (defcustom ess-execute-in-process-buffer nil
1074 "*If non-nil, the ess-execute- commands output to the process buffer.
1075 Otherwise, they get their own temporary buffer."
1076 :group 'ess-proc
1077 :type 'boolean)
1079 (defcustom ess-eval-empty nil
1080 "*If non-nil, `ess-eval-line-and-step' and `ess-eval-linewise'
1081 will send empty lines to the ESS process."
1082 :group 'ess-proc
1083 :type 'boolean)
1085 (defcustom ess-eval-visibly-p t
1086 "*If non-nil, the ess-eval- commands display the text to be evaluated
1087 in the process buffer."
1088 :group 'ess-proc
1089 :type 'boolean)
1091 (defcustom ess-synchronize-evals nil
1092 "*If t, then all evaluations will synchronize with the ESS process. This
1093 means ess-mode will wait for S to dent a prompt before sending the next
1094 line of code. This allows users of Emacs version 18.57 or less to
1095 evaluate large regions of code without causing an error. Users of newer
1096 Emacsen usually do not want this feature, since it locks up use
1097 of Emacs until the code has been successfully evaluated."
1098 :group 'ess-proc
1099 :type 'boolean)
1101 (defcustom ess-eval-visibly-at-end t
1102 "*If non-nil, the ess-eval- commands display the results of evaluation
1103 at the bottom of the process buffer."
1104 :group 'ess-proc
1105 :type 'boolean)
1107 \f ; System variables
1109 ;;*;; Variables relating to multiple processes
1111 (defcustom ess-current-process-name nil
1112 "Name of the current S process."
1113 :group 'ess-proc
1114 :type '(choice (const nil) string))
1116 ;; defconst ess-local-process-name now done in S.el
1118 (defcustom ess-process-name-list nil
1119 "Alist of active ESS processes.")
1121 ;;*;; Inferior ESS commands
1123 (defcustom inferior-ess-load-command "source(\"%s\")\n"
1124 "Format-string for building the ess command to load a file.
1126 This format string should use %s to substitute a file name and should
1127 result in an ESS expression that will command the inferior ESS to load
1128 that file."
1129 :group 'ess-command
1130 :type 'string)
1132 (defcustom inferior-ess-dump-command "dump(\"%s\",file=\"%s\")\n"
1133 "Format-string for building the ess command to dump an object into a file.
1135 Use first %s to substitute an object name
1136 Use second %s to substitute the dump file name."
1137 :group 'ess-command
1138 :type 'string)
1140 (defcustom inferior-ess-help-command "help(\"%s\")\n"
1141 "Format-string for building the ESS command to ask for help on an object.
1143 This format string should use %s to substitute an object name."
1144 :group 'ess-command
1145 :type 'string)
1147 (make-variable-buffer-local 'inferior-ess-help-command)
1148 (setq-default inferior-ess-help-command "help(\"%s\")\n")
1150 (defcustom inferior-ess-exit-command "q()\n"
1151 "Format-string for building the ess command to exit.
1153 This format string should use %s to substitute an object name."
1154 :group 'ess-command
1155 :type 'string)
1157 (make-variable-buffer-local 'inferior-ess-exit-command)
1158 (setq-default inferior-ess-exit-command "q()\n")
1160 (defvar inferior-ess-search-list-command nil
1161 "`ess-language' command that prints out the search list;
1162 i.e. the list of directories and (recursive) objects that `ess-language' uses
1163 when it searches for objects.
1165 Really set in <ess-lang>-customize-alist in ess[dl]-*.el")
1166 ;; and hence made buffer-local via that scheme...
1168 (defcustom inferior-ess-names-command "names(%s)\n"
1169 "Format string for ESS command to extract names from an object.
1171 %s is replaced by the object name -- usually a list or data frame."
1172 :group 'ess-command
1173 :type 'string)
1175 (defcustom inferior-ess-get-prompt-command "options()$prompt\n"
1176 "Command to find the value of the current S prompt."
1177 :group 'ess-command
1178 :type 'string)
1180 (defvar ess-cmd-delay nil
1181 "*Set to a positive number if ESS will include delays proportional to
1182 `ess-cmd-delay' in some places. These delays are introduced to
1183 prevent timeouts in certain processes, such as completion.")
1184 (make-variable-buffer-local 'ess-cmd-delay)
1186 (defcustom ess-R-cmd-delay nil
1187 "used to initialize `ess-cmd-delay'."
1188 :group 'ess-command
1189 :type '(choice (const nil) number))
1191 (defcustom ess-S+-cmd-delay 1.0
1192 "used to initialize `ess-cmd-delay'."
1193 :group 'ess-command
1194 :type '(choice (const nil) number))
1196 ;;*;; Regular expressions
1198 (defvar inferior-ess-prompt nil
1199 "The regular expression inferior ess mode uses for recognizing prompts.
1200 Constructed at run time from `inferior-ess-primary-prompt' and
1201 `inferior-ess-secondary-prompt' within `inferior-ess-mode'.")
1203 (make-variable-buffer-local 'inferior-ess-prompt)
1205 (defvar ess-change-sp-regexp ""
1206 "The regexp for matching the S/R/.. commands that change the search path.")
1207 (make-variable-buffer-local 'ess-change-sp-regexp)
1209 (defcustom ess-S+-change-sp-regexp
1210 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|module(\\|source(\\)"
1211 "The regexp for matching the S-plus commands that change the search path."
1212 :group 'ess-proc
1213 :type 'regexp)
1215 (defcustom ess-S-change-sp-regexp
1216 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)"
1217 "The regexp for matching the S commands that change the search path."
1218 :group 'ess-proc
1219 :type 'regexp)
1221 (defcustom ess-R-change-sp-regexp
1222 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)"
1223 "The regexp for matching the R commands that change the search path."
1224 :group 'ess-proc
1225 :type 'regexp)
1228 ;;*;; Process-dependent variables
1230 (defvar ess-search-list nil
1231 "Cache of list of directories and objects to search for ESS objects.")
1233 (make-variable-buffer-local 'ess-search-list)
1235 (defvar ess-sl-modtime-alist nil
1236 "Alist of modification times for all ess directories accessed this
1237 session.")
1239 (make-variable-buffer-local 'ess-sl-modtime-alist)
1241 (defvar ess-sp-change nil
1242 "This symbol flags a change in the ess search path.")
1244 (make-variable-buffer-local 'ess-sp-change)
1246 (defvar ess-prev-load-dir/file nil
1247 "This symbol saves the (directory . file) pair used in the last
1248 `ess-load-file' command. Used for determining the default in the next one.")
1250 (make-variable-buffer-local 'ess-prev-load-dir/file)
1252 (defvar ess-object-list nil
1253 ;; This is a list of the currently known object names. It is
1254 ;; current only for one command entry; it exists under the
1255 ;; assumption that the list of objects doesn't change while entering
1256 ;; a command.
1257 "Cache of object names")
1259 (make-variable-buffer-local 'ess-object-list)
1261 ;;*;; Miscellaneous system variables
1263 (defvar ess-temp-point nil
1264 "Variable used to retain a buffer position past let or let*.")
1266 (defvar ess-mode-map nil
1267 "Keymap for `ess-mode'.")
1269 (defvar ess-eval-map nil
1270 "Keymap for ess-eval functions.")
1272 (defvar inferior-ess-mode-map nil
1273 "Keymap for `inferior-ess' mode.")
1275 (defvar ess-mode-minibuffer-map nil)
1277 ;; SJE: Wed 29 Dec 2004 - following 3 ess-object* variables can be removed
1278 ;; soon if no-one needs the completion code.
1279 (defvar ess-object-name-db-file "ess-namedb"
1280 "File containing definitions for `ess-object-name-db'.")
1282 (defvar ess-object-name-db-file-loaded '()
1283 "List of programs whose name-db file has been loaded.")
1285 (defvar ess-object-name-db nil
1286 "Alist of lists of object names, with directory names as keys.
1287 The file ess-namedb.el is loaded (if it exists) to define this variable.
1288 See also function `ess-create-object-name-db'.")
1290 (make-variable-buffer-local 'ess-object-name-db)
1291 (setq-default ess-object-name-db nil)
1293 (defcustom ess-S-loop-timeout 2000000
1294 "Integer specifying how many loops ess-mode will wait for the prompt
1295 before signaling an error. Will be set to `ess-loop-timeout' in the S dialects'
1296 alists. Increase this, if you have a fast(er) machine."
1297 :group 'ess-proc
1298 :type 'integer)
1300 (defcustom ess-XLS-loop-timeout 50000
1301 "Integer specifying how many loops ess-mode will wait for the prompt
1302 before signaling an error. Will be set to `ess-loop-timeout' in the XLispStat
1303 dialects' alists. Increase this, if you have a fast(er) machine."
1304 :group 'ess-proc
1305 :type 'integer)
1307 ;; NOTA BENE: Other languages/dialect currently set `ess-loop-timeout'
1308 ;; **directly** in their essd-*.el alist !!
1310 ;;;*;;; Font-lock support
1312 ;;; for programming, transcript, and inferior process modes.
1314 (defcustom inferior-ess-font-lock-input t
1315 "*If non-nil, input is syntactically font-locked.
1316 If nil, input is in the `font-lock-variable-name-face'."
1317 :group 'ess
1318 :type 'boolean)
1320 (defvar ess-R-constants
1321 '("TRUE" "FALSE" "NA" "NULL" "Inf" "NaN"))
1323 (defvar ess-S-constants
1324 (append ess-R-constants '("T" "F")))
1326 ;; first the common ones
1327 (defvar ess-S-modifyiers
1328 '("library" "attach" "detach" "source" "module"))
1329 (defvar ess-R-modifyiers
1330 '("library" "attach" "detach" "source" "require"))
1332 (defvar ess-R-keywords
1333 '("while" "for" "in" "repeat" "if" "else" "switch" "break" "next"
1334 "function" "return" "message" "warning" "stop"))
1335 (defvar ess-S-keywords
1336 (append ess-R-keywords '("terminate")))
1338 (defvar ess-R-message-prefixes
1339 '("Error:" "Error in"
1340 "Warning:" "Warning in"
1341 "Warning messages?"))
1342 (defvar ess-S-message-prefixes
1343 (append ess-R-message-prefixes
1344 '("Syntax error:" "Dumped")))
1347 (defvar ess-R-assign-ops
1348 '("<<-" "<-" "->") ; don't want "=" here which is not only for assign
1350 (defvar ess-S-assign-ops
1351 '("<<-" "<-" "_" "->") ; don't want "=" here which is not only for assign
1354 (defvar ess-R-function-name-regexp
1355 (concat "\\s\"?\\(\\(\\sw\\|\\s_\\)+"
1356 "\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\)"
1357 "\\(\\s-\\|\n\\)*function")
1359 (defvar ess-S-function-name-regexp
1360 ess-R-function-name-regexp ; since "_" is deprecated for S-plus as well
1364 (defvar ess-R-mode-font-lock-keywords
1365 (list
1366 (cons (regexp-opt ess-R-assign-ops)
1367 'font-lock-reference-face) ; assign
1368 (cons (concat "\\<" (regexp-opt ess-R-constants 'enc-paren) "\\>")
1369 'font-lock-type-face) ; constants
1370 (cons (concat "\\<" (regexp-opt ess-R-modifyiers 'enc-paren) "\\>")
1371 'font-lock-reference-face) ; modify search list or source
1372 ; new definitions
1373 (cons (concat "\\<" (regexp-opt ess-R-keywords 'enc-paren) "\\>")
1374 'font-lock-keyword-face) ; keywords
1375 (cons ess-R-function-name-regexp
1376 '(1 font-lock-function-name-face t))
1377 ; function name
1379 "Font-lock patterns used in `R-mode' buffers.")
1381 (defvar ess-S-mode-font-lock-keywords
1382 (list
1383 (cons (regexp-opt ess-S-assign-ops)
1384 'font-lock-reference-face) ; assign
1385 (cons (concat "\\<" (regexp-opt ess-S-constants 'enc-paren) "\\>")
1386 'font-lock-type-face) ; constants
1387 (cons (concat "\\<" (regexp-opt ess-S-modifyiers 'enc-paren) "\\>")
1388 'font-lock-reference-face) ; modify search list or source
1389 ; new definitions
1390 (cons (concat "\\<" (regexp-opt ess-S-keywords 'enc-paren) "\\>")
1391 'font-lock-keyword-face) ; keywords
1392 (cons ess-S-function-name-regexp
1393 '(1 font-lock-function-name-face t))
1394 ; function name
1396 "Font-lock patterns used in `S-mode' buffers.")
1401 (defvar inferior-ess-R-font-lock-keywords
1402 (append
1403 '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1405 (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1406 (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1407 '(1 font-lock-variable-name-face keep t))) )
1409 ess-R-mode-font-lock-keywords
1411 (list
1412 (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face); ess-mode msg
1413 (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1414 (cons (concat "^" (regexp-opt ess-R-message-prefixes 'enc-paren))
1415 'font-lock-reference-face) ; inferior-ess problems or errors
1416 (cons "#" 'font-lock-comment-face) ; comment
1417 (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1419 "Font-lock patterns used in inferior-R-mode buffers.")
1421 (defvar inferior-ess-S-font-lock-keywords
1422 (append
1423 '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1425 (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1426 (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1427 '(1 font-lock-variable-name-face keep t))) )
1429 ess-S-mode-font-lock-keywords
1431 (list
1432 (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face) ; ess-mode msg
1433 (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1434 (cons (concat "^" (regexp-opt ess-S-message-prefixes 'enc-paren))
1435 'font-lock-reference-face) ; inferior-ess problems or errors
1436 (cons "#" 'font-lock-comment-face) ; comment
1437 (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1439 "Font-lock patterns used in inferior-S-mode buffers.")
1441 ;; use the inferior-* ones directly in ess-trns.el
1442 ;; (defvar ess-trans-font-lock-keywords
1443 ;; inferior-ess-font-lock-keywords
1444 ;; "Font-lock patterns used in `ess-transcript-mode' buffers.")
1447 ;;;*;;; ess-help variables
1449 \f ; ess-help-mode
1450 ;; This will never need to be loaded independently of any of the other
1451 ;; modules, but they can all call it so we may as well put it here.
1453 ;;*;; Variables relating to ess-help-mode
1455 (defcustom ess-help-own-frame nil
1456 "*Controls whether ESS help buffers should start in a different frame.
1458 Possible values are:
1459 nil: Display help in current frame.
1460 'one: All help buffers are shown in one dedicated frame.
1461 t: Each help buffer gets its own frame.
1463 The parameters of this frame are stored in `ess-help-frame-alist'.
1464 See also `inferior-ess-own-frame'."
1465 :group 'ess-help
1466 :type '(choice (const nil) (const one) (const t)))
1468 (defcustom ess-help-frame-alist special-display-frame-alist
1469 "*Alist of frame parameters used to create help frames.
1470 This defaults to `special-display-frame-alist' and is used only when
1471 the variable `ess-help-own-frame' is non-nil."
1472 :group 'ess-help
1473 :type 'alist)
1476 \f ; User changeable variables
1477 ;;;=====================================================
1478 ;;; Users note: Variables with document strings starting
1479 ;;; with a * are the ones you can generally change safely, and
1480 ;;; may have to upon occasion.
1482 (defcustom ess-help-kill-bogus-buffers nil
1483 "*If non-nil, kill ESS help buffers immediately if they are \"bogus\"."
1484 :group 'ess-help
1485 :type 'boolean)
1487 (defvar ess-help-form 'separate-buffer
1488 "*Place to show help. NOT IMPLEMENTED YET.
1489 Choices are `separate-buffer', `s-process', `www'. The latter uses
1490 `browse-url' to find the location.")
1492 ;; WWW Help NOT included yet. Be patient.
1493 (defvar ess-help-w3-url-prefix "http://pyrite.cfas.washington.edu/ESS/R/"
1494 "*Head URL for finding function help.")
1496 (defvar ess-help-w3-url-funs "funs/"
1497 "Place to find functions.")
1500 \f ; System variables
1501 ;;;=====================================================
1502 ;;; Users note: You will rarely have to change these
1503 ;;; variables.
1505 ;;*;; Variables relating to ess-help-mode
1507 ;;-- ess-help-S-.. and ess-help-R-.. : in essl-s.el (are used in ess-inf).
1509 (defvar ess-help-sec-keys-alist nil
1510 "Alist of (key . string) pairs for use in section searching.")
1512 (defvar ess-help-sec-regex nil
1513 "Reg(ular) Ex(pression) of section headers in help file")
1515 (make-variable-buffer-local 'ess-help-sec-keys-alist)
1516 (make-variable-buffer-local 'ess-help-sec-regex)
1519 \f ; ess-mode: editing S source
1521 ;;; This syntax table is required by ess-mode.el, ess-inf.el and
1522 ;;; ess-trans.el, so we provide it here.
1523 (defvar ess-mode-syntax-table nil "Syntax table for `ess-mode'.")
1524 (make-variable-buffer-local 'ess-mode-syntax-table)
1527 \f ; Buffer local customization stuff
1529 (defvar ess-source-modes '(ess-mode)
1530 "A list of modes used to determine if a buffer contains ess source code.")
1531 ;;; If a file is loaded into a buffer that is in one of these major modes, it
1532 ;;; is considered an ess source file. The function ess-load-file uses this to
1533 ;;; determine defaults.
1535 (defcustom ess-error-buffer-name "*ESS-errors*"
1536 "Name of buffer to keep process error messages in.
1537 Created for each process."
1538 :group 'ess-proc
1539 :type 'string)
1541 (defcustom ess-verbose nil
1542 "if non-nil, write more information to `ess-dribble-buffer' than usual."
1543 :group 'ess-proc
1544 :type 'boolean)
1546 (defvar ess-dribble-buffer (generate-new-buffer "*ESS*")
1547 "Buffer for temporary use for setting default variable values.
1548 Used for recording status of the program, mainly for debugging.")
1550 (defvar ess-customize-alist nil
1551 "Variable settings to use for proper behavior.
1552 Not buffer local!")
1554 (defvar ess-local-customize-alist nil
1555 "Buffer local settings for proper behavior.
1556 Used to store the values for passing on to newly created buffers.")
1558 (make-variable-buffer-local 'ess-local-customize-alist)
1560 (defvar ess-mode-editing-alist nil
1561 "Variable settings for ess-mode.")
1563 (defvar ess-transcript-minor-mode nil
1564 "Non-nil if using `ess-transcript-mode' as a minor mode of some other mode.")
1566 (make-variable-buffer-local 'ess-transcript-minor-mode)
1568 (defvar ess-listing-minor-mode nil
1569 "Non-nil if using ess-listing-minor-mode.")
1571 (make-variable-buffer-local 'ess-listing-minor-mode)
1573 (provide 'ess-cust)
1575 \f ; Local variables section
1577 ;;; This file is automatically placed in Outline minor mode.
1578 ;;; The file is structured as follows:
1579 ;;; Chapters: ^L ;
1580 ;;; Sections: ;;*;;
1581 ;;; Subsections: ;;;*;;;
1582 ;;; Components: defuns, defvars, defconsts
1583 ;;; Random code beginning with a ;;;;* comment
1585 ;;; Local variables:
1586 ;;; mode: emacs-lisp
1587 ;;; mode: outline-minor
1588 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
1589 ;;; End:
1591 ;;; ess-cust.el ends here