*** empty log message ***
[ess.git] / lisp / ess-cust.el
blob9c32d171e7923da39845f7df833e290cbeffbc4a
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 (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.3.5"
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 "Non-nil means use func-menu."
153 :group 'ess
154 :type 'boolean)
156 (defcustom ess-speedbar-use-p (fboundp 'speedbar)
157 "Non-nil means use speedbar."
158 :group 'ess
159 :type 'boolean)
161 (defcustom ess-imenu-use-p (fboundp 'imenu)
162 "Non-nil means use imenu facility.
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 "*Non-nil means request the process directory each time S is run."
172 :group 'ess
173 :type 'boolean)
175 (defcustom ess-ask-about-transfile nil
176 "*Non-nil means ask about a transcript file before running ESS."
177 :group 'ess
178 :type 'boolean)
180 (defcustom ess-display-buffer-reuse-frames t
181 "*Non-nil means \[[display-buffer] reuses existing frames; see
182 `display-buffer-reuse-frames'."
183 :group 'ess
184 :type 'boolean)
186 (defcustom ess-language nil
187 "*Prefix of all ESS processes, and defines the dialect in use.
188 Currently acceptable values are `S', `XLS', `SAS'.
189 Can be changed, e.g., to `R'. Use `setq-default' if setting it in
190 .emacs (also see ess-site.el)."
191 :group 'ess
192 :type '(choice (const :tag "Initial" :value "Initial")
193 (const :tag "S" :value "S")
194 (const :tag "XLS" :value "XLS")
195 (const :tag "SAS" :value "SAS")
196 (const :tag "R" :value "R")))
198 (make-variable-buffer-local 'ess-language)
199 (setq-default ess-language "Initial")
201 (defvar ess-dialect nil
202 "String version of the dialect being run for the inferior process.
203 This, plus `ess-language', should be able to determine the exact
204 version of the statistical package being executed in the particular
205 buffer.
207 Current values could include:
208 for `ess-dialect' = S3, S4, Sp3, Sp4, Sp5, Sp6, R, XLS, SAS, STA
210 Used to adjust for changes in versions of the program.")
212 (make-variable-buffer-local 'ess-dialect)
213 ;;(setq-default ess-dialect "Initial-dialect")
214 (setq-default ess-dialect nil)
215 ;;; SJE -- why use "Initial-dialect"? If we use nil, it matches "None"
216 ;;; in the custom choice.
218 ;; (defcustom ess-etc-directory
219 ;; (expand-file-name (concat ess-lisp-directory "/../etc/"))
220 ;; "*Location of the ESS etc/ directory.
221 ;; The ESS etc directory stores various auxillary files that are useful
222 ;; for ESS, such as icons."
223 ;; :group 'ess
224 ;; :type 'directory)
226 (defcustom ess-directory-function nil
227 "*Function to return the directory that ESS is run from.
228 If nil or if the function returns nil then you get `ess-directory'."
229 :group 'ess
230 :type '(choice (const nil) function))
232 (defcustom ess-setup-directory-function nil
233 "*Function to setup the directory that ESS is run from.
234 This function can be called to set environment variables or to create
235 a workspace."
236 :group 'ess
237 :type '(choice (const nil) function))
239 (defcustom ess-directory nil
240 "*The directory ESS is run from. It must end in a slash.
241 Provided as a default if `ess-ask-for-ess-directory' is non-nil.
242 A nil value means use the current buffer's default directory.
243 Buffer-local: in process buffers, this contains the directory ESS was
244 run from."
245 :group 'ess
246 :type '(choice (const nil) directory))
248 (defcustom ess-history-directory nil
249 "*Directory to pick up `ess-history-file' from.
250 If this is nil, the history file is relative to `ess-directory'."
251 :group 'ess
252 :type '(choice (const nil) directory))
254 (defcustom ess-history-file nil
255 "*File to pick up history from.
256 If this is a relative file name, it is relative to `ess-history-directory'."
257 :group 'ess
258 :type '(choice (const nil) file))
260 (defcustom ess-plain-first-buffername t
261 "*No fancy process buffname for the first process of each type (novice mode)."
262 :group 'ess
263 :type 'boolean)
266 (defcustom ess-use-inferior-program-name-in-buffer-name nil
267 "*For R, use e.g., 'R-2.1.0' or 'R-devel' (the program name) for buffer name.
268 Avoids the plain dialect name."
269 :group 'ess
270 :type 'boolean)
273 (defcustom ess-S-assign " <- "
274 "*String to be used for left assignment in all S dialects.
275 Used by \\[ess-smart-underscore]."
276 :group 'ess-S
277 :type 'string)
279 ;;*;; Variables concerning editing behaviour
281 (defcustom ess-filenames-map t
282 "Declares if the filenames in an attached directory are the same
283 as objects in that directory (when t). This is not true for DOS and
284 other OS's with limited filename lengths. Even if this is set
285 incorrectly, the right things will probably still happen, however."
286 :group 'ess-edit
287 :type 'boolean)
289 ;;; SJE -- this is set in ess-site.el to be "always", so I changed
290 ;;; value t to be "always", so that ess-site.el does not need editing.
291 ;;; However, this is a bit messy, and would be nicer if ess-site.el
292 ;;; value was t rather than "always".
293 (defcustom ess-keep-dump-files 'ask
294 "*Variable controlling whether to delete dump files after a successful load.
295 If nil: always delete. If `ask', confirm to delete. If `check', confirm
296 to delete, except for files created with ess-dump-object-into-edit-buffer.
297 Anything else, never delete. This variable only affects the behaviour
298 of `ess-load-file'. Dump files are never deleted if an error occurs
299 during the load. "
300 :group 'ess-edit
301 :type '(choice (const :tag "Check" :value 'check)
302 (const :tag "Ask" :value 'ask)
303 (const :tag "Always keep" :value "always")
304 (const :tag "Always delete" :value nil)
308 (defcustom ess-delete-dump-files nil
309 "*Non-nil means delete dump files after they are created.
310 This applies to dump files created with
311 `ess-dump-object-into-edit-buffer', only.
313 Boolean flag which determines what to do with the dump files
314 generated by \\[ess-dump-object-into-edit-buffer], as follows:
316 If nil: dump files are deleted after each use, and so appear
317 only transiently. The one exception to this is when a loading error
318 occurs, in which case the file is retained until the error is
319 corrected and the file re-loaded.
321 If non-nil: dump files are not deleted, and backups are kept
322 as usual. This provides a simple method for keeping an archive of S
323 functions in text-file form.
325 Auto-save is always enabled in dump-file buffers to enable recovery
326 from crashes.
328 This is useful to prevent sources file being created for objects
329 you don't actually modify. Once the buffer is modified and saved
330 however, the file is not subsequently unless `ess-keep-dump-files' is
331 nil, and the file is successfully loaded back into S."
332 :group 'ess-edit
333 :type 'boolean)
335 ;;; From ess-mode:
337 (defcustom ess-mode-silently-save t
338 "*Non-nil means automatically save ESS source buffers before loading."
339 :group 'ess-edit
340 :type 'boolean)
342 ;;*;; Variables controlling editing
344 ;;;*;;; Edit buffer processing
345 (defcustom ess-function-template " <- function( )\n{\n\n}\n"
346 "If non-nil, function template used when editing nonexistent objects.
348 The edit buffer will contain the object name in quotes, followed by
349 this string. Point will be placed after the first parenthesis or
350 bracket."
351 :group 'ess-edit
352 :type 'string)
354 ;;; By K.Shibayama 5.14.1992
355 ;;; Setting any of the following variables in your .emacs is equivalent
356 ;;; to modifying the DEFAULT style.
358 ;;;*;;; Indentation parameters
360 (defcustom ess-auto-newline nil
361 "*Non-nil means automatically newline before and after braces
362 inserted in S code."
363 :type 'boolean
364 :group 'ess-edit)
366 (defcustom ess-tab-always-indent t
367 "*Non-nil means TAB in S mode should always reindent the current line,
368 regardless of where in the line point is when the TAB command is used."
369 :type 'boolean
370 :group 'ess-edit)
372 (defcustom ess-indent-level 2
373 "*Indentation of S statements with respect to containing block."
374 :type 'integer
375 :group 'ess-edit)
377 (defcustom ess-brace-imaginary-offset 0
378 "*Imagined indentation of an open brace following a statement."
379 :type 'integer
380 :group 'ess-edit)
382 (defcustom ess-brace-offset 0
383 "*Extra indentation for open braces.
384 Compares with other text in same context."
385 :type 'integer
386 :group 'ess-edit)
388 (defcustom ess-continued-statement-offset 2
389 "*Extra indent for lines not starting new statements."
390 :type 'integer
391 :group 'ess-edit)
393 (defcustom ess-continued-brace-offset 0
394 "*Extra indent for substatements that start with open-braces.
395 This is in addition to ess-continued-statement-offset."
396 :type 'integer
397 :group 'ess-edit)
399 (defcustom ess-arg-function-offset 2
400 "*Extra indent for internal substatements of function `foo' that called
401 in `arg=foo(...)' form.
402 If not number, the statements are indented at open-parenthesis following foo."
403 :type 'integer
404 :group 'ess-edit)
406 ;;added rmh 2Nov97 at request of Terry Therneau
407 (defcustom ess-close-brace-offset 0
408 "*Extra indentation for closing braces."
409 :type 'integer
410 :group 'ess-edit)
412 ;;added rmh 2Nov97 at request of Terry Therneau
413 (defcustom ess-fancy-comments t
414 "*Non-nil means distiguish between #, ##, and ### for indentation."
415 :type 'boolean
416 :group 'ess-edit)
419 ;; PeterDalgaard, 1Apr97 :
420 ;;The default ess-else-offset should be 0, not 2 IMHO (try looking at
421 ;;the ls() function, for instance). Was 2.
422 (defcustom ess-else-offset 0
423 "*Extra indent for `else' lines."
424 :type 'integer
425 :group 'ess-edit)
427 (defcustom ess-expression-offset 4
428 "*Extra indent for internal substatements of `expression' that specified
429 in `obj <- expression(...)' form.
430 If not number, the statements are indented at open-parenthesis following
431 `expression'."
432 :type 'integer
433 :group 'ess-edit)
435 ;;;*;;; Editing styles
437 ;;; **FIXME** The following NEEDS to be customized.
438 ;; SJE: I disagree; this variable should not be customized; individual vars,
439 ;; such as ess-indent-level are already customizable.
440 (defvar ess-default-style-list
441 (list 'DEFAULT
442 (cons 'ess-indent-level ess-indent-level)
443 (cons 'ess-continued-statement-offset ess-continued-statement-offset)
444 (cons 'ess-brace-offset ess-brace-offset)
445 (cons 'ess-expression-offset ess-expression-offset)
446 (cons 'ess-else-offset ess-else-offset)
447 (cons 'ess-brace-imaginary-offset ess-brace-imaginary-offset)
448 (cons 'ess-continued-brace-offset ess-continued-brace-offset)
449 (cons 'ess-arg-function-offset ess-arg-function-offset)
450 (cons 'ess-close-brace-offset ess-close-brace-offset))
451 "Default style constructed from initial values of indentation variables.")
453 (defvar ess-style-alist
454 (cons ess-default-style-list
455 '((GNU (ess-indent-level . 2)
456 (ess-continued-statement-offset . 2)
457 (ess-brace-offset . 0)
458 (ess-arg-function-offset . 4)
459 (ess-expression-offset . 2)
460 (ess-else-offset . 0)
461 (ess-close-brace-offset . 0))
462 (BSD (ess-indent-level . 8)
463 (ess-continued-statement-offset . 8)
464 (ess-brace-offset . -8)
465 (ess-arg-function-offset . 0)
466 (ess-expression-offset . 8)
467 (ess-else-offset . 0)
468 (ess-close-brace-offset . 0))
469 (K&R (ess-indent-level . 5)
470 (ess-continued-statement-offset . 5)
471 (ess-brace-offset . -5)
472 (ess-arg-function-offset . 0)
473 (ess-expression-offset . 5)
474 (ess-else-offset . 0)
475 (ess-close-brace-offset . 0))
476 (C++ (ess-indent-level . 4)
477 (ess-continued-statement-offset . 4)
478 (ess-brace-offset . -4)
479 (ess-arg-function-offset . 0)
480 (ess-expression-offset . 4)
481 (ess-else-offset . 0)
482 (ess-close-brace-offset . 0))
483 ;; R added ajr 17Feb04 to match "common R" use
484 (RRR (ess-indent-level . 4)
485 (ess-continued-statement-offset . 4)
486 (ess-brace-offset . 0)
487 (ess-arg-function-offset . 4)
488 (ess-expression-offset . 4)
489 (ess-else-offset . 0)
490 (ess-close-brace-offset . 0))
491 ;; CLB added rmh 2Nov97 at request of Terry Therneau
492 (CLB (ess-indent-level . 2)
493 (ess-continued-statement-offset . 4)
494 (ess-brace-offset . 0)
495 (ess-arg-function-offset . 0)
496 (ess-expression-offset . 4)
497 (ess-else-offset . 0)
498 (ess-close-brace-offset . 2))))
499 "Predefined formatting styles for ESS code.
500 Values for all groups, except DEFAULT, are fixed.
501 To change the value of variables in the DEFAULT group, change
502 the corresponding variables, e.g. `ess-indent-level'.
503 The default style in use is controlled by `ess-default-style'.")
505 (defcustom ess-default-style 'DEFAULT
506 "*The default value of `ess-style'.
507 See the variable `ess-style-alist' for how these groups (DEFAULT,
508 GNU, BSD, ...) map onto different settings for variables."
509 :type '(choice (const DEFAULT)
510 (const GNU)
511 (const BSD)
512 (const K&R)
513 (const C++)
514 (const :tag "Common R" :value 'RRR)
515 (const CLB))
516 :group 'ess-edit)
518 (defvar ess-style ess-default-style
519 "*The buffer specific ESS indentation style.")
521 ;;*;; Variables controlling behaviour of dump files
523 (defcustom ess-source-directory
524 (if ess-microsoft-p (getenv "TEMP") "/tmp/")
525 "*Directory in which to place dump files.
526 This can be a string (an absolute directory name ending in a slash) or
527 a lambda expression of no arguments which will return a suitable string
528 value. The lambda expression is evaluated with the process buffer as the
529 current buffer.
531 Possible value:
533 '(lambda () (file-name-as-directory
534 (expand-file-name (concat (car ess-search-list) \"/.Src\"))))
536 This always dumps to a sub-directory (\".Src\") of the current ess
537 working directory (i.e. first elt of search list)."
538 :group 'ess-edit
539 :type 'directory)
542 (defcustom ess-dump-filename-template-proto (concat (user-login-name) ".%s.S")
543 "*Prototype template for filenames of dumped objects.
544 The ending `S' is replaced by the current \\[ess-suffix], to give
545 \\[ess-dump-filename-template] when an inferior ESS process starts.
547 By default, gives filenames like `user.foofun.S', so as not to clash with
548 other users if you are using a shared directory. Other alternatives:
549 \"%s.S\" ; Don't bother uniquifying if using your own directory(ies)
550 \"dumpdir\"; Always dump to a specific filename. This makes it impossible
551 to edit more than one object at a time, though.
552 (make-temp-name \"scr.\") ; Another way to uniquify"
553 ;; MM: The last 3-4 lines above suck (I don't understand them) -- FIXME --
555 :group 'ess-edit
556 :type 'string)
559 ;;*;; Hooks
561 (defcustom ess-mode-hook nil
562 "*Hook for customizing ESS each time it is entered."
563 :group 'ess-hooks
564 :type 'hook)
566 (defcustom ess-mode-load-hook nil
567 "*Hook to call when ess.el is loaded."
568 :group 'ess-hooks
569 :type 'hook)
571 (defcustom ess-pre-run-hook nil
572 "*Hook to call before starting up ESS.
573 Good for setting up your directory."
574 :group 'ess-hooks
575 :type 'hook)
577 (defcustom ess-post-run-hook nil
578 "*Hook to call just after the ESS process starts up.
579 Good for evaluating ESS code."
580 :group 'ess-hooks
581 :type 'hook)
583 (defcustom inferior-ess-mode-hook nil
584 "*Hook for customizing inferior ESS mode. Called after
585 `inferior-ess-mode' is entered and variables have been initialised."
586 :group 'ess-hooks
587 :type 'hook)
589 ;;; make it possible to save an inferior-ess-mode buffer without losing
590 ;;; the connection to the running ESS process.
591 (put 'inferior-ess-mode 'mode-class 'special)
592 ;; FIXME AJR: Should the above be there? I don't think so!
593 ;; MM : the functionality should be, right? Move statement to ./ess.el ?
594 ;; AJR: No, we should move the statement to ./ess-inf.el
596 (defcustom ess-help-mode-hook nil
597 "Functions to call when entering `ess-help-mode'."
598 :group 'ess-hooks
599 :type 'hook)
601 (defcustom ess-send-input-hook nil
602 "Hook called just before line input is sent to the process."
603 :group 'ess-hooks
604 :type 'hook)
606 (defcustom ess-transcript-mode-hook nil
607 "Hook for customizing ESS transcript mode."
608 :group 'ess-hooks
609 :type 'hook)
611 (defcustom Rnw-mode-hook nil
612 "Hook run when entering Rnw mode."
613 :type 'hook
614 :group 'ess-R)
617 (defcustom ess-pdf-viewer-pref nil
618 "External pdf viewer you like to use from ESS.
619 If nil, will use getOption(\"pdfviewer\") in R, and try finding one
620 from a list."
621 :type '(choice (const nil) string)
622 :group 'ess)
624 (defcustom ess-ps-viewer-pref nil
625 "External PostScript viewer you like to use from ESS.
626 If nil, ESS will try finding one from a list."
627 :type '(choice (const nil) string)
628 :group 'ess)
631 \f ; System variables
633 ;; SJE -- this should not be defcustom - user does not set it.
634 (defvar ess-local-process-name nil
635 "The name of the ESS process associated with the current buffer.")
636 (make-variable-buffer-local 'ess-local-process-name)
638 (defcustom ess-kermit-command "gkermit -T"
639 "*Kermit command invoked by `ess-kermit-get' and `ess-kermit-send'."
640 :group 'ess
641 :type 'string)
643 (defcustom ess-kermit-prefix "#"
644 "*String files must begin with to use kermit file transfer."
645 :group 'ess
646 :type 'string)
648 (defcustom ess-kermit-remote-directory "."
649 "*Buffer local variable that designates remote directory of file."
650 :group 'ess
651 :type 'string)
652 (make-variable-buffer-local 'ess-kermit-remote-directory)
654 ;;*;; Regular expressions
656 ;; -- Note: Some variables not-to-customize moved to ./ess-mode.el :
657 ;; ess-set-function-start
659 ;; Fixme: the following is just for S dialects :
660 (defcustom ess-dumped-missing-re
661 "\\(<-\nDumped\n\\'\\)\\|\\(<-\\(\\s \\|\n\\)*\\'\\)"
662 "If a dumped object's buffer matches this re, then it is replaced
663 by `ess-function-template'."
664 :group 'ess
665 :type 'regexp)
667 (defcustom ess-dump-error-re
668 (if (string= ess-language "S") "\nDumped\n\\'"
669 "[Ee]rror")
670 "Regexp used to detect an error when loading a file."
671 :group 'ess
672 :type 'regexp)
674 ;;;; This is tested for S dialects (actually only for R) -- be careful with it!
675 (defvar ess-help-arg-regexp "\\(['\"]?\\)\\([^,=)'\"]*\\)\\1"
676 "Reg(ular) Ex(pression) of help(.) arguments. MUST: 2nd \\(.\\) = arg.")
678 \f ; ess-inf: variables for inferior-ess.
680 ;;*;; System dependent variables
682 ;; If you need to change the *-program-name variables, do so in
683 ;; ess-site.el. Do NOT make the changes here!!
684 ;; Keep a copy of your revised ess-site.el to use as a starting point
685 ;; for upgrades of ESS.
687 (defcustom inferior-ess-own-frame nil
688 "*Non-nil means that inferior ESS buffers should start in their own frame.
689 The parameters of this frame are stored in `inferior-ess-frame-alist'."
690 :group 'ess-proc
691 :type 'boolean)
693 (defcustom inferior-ess-frame-alist default-frame-alist
694 "*Alist of frame parameters used to create new frames for iESS buffers.
695 This defaults to `default-frame-alist' and is used only when
696 the variable `inferior-ess-own-frame' is non-nil."
697 :group 'ess-proc
698 :type 'alist)
700 (defcustom inferior-ess-same-window t
701 "*Non-nil indicates new inferior ESS process appears in current window.
702 Otherwise, the new inferior ESS buffer is shown in another window in the
703 current frame. This variable is ignored if `inferior-ess-own-frame' is
704 non-nil."
705 :group 'ess-proc
706 :type 'boolean)
708 (defcustom inferior-R-program-name
709 (if ess-microsoft-p "Rterm" "R")
710 "*Program name for invoking an inferior ESS with \\[R]."
711 :group 'ess-R
712 :type 'string)
714 (defcustom inferior-R-args ""
715 "*String of arguments (see 'R --help') used when starting R.
716 These arguments are currently not passed to other versions of R that have
717 been created using the variable `ess-r-versions'."
718 :group 'ess-R
719 :type 'string)
721 (defcustom inferior-R-objects-command "objects(pos=%d, all.names=TRUE)\n"
722 "Format string for R command to get a list of objects at position %d.
723 Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
724 :group 'ess-command
725 :type 'string)
727 (defcustom ess-rterm-versions nil
728 "*Construct ess-rterm-versions. If you have versions of R in
729 locations other than in ../../rw*/bin/Rterm.exe, relative to the
730 directory in the `exec-path' variable containing your default location
731 of Rterm, you will need to redefine this variable with a
732 `custom-set-variables' statement in your site-start.el or .emacs
733 file."
734 :group 'ess-R
735 :type '(repeat string))
737 (defcustom ess-SHOME-versions
738 '("c:/progra~1/Insightful/splus62"
739 "c:/progra~1/Insightful/splus61"
740 "c:/progra~1/MathSoft/splus6"
741 "c:/progra~1/spls45se"
742 "c:/progra~1/Insightful/splus62netclient"
743 "c:/progra~1/Insightful/splus62net/server"
744 "c:/progra~1/Insightful/splus61netclient"
745 "c:/progra~1/Insightful/splus61net/server"
746 "c:/progra~1/Insightful/splus6se"
747 "c:/progra~1/Insightful/splus61se"
748 "c:/progra~1/Insightful/splus62se"
749 "c:/progra~1/Insightful/splus70"
750 "c:/progra~1/Insightful/splus71"
751 "c:/progra~1/Insightful/splus80")
752 "*List of possible values of the environment variable SHOME for recent
753 releases of S-Plus. These are the default locations for several
754 current and recent releases of S-Plus. If any of these pathnames
755 correspond to a directory on your machine, running the function
756 `ess-sqpe-versions-create' will create a function, for example, `M-x
757 splus70', that will start the corresponding version Sqpe inside an
758 emacs buffer in iESS[S] mode. If you have versions of S-Plus in
759 locations other than these default values, redefine this variable with
760 a `custom-set-variables' statement in your site-start.el or .emacs
761 file. The list of functions actually created appears in the *ESS*
762 buffer and should appear in the \"ESS / Start Process / Other\"
763 menu."
764 :group 'ess-SPLUS
765 :type '(repeat string))
767 (defcustom inferior-S3-program-name "/disk05/s/S"
768 "*Program name for invoking an inferior ESS with S3()."
769 :group 'ess-S
770 :type 'string)
772 (defcustom inferior-S+3-program-name "Splus"
773 "*Program name for invoking an inferior ESS with S+3()."
774 :group 'ess-SPLUS
775 :type 'string)
777 (defcustom inferior-S+4-program-name "c:/progra~1/spls45se/cmd/Splus.exe"
778 "*Program name for invoking an external GUI S+4.
779 The default value is correct for a default installation of
780 S-Plus 4.5 Student Edition and with bash as the shell.
781 For any other version or location, change this value in ess-site.el or
782 site-start.el. Use the 8.3 version of the pathname.
783 Use double backslashes if you use the msdos shell."
784 :group 'ess-SPLUS
785 :type 'string)
787 (defcustom inferior-S+4-print-command "S_PRINT_COMMAND=gnuclientw.exe"
788 "*Destination of print icon in S+4 Commands window."
789 :group 'ess-SPLUS
790 :type 'string)
792 (defcustom inferior-S+4-editor-pager-command
793 "options(editor='gnuclient.exe', pager='gnuclientw.exe')"
794 "*Programs called by the editor() and pager() functions
795 in S+4 Commands window and in Sqpe+4 buffer."
796 :group 'ess-S
797 :type 'string)
799 (defcustom inferior-Sqpe+4-program-name "c:/progra~1/spls45se/cmd/Sqpe.exe"
800 "*Program name for invoking an inferior ESS with Sqpe+4()."
801 :group 'ess-SPLUS
802 :type 'string)
804 (defcustom inferior-Sqpe+4-SHOME-name
805 (if ess-microsoft-p "c:/progra~1/spls45se" "")
806 "*SHOME name for invoking an inferior ESS with Sqpe+4().
807 The default value is correct for a default installation of
808 S-Plus 4.5 Student Edition. For any other version or location,
809 change this value in ess-site.el or site-start.el. Use the 8.3
810 version of the pathname."
811 :group 'ess-SPLUS
812 :type 'string)
813 ;;(if ess-microsoft-p
814 ;; (let* ((SHOME (getenv "SHOME"))
815 ;; (PATH (getenv "PATH"))
816 ;; (split-PATH (split-string PATH ";")) ;; Unix uses ":"
817 ;; (num 0)
818 ;; pathname)
819 ;; (if (not SHOME)
820 ;; (while (< num (length split-PATH))
821 ;; (setq pathname (concat (nth num split-PATH) "/Sqpe.exe"))
822 ;; (if (not (file-exists-p pathname))
823 ;; (setq num (1+ num))
824 ;; (progn
825 ;; (setq num (length split-PATH))
826 ;; (setq SHOME (expand-file-name (concat pathname "/../..")))))))
827 ;; (setq-default inferior-Sqpe+4-SHOME-name SHOME)))
830 (defcustom inferior-S-elsewhere-program-name "sh"
831 "*Program name for invoking an inferior ESS with S on a different computer."
832 :group 'ess-proc
833 :type 'string)
835 (defcustom inferior-ESS-elsewhere-program-name "sh"
836 "*Program name for invoking an inferior ESS with program on a
837 different computer."
838 :group 'ess-proc
839 :type 'string)
841 (defcustom inferior-S4-program-name "S4"
842 "*Program name for invoking an inferior ESS with S4()."
843 :group 'ess-S
844 :type 'string)
846 (defcustom inferior-S+5-program-name "Splus5"
847 "*Program name for invoking an inferior ESS with S+5()."
848 :group 'ess-SPLUS
849 :type 'string)
851 (if ess-microsoft-p
852 (defcustom inferior-S+6-program-name
853 "c:/progra~1/insigh~1/splus70/cmd/Splus.exe"
854 "*Program name for invoking an external GUI S+6 for Windows.
855 The default value is correct for a default installation of
856 S-Plus 7.0 and with bash as the shell.
857 For any other version or location, change this value in ess-site.el or
858 site-start.el. Use the 8.3 version of the pathname.
859 Use double backslashes if you use the msdos shell."
860 :group 'ess-SPLUS
861 :type 'string)
862 (defcustom inferior-S+6-program-name "Splus6"
863 "*Program name for invoking an inferior ESS with S+6() for Unix."
864 :group 'ess-SPLUS
865 :type 'string))
867 (defcustom inferior-Splus-args ""
868 "*String of arguments used when starting S.
869 These arguments are currently passed only to S+6."
870 :group 'ess-SPLUS
871 :type 'string)
873 (defcustom inferior-Splus-objects-command "objects(where=%d)\n"
874 "Format string for R command to get a list of objects at position %d.
875 Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
876 :group 'ess-command
877 :type 'string)
879 (defcustom inferior-S+6-print-command "S_PRINT_COMMAND=gnuclientw.exe"
880 "*Destination of print icon in S+6 for Windows Commands window."
881 :group 'ess-SPLUS
882 :type 'string)
884 (defcustom inferior-S+6-editor-pager-command
885 "options(editor='gnuclient.exe', pager='gnuclientw.exe')"
886 "*Programs called by the editor() and pager() functions
887 in S+6 for Windows Commands window and in Sqpe+6 for Windows buffer."
888 :group 'ess-SPLUS
889 :type 'string)
891 (defcustom inferior-Sqpe+6-program-name
892 "c:/progra~1/insigh~1/splus70/cmd/Sqpe.exe"
893 "*Program name for invoking an inferior ESS with Sqpe+6() for Windows."
894 :group 'ess-S
895 :type 'string)
897 (defcustom inferior-Sqpe+6-SHOME-name
898 (if ess-microsoft-p "c:/progra~1/insigh~1/splus70" "")
899 "*SHOME name for invoking an inferior ESS with Sqpe+6() for Windows.
900 The default value is correct for a default installation of
901 S-Plus 7.0. For any other version or location,
902 change this value in ess-site.el or site-start.el. Use the 8.3
903 version of the pathname."
904 :group 'ess-SPLUS
905 :type 'string)
906 ;;(if ess-microsoft-p
907 ;; (let* ((SHOME (getenv "SHOME"))
908 ;; (PATH (getenv "PATH"))
909 ;; (split-PATH (split-string PATH ";")) ;; Unix uses ":"
910 ;; (num 0)
911 ;; pathname)
912 ;; (if (not SHOME)
913 ;; (while (< num (length split-PATH))
914 ;; (setq pathname (concat (nth num split-PATH) "/Sqpe.exe"))
915 ;; (if (not (file-exists-p pathname))
916 ;; (setq num (1+ num))
917 ;; (progn
918 ;; (setq num (length split-PATH))
919 ;; (setq SHOME (expand-file-name (concat pathname "/../..")))))))
920 ;; (setq-default inferior-Sqpe+6-SHOME-name SHOME)))
922 (defcustom ess-S-quit-kill-buffers-p nil
923 "Controls whether S buffers should also be killed once a process is killed.
924 This is used only when an iESS process is killed using C-c C-q.
925 Possible values:
926 nil - do not kill any S buffers associated with the process.
927 t - kill S buffers associated with the process.
928 ask - ask the user whether the S buffers should be killed."
929 :group 'ess-S
930 :type '(choice (const nil) (const t) (const ask)))
932 (defcustom inferior-XLS-program-name "xlispstat"
933 "*Program name for invoking an inferior ESS with \\[XLS]."
934 :group 'ess-XLS
935 :type 'string)
937 (defcustom inferior-VST-program-name "vista"
938 "*Program name for invoking an inferior ESS with \\[ViSta]."
939 :group 'ess-XLS
940 :type 'string)
942 (defcustom inferior-ARC-program-name "arc"
943 "*Program name for invoking an inferior ESS with \\[ARC]."
944 :group 'ess-XLS
945 :type 'string)
947 (defcustom inferior-SAS-program-name "sas"
948 "*Program name for invoking an inferior ESS with SAS()."
949 :group 'ess-sas
950 :type 'string)
952 (defcustom inferior-STA-program-name "env"
953 "*Program name for invoking an inferior ESS with stata().
954 This is NOT Stata, because we need to call stata with TERM=emacs in
955 order for it to work right. And Emacs is too smart for it."
956 :group 'ess-Stata
957 :type 'string)
959 (defcustom inferior-OMG-program-name "omegahat"
960 "*Program name for invoking an inferior ESS with omegahat()."
961 :group 'ess-OMG
962 :type 'string)
965 ;;;;; names for setting the pager and editor options of the
966 ;;;;; inferior-ess-process
968 ;;; S-editor and S-pager,
969 ;;; R-editor and R-pager,
970 ;;; ess-editor and ess-pager,
971 ;;; and inferior-ess-language-start
972 ;;; apply in principle to the 15 files essd[s-]*.el
973 ;;; Several of the files (essd-sp4.el and essd-sp6w.el) have more
974 ;;; than one *-customize-alist.
975 ;;; These variables are currently used only with the S language files for
976 ;;; S S-Plus R.
978 (defcustom R-editor
979 (if ess-microsoft-p "gnuclient.exe"
980 (if (equal system-type 'Apple-Macintosh) nil
981 (if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
982 "*Editor called by R process with 'edit()' command."
983 :group 'ess
984 :type 'string)
986 (defcustom R-pager 'nil ; Usually nil is correct as ESS and page() cooperate.
987 "*Pager called by R process with 'page()' command."
988 :group 'ess
989 :type '(choice (const nil) string))
991 (defcustom S-editor
992 (if ess-microsoft-p "gnuclient.exe"
993 (if (equal system-type 'Apple-Macintosh) nil
994 (if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
995 "*Editor called by S process with 'edit()' command."
996 :group 'ess
997 :type 'string)
999 (defcustom S-pager
1000 (if ess-microsoft-p "gnuclientw.exe"
1001 (if (equal system-type 'Apple-Macintosh) nil
1002 (if (featurep 'xemacs) "gnuclient -q" "emacsclient")))
1003 "*Pager called by S process with 'page()' command."
1004 ;; Change made to provide a better help(function) experience with
1005 ;; S+6 and xemacs
1006 ;; gnuclient -q will open a buffer with an HTML help file
1007 ;; you can view it with M-x browse-url-of-buffer
1008 :group 'ess
1009 :type 'string)
1011 (defvar ess-editor nil
1012 "*Editor by which the process sends information to an emacs buffer
1013 for editing and then to be returned to the process.")
1015 (defvar ess-pager nil
1016 "*Pager by which the process sends information to an emacs buffer.")
1018 (defvar inferior-ess-language-start nil
1019 "*Initialization commands sent to the ESS process.")
1021 (make-variable-buffer-local 'ess-editor)
1022 (make-variable-buffer-local 'ess-pager)
1023 (make-variable-buffer-local 'inferior-ess-language-start)
1027 ;;;;; names for S-Plus help files on MS-Windows
1029 (defcustom inferior-ess-help-filetype nil
1030 "S-Plus and Sqpe for Windows use the \"chm\" (compiled html) filetype
1031 for help files. The default value is nil for other systems."
1032 :group 'ess-proc
1033 :type 'string)
1034 (make-variable-buffer-local 'inferior-ess-help-filetype)
1035 (setq-default inferior-ess-help-filetype nil)
1038 ;;;;; names for communication using MS-Windows 9x/NT ddeclient mechanism
1040 (defcustom inferior-ess-ddeclient nil
1041 "*ddeclient is the intermediary between emacs and the stat program."
1042 :group 'ess-proc
1043 :type 'string)
1045 (make-variable-buffer-local 'inferior-ess-ddeclient)
1047 (defcustom inferior-ess-client-name nil
1048 "*Name of ESS program ddeclient talks to."
1049 :group 'ess-proc
1050 :type 'string)
1052 (make-variable-buffer-local 'inferior-ess-client-name)
1054 (defcustom inferior-ess-client-command nil
1055 "*ddeclient command sent to the ESS program."
1056 :group 'ess-proc
1057 :type '(choice (const nil) string))
1059 (make-variable-buffer-local 'inferior-ess-client-command)
1061 ;;;;; user settable defaults
1062 (defvar inferior-S-program-name inferior-S+3-program-name
1063 "*Program name for invoking an inferior ESS with S().")
1064 ;;- (setq inferior-S-program
1065 ;;- (cond ((string= S-proc-prefix "S") "Splus")
1066 ;;- ((string= S-proc-prefix "R") "R")
1067 ;;- (t "S")
1068 ;;- ))
1069 ;;(make-local-variable 'inferior-S-program)
1071 (defvar inferior-ess-program nil ;inferior-S-program-name
1072 "*Default program name for invoking inferior-ess().
1073 The other variables ...-program-name should be changed, for the
1074 corresponding program.")
1076 (make-variable-buffer-local 'inferior-ess-program)
1077 (setq-default inferior-ess-program inferior-S-program-name)
1080 (defvar inferior-ess-start-args ""
1081 "String of arguments passed to the ESS process.
1082 If you wish to pass arguments to a process, see e.g. `inferior-R-args'.")
1084 (defcustom inferior-ess-start-file nil
1085 "*File dumped into process, if non-nil."
1086 :group 'ess-proc
1087 :type '(choice (const nil) file))
1089 (defcustom inferior-ess-pager "cat"
1090 "*Pager to use for reporting help files and similar things."
1091 :group 'ess-proc
1092 :type 'string)
1094 (defcustom inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?"
1095 "Regular expression used by `ess-mode' to detect the primary prompt.
1096 Do not anchor to bol with `^'."
1097 :group 'ess-proc
1098 :type 'string)
1100 (make-variable-buffer-local 'inferior-ess-primary-prompt)
1101 (setq-default inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?")
1103 (defcustom inferior-ess-secondary-prompt "+ ?"
1104 "Regular expression used by ess-mode to detect the secondary prompt.
1105 (This is issued by S to continue an incomplete expression). Do not
1106 anchor to bol with `^'."
1107 :group 'ess-proc
1108 :type 'string)
1110 (make-variable-buffer-local 'inferior-ess-secondary-prompt)
1111 (setq-default inferior-ess-secondary-prompt "+ ?")
1113 ;;*;; Variables controlling interaction with the ESS process
1115 (defcustom ess-execute-in-process-buffer nil
1116 "*Non-nil means the ess-execute- commands output to the process buffer.
1117 Otherwise, they get their own temporary buffer."
1118 :group 'ess-proc
1119 :type 'boolean)
1121 (defcustom ess-eval-empty nil
1122 "*Non-nil means `ess-eval-line*' will send empty lines to the ESS process."
1123 :group 'ess-proc
1124 :type 'boolean)
1126 (defcustom ess-eval-visibly-p t
1127 "*Non-nil means ess-eval- commands display commands in the process buffer."
1128 :group 'ess-proc
1129 :type 'boolean)
1131 (defcustom ess-synchronize-evals nil
1132 "*Non-nil means all evaluations will synchronize with the ESS process.
1133 This means ess-mode will wait for S to dent a prompt before sending the next
1134 line of code. This allows users of Emacs version 18.57 or less to
1135 evaluate large regions of code without causing an error. Users of newer
1136 Emacsen usually do not want this feature, since it locks up use
1137 of Emacs until the code has been successfully evaluated."
1138 :group 'ess-proc
1139 :type 'boolean)
1141 (defcustom ess-eval-visibly-at-end t
1142 "*Non-nil means ess-eval- commands display output at end of process buffer."
1143 :group 'ess-proc
1144 :type 'boolean)
1147 (defcustom ess-eval-ddeclient-sleep 0.06
1148 "*If non-nil, a number specifying *seconds* to wait after certain
1149 \[[ess-eval-linewise-ddeclient]] calls, such as those at startup."
1150 ;; i.e this currently only applies to (if microsoft-p ...) !
1151 :group 'ess-proc
1152 :type '(choice (const nil) number))
1155 \f ; System variables
1157 ;;*;; Variables relating to multiple processes
1159 ;; SJE -- this shouldn't be customixed by user.
1160 (defvar ess-current-process-name nil
1161 "Name of the current S process.")
1163 (defvar ess-process-name-list nil
1164 "Alist of active ESS processes.")
1166 ;;*;; Inferior ESS commands
1168 (defcustom inferior-ess-load-command "source(\"%s\")\n"
1169 "Format-string for building the ess command to load a file.
1171 This format string should use %s to substitute a file name and should
1172 result in an ESS expression that will command the inferior ESS to load
1173 that file."
1174 :group 'ess-command
1175 :type 'string)
1177 (defcustom inferior-ess-dump-command "dump(\"%s\",file=\"%s\")\n"
1178 "Format-string for building the ess command to dump an object into a file.
1180 Use first %s to substitute an object name
1181 Use second %s to substitute the dump file name."
1182 :group 'ess-command
1183 :type 'string)
1185 (defcustom inferior-ess-help-command "help(\"%s\")\n"
1186 "Format-string for building the ESS command to ask for help on an object.
1188 This format string should use %s to substitute an object name."
1189 :group 'ess-command
1190 :type 'string)
1192 (make-variable-buffer-local 'inferior-ess-help-command)
1193 (setq-default inferior-ess-help-command "help(\"%s\")\n")
1195 (defcustom inferior-ess-exit-command "q()\n"
1196 "Format-string for building the ess command to exit.
1198 This format string should use %s to substitute an object name."
1199 :group 'ess-command
1200 :type 'string)
1202 (make-variable-buffer-local 'inferior-ess-exit-command)
1203 (setq-default inferior-ess-exit-command "q()\n")
1205 (defvar inferior-ess-search-list-command nil
1206 "`ess-language' command that prints out the search list;
1207 i.e. the list of directories and (recursive) objects that `ess-language' uses
1208 when it searches for objects.
1210 Really set in <ess-lang>-customize-alist in ess[dl]-*.el")
1211 ;; and hence made buffer-local via that scheme...
1213 (defcustom inferior-ess-names-command "names(%s)\n"
1214 "Format string for ESS command to extract names from an object.
1216 %s is replaced by the object name -- usually a list or data frame."
1217 :group 'ess-command
1218 :type 'string)
1220 (defcustom inferior-ess-safe-names-command "try(names(%s), silent=TRUE)\n"
1221 "Format string for ESS command to extract names from an object *safely*.
1223 %s is replaced by an \"object name\" -- usually a list or data frame, but in R also
1224 e.g., 'package:stats'."
1226 :group 'ess-command
1227 :type 'string)
1229 (defcustom inferior-ess-get-prompt-command "options()$prompt\n"
1230 "Command to find the value of the current S prompt."
1231 :group 'ess-command
1232 :type 'string)
1234 (defvar ess-cmd-delay nil
1235 "*Set to a positive number if ESS will include delays proportional to
1236 `ess-cmd-delay' in some places. These delays are introduced to
1237 prevent timeouts in certain processes, such as completion.")
1238 (make-variable-buffer-local 'ess-cmd-delay)
1240 (defcustom ess-R-cmd-delay nil
1241 "Used to initialize `ess-cmd-delay'."
1242 :group 'ess-command
1243 :type '(choice (const nil) number))
1245 (defcustom ess-S+-cmd-delay 1.0
1246 "Used to initialize `ess-cmd-delay'."
1247 :group 'ess-command
1248 :type '(choice (const nil) number))
1250 ;;*;; Regular expressions
1252 (defvar inferior-ess-prompt nil
1253 "The regular expression inferior ess mode uses for recognizing prompts.
1254 Constructed at run time from `inferior-ess-primary-prompt' and
1255 `inferior-ess-secondary-prompt' within `inferior-ess-mode'.")
1257 (make-variable-buffer-local 'inferior-ess-prompt)
1259 (defvar ess-change-sp-regexp ""
1260 "The regexp for matching the S/R/.. commands that change the search path.")
1261 (make-variable-buffer-local 'ess-change-sp-regexp)
1263 (defcustom ess-S+-change-sp-regexp
1264 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|module(\\|source(\\)"
1265 "The regexp for matching the S-plus commands that change the search path."
1266 :group 'ess-proc
1267 :type 'regexp)
1269 (defcustom ess-S-change-sp-regexp
1270 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)"
1271 "The regexp for matching the S commands that change the search path."
1272 :group 'ess-proc
1273 :type 'regexp)
1275 (defcustom ess-R-change-sp-regexp
1276 "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)"
1277 "The regexp for matching the R commands that change the search path."
1278 :group 'ess-proc
1279 :type 'regexp)
1282 ;;*;; Process-dependent variables
1284 (defvar ess-search-list nil
1285 "Cache of list of directories and objects to search for ESS objects.")
1287 (make-variable-buffer-local 'ess-search-list)
1289 (defvar ess-sl-modtime-alist nil
1290 "Alist of modification times for all ess directories accessed this
1291 session.")
1293 (make-variable-buffer-local 'ess-sl-modtime-alist)
1295 (defvar ess-sp-change nil
1296 "This symbol flags a change in the ess search path.")
1298 (make-variable-buffer-local 'ess-sp-change)
1300 (defvar ess-prev-load-dir/file nil
1301 "This symbol saves the (directory . file) pair used in the last
1302 `ess-load-file' command. Used for determining the default in the next one.")
1304 (make-variable-buffer-local 'ess-prev-load-dir/file)
1306 (defvar ess-object-list nil
1307 ;; This is a list of the currently known object names. It is
1308 ;; current only for one command entry; it exists under the
1309 ;; assumption that the list of objects doesn't change while entering
1310 ;; a command.
1311 "Cache of object names")
1313 (make-variable-buffer-local 'ess-object-list)
1315 ;;*;; Miscellaneous system variables
1317 (defvar ess-temp-point nil
1318 "Variable used to retain a buffer position past let or let*.")
1320 (defvar ess-mode-map nil
1321 "Keymap for `ess-mode'.")
1323 (defvar ess-eval-map nil
1324 "Keymap for ess-eval functions.")
1326 (defvar inferior-ess-mode-map nil
1327 "Keymap for `inferior-ess' mode.")
1329 (defvar ess-mode-minibuffer-map nil)
1331 ;; SJE: Wed 29 Dec 2004 - following 3 ess-object* variables can be removed
1332 ;; soon if no-one needs the completion code.
1333 (defvar ess-object-name-db-file "ess-namedb"
1334 "File containing definitions for `ess-object-name-db'.")
1336 (defvar ess-object-name-db-file-loaded '()
1337 "List of programs whose name-db file has been loaded.")
1339 (defvar ess-object-name-db nil
1340 "Alist of lists of object names, with directory names as keys.
1341 The file ess-namedb.el is loaded (if it exists) to define this variable.
1342 See also function `ess-create-object-name-db'.")
1344 (make-variable-buffer-local 'ess-object-name-db)
1345 (setq-default ess-object-name-db nil)
1347 ;; SJE: 2007-07-16 -- add to quieten byte compile.
1348 (defvar ess-loop-timeout nil
1349 "Number ofloops ess-mode will wait for prompt before signalling an error.")
1351 (defcustom ess-S-loop-timeout 2000000
1352 "Integer specifying how many loops ess-mode will wait for the prompt
1353 before signaling an error. Will be set to `ess-loop-timeout' in the S dialects'
1354 alists. Increase this, if you have a fast(er) machine."
1355 :group 'ess-proc
1356 :type 'integer)
1358 (defcustom ess-XLS-loop-timeout 50000
1359 "Integer specifying how many loops ess-mode will wait for the prompt
1360 before signaling an error. Will be set to `ess-loop-timeout' in the XLispStat
1361 dialects' alists. Increase this, if you have a fast(er) machine."
1362 :group 'ess-proc
1363 :type 'integer)
1365 ;; NOTA BENE: Other languages/dialect currently set `ess-loop-timeout'
1366 ;; **directly** in their essd-*.el alist !!
1368 ;;;*;;; Font-lock support
1370 ;;; for programming, transcript, and inferior process modes.
1372 (defcustom inferior-ess-font-lock-input t
1373 "*Non-nil means input is syntactically font-locked.
1374 If nil, input is in the `font-lock-variable-name-face'."
1375 :group 'ess
1376 :type 'boolean)
1378 (defvar ess-R-constants
1379 '("TRUE" "FALSE" "NA" "NULL" "Inf" "NaN"))
1381 (defvar ess-S-constants
1382 (append ess-R-constants '("T" "F")))
1384 ;; first the common ones
1385 (defvar ess-S-modifyiers
1386 '("library" "attach" "detach" "source" "module"))
1387 (defvar ess-R-modifyiers
1388 '("library" "attach" "detach" "source" "require"))
1390 (defvar ess-R-keywords
1391 '("while" "for" "in" "repeat" "if" "else" "switch" "break" "next"
1392 "function" "return" "message" "warning" "stop"))
1393 (defvar ess-S-keywords
1394 (append ess-R-keywords '("terminate")))
1396 ;; only some of these keywords "look like functions but are not":
1397 (defvar ess-S-non-functions
1398 '("if" "for" "function" "while"))
1401 (defvar ess-R-message-prefixes
1402 '("Error:" "Error in"
1403 "Warning:" "Warning in"
1404 "Warning messages"))
1405 (defvar ess-S-message-prefixes
1406 (append ess-R-message-prefixes
1407 '("Syntax error:" "Dumped")))
1410 (defvar ess-R-assign-ops
1411 '("<<-" "<-" "->") ; don't want "=" here which is not only for assign
1413 (defvar ess-S-assign-ops
1414 '("<<-" "<-" "_" "->") ; don't want "=" here which is not only for assign
1417 ;; Note: \\s\" is really \s" which means match a char belonging to the
1418 ;; "quote character" syntax class.
1419 (defvar ess-R-function-name-regexp
1420 (concat "\\s\"?\\(\\(\\sw\\|\\s_\\)+"
1421 "\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\)"
1422 "\\(\\s-\\|\n\\)*function")
1424 (defvar ess-S-function-name-regexp
1425 ess-R-function-name-regexp ; since "_" is deprecated for S-plus as well
1428 (defvar ess-R-mode-font-lock-keywords
1429 (list
1430 (cons (regexp-opt ess-R-assign-ops)
1431 'font-lock-reference-face) ; assign
1432 (cons (concat "\\<" (regexp-opt ess-R-constants 'enc-paren) "\\>")
1433 'font-lock-type-face) ; constants
1434 (cons (concat "\\<" (regexp-opt ess-R-modifyiers 'enc-paren) "\\>")
1435 'font-lock-reference-face) ; modify search list or source
1436 ; new definitions
1437 (cons (concat "\\<" (regexp-opt ess-R-keywords 'enc-paren) "\\>")
1438 'font-lock-keyword-face) ; keywords
1439 (cons ess-R-function-name-regexp
1440 '(1 font-lock-function-name-face t))
1441 ; function name
1443 "Font-lock patterns used in `R-mode' buffers.")
1445 (defvar ess-S-mode-font-lock-keywords
1446 (list
1447 (cons (regexp-opt ess-S-assign-ops)
1448 'font-lock-reference-face) ; assign
1449 (cons (concat "\\<" (regexp-opt ess-S-constants 'enc-paren) "\\>")
1450 'font-lock-type-face) ; constants
1451 (cons (concat "\\<" (regexp-opt ess-S-modifyiers 'enc-paren) "\\>")
1452 'font-lock-reference-face) ; modify search list or source
1453 ; new definitions
1454 (cons (concat "\\<" (regexp-opt ess-S-keywords 'enc-paren) "\\>")
1455 'font-lock-keyword-face) ; keywords
1456 (cons ess-S-function-name-regexp
1457 '(1 font-lock-function-name-face t))
1458 ; function name
1460 "Font-lock patterns used in `S-mode' buffers.")
1465 (defvar inferior-ess-R-font-lock-keywords
1466 (append
1467 '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1469 (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1470 (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1471 '(1 font-lock-variable-name-face keep t))) )
1473 ess-R-mode-font-lock-keywords
1475 (list
1476 (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face); ess-mode msg
1477 (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1478 (cons (concat "^" (regexp-opt ess-R-message-prefixes 'enc-paren))
1479 'font-lock-reference-face) ; inferior-ess problems or errors
1480 (cons "#" 'font-lock-comment-face) ; comment
1481 (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1483 "Font-lock patterns used in inferior-R-mode buffers.")
1485 (defvar inferior-ess-S-font-lock-keywords
1486 (append
1487 '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1489 (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1490 (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1491 '(1 font-lock-variable-name-face keep t))) )
1493 ess-S-mode-font-lock-keywords
1495 (list
1496 (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face) ; ess-mode msg
1497 (cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1498 (cons (concat "^" (regexp-opt ess-S-message-prefixes 'enc-paren))
1499 'font-lock-reference-face) ; inferior-ess problems or errors
1500 (cons "#" 'font-lock-comment-face) ; comment
1501 (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1503 "Font-lock patterns used in inferior-S-mode buffers.")
1505 ;; use the inferior-* ones directly in ess-trns.el
1506 ;; (defvar ess-trans-font-lock-keywords
1507 ;; inferior-ess-font-lock-keywords
1508 ;; "Font-lock patterns used in `ess-transcript-mode' buffers.")
1511 ;;;*;;; ess-help variables
1513 \f ; ess-help-mode
1514 ;; This will never need to be loaded independently of any of the other
1515 ;; modules, but they can all call it so we may as well put it here.
1517 ;;*;; Variables relating to ess-help-mode
1519 (defcustom ess-help-own-frame nil
1520 "*Controls whether ESS help buffers should start in a different frame.
1522 Possible values are:
1523 nil: Display help in current frame.
1524 'one: All help buffers are shown in one dedicated frame.
1525 t: Each help buffer gets its own frame.
1527 The parameters of this frame are stored in `ess-help-frame-alist'.
1528 See also `inferior-ess-own-frame'."
1529 :group 'ess-help
1530 :type '(choice (const nil) (const one) (const t)))
1532 (defcustom ess-help-frame-alist special-display-frame-alist
1533 "*Alist of frame parameters used to create help frames.
1534 This defaults to `special-display-frame-alist' and is used only when
1535 the variable `ess-help-own-frame' is non-nil."
1536 :group 'ess-help
1537 :type 'alist)
1540 \f ; User changeable variables
1541 ;;;=====================================================
1542 ;;; Users note: Variables with document strings starting
1543 ;;; with a * are the ones you can generally change safely, and
1544 ;;; may have to upon occasion.
1546 (defcustom ess-help-kill-bogus-buffers nil
1547 "*Non-nil means kill ESS help buffers immediately if they are \"bogus\"."
1548 :group 'ess-help
1549 :type 'boolean)
1551 (defvar ess-help-form 'separate-buffer
1552 "*Place to show help. NOT IMPLEMENTED YET.
1553 Choices are `separate-buffer', `s-process', `www'. The latter uses
1554 `browse-url' to find the location.")
1556 ;; WWW Help NOT included yet. Be patient.
1557 (defvar ess-help-w3-url-prefix "http://pyrite.cfas.washington.edu/ESS/R/"
1558 "*Head URL for finding function help.")
1560 (defvar ess-help-w3-url-funs "funs/"
1561 "Place to find functions.")
1563 (defcustom ess-r-args-noargsmsg "No args found."
1564 "Message returned if \\[ess-r-args-get] cannot find a list of arguments."
1565 :group 'ess-R
1566 :type 'string)
1568 (defcustom ess-r-args-show-prefix "ARGS: "
1569 "A prefix string that is shown before the arguments list."
1570 :group 'ess-R
1571 :type 'string)
1573 (defcustom ess-r-args-show-as 'message
1574 "How ess-r-args-show should show the argument list. Possible values
1575 are: 'message' (the default) or 'tooltip'."
1576 :group 'ess-R
1577 :type '(choice
1578 (const :tag "message" :value 'message)
1579 (const :tag "tooltip" :value 'tooltip)))
1581 (defcustom ess-r-args-keep-silent ess-S-non-functions
1582 "List of functions names which should *not* trigger \\[ess-r-args-show];
1583 Defaults to `ess-S-non-functions'."
1584 :group 'ess-R
1585 :type '(repeat string))
1587 (defcustom ess-r-args-electric-paren nil
1588 "*non-nil means re-assign \"(\" to \\[ess-r-args-auto-show]."
1589 :group 'ess-R
1590 :type 'boolean)
1593 \f ; System variables
1594 ;;;=====================================================
1595 ;;; Users note: You will rarely have to change these
1596 ;;; variables.
1598 ;;*;; Variables relating to ess-help-mode
1600 ;;-- ess-help-S-.. and ess-help-R-.. : in essl-s.el (are used in ess-inf).
1602 (defvar ess-help-sec-keys-alist nil
1603 "Alist of (key . string) pairs for use in section searching.")
1605 (defvar ess-help-sec-regex nil
1606 "Reg(ular) Ex(pression) of section headers in help file")
1608 (make-variable-buffer-local 'ess-help-sec-keys-alist)
1609 (make-variable-buffer-local 'ess-help-sec-regex)
1612 \f ; ess-mode: editing S source
1614 ;;; This syntax table is required by ess-mode.el, ess-inf.el and
1615 ;;; ess-trans.el, so we provide it here.
1616 (defvar ess-mode-syntax-table nil "Syntax table for `ess-mode'.")
1617 (make-variable-buffer-local 'ess-mode-syntax-table)
1620 \f ; Buffer local customization stuff
1622 (defvar ess-source-modes '(ess-mode)
1623 "A list of modes used to determine if a buffer contains ess source code.")
1624 ;;; If a file is loaded into a buffer that is in one of these major modes, it
1625 ;;; is considered an ess source file. The function ess-load-file uses this to
1626 ;;; determine defaults.
1628 (defcustom ess-error-buffer-name "*ESS-errors*"
1629 "Name of buffer to keep process error messages in.
1630 Created for each process."
1631 :group 'ess-proc
1632 :type 'string)
1634 (defcustom ess-verbose nil
1635 "Non-nil means write more information to `ess-dribble-buffer' than usual."
1636 :group 'ess-proc
1637 :type 'boolean)
1639 (defvar ess-dribble-buffer (generate-new-buffer "*ESS*")
1640 "Buffer for temporary use for setting default variable values.
1641 Used for recording status of the program, mainly for debugging.")
1643 (defvar ess-customize-alist nil
1644 "Variable settings to use for proper behavior.
1645 Not buffer local!")
1647 (defvar ess-local-customize-alist nil
1648 "Buffer local settings for proper behavior.
1649 Used to store the values for passing on to newly created buffers.")
1651 (make-variable-buffer-local 'ess-local-customize-alist)
1653 (defvar ess-mode-editing-alist nil
1654 "Variable settings for ess-mode.")
1656 (defvar ess-transcript-minor-mode nil
1657 "Non-nil if using `ess-transcript-mode' as a minor mode of some other mode.")
1659 (make-variable-buffer-local 'ess-transcript-minor-mode)
1661 (defvar ess-listing-minor-mode nil
1662 "Non-nil if using ess-listing-minor-mode.")
1664 (make-variable-buffer-local 'ess-listing-minor-mode)
1666 (provide 'ess-cust)
1668 \f ; Local variables section
1670 ;;; This file is automatically placed in Outline minor mode.
1671 ;;; The file is structured as follows:
1672 ;;; Chapters: ^L ;
1673 ;;; Sections: ;;*;;
1674 ;;; Subsections: ;;;*;;;
1675 ;;; Components: defuns, defvars, defconsts
1676 ;;; Random code beginning with a ;;;;* comment
1678 ;;; Local variables:
1679 ;;; mode: emacs-lisp
1680 ;;; mode: outline-minor
1681 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
1682 ;;; End:
1684 ;;; ess-cust.el ends here