ESS[SAS]: somebody forgot about the SUM statement (probably me)
[ess.git] / lisp / ess-cust.el
blob258db6808150b61f4cf9e3c3fe2dbc7ae3c72b0b
1 ;;; ess-cust.el --- Customize variables for ESS
3 ;; Copyright (C) 1997--2006 A.J. Rossini, Rich M. Heiberger, Martin
4 ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6 ;; Original Author: A.J. Rossini <blindglobe@gmail.com>
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 (require 'ess-emcs); for 'xemacs feature
39 (condition-case ()
40 (require 'custom)
41 (error nil))
42 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
43 nil ;; We've got what we needed
44 ;; We have the old custom-library, hack around it!
45 (defmacro defgroup (&rest args)
46 nil)
47 (defmacro defface (var values doc &rest args)
48 (` (make-face (, var))))
49 (defmacro defcustom (var value doc &rest args)
50 (` (defvar (, var) (, value) (, doc))))))
52 ;; Customization Groups
54 (defgroup ess nil
55 "ESS: Emacs Speaks Statistics."
56 :group 'local)
58 (defgroup ess-edit nil
59 "ESS: editing behavior, including coments/indentation."
60 :group 'ess
61 :prefix "ess-")
63 (defgroup ess-proc nil
64 "ESS: process control."
65 :group 'ess
66 :prefix "ess-")
68 (defgroup ess-command nil
69 "ESS: Commands for various things."
70 :group 'ess
71 :prefix "ess-")
73 (defgroup ess-help nil
74 "ESS: help functions."
75 :group 'ess
76 :prefix "ess-")
78 (defgroup ess-hooks nil
79 "ESS: hooks for customization."
80 :group 'ess
81 :prefix "ess-")
83 (defgroup ess-S nil
84 "ESS: S Languages."
85 :group 'ess
86 :prefix "ess-")
88 (defgroup ess-origS nil
89 "ESS: Original S Dialect from Bell Labs/AT&T."
90 :group 'ess-S
91 :prefix "ess-")
93 (defgroup ess-SPLUS nil
94 "ESS: S-PLUS Dialect of S."
95 :group 'ess-S
96 :prefix "ess-")
98 (defgroup ess-R nil
99 "ESS: R Dialect of S."
100 :group 'ess-S
101 :prefix "ess-")
103 (defgroup ess-sas nil
104 "ESS: SAS."
105 :group 'ess
106 :prefix "ess-")
108 (defgroup ess-Stata nil
109 "ESS: Stata."
110 :group 'ess
111 :prefix "ess-")
113 (defgroup ess-XLS nil
114 "ESS: XLispStat."
115 :group 'ess
116 :prefix "ess-")
118 (defgroup ess-OMG nil
119 "ESS: Omegahat."
120 :group 'ess
121 :prefix "ess-")
123 (defgroup ess-mouse nil ;; FIXME: this is not used yet <--> ./ess-mous.el
124 "ESS: Mouse."
125 :group 'ess
126 :prefix "ess-")
128 ;; Variables (not user-changeable)
130 (defvar ess-version "5.3.7"
131 "Version of ESS currently loaded.")
133 (defvar no-doc
134 "This function is part of ESS, but has not yet been loaded.
135 Full documentation will be available after autoloading the function."
136 "Documentation for autoload functions.")
139 \f ; User changeable variables
141 ;;; Common user changeable variable are described and documented in
142 ;;; ess-site.el. Please check there first!
143 ;;;=====================================================
144 ;;; In general: Variables with document strings starting with a * are
145 ;;; the ones you can generally change safely, and may have to upon
146 ;;; occasion.
148 ;;*;; Options and Initialization
150 ;; Menus and pulldowns.
152 (defcustom ess-funcmenu-use-p (fboundp 'func-menu)
153 "Non-nil means use func-menu."
154 :group 'ess
155 :type 'boolean)
157 (defcustom ess-speedbar-use-p (fboundp 'speedbar)
158 "Non-nil means use speedbar."
159 :group 'ess
160 :type 'boolean)
162 (defcustom ess-imenu-use-p (fboundp 'imenu)
163 "Non-nil means use imenu facility.
164 This value can be overridden by mode-specific variables, such
165 as `ess-imenu-use-S'."
166 :group 'ess
167 :type 'boolean)
171 (defcustom ess-ask-for-ess-directory t
172 "*Non-nil means request the process directory each time S is run."
173 :group 'ess
174 :type 'boolean)
176 (defcustom ess-ask-about-transfile nil
177 "*Non-nil means ask about a transcript file before running ESS."
178 :group 'ess
179 :type 'boolean)
181 (defcustom ess-display-buffer-reuse-frames t
182 "*Non-nil means \[[display-buffer] reuses existing frames; see
183 `display-buffer-reuse-frames'."
184 :group 'ess
185 :type 'boolean)
187 (defcustom ess-language nil
188 "*Prefix of all ESS processes, and defines the dialect in use.
189 Currently acceptable values are `S', `XLS', `SAS'.
190 Can be changed, e.g., to `R'. Use `setq-default' if setting it in
191 .emacs (also see ess-site.el)."
192 :group 'ess
193 :type '(choice (const :tag "Initial" :value "Initial")
194 (const :tag "S" :value "S")
195 (const :tag "XLS" :value "XLS")
196 (const :tag "SAS" :value "SAS")
197 (const :tag "R" :value "R")))
199 (make-variable-buffer-local 'ess-language)
200 (setq-default ess-language "Initial")
202 (defvar ess-dialect nil
203 "String version of the dialect being run for the inferior process.
204 This, plus `ess-language', should be able to determine the exact
205 version of the statistical package being executed in the particular
206 buffer.
208 Current values could include:
209 for `ess-dialect' = S3, S4, Sp3, Sp4, Sp5, Sp6, R, XLS, SAS, STA
211 Used to adjust for changes in versions of the program.")
213 (make-variable-buffer-local 'ess-dialect)
214 ;;(setq-default ess-dialect "Initial-dialect")
215 (setq-default ess-dialect nil)
216 ;;; SJE -- why use "Initial-dialect"? If we use nil, it matches "None"
217 ;;; in the custom choice.
219 ;; (defcustom ess-etc-directory
220 ;; (expand-file-name (concat ess-lisp-directory "/../etc/"))
221 ;; "*Location of the ESS etc/ directory.
222 ;; The ESS etc directory stores various auxillary files that are useful
223 ;; for ESS, such as icons."
224 ;; :group 'ess
225 ;; :type 'directory)
227 (defcustom ess-directory-function nil
228 "*Function to return the directory that ESS is run from.
229 If nil or if the function returns nil then you get `ess-directory'."
230 :group 'ess
231 :type '(choice (const nil) function))
233 (defcustom ess-setup-directory-function nil
234 "*Function to setup the directory that ESS is run from.
235 This function can be called to set environment variables or to create
236 a workspace."
237 :group 'ess
238 :type '(choice (const nil) function))
240 (defcustom ess-directory nil
241 "*The directory ESS is run from. It must end in a slash.
242 Provided as a default if `ess-ask-for-ess-directory' is non-nil.
243 A nil value means use the current buffer's default directory.
244 Buffer-local: in process buffers, this contains the directory ESS was
245 run from."
246 :group 'ess
247 :type '(choice (const nil) directory))
249 (defcustom ess-history-directory nil
250 "*Directory to pick up `ess-history-file' from.
251 If this is nil, the history file is relative to `ess-directory'."
252 :group 'ess
253 :type '(choice (const nil) directory))
255 (defcustom ess-history-file nil
256 "*File to pick up history from.
257 If this is a relative file name, it is relative to `ess-history-directory'."
258 :group 'ess
259 :type '(choice (const nil) file))
261 (defcustom ess-plain-first-buffername t
262 "*No fancy process buffname for the first process of each type (novice mode)."
263 :group 'ess
264 :type 'boolean)
267 (defcustom ess-use-inferior-program-name-in-buffer-name nil
268 "*For R, use e.g., 'R-2.1.0' or 'R-devel' (the program name) for buffer name.
269 Avoids the plain dialect name."
270 :group 'ess
271 :type 'boolean)
274 (defcustom ess-S-assign " <- "
275 "*String to be used for left assignment in all S dialects.
276 Used by \\[ess-smart-underscore]."
277 :group 'ess-S
278 :type 'string)
280 ;;*;; Variables concerning editing behaviour
282 (defcustom ess-filenames-map t
283 "Declares if the filenames in an attached directory are the same
284 as objects in that directory (when t). This is not true for DOS and
285 other OS's with limited filename lengths. Even if this is set
286 incorrectly, the right things will probably still happen, however."
287 :group 'ess-edit
288 :type 'boolean)
290 ;;; SJE -- this is set in ess-site.el to be "always", so I changed
291 ;;; value t to be "always", so that ess-site.el does not need editing.
292 ;;; However, this is a bit messy, and would be nicer if ess-site.el
293 ;;; value was t rather than "always".
294 (defcustom ess-keep-dump-files 'ask
295 "*Variable controlling whether to delete dump files after a successful load.
296 If nil: always delete. If `ask', confirm to delete. If `check', confirm
297 to delete, except for files created with ess-dump-object-into-edit-buffer.
298 Anything else, never delete. This variable only affects the behaviour
299 of `ess-load-file'. Dump files are never deleted if an error occurs
300 during the load. "
301 :group 'ess-edit
302 :type '(choice (const :tag "Check" :value 'check)
303 (const :tag "Ask" :value 'ask)
304 (const :tag "Always keep" :value "always")
305 (const :tag "Always delete" :value nil)
309 (defcustom ess-delete-dump-files nil
310 "*Non-nil means delete dump files after they are created.
311 This applies to dump files created with
312 `ess-dump-object-into-edit-buffer', only.
314 Boolean flag which determines what to do with the dump files
315 generated by \\[ess-dump-object-into-edit-buffer], as follows:
317 If nil: dump files are deleted after each use, and so appear
318 only transiently. The one exception to this is when a loading error
319 occurs, in which case the file is retained until the error is
320 corrected and the file re-loaded.
322 If non-nil: dump files are not deleted, and backups are kept
323 as usual. This provides a simple method for keeping an archive of S
324 functions in text-file form.
326 Auto-save is always enabled in dump-file buffers to enable recovery
327 from crashes.
329 This is useful to prevent sources file being created for objects
330 you don't actually modify. Once the buffer is modified and saved
331 however, the file is not subsequently unless `ess-keep-dump-files' is
332 nil, and the file is successfully loaded back into S."
333 :group 'ess-edit
334 :type 'boolean)
336 ;;; From ess-mode:
338 (defcustom ess-mode-silently-save t
339 "*Non-nil means automatically save ESS source buffers before loading."
340 :group 'ess-edit
341 :type 'boolean)
343 ;;*;; Variables controlling editing
345 ;;;*;;; Edit buffer processing
346 (defcustom ess-function-template " <- function( )\n{\n\n}\n"
347 "If non-nil, function template used when editing nonexistent objects.
349 The edit buffer will contain the object name in quotes, followed by
350 this string. Point will be placed after the first parenthesis or
351 bracket."
352 :group 'ess-edit
353 :type 'string)
355 ;;; By K.Shibayama 5.14.1992
356 ;;; Setting any of the following variables in your .emacs is equivalent
357 ;;; to modifying the DEFAULT style.
359 ;;;*;;; Indentation parameters
361 (defcustom ess-auto-newline nil
362 "*Non-nil means automatically newline before and after braces
363 inserted in S code."
364 :type 'boolean
365 :group 'ess-edit)
367 (defcustom ess-tab-always-indent t
368 "*Non-nil means TAB in S mode should always reindent the current line,
369 regardless of where in the line point is when the TAB command is used."
370 :type 'boolean
371 :group 'ess-edit)
373 (defcustom ess-indent-level 2
374 "*Indentation of S statements with respect to containing block."
375 :type 'integer
376 :group 'ess-edit)
378 (defcustom ess-brace-imaginary-offset 0
379 "*Imagined indentation of an open brace following a statement."
380 :type 'integer
381 :group 'ess-edit)
383 (defcustom ess-brace-offset 0
384 "*Extra indentation for open braces.
385 Compares with other text in same context."
386 :type 'integer
387 :group 'ess-edit)
389 (defcustom ess-continued-statement-offset 2
390 "*Extra indent for lines not starting new statements."
391 :type 'integer
392 :group 'ess-edit)
394 (defcustom ess-continued-brace-offset 0
395 "*Extra indent for substatements that start with open-braces.
396 This is in addition to ess-continued-statement-offset."
397 :type 'integer
398 :group 'ess-edit)
400 (defcustom ess-arg-function-offset 2
401 "*Extra indent for internal substatements of function `foo' that called
402 in `arg=foo(...)' form.
403 If not number, the statements are indented at open-parenthesis following foo."
404 :type 'integer
405 :group 'ess-edit)
407 ;;added rmh 2Nov97 at request of Terry Therneau
408 (defcustom ess-close-brace-offset 0
409 "*Extra indentation for closing braces."
410 :type 'integer
411 :group 'ess-edit)
413 ;;added rmh 2Nov97 at request of Terry Therneau
414 (defcustom ess-fancy-comments t
415 "*Non-nil means distiguish between #, ##, and ### for indentation."
416 :type 'boolean
417 :group 'ess-edit)
420 ;; PeterDalgaard, 1Apr97 :
421 ;;The default ess-else-offset should be 0, not 2 IMHO (try looking at
422 ;;the ls() function, for instance). Was 2.
423 (defcustom ess-else-offset 0
424 "*Extra indent for `else' lines."
425 :type 'integer
426 :group 'ess-edit)
428 (defcustom ess-expression-offset 4
429 "*Extra indent for internal substatements of `expression' that specified
430 in `obj <- expression(...)' form.
431 If not number, the statements are indented at open-parenthesis following
432 `expression'."
433 :type 'integer
434 :group 'ess-edit)
436 ;;;*;;; Editing styles
438 ;;; **FIXME** The following NEEDS to be customized.
439 ;; SJE: I disagree; this variable should not be customized; individual vars,
440 ;; such as ess-indent-level are already customizable.
441 (defvar ess-default-style-list
442 (list 'DEFAULT
443 (cons 'ess-indent-level ess-indent-level)
444 (cons 'ess-continued-statement-offset ess-continued-statement-offset)
445 (cons 'ess-brace-offset ess-brace-offset)
446 (cons 'ess-expression-offset ess-expression-offset)
447 (cons 'ess-else-offset ess-else-offset)
448 (cons 'ess-brace-imaginary-offset ess-brace-imaginary-offset)
449 (cons 'ess-continued-brace-offset ess-continued-brace-offset)
450 (cons 'ess-arg-function-offset ess-arg-function-offset)
451 (cons 'ess-close-brace-offset ess-close-brace-offset))
452 "Default style constructed from initial values of indentation variables.")
454 (defvar ess-style-alist
455 (cons ess-default-style-list
456 '((GNU (ess-indent-level . 2)
457 (ess-continued-statement-offset . 2)
458 (ess-brace-offset . 0)
459 (ess-arg-function-offset . 4)
460 (ess-expression-offset . 2)
461 (ess-else-offset . 0)
462 (ess-close-brace-offset . 0))
463 (BSD (ess-indent-level . 8)
464 (ess-continued-statement-offset . 8)
465 (ess-brace-offset . -8)
466 (ess-arg-function-offset . 0)
467 (ess-expression-offset . 8)
468 (ess-else-offset . 0)
469 (ess-close-brace-offset . 0))
470 (K&R (ess-indent-level . 5)
471 (ess-continued-statement-offset . 5)
472 (ess-brace-offset . -5)
473 (ess-arg-function-offset . 0)
474 (ess-expression-offset . 5)
475 (ess-else-offset . 0)
476 (ess-close-brace-offset . 0))
477 (C++ (ess-indent-level . 4)
478 (ess-continued-statement-offset . 4)
479 (ess-brace-offset . -4)
480 (ess-arg-function-offset . 0)
481 (ess-expression-offset . 4)
482 (ess-else-offset . 0)
483 (ess-close-brace-offset . 0))
484 ;; R added ajr 17Feb04 to match "common R" use
485 (RRR (ess-indent-level . 4)
486 (ess-continued-statement-offset . 4)
487 (ess-brace-offset . 0)
488 (ess-arg-function-offset . 4)
489 (ess-expression-offset . 4)
490 (ess-else-offset . 0)
491 (ess-close-brace-offset . 0))
492 ;; CLB added rmh 2Nov97 at request of Terry Therneau
493 (CLB (ess-indent-level . 2)
494 (ess-continued-statement-offset . 4)
495 (ess-brace-offset . 0)
496 (ess-arg-function-offset . 0)
497 (ess-expression-offset . 4)
498 (ess-else-offset . 0)
499 (ess-close-brace-offset . 2))))
500 "Predefined formatting styles for ESS code.
501 Values for all groups, except DEFAULT, are fixed.
502 To change the value of variables in the DEFAULT group, change
503 the corresponding variables, e.g. `ess-indent-level'.
504 The default style in use is controlled by `ess-default-style'.")
506 (defcustom ess-default-style 'DEFAULT
507 "*The default value of `ess-style'.
508 See the variable `ess-style-alist' for how these groups (DEFAULT,
509 GNU, BSD, ...) map onto different settings for variables."
510 :type '(choice (const DEFAULT)
511 (const GNU)
512 (const BSD)
513 (const K&R)
514 (const C++)
515 (const :tag "Common R" :value 'RRR)
516 (const CLB))
517 :group 'ess-edit)
519 ;; the real setting of this happens via <foo>-editing-alist:
520 (defvar ess-style ess-default-style
521 "*The buffer specific ESS indentation style.")
523 ;;*;; Variables controlling behaviour of dump files
525 (defcustom ess-source-directory
526 (if ess-microsoft-p (getenv "TEMP") "/tmp/")
527 "*Directory in which to place dump files.
528 This can be a string (an absolute directory name ending in a slash) or
529 a lambda expression of no arguments which will return a suitable string
530 value. The lambda expression is evaluated with the process buffer as the
531 current buffer.
533 Possible value:
535 '(lambda () (file-name-as-directory
536 (expand-file-name (concat (car ess-search-list) \"/.Src\"))))
538 This always dumps to a sub-directory (\".Src\") of the current ess
539 working directory (i.e. first elt of search list)."
540 :group 'ess-edit
541 :type 'directory)
544 (defcustom ess-dump-filename-template-proto (concat (user-login-name) ".%s.S")
545 "*Prototype template for filenames of dumped objects.
546 The ending `S' is replaced by the current \\[ess-suffix], to give
547 \\[ess-dump-filename-template] when an inferior ESS process starts.
549 By default, gives filenames like `user.foofun.S', so as not to clash with
550 other users if you are using a shared directory. Other alternatives:
551 \"%s.S\" ; Don't bother uniquifying if using your own directory(ies)
552 \"dumpdir\"; Always dump to a specific filename. This makes it impossible
553 to edit more than one object at a time, though.
554 (make-temp-name \"scr.\") ; Another way to uniquify"
555 ;; MM: The last 3-4 lines above suck (I don't understand them) -- FIXME --
557 :group 'ess-edit
558 :type 'string)
561 ;;*;; Hooks
563 (defcustom ess-mode-hook nil
564 "*Hook for customizing ESS each time it is entered."
565 :group 'ess-hooks
566 :type 'hook)
568 (defcustom ess-mode-load-hook nil
569 "*Hook to call when ess.el is loaded."
570 :group 'ess-hooks
571 :type 'hook)
573 (defcustom ess-pre-run-hook nil
574 "*Hook to call before starting up ESS.
575 Good for setting up your directory."
576 :group 'ess-hooks
577 :type 'hook)
579 (defcustom ess-post-run-hook nil
580 "*Hook to call just after the ESS process starts up.
581 Good for evaluating ESS code."
582 :group 'ess-hooks
583 :type 'hook)
585 (defcustom inferior-ess-mode-hook nil
586 "*Hook for customizing inferior ESS mode. Called after
587 `inferior-ess-mode' is entered and variables have been initialised."
588 :group 'ess-hooks
589 :type 'hook)
591 ;;; make it possible to save an inferior-ess-mode buffer without losing
592 ;;; the connection to the running ESS process.
593 (put 'inferior-ess-mode 'mode-class 'special)
594 ;; FIXME AJR: Should the above be there? I don't think so!
595 ;; MM : the functionality should be, right? Move statement to ./ess.el ?
596 ;; AJR: No, we should move the statement to ./ess-inf.el
598 (defcustom ess-help-mode-hook nil
599 "Functions to call when entering `ess-help-mode'."
600 :group 'ess-hooks
601 :type 'hook)
603 (defcustom ess-send-input-hook nil
604 "Hook called just before line input is sent to the process."
605 :group 'ess-hooks
606 :type 'hook)
608 (defcustom ess-transcript-mode-hook nil
609 "Hook for customizing ESS transcript mode."
610 :group 'ess-hooks
611 :type 'hook)
613 (defcustom Rnw-mode-hook nil
614 "Hook run when entering Rnw mode."
615 :type 'hook
616 :group 'ess-R)
619 (defcustom ess-pdf-viewer-pref nil
620 "External pdf viewer you like to use from ESS.
621 If nil, will use getOption(\"pdfviewer\") in R, and try finding one
622 from a list."
623 :type '(choice (const nil) string)
624 :group 'ess)
626 (defcustom ess-ps-viewer-pref nil
627 "External PostScript viewer you like to use from ESS.
628 If nil, ESS will try finding one from a list."
629 :type '(choice (const nil) string)
630 :group 'ess)
633 \f ; System variables
635 ;; SJE -- this should not be defcustom - user does not set it.
636 (defvar ess-local-process-name nil
637 "The name of the ESS process associated with the current buffer.")
638 (make-variable-buffer-local 'ess-local-process-name)
640 (defcustom ess-kermit-command "gkermit -T"
641 "*Kermit command invoked by `ess-kermit-get' and `ess-kermit-send'."
642 :group 'ess
643 :type 'string)
645 (defcustom ess-kermit-prefix "#"
646 "*String files must begin with to use kermit file transfer."
647 :group 'ess
648 :type 'string)
650 (defcustom ess-kermit-remote-directory "."
651 "*Buffer local variable that designates remote directory of file."
652 :group 'ess
653 :type 'string)
654 (make-variable-buffer-local 'ess-kermit-remote-directory)
656 ;;*;; Regular expressions
658 ;; -- Note: Some variables not-to-customize moved to ./ess-mode.el :
659 ;; ess-set-function-start
661 ;; Fixme: the following is just for S dialects :
662 (defcustom ess-dumped-missing-re
663 "\\(<-\nDumped\n\\'\\)\\|\\(<-\\(\\s \\|\n\\)*\\'\\)"
664 "If a dumped object's buffer matches this re, then it is replaced
665 by `ess-function-template'."
666 :group 'ess
667 :type 'regexp)
669 (defcustom ess-dump-error-re
670 (if (string= ess-language "S") "\nDumped\n\\'"
671 "[Ee]rror")
672 "Regexp used to detect an error when loading a file."
673 :group 'ess
674 :type 'regexp)
676 ;;;; This is tested for S dialects (actually only for R) -- be careful with it!
677 (defvar ess-help-arg-regexp "\\(['\"]?\\)\\([^,=)'\"]*\\)\\1"
678 "Reg(ular) Ex(pression) of help(.) arguments. MUST: 2nd \\(.\\) = arg.")
680 \f ; ess-inf: variables for inferior-ess.
682 ;;*;; System dependent variables
684 ;; If you need to change the *-program-name variables, do so in
685 ;; ess-site.el. Do NOT make the changes here!!
686 ;; Keep a copy of your revised ess-site.el to use as a starting point
687 ;; for upgrades of ESS.
689 (defcustom inferior-ess-own-frame nil
690 "*Non-nil means that inferior ESS buffers should start in their own frame.
691 The parameters of this frame are stored in `inferior-ess-frame-alist'."
692 :group 'ess-proc
693 :type 'boolean)
695 (defcustom inferior-ess-frame-alist default-frame-alist
696 "*Alist of frame parameters used to create new frames for iESS buffers.
697 This defaults to `default-frame-alist' and is used only when
698 the variable `inferior-ess-own-frame' is non-nil."
699 :group 'ess-proc
700 :type 'alist)
702 (defcustom inferior-ess-same-window t
703 "*Non-nil indicates new inferior ESS process appears in current window.
704 Otherwise, the new inferior ESS buffer is shown in another window in the
705 current frame. This variable is ignored if `inferior-ess-own-frame' is
706 non-nil."
707 :group 'ess-proc
708 :type 'boolean)
710 (defcustom inferior-R-program-name
711 (if ess-microsoft-p "Rterm" "R")
712 "*Program name for invoking an inferior ESS with \\[R]."
713 :group 'ess-R
714 :type 'string)
716 (defcustom inferior-R-args ""
717 "*String of arguments (see 'R --help') used when starting R.
718 These arguments are currently not passed to other versions of R that have
719 been created using the variable `ess-r-versions'."
720 :group 'ess-R
721 :type 'string)
723 (defcustom inferior-R-objects-command "objects(pos=%d, all.names=TRUE)\n"
724 "Format string for R command to get a list of objects at position %d.
725 Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
726 :group 'ess-command
727 :type 'string)
730 (defcustom ess-program-files
731 (if ess-microsoft-p
732 (w32-short-file-name (getenv "ProgramFiles"))
733 nil)
734 "Safe (no embedded blanks) 8.3 name that works across internationalization."
735 :group 'ess
736 :type 'string)
739 (defcustom ess-rterm-version-paths nil
740 "*To contain the full path file names of Rterm versions, computed via
741 \\[ess-find-rterm]. If you have versions of R in locations other than
742 in ../../R-*/bin/Rterm.exe or ../../rw*/bin/Rterm.exe, relative to the
743 directory in the `exec-path' variable containing your default location
744 of Rterm, you will need to redefine this variable with a
745 `custom-set-variables' statement in your site-start.el or .emacs
746 file."
747 :group 'ess-R
748 :type '(repeat string))
750 (defcustom ess-SHOME-versions
751 ;; ess-program-files ~= "c:/progra~1" for typical locales/languages
752 (mapcar
753 '(lambda (ch) (concat ess-program-files ch))
754 '("/Insightful/splus62"
755 "/Insightful/splus61"
756 "/MathSoft/splus6"
757 "/spls45se"
758 "/Insightful/splus62netclient"
759 "/Insightful/splus62net/server"
760 "/Insightful/splus61netclient"
761 "/Insightful/splus61net/server"
762 "/Insightful/splus6se"
763 "/Insightful/splus61se"
764 "/Insightful/splus62se"
765 "/Insightful/splus70"
766 "/Insightful/splus71"
767 "/Insightful/splus8.0.1"
768 "/Insightful/splus8.0.4"
769 "/Insightful/splus80"))
770 "*List of possible values of the environment variable SHOME for recent
771 releases of S-Plus. These are the default locations for several
772 current and recent releases of S-Plus. If any of these pathnames
773 correspond to a directory on your machine, running the function
774 `ess-sqpe-versions-create' will create a function, for example, `M-x
775 splus70', that will start the corresponding version Sqpe inside an
776 emacs buffer in iESS[S] mode. If you have versions of S-Plus in
777 locations other than these default values, redefine this variable with
778 a `custom-set-variables' statement in your site-start.el or .emacs
779 file. The list of functions actually created appears in the *ESS*
780 buffer and should appear in the \"ESS / Start Process / Other\"
781 menu."
782 :group 'ess-SPLUS
783 :type '(repeat string))
785 (defcustom inferior-S3-program-name "/disk05/s/S"
786 "*Program name for invoking an inferior ESS with S3()."
787 :group 'ess-S
788 :type 'string)
790 (defcustom inferior-S+3-program-name "Splus"
791 "*Program name for invoking an inferior ESS with S+3()."
792 :group 'ess-SPLUS
793 :type 'string)
795 (defcustom inferior-S+4-program-name
796 (concat ess-program-files "/spls45se/cmd/Splus.exe")
797 "*Program name for invoking an external GUI S+4.
798 The default value is correct for a default installation of
799 S-Plus 4.5 Student Edition and with bash as the shell.
800 For any other version or location, change this value in ess-site.el or
801 site-start.el. Use the 8.3 version of the pathname.
802 Use double backslashes if you use the msdos shell."
803 :group 'ess-SPLUS
804 :type 'string)
806 (defcustom inferior-S+4-print-command "S_PRINT_COMMAND=gnuclientw.exe"
807 "*Destination of print icon in S+4 Commands window."
808 :group 'ess-SPLUS
809 :type 'string)
811 (defcustom inferior-S+4-editor-pager-command
812 "options(editor='gnuclient.exe', pager='gnuclientw.exe')"
813 "*Programs called by the editor() and pager() functions
814 in S+4 Commands window and in Sqpe+4 buffer."
815 :group 'ess-S
816 :type 'string)
818 (defcustom inferior-Sqpe+4-program-name
819 (concat ess-program-files "/spls45se/cmd/Sqpe.exe")
820 "*Program name for invoking an inferior ESS with Sqpe+4()."
821 :group 'ess-SPLUS
822 :type 'string)
824 (defcustom inferior-Sqpe+4-SHOME-name
825 (if ess-microsoft-p (concat ess-program-files "/spls45se" ""))
826 "*SHOME name for invoking an inferior ESS with Sqpe+4().
827 The default value is correct for a default installation of
828 S-Plus 4.5 Student Edition. For any other version or location,
829 change this value in ess-site.el or site-start.el. Use the 8.3
830 version of the pathname."
831 :group 'ess-SPLUS
832 :type 'string)
833 ;;(if ess-microsoft-p
834 ;; (let* ((SHOME (getenv "SHOME"))
835 ;; (PATH (getenv "PATH"))
836 ;; (split-PATH (split-string PATH ";")) ;; Unix uses ":"
837 ;; (num 0)
838 ;; pathname)
839 ;; (if (not SHOME)
840 ;; (while (< num (length split-PATH))
841 ;; (setq pathname (concat (nth num split-PATH) "/Sqpe.exe"))
842 ;; (if (not (file-exists-p pathname))
843 ;; (setq num (1+ num))
844 ;; (progn
845 ;; (setq num (length split-PATH))
846 ;; (setq SHOME (expand-file-name (concat pathname "/../..")))))))
847 ;; (setq-default inferior-Sqpe+4-SHOME-name SHOME)))
850 (defcustom inferior-S-elsewhere-program-name "sh"
851 "*Program name for invoking an inferior ESS with S on a different computer."
852 :group 'ess-proc
853 :type 'string)
855 (defcustom inferior-ESS-elsewhere-program-name "sh"
856 "*Program name for invoking an inferior ESS with program on a
857 different computer."
858 :group 'ess-proc
859 :type 'string)
861 (defcustom inferior-S4-program-name "S4"
862 "*Program name for invoking an inferior ESS with S4()."
863 :group 'ess-S
864 :type 'string)
866 (defcustom inferior-S+5-program-name "Splus5"
867 "*Program name for invoking an inferior ESS with S+5()."
868 :group 'ess-SPLUS
869 :type 'string)
871 (if ess-microsoft-p
872 (defcustom inferior-S+6-program-name
873 (concat ess-program-files "/insigh~1/splus70/cmd/Splus.exe")
874 "*Program name for invoking an external GUI S+6 for Windows.
875 The default value is correct for a default installation of
876 S-Plus 7.0 and with bash as the shell.
877 For any other version or location, change this value in ess-site.el or
878 site-start.el. Use the 8.3 version of the pathname.
879 Use double backslashes if you use the msdos shell."
880 :group 'ess-SPLUS
881 :type 'string)
882 (defcustom inferior-S+6-program-name "Splus6"
883 "*Program name for invoking an inferior ESS with S+6() for Unix."
884 :group 'ess-SPLUS
885 :type 'string))
887 (defcustom inferior-Splus-args ""
888 "*String of arguments used when starting S.
889 These arguments are currently passed only to S+6."
890 :group 'ess-SPLUS
891 :type 'string)
893 (defcustom inferior-Splus-objects-command "objects(where=%d)\n"
894 "Format string for R command to get a list of objects at position %d.
895 Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
896 :group 'ess-command
897 :type 'string)
899 (defcustom inferior-S+6-print-command "S_PRINT_COMMAND=gnuclientw.exe"
900 "*Destination of print icon in S+6 for Windows Commands window."
901 :group 'ess-SPLUS
902 :type 'string)
904 (defcustom inferior-S+6-editor-pager-command
905 "options(editor='gnuclient.exe', pager='gnuclientw.exe')"
906 "*Programs called by the editor() and pager() functions
907 in S+6 for Windows Commands window and in Sqpe+6 for Windows buffer."
908 :group 'ess-SPLUS
909 :type 'string)
911 (defcustom inferior-Sqpe+6-program-name
912 (concat ess-program-files "/insigh~1/splus70/cmd/Sqpe.exe")
913 "*Program name for invoking an inferior ESS with Sqpe+6() for Windows."
914 :group 'ess-S
915 :type 'string)
917 (defcustom inferior-Sqpe+6-SHOME-name
918 (if ess-microsoft-p (concat ess-program-files "/insigh~1/splus70" ""))
919 "*SHOME name for invoking an inferior ESS with Sqpe+6() for Windows.
920 The default value is correct for a default installation of
921 S-Plus 7.0. For any other version or location,
922 change this value in ess-site.el or site-start.el. Use the 8.3
923 version of the pathname."
924 :group 'ess-SPLUS
925 :type 'string)
926 ;;(if ess-microsoft-p
927 ;; (let* ((SHOME (getenv "SHOME"))
928 ;; (PATH (getenv "PATH"))
929 ;; (split-PATH (split-string PATH ";")) ;; Unix uses ":"
930 ;; (num 0)
931 ;; pathname)
932 ;; (if (not SHOME)
933 ;; (while (< num (length split-PATH))
934 ;; (setq pathname (concat (nth num split-PATH) "/Sqpe.exe"))
935 ;; (if (not (file-exists-p pathname))
936 ;; (setq num (1+ num))
937 ;; (progn
938 ;; (setq num (length split-PATH))
939 ;; (setq SHOME (expand-file-name (concat pathname "/../..")))))))
940 ;; (setq-default inferior-Sqpe+6-SHOME-name SHOME)))
942 (defcustom ess-S-quit-kill-buffers-p nil
943 "Controls whether S buffers should also be killed once a process is killed.
944 This is used only when an iESS process is killed using C-c C-q.
945 Possible values:
946 nil - do not kill any S buffers associated with the process.
947 t - kill S buffers associated with the process.
948 ask - ask the user whether the S buffers should be killed."
949 :group 'ess-S
950 :type '(choice (const nil) (const t) (const ask)))
952 (defcustom inferior-XLS-program-name "xlispstat"
953 "*Program name for invoking an inferior ESS with \\[XLS]."
954 :group 'ess-XLS
955 :type 'string)
957 (defcustom inferior-VST-program-name "vista"
958 "*Program name for invoking an inferior ESS with \\[ViSta]."
959 :group 'ess-XLS
960 :type 'string)
962 (defcustom inferior-ARC-program-name "arc"
963 "*Program name for invoking an inferior ESS with \\[ARC]."
964 :group 'ess-XLS
965 :type 'string)
967 (defcustom inferior-SAS-program-name "sas"
968 "*Program name for invoking an inferior ESS with SAS()."
969 :group 'ess-sas
970 :type 'string)
972 (defcustom inferior-STA-program-name "env"
973 "*Program name for invoking an inferior ESS with stata().
974 This is NOT Stata, because we need to call stata with TERM=emacs in
975 order for it to work right. And Emacs is too smart for it."
976 :group 'ess-Stata
977 :type 'string)
979 (defcustom inferior-OMG-program-name "omegahat"
980 "*Program name for invoking an inferior ESS with omegahat()."
981 :group 'ess-OMG
982 :type 'string)
985 ;;;;; names for setting the pager and editor options of the
986 ;;;;; inferior-ess-process
988 ;;; S-editor and S-pager,
989 ;;; R-editor and R-pager,
990 ;;; ess-editor and ess-pager,
991 ;;; and inferior-ess-language-start
992 ;;; apply in principle to the 15 files essd[s-]*.el
993 ;;; Several of the files (essd-sp4.el and essd-sp6w.el) have more
994 ;;; than one *-customize-alist.
995 ;;; These variables are currently used only with the S language files for
996 ;;; S S-Plus R.
998 (defcustom R-editor
999 (if ess-microsoft-p "gnuclient.exe"
1000 (if (equal system-type 'Apple-Macintosh) nil
1001 (if (featurep 'xemacs) "gnuclient" "emacsclient"))) ;; unix
1002 "*Editor called by R process with 'edit()' command."
1003 :group 'ess
1004 :type 'string)
1006 (defcustom R-pager 'nil ; Usually nil is correct as ESS and page() cooperate.
1007 "*Pager called by R process with 'page()' command."
1008 :group 'ess
1009 :type '(choice (const nil) string))
1011 (defcustom S-editor
1012 (if ess-microsoft-p "gnuclient.exe"
1013 (if (equal system-type 'Apple-Macintosh) nil
1014 (if (featurep 'xemacs) "gnuclient" "emacsclient"))) ;; unix
1015 "*Editor called by S process with 'edit()' command."
1016 :group 'ess
1017 :type 'string)
1019 (defcustom S-pager
1020 (if ess-microsoft-p "gnuclientw.exe"
1021 (if (equal system-type 'Apple-Macintosh) nil
1022 (if (featurep 'xemacs) "gnuclient" "emacsclient")))
1023 "*Pager called by S process with 'page()' command."
1024 ;; Change made to provide a better help(function) experience with
1025 ;; S+6 and xemacs
1026 ;; gnuclient -q will open a buffer with an HTML help file
1027 ;; you can view it with M-x browse-url-of-buffer
1028 :group 'ess
1029 :type 'string)
1031 (defvar ess-editor nil
1032 "*Editor by which the process sends information to an emacs buffer
1033 for editing and then to be returned to the process.")
1035 (defvar ess-pager nil
1036 "*Pager by which the process sends information to an emacs buffer.")
1038 (defvar inferior-ess-language-start nil
1039 "*Initialization commands sent to the ESS process.")
1041 (make-variable-buffer-local 'ess-editor)
1042 (make-variable-buffer-local 'ess-pager)
1043 (make-variable-buffer-local 'inferior-ess-language-start)
1047 ;;;;; names for S-Plus help files on MS-Windows
1049 (defcustom inferior-ess-help-filetype nil
1050 "S-Plus and Sqpe for Windows use the \"chm\" (compiled html) filetype
1051 for help files. The default value is nil for other systems."
1052 :group 'ess-proc
1053 :type 'string)
1054 (make-variable-buffer-local 'inferior-ess-help-filetype)
1055 (setq-default inferior-ess-help-filetype nil)
1058 ;;;;; names for communication using MS-Windows 9x/NT ddeclient mechanism
1060 (defcustom inferior-ess-ddeclient nil
1061 "*ddeclient is the intermediary between emacs and the stat program."
1062 :group 'ess-proc
1063 :type 'string)
1065 (make-variable-buffer-local 'inferior-ess-ddeclient)
1067 (defcustom inferior-ess-client-name nil
1068 "*Name of ESS program ddeclient talks to."
1069 :group 'ess-proc
1070 :type 'string)
1072 (make-variable-buffer-local 'inferior-ess-client-name)
1074 (defcustom inferior-ess-client-command nil
1075 "*ddeclient command sent to the ESS program."
1076 :group 'ess-proc
1077 :type '(choice (const nil) string))
1079 (make-variable-buffer-local 'inferior-ess-client-command)
1081 ;;;;; user settable defaults
1082 (defvar inferior-S-program-name inferior-S+3-program-name
1083 "*Program name for invoking an inferior ESS with S().")
1084 ;;- (setq inferior-S-program
1085 ;;- (cond ((string= S-proc-prefix "S") "Splus")
1086 ;;- ((string= S-proc-prefix "R") "R")
1087 ;;- (t "S")
1088 ;;- ))
1089 ;;(make-local-variable 'inferior-S-program)
1091 (defvar inferior-ess-program nil ;inferior-S-program-name
1092 "*Default program name for invoking inferior-ess().
1093 The other variables ...-program-name should be changed, for the
1094 corresponding program.")
1096 (make-variable-buffer-local 'inferior-ess-program)
1097 (setq-default inferior-ess-program inferior-S-program-name)
1100 (defvar inferior-ess-start-args ""
1101 "String of arguments passed to the ESS process.
1102 If you wish to pass arguments to a process, see e.g. `inferior-R-args'.")
1104 (defcustom inferior-ess-start-file nil
1105 "*File dumped into process, if non-nil."
1106 :group 'ess-proc
1107 :type '(choice (const nil) file))
1109 (defcustom inferior-ess-pager "cat"
1110 "*Pager to use for reporting help files and similar things."
1111 :group 'ess-proc
1112 :type 'string)
1114 (defcustom inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?"
1115 "Regular expression used by `ess-mode' to detect the primary prompt.
1116 Do not anchor to bol with `^'."
1117 :group 'ess-proc
1118 :type 'string)
1120 (make-variable-buffer-local 'inferior-ess-primary-prompt)
1121 (setq-default inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?")
1123 (defcustom inferior-ess-secondary-prompt "+ ?"
1124 "Regular expression used by ess-mode to detect the secondary prompt.
1125 (This is issued by S to continue an incomplete expression). Do not
1126 anchor to bol with `^'."
1127 :group 'ess-proc
1128 :type 'string)
1130 (make-variable-buffer-local 'inferior-ess-secondary-prompt)
1131 (setq-default inferior-ess-secondary-prompt "+ ?")
1133 ;;*;; Variables controlling interaction with the ESS process
1135 (defcustom ess-execute-in-process-buffer nil
1136 "*Non-nil means the ess-execute- commands output to the process buffer.
1137 Otherwise, they get their own temporary buffer."
1138 :group 'ess-proc
1139 :type 'boolean)
1141 (defcustom ess-eval-empty nil
1142 "*Non-nil means `ess-eval-line*' will send empty lines to the ESS process."
1143 :group 'ess-proc
1144 :type 'boolean)
1146 (defcustom ess-eval-visibly-p t
1147 "*Non-nil means ess-eval- commands display commands in the process buffer."
1148 :group 'ess-proc
1149 :type 'boolean)
1151 (defcustom ess-synchronize-evals nil
1152 "*Non-nil means all evaluations will synchronize with the ESS process.
1153 This means ess-mode will wait for S to dent a prompt before sending the next
1154 line of code. This allows users of Emacs version 18.57 or less to
1155 evaluate large regions of code without causing an error. Users of newer
1156 Emacsen usually do not want this feature, since it locks up use
1157 of Emacs until the code has been successfully evaluated."
1158 :group 'ess-proc
1159 :type 'boolean)
1161 (defcustom ess-eval-visibly-at-end t
1162 "*Non-nil means ess-eval- commands display output at end of process buffer."
1163 :group 'ess-proc
1164 :type 'boolean)
1167 (defcustom ess-eval-ddeclient-sleep 0.06
1168 "*If non-nil, a number specifying *seconds* to wait after certain
1169 \[[ess-eval-linewise-ddeclient]] calls, such as those at startup."
1170 ;; i.e this currently only applies to (if microsoft-p ...) !
1171 :group 'ess-proc
1172 :type '(choice (const nil) number))
1175 \f ; System variables
1177 ;;*;; Variables relating to multiple processes
1179 ;; SJE -- this shouldn't be customixed by user.
1180 (defvar ess-current-process-name nil
1181 "Name of the current S process.")
1183 (defvar ess-process-name-list nil
1184 "Alist of active ESS processes.")
1186 ;;*;; Inferior ESS commands
1188 (defcustom inferior-ess-load-command "source(\"%s\")\n"
1189 "Format-string for building the ess command to load a file.
1191 This format string should use %s to substitute a file name and should
1192 result in an ESS expression that will command the inferior ESS to load
1193 that file."
1194 :group 'ess-command
1195 :type 'string)
1197 (defcustom inferior-ess-dump-command "dump(\"%s\",file=\"%s\")\n"
1198 "Format-string for building the ess command to dump an object into a file.
1200 Use first %s to substitute an object name
1201 Use second %s to substitute the dump file name."
1202 :group 'ess-command
1203 :type 'string)
1205 (defcustom inferior-ess-help-command "help(\"%s\")\n"
1206 "Format-string for building the ESS command to ask for help on an object.
1208 This format string should use %s to substitute an object name."
1209 :group 'ess-command
1210 :type 'string)
1212 (make-variable-buffer-local 'inferior-ess-help-command)
1213 (setq-default inferior-ess-help-command "help(\"%s\")\n")
1215 (defcustom inferior-ess-exit-command "q()\n"
1216 "Format-string for building the ess command to exit.
1218 This format string should use %s to substitute an object name."
1219 :group 'ess-command
1220 :type 'string)
1222 (make-variable-buffer-local 'inferior-ess-exit-command)
1223 (setq-default inferior-ess-exit-command "q()\n")
1225 (defvar inferior-ess-search-list-command nil
1226 "`ess-language' command that prints out the search list;
1227 i.e. the list of directories and (recursive) objects that `ess-language' uses
1228 when it searches for objects.
1230 Really set in <ess-lang>-customize-alist in ess[dl]-*.el")
1231 ;; and hence made buffer-local via that scheme...
1233 ;; FIXME: this is nowhere used :
1234 (defcustom inferior-ess-names-command "names(%s)\n"
1235 "Format string for ESS command to extract names from an object.
1237 %s is replaced by the object name -- usually a list or data frame."
1238 :group 'ess-command
1239 :type 'string)
1241 (defcustom inferior-ess-safe-names-command "try(names(%s), silent=TRUE)\n"
1242 "Format string for ESS command to extract names from an object *safely*.
1244 %s is replaced by an \"object name\" -- usually a list or data frame, but in R also
1245 e.g., 'package:stats'."
1247 :group 'ess-command
1248 :type 'string)
1250 (defcustom inferior-ess-get-prompt-command "options()$prompt\n"
1251 "Command to find the value of the current S prompt."
1252 :group 'ess-command
1253 :type 'string)
1255 (defvar ess-cmd-delay nil
1256 "*Set to a positive number if ESS will include delays proportional to
1257 `ess-cmd-delay' in some places. These delays are introduced to
1258 prevent timeouts in certain processes, such as completion.")
1259 (make-variable-buffer-local 'ess-cmd-delay)
1261 (defcustom ess-R-cmd-delay nil
1262 "Used to initialize `ess-cmd-delay'."
1263 :group 'ess-command
1264 :type '(choice (const nil) number))
1266 (defcustom ess-S+-cmd-delay 1.0
1267 "Used to initialize `ess-cmd-delay'."
1268 :group 'ess-command
1269 :type '(choice (const nil) number))
1271 ;;*;; Regular expressions
1273 (defvar inferior-ess-prompt nil
1274 "The regular expression inferior ess mode uses for recognizing prompts.
1275 Constructed at run time from `inferior-ess-primary-prompt' and
1276 `inferior-ess-secondary-prompt' within \\[ess-multi].")
1278 (make-variable-buffer-local 'inferior-ess-prompt)
1280 (defvar ess-change-sp-regexp ""
1281 "The regexp for matching the S/R/.. commands that change the search path.")
1282 (make-variable-buffer-local 'ess-change-sp-regexp)
1284 (defcustom ess-S+-change-sp-regexp
1285 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|module(\\|source(\\)"
1286 "The regexp for matching the S-plus commands that change the search path."
1287 :group 'ess-proc
1288 :type 'regexp)
1290 (defcustom ess-S-change-sp-regexp
1291 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)"
1292 "The regexp for matching the S commands that change the search path."
1293 :group 'ess-proc
1294 :type 'regexp)
1296 (defcustom ess-R-change-sp-regexp
1297 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)"
1298 "The regexp for matching the R commands that change the search path."
1299 :group 'ess-proc
1300 :type 'regexp)
1303 ;;*;; Process-dependent variables
1305 (defvar ess-search-list nil
1306 "Cache of list of directories and objects to search for ESS objects.")
1308 (make-variable-buffer-local 'ess-search-list)
1310 (defvar ess-sl-modtime-alist nil
1311 "Alist of modification times for all ess directories accessed this
1312 session.")
1314 (make-variable-buffer-local 'ess-sl-modtime-alist)
1316 (defvar ess-sp-change nil
1317 "This symbol flags a change in the ess search path.")
1319 (make-variable-buffer-local 'ess-sp-change)
1321 (defvar ess-prev-load-dir/file nil
1322 "This symbol saves the (directory . file) pair used in the last
1323 `ess-load-file' command. Used for determining the default in the next one.")
1325 (make-variable-buffer-local 'ess-prev-load-dir/file)
1327 (defvar ess-object-list nil
1328 ;; This is a list of the currently known object names. It is
1329 ;; current only for one command entry; it exists under the
1330 ;; assumption that the list of objects doesn't change while entering
1331 ;; a command.
1332 "Cache of object names")
1334 (make-variable-buffer-local 'ess-object-list)
1336 ;;*;; Miscellaneous system variables
1338 (defvar ess-temp-point nil
1339 "Variable used to retain a buffer position past let or let*.")
1341 (defvar ess-mode-map nil
1342 "Keymap for `ess-mode'.")
1344 (defvar ess-eval-map nil
1345 "Keymap for ess-eval functions.")
1347 (defvar inferior-ess-mode-map nil
1348 "Keymap for `inferior-ess' mode.")
1350 (defvar ess-mode-minibuffer-map nil)
1352 ;; SJE: Wed 29 Dec 2004 - following 3 ess-object* variables can be removed
1353 ;; soon if no-one needs the completion code.
1354 (defvar ess-object-name-db-file "ess-namedb"
1355 "File containing definitions for `ess-object-name-db'.")
1357 (defvar ess-object-name-db-file-loaded '()
1358 "List of programs whose name-db file has been loaded.")
1360 (defvar ess-object-name-db nil
1361 "Alist of lists of object names, with directory names as keys.
1362 The file ess-namedb.el is loaded (if it exists) to define this variable.
1363 See also function `ess-create-object-name-db'.")
1365 (make-variable-buffer-local 'ess-object-name-db)
1366 (setq-default ess-object-name-db nil)
1368 ;; SJE: 2007-07-16 -- add to quieten byte compile.
1369 (defvar ess-loop-timeout nil
1370 "Number ofloops ess-mode will wait for prompt before signalling an error.")
1372 (defcustom ess-S-loop-timeout 2000000
1373 "Integer specifying how many loops ess-mode will wait for the prompt
1374 before signaling an error. Will be set to `ess-loop-timeout' in the S dialects'
1375 alists. Increase this, if you have a fast(er) machine."
1376 :group 'ess-proc
1377 :type 'integer)
1379 (defcustom ess-XLS-loop-timeout 50000
1380 "Integer specifying how many loops ess-mode will wait for the prompt
1381 before signaling an error. Will be set to `ess-loop-timeout' in the XLispStat
1382 dialects' alists. Increase this, if you have a fast(er) machine."
1383 :group 'ess-proc
1384 :type 'integer)
1386 ;; NOTA BENE: Other languages/dialect currently set `ess-loop-timeout'
1387 ;; **directly** in their essd-*.el alist !!
1389 ;;;*;;; Font-lock support
1391 ;;; for programming, transcript, and inferior process modes.
1393 (defcustom ess-font-lock-mode
1394 (if (ess-running-emacs-version-or-newer 22 1)
1395 global-font-lock-mode
1396 ;; else for emacs 21.x and earlier
1398 "*Non-nil means we use font lock support for ESS buffers.
1399 Default is t, to use font lock support.
1400 If you change the value of this variable, restart Emacs for it to take effect."
1401 :group 'ess
1402 :type 'boolean)
1404 (defcustom inferior-ess-font-lock-input t
1405 "*Non-nil means input is syntactically font-locked.
1406 If nil, input is in the `font-lock-variable-name-face'."
1407 :group 'ess
1408 :type 'boolean)
1410 (defvar ess-R-constants
1411 '("TRUE" "FALSE" "NA" "NULL" "Inf" "NaN"))
1413 (defvar ess-S-constants
1414 (append ess-R-constants '("T" "F")))
1416 ;; first the common ones
1417 (defvar ess-S-modifyiers
1418 '("library" "attach" "detach" "source" "module"))
1419 (defvar ess-R-modifyiers
1420 '("library" "attach" "detach" "source" "require"))
1422 (defvar ess-R-keywords
1423 '("while" "for" "in" "repeat" "if" "else" "switch" "break" "next"
1424 "function" "return" "message" "warning" "stop"))
1425 (defvar ess-S-keywords
1426 (append ess-R-keywords '("terminate")))
1428 ;; only some of these keywords "look like functions but are not":
1429 (defvar ess-S-non-functions
1430 '("if" "for" "function" "while"))
1433 (defvar ess-R-message-prefixes
1434 '("Error:" "Error in"
1435 "Warning:" "Warning in"
1436 "Warning messages"))
1437 (defvar ess-S-message-prefixes
1438 (append ess-R-message-prefixes
1439 '("Syntax error:" "Dumped")))
1442 (defvar ess-R-assign-ops
1443 '("<<-" "<-" "->") ; don't want "=" here which is not only for assign
1445 (defvar ess-S-assign-ops
1446 '("<<-" "<-" "_" "->") ; don't want "=" here which is not only for assign
1449 ;; Note: \\s\" is really \s" which means match a char belonging to the
1450 ;; "quote character" syntax class.
1451 (defvar ess-R-function-name-regexp
1452 (concat "\\s\"?\\(\\(\\sw\\|\\s_\\)+"
1453 "\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\)"
1454 "\\(\\s-\\|\n\\)*function")
1456 (defvar ess-S-function-name-regexp
1457 ess-R-function-name-regexp ; since "_" is deprecated for S-plus as well
1460 (defvar ess-R-mode-font-lock-keywords
1461 (list
1462 (cons (regexp-opt ess-R-assign-ops)
1463 'font-lock-reference-face) ; assign
1464 (cons (concat "\\<" (regexp-opt ess-R-constants 'enc-paren) "\\>")
1465 'font-lock-type-face) ; constants
1466 (cons (concat "\\<" (regexp-opt ess-R-modifyiers 'enc-paren) "\\>")
1467 'font-lock-reference-face) ; modify search list or source
1468 ; new definitions
1469 (cons (concat "\\<" (regexp-opt ess-R-keywords 'enc-paren) "\\>")
1470 'font-lock-keyword-face) ; keywords
1471 (cons ess-R-function-name-regexp
1472 '(1 font-lock-function-name-face t))
1473 ; function name
1475 "Font-lock patterns used in `R-mode' buffers.")
1477 (defvar ess-S-mode-font-lock-keywords
1478 (list
1479 (cons (regexp-opt ess-S-assign-ops)
1480 'font-lock-reference-face) ; assign
1481 (cons (concat "\\<" (regexp-opt ess-S-constants 'enc-paren) "\\>")
1482 'font-lock-type-face) ; constants
1483 (cons (concat "\\<" (regexp-opt ess-S-modifyiers 'enc-paren) "\\>")
1484 'font-lock-reference-face) ; modify search list or source
1485 ; new definitions
1486 (cons (concat "\\<" (regexp-opt ess-S-keywords 'enc-paren) "\\>")
1487 'font-lock-keyword-face) ; keywords
1488 (cons ess-S-function-name-regexp
1489 '(1 font-lock-function-name-face t))
1490 ; function name
1492 "Font-lock patterns used in `S-mode' buffers.")
1497 (defvar inferior-ess-R-font-lock-keywords
1498 (append
1499 '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1501 (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1502 (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1503 '(1 font-lock-variable-name-face keep t))) )
1505 ess-R-mode-font-lock-keywords
1507 (list
1508 (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face); ess-mode msg
1509 (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1510 (cons (concat "^" (regexp-opt ess-R-message-prefixes 'enc-paren))
1511 'font-lock-reference-face) ; inferior-ess problems or errors
1512 (cons "#" 'font-lock-comment-face) ; comment
1513 (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1515 "Font-lock patterns used in inferior-R-mode buffers.")
1517 (defvar inferior-ess-S-font-lock-keywords
1518 (append
1519 '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1521 (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1522 (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1523 '(1 font-lock-variable-name-face keep t))) )
1525 ess-S-mode-font-lock-keywords
1527 (list
1528 (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face) ; ess-mode msg
1529 (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1530 (cons (concat "^" (regexp-opt ess-S-message-prefixes 'enc-paren))
1531 'font-lock-reference-face) ; inferior-ess problems or errors
1532 (cons "#" 'font-lock-comment-face) ; comment
1533 (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1535 "Font-lock patterns used in inferior-S-mode buffers.")
1537 ;; use the inferior-* ones directly in ess-trns.el
1538 ;; (defvar ess-trans-font-lock-keywords
1539 ;; inferior-ess-font-lock-keywords
1540 ;; "Font-lock patterns used in `ess-transcript-mode' buffers.")
1543 ;;;*;;; ess-help variables
1545 \f ; ess-help-mode
1546 ;; This will never need to be loaded independently of any of the other
1547 ;; modules, but they can all call it so we may as well put it here.
1549 ;;*;; Variables relating to ess-help-mode
1551 (defcustom ess-help-own-frame nil
1552 "*Controls whether ESS help buffers should start in a different frame.
1554 Possible values are:
1555 nil: Display help in current frame.
1556 'one: All help buffers are shown in one dedicated frame.
1557 t: Each help buffer gets its own frame.
1559 The parameters of this frame are stored in `ess-help-frame-alist'.
1560 See also `inferior-ess-own-frame'."
1561 :group 'ess-help
1562 :type '(choice (const nil) (const one) (const t)))
1564 (defcustom ess-help-frame-alist special-display-frame-alist
1565 "*Alist of frame parameters used to create help frames.
1566 This defaults to `special-display-frame-alist' and is used only when
1567 the variable `ess-help-own-frame' is non-nil."
1568 :group 'ess-help
1569 :type 'alist)
1572 \f ; User changeable variables
1573 ;;;=====================================================
1574 ;;; Users note: Variables with document strings starting
1575 ;;; with a * are the ones you can generally change safely, and
1576 ;;; may have to upon occasion.
1578 (defcustom ess-help-kill-bogus-buffers nil
1579 "*Non-nil means kill ESS help buffers immediately if they are \"bogus\"."
1580 :group 'ess-help
1581 :type 'boolean)
1583 (defvar ess-help-form 'separate-buffer
1584 "*Place to show help. NOT IMPLEMENTED YET.
1585 Choices are `separate-buffer', `s-process', `www'. The latter uses
1586 `browse-url' to find the location.")
1588 ;; WWW Help NOT included yet. Be patient.
1589 (defvar ess-help-w3-url-prefix "http://pyrite.cfas.washington.edu/ESS/R/"
1590 "*Head URL for finding function help.")
1592 (defvar ess-help-w3-url-funs "funs/"
1593 "Place to find functions.")
1595 (defcustom ess-r-args-noargsmsg "No args found."
1596 "Message returned if \\[ess-r-args-get] cannot find a list of arguments."
1597 :group 'ess-R
1598 :type 'string)
1600 (defcustom ess-r-args-show-prefix "ARGS: "
1601 "A prefix string that is shown before the arguments list."
1602 :group 'ess-R
1603 :type 'string)
1605 (defcustom ess-r-args-show-as 'message
1606 "How ess-r-args-show should show the argument list. Possible values
1607 are: 'message' (the default) or 'tooltip'."
1608 :group 'ess-R
1609 :type '(choice
1610 (const :tag "message" :value 'message)
1611 (const :tag "tooltip" :value 'tooltip)))
1613 (defcustom ess-r-args-keep-silent ess-S-non-functions
1614 "List of functions names which should *not* trigger \\[ess-r-args-show];
1615 Defaults to `ess-S-non-functions'."
1616 :group 'ess-R
1617 :type '(repeat string))
1619 (defcustom ess-r-args-electric-paren t
1620 "*non-nil means re-assign \"(\" to \\[ess-r-args-auto-show]."
1621 :group 'ess-R
1622 :type 'boolean)
1624 (defvar ess-has-tooltip (not (featurep 'xemacs))
1625 "non-nil if 'tooltip can be required; typically nil for Xemacs.")
1628 \f ; System variables
1629 ;;;=====================================================
1630 ;;; Users note: You will rarely have to change these
1631 ;;; variables.
1633 ;;*;; Variables relating to ess-help-mode
1635 ;;-- ess-help-S-.. and ess-help-R-.. : in essl-s.el (are used in ess-inf).
1637 (defvar ess-help-sec-keys-alist nil
1638 "Alist of (key . string) pairs for use in section searching.")
1640 (defvar ess-help-sec-regex nil
1641 "Reg(ular) Ex(pression) of section headers in help file")
1643 (make-variable-buffer-local 'ess-help-sec-keys-alist)
1644 (make-variable-buffer-local 'ess-help-sec-regex)
1647 \f ; ess-mode: editing S source
1649 ;;; This syntax table is required by ess-mode.el, ess-inf.el and
1650 ;;; ess-trans.el, so we provide it here.
1651 (defvar ess-mode-syntax-table nil "Syntax table for `ess-mode'.")
1652 (make-variable-buffer-local 'ess-mode-syntax-table)
1655 \f ; Buffer local customization stuff
1657 (defvar ess-source-modes '(ess-mode)
1658 "A list of modes used to determine if a buffer contains ess source code.")
1659 ;;; If a file is loaded into a buffer that is in one of these major modes, it
1660 ;;; is considered an ess source file. The function ess-load-file uses this to
1661 ;;; determine defaults.
1663 (defcustom ess-error-buffer-name "*ESS-errors*"
1664 "Name of buffer to keep process error messages in.
1665 Created for each process."
1666 :group 'ess-proc
1667 :type 'string)
1669 (defcustom ess-verbose nil
1670 "Non-nil means write more information to `ess-dribble-buffer' than usual."
1671 :group 'ess-proc
1672 :type 'boolean)
1674 (defvar ess-dribble-buffer (generate-new-buffer "*ESS*")
1675 "Buffer for temporary use for setting default variable values.
1676 Used for recording status of the program, mainly for debugging.")
1678 (defvar ess-customize-alist nil
1679 "Variable settings to use for proper behavior.
1680 Not buffer local!")
1682 (defvar ess-local-customize-alist nil
1683 "Buffer local settings for proper behavior.
1684 Used to store the values for passing on to newly created buffers.")
1686 (make-variable-buffer-local 'ess-local-customize-alist)
1688 (defvar ess-mode-editing-alist nil
1689 "Variable settings for ess-mode.")
1691 (defvar ess-transcript-minor-mode nil
1692 "Non-nil if using `ess-transcript-mode' as a minor mode of some other mode.")
1694 (make-variable-buffer-local 'ess-transcript-minor-mode)
1696 (defvar ess-listing-minor-mode nil
1697 "Non-nil if using ess-listing-minor-mode.")
1699 (make-variable-buffer-local 'ess-listing-minor-mode)
1701 (provide 'ess-cust)
1703 \f ; Local variables section
1705 ;;; This file is automatically placed in Outline minor mode.
1706 ;;; The file is structured as follows:
1707 ;;; Chapters: ^L ;
1708 ;;; Sections: ;;*;;
1709 ;;; Subsections: ;;;*;;;
1710 ;;; Components: defuns, defvars, defconsts
1711 ;;; Random code beginning with a ;;;;* comment
1713 ;;; Local variables:
1714 ;;; mode: emacs-lisp
1715 ;;; mode: outline-minor
1716 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
1717 ;;; End:
1719 ;;; ess-cust.el ends here