177
192
(make-variable-buffer-local 'ess-language)
178
193
(setq-default ess-language "Initial")
180
(defcustom ess-dialect nil
195
(defvar ess-dialect nil
181
196
"String version of the dialect being run for the inferior process.
182
197
This, plus `ess-language', should be able to determine the exact
183
198
version of the statistical package being executed in the particular
186
201
Current values could include:
187
for `ess-dialect' = S3, S4, S+3, S+4, S+5, S+6, R, XLS, SAS, STA
202
for `ess-dialect' = S3, S4, Sp3, Sp4, Sp5, Sp6, R, XLS, SAS, STA
189
Used to adjust for changes in versions of the program"
191
:type '(choice (const :tag "None" :value nil)
192
(const :tag "S3" :value "S3")
193
(const :tag "Sp3" :value "Sp3")
194
(const :tag "S4" :value "S4")
195
(const :tag "Sp4" :value "Sp4")
196
(const :tag "Sp5" :value "Sp5")
197
(const :tag "Sp6" :value "Sp6")
198
(const :tag "XLS" :value "XLS")
199
(const :tag "SAS" :value "SAS")
200
(const :tag "Runix" :value "Runix")
201
(const :tag "Rwin" :value "Rwin")))
204
Used to adjust for changes in versions of the program.")
203
206
(make-variable-buffer-local 'ess-dialect)
204
(setq-default ess-dialect "Initial-dialect")
207
;;(setq-default ess-dialect "Initial-dialect")
208
(setq-default ess-dialect nil)
209
;;; SJE -- why use "Initial-dialect"? If we use nil, it matches "None"
210
;;; in the custom choice.
212
;; (defcustom ess-etc-directory
213
;; (expand-file-name (concat ess-lisp-directory "/../etc/"))
214
;; "*Location of the ESS etc/ directory.
215
;; The ESS etc directory stores various auxillary files that are useful
216
;; for ESS, such as icons."
206
220
(defcustom ess-directory-function nil
207
221
"*Function to return the directory that ESS is run from.
208
If nil or or if returns nil then you get `ess-directory'."
222
If nil or if the function returns nil then you get `ess-directory'."
224
:type '(choice (const nil) function))
226
(defcustom ess-setup-directory-function nil
227
"*Function to setup the directory that ESS is run from.
228
This function can be called to set environment variables or to create
231
:type '(choice (const nil) function))
212
233
(defcustom ess-directory nil
213
234
"*The directory ESS is run from. It must end in a slash.
311
344
;;;*;;; Indentation parameters
313
(defvar ess-auto-newline nil
346
(defcustom ess-auto-newline nil
314
347
"*Non-nil means automatically newline before and after braces
315
inserted in S code.")
317
(defvar ess-tab-always-indent t
352
(defcustom ess-tab-always-indent t
318
353
"*Non-nil means TAB in S mode should always reindent the current line,
319
regardless of where in the line point is when the TAB command is used.")
321
(defvar ess-indent-level 2
322
"*Indentation of S statements with respect to containing block.")
324
(defvar ess-brace-imaginary-offset 0
325
"*Imagined indentation of an open brace following a statement.")
327
(defvar ess-brace-offset 0
354
regardless of where in the line point is when the TAB command is used."
358
(defcustom ess-indent-level 2
359
"*Indentation of S statements with respect to containing block."
363
(defcustom ess-brace-imaginary-offset 0
364
"*Imagined indentation of an open brace following a statement."
368
(defcustom ess-brace-offset 0
328
369
"*Extra indentation for open braces.
329
Compares with other text in same context.")
331
(defvar ess-continued-statement-offset 2
332
"*Extra indent for lines not starting new statements.")
334
(defvar ess-continued-brace-offset 0
370
Compares with other text in same context."
374
(defcustom ess-continued-statement-offset 2
375
"*Extra indent for lines not starting new statements."
379
(defcustom ess-continued-brace-offset 0
335
380
"*Extra indent for substatements that start with open-braces.
336
This is in addition to ess-continued-statement-offset.")
381
This is in addition to ess-continued-statement-offset."
338
(defvar ess-arg-function-offset 2
385
(defcustom ess-arg-function-offset 2
339
386
"*Extra indent for internal substatements of function `foo' that called
340
387
in `arg=foo(...)' form.
341
If not number, the statements are indented at open-parenthesis following foo.")
343
;;added rmh 2Nov97 at request of Terry Therneau
344
(defvar ess-close-brace-offset 0
345
"*Extra indentation for closing braces.")
347
;;added rmh 2Nov97 at request of Terry Therneau
348
(defvar ess-fancy-comments t
349
"*Non-nil means distiguish between #, ##, and ### for indentation.")
388
If not number, the statements are indented at open-parenthesis following foo."
392
;;added rmh 2Nov97 at request of Terry Therneau
393
(defcustom ess-close-brace-offset 0
394
"*Extra indentation for closing braces."
398
;;added rmh 2Nov97 at request of Terry Therneau
399
(defcustom ess-fancy-comments t
400
"*Non-nil means distiguish between #, ##, and ### for indentation."
352
405
;; PeterDalgaard, 1Apr97 :
353
406
;;The default ess-else-offset should be 0, not 2 IMHO (try looking at
354
407
;;the ls() function, for instance). Was 2.
355
(defvar ess-else-offset 0
356
"*Extra indent for `else' lines.")
408
(defcustom ess-else-offset 0
409
"*Extra indent for `else' lines."
358
(defvar ess-expression-offset 4
413
(defcustom ess-expression-offset 4
359
414
"*Extra indent for internal substatements of `expression' that specified
360
415
in `obj <- expression(...)' form.
361
416
If not number, the statements are indented at open-parenthesis following
364
421
;;;*;;; Editing styles
366
423
;;; **FIXME** The following NEEDS to be customized.
424
;; SJE: I disagree; this variable should not be customized; individual vars,
425
;; such as ess-indent-level are already customizable.
368
426
(defvar ess-default-style-list
370
428
(cons 'ess-indent-level ess-indent-level)
431
511
This can be a string (an absolute directory name ending in a slash) or
432
512
a lambda expression of no arguments which will return a suitable string
433
513
value. The lambda expression is evaluated with the process buffer as the
518
'(lambda () (file-name-as-directory
519
(expand-file-name (concat (car ess-search-list) \"/.Src\"))))
521
This always dumps to a sub-directory (\".Src\") of the current ess
522
working directory (i.e. first elt of search list)."
436
524
:type 'directory)
439
;;; '(lambda () (file-name-as-directory
440
;;; (expand-file-name (concat (car ess-search-list) "/.Src"))))
441
;;; This always dumps to a sub-directory (".Src") of the current ess
442
;;; working directory (i.e. first elt of search list)
444
(defcustom ess-dump-filename-template (concat (user-login-name) ".%s.S")
445
"*Template for filenames of dumped objects.
446
%s is replaced by the object name.
448
This gives filenames like `user.foofun.S', so as not to clash with
527
(defcustom ess-dump-filename-template-proto (concat (user-login-name) ".%s.S")
528
"*Prototype template for filenames of dumped objects.
529
The ending `S' is replaced by the current \\[ess-suffix], to give
530
\\[ess-dump-filename-template] when an inferior ESS process starts.
532
By default, gives filenames like `user.foofun.S', so as not to clash with
449
533
other users if you are using a shared directory. Other alternatives:
450
534
\"%s.S\" ; Don't bother uniquifying if using your own directory(ies)
451
\"dump\" ; Always dump to a specific filename. This makes it impossible
535
\"dumpdir\"; Always dump to a specific filename. This makes it impossible
452
536
to edit more than one object at a time, though.
453
537
(make-temp-name \"scr.\") ; Another way to uniquify"
538
;; MM: The last 3-4 lines above suck (I don't understand them) -- FIXME --
459
546
(defcustom ess-mode-hook nil
508
596
; System variables
510
598
(defcustom ess-local-process-name nil
511
"The name of the ess process associated with the current buffer."
599
"The name of the ESS process associated with the current buffer."
601
:type '(choice (const nil) string))
515
603
(make-variable-buffer-local 'ess-local-process-name)
606
(defcustom ess-kermit-command "gkermit -T"
607
"*Kermit command invoked by `ess-kermit-get' and `ess-kermit-send'."
612
(defcustom ess-kermit-prefix "#"
613
"*String files must begin with to use kermit file transfer."
618
(defcustom ess-kermit-remote-directory "."
619
"*Buffer local variable that designates remote directory of file."
624
(make-variable-buffer-local 'ess-kermit-remote-directory)
518
626
;;*;; Regular expressions
520
628
;; FIXME : This is just for the S dialects; need to define this for others,
522
630
;; {however "XLS-mode" should just use standard lisp "beginning of function"}
523
(defcustom ess-function-pattern
527
;;- "\\(\\sw\\|\\s_\\)+" ; symbol
529
;;- "\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*" ; whitespace, assign, whitespace/nl
530
;;- "function\\s-*(" ; function keyword, parenthesis
532
;;- "\\<\\(\\sw\\|\\s_\\)+" ; symbol
533
;;- "\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*" ; whitespace, assign, whitespace/nl
534
;;- "function\\s-*(" ; function keyword, parenthesis
536
;;----- new version by "Stephen C. Pope" <scp@predict.com> :
632
(defcustom ess-R-function-pattern
636
"\\(\\sw\\|\\s_\\)+\\(<-\\)?" ; symbol (replacement?)
639
"\\(^\\|[ ]\\)" ; beginning of name
640
"\\(\\sw\\|\\s_\\)+" ; symbol
641
"\\)\\)" ; END EITHER OR
642
"\\s-*\\(<-\\|=\\)" ; whitespace, assign, whitespace/nl
643
"\\(\\(\\s-\\|\n\\)*\\s<.*\\s>\\)*" ; whitespace, comment
644
"\\(\\s-\\|\n\\)*function\\s-*(" ; whitespace, function keyword, parenthesis
646
"The regular expression for matching the beginning of an R function."
650
(defcustom ess-S-function-pattern
651
;; the same as "R" - but allowing "_" in assign
537
653
"\\(\\(" ; EITHER
539
655
"\\(\\sw\\|\\s_\\)+\\(<-\\)?" ; symbol (replacement?)
585
697
;; Keep a copy of your revised ess-site.el to use as a starting point
586
698
;; for upgrades of ESS.
588
(defvar inferior-R-program-name
700
(defcustom inferior-ess-own-frame nil
701
"*Non-nil means that inferior ESS buffers should start in their own frame.
702
The parameters of this frame are stored in `inferior-ess-frame-alist'."
706
(defcustom inferior-ess-frame-alist default-frame-alist
707
"*Alist of frame parameters used to create new frames for iESS buffers.
708
This defaults to `default-frame-alist' and is used only when
709
the variable `inferior-ess-own-frame' is non-nil."
713
(defcustom inferior-ess-same-window t
714
"*Non-nil indicates new inferior ESS process appears in current window.
715
Otherwise, the new inferior ESS buffer is shown in another window in the
716
current frame. This variable is ignored if `inferior-ess-own-frame' is
721
(defcustom inferior-R-program-name
589
722
(if ess-microsoft-p "Rterm" "R")
590
"*Program name for invoking an inferior ESS with \\[R].")
723
"*Program name for invoking an inferior ESS with \\[R]."
727
(defcustom inferior-R-args ""
728
"*String of arguments used when starting R.
729
These arguments are currently not passed to other versions of R that have
730
been created using the variable `ess-r-versions'."
734
(defcustom inferior-R-objects-command "objects(pos=%d, all.names=TRUE)\n"
735
"Format string for R command to get a list of objects at position %d.
736
Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
740
(defcustom ess-r-versions '( "R-1" "R-2")
741
"*List of partial strings for versions of R to access within ESS.
742
Each string specifies the start of a filename. If a filename
743
beginning with one of these strings is found on `exec-path', a M-x
744
command for that version of R is made available. For example, if the
745
file \"R-1.8.1\" is found and this variable includes the string
746
\"R-1\", a function called `M-x R-1.8.1' will be available to run that
748
If duplicate versions of the same program are found (which happens if
749
the same path is listed on `exec-path' more than once), they are
750
ignored by calling `ess-uniq-list'."
752
:type '(repeat string))
755
(defcustom ess-rterm-versions nil
756
"*Construct ess-rterm-versions. If you have versions of R in
757
locations other than in ../../rw*/bin/Rterm.exe, relative to the
758
directory in the `exec-path' variable containing your default location
759
of Rterm, you will need to redefine this variable with a
760
`custom-set-variables' statement in your site-start.el or .emacs
763
:type '(repeat string))
765
(defcustom ess-SHOME-versions
766
'("c:/progra~1/Insightful/splus62"
767
"c:/progra~1/Insightful/splus61"
768
"c:/progra~1/MathSoft/splus6"
769
"c:/progra~1/spls45se"
770
"c:/progra~1/Insightful/splus62netclient"
771
"c:/progra~1/Insightful/splus62net/server"
772
"c:/progra~1/Insightful/splus61netclient"
773
"c:/progra~1/Insightful/splus61net/server"
774
"c:/progra~1/Insightful/splus6se"
775
"c:/progra~1/Insightful/splus61se"
776
"c:/progra~1/Insightful/splus62se"
777
"c:/progra~1/Insightful/splus70"
778
"c:/progra~1/Insightful/splus71")
779
"*List of possible values of the environment variable SHOME for recent
780
releases of S-Plus. These are the default locations for several
781
current and recent releases of S-Plus. If any of these pathnames
782
correspond to a directory on your machine, running the function
783
`ess-sqpe-versions-create' will create a function, for example, `M-x
784
splus62', that will start the corresponding version Sqpe inside an
785
emacs buffer in iESS[S] mode. If you have versions of S-Plus in
786
locations other than these default values, redefine this variable with
787
a `custom-set-variables' statement in your site-start.el or .emacs
788
file. The list of functions actually created appears in the *ESS*
789
buffer and should appear in the \"ESS / Start Process / Other\"
792
:type '(repeat string))
593
794
(defcustom inferior-S3-program-name "/disk05/s/S"
594
795
"*Program name for invoking an inferior ESS with S3()."
774
999
;;; ess-editor and ess-pager,
775
1000
;;; and inferior-ess-language-start
776
1001
;;; apply in principle to the 15 files essd[s-]*.el
777
;;; Several of the files (essd-sp4.el and essdsp6w.el) have more
1002
;;; Several of the files (essd-sp4.el and essd-sp6w.el) have more
778
1003
;;; than one *-customize-alist.
779
1004
;;; These variables are currently used only with the S language files for
783
1008
(if ess-microsoft-p "gnuclient.exe"
784
1009
(if (equal system-type 'Apple-Macintosh) nil
785
"emacslient")) ;; unix
1010
(if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
786
1011
"*Editor called by R process with 'edit()' command."
790
(defcustom R-pager nil ; Usually nil is correct as ESS and page() cooperate.
1015
(defcustom R-pager 'nil ; Usually nil is correct as ESS and page() cooperate.
791
1016
"*Pager called by R process with 'page()' command."
1018
:type '(choice (const nil) string))
795
1020
(defcustom S-editor
796
1021
(if ess-microsoft-p "gnuclient.exe"
797
1022
(if (equal system-type 'Apple-Macintosh) nil
798
"emacslient")) ;; unix
1023
(if (featurep 'xemacs) "gnuclient -q" "emacsclient"))) ;; unix
799
1024
"*Editor called by S process with 'edit()' command."
803
1028
(defcustom S-pager
804
1029
(if ess-microsoft-p "gnuclientw.exe"
805
1030
(if (equal system-type 'Apple-Macintosh) nil
806
"emacslient")) ;; unix
1031
(if (featurep 'xemacs) "gnuclient -q" "emacsclient")))
807
1032
"*Pager called by S process with 'page()' command."
1033
;; Change made to provide a better help(function) experience with
1035
;; gnuclient -q will open a buffer with an HTML help file
1036
;; you can view it with M-x browse-url-of-buffer
811
(defcustom ess-editor nil
1040
(defvar ess-editor nil
812
1041
"*Editor by which the process sends information to an emacs buffer
813
for editing and then to be returned to the process."
817
(defcustom ess-pager nil
818
"*Pager by which the process sends information to an emacs buffer."
822
(defcustom inferior-ess-language-start nil
823
"*Initialization commands sent to the ess process."
1042
for editing and then to be returned to the process.")
1044
(defvar ess-pager nil
1045
"*Pager by which the process sends information to an emacs buffer.")
1047
(defvar inferior-ess-language-start nil
1048
"*Initialization commands sent to the ESS process.")
827
1050
(make-variable-buffer-local 'ess-editor)
828
1051
(make-variable-buffer-local 'ess-pager)
847
1070
(make-variable-buffer-local 'inferior-ess-client-name)
849
1072
(defcustom inferior-ess-client-command nil
850
"*ddeclient command sent to the ESS program")
1073
"*ddeclient command sent to the ESS program."
1075
:type '(choice (const nil) string))
852
1077
(make-variable-buffer-local 'inferior-ess-client-command)
854
1079
;;;;; user settable defaults
855
1080
(defvar inferior-S-program-name inferior-S+3-program-name
856
1081
"*Program name for invoking an inferior ESS with S().")
1082
;;- (setq inferior-S-program
1083
;;- (cond ((string= S-proc-prefix "S") "Splus")
1084
;;- ((string= S-proc-prefix "R") "R")
1087
;;(make-local-variable 'inferior-S-program)
858
1089
(defvar inferior-ess-program nil ;inferior-S-program-name
859
1090
"*Default program name for invoking inferior-ess().
860
1091
The other variables ...-program-name should be changed, for the
861
1092
corresponding program.")
863
;;(make-local-variable 'inferior-S-program)
864
1094
(make-variable-buffer-local 'inferior-ess-program)
865
1095
(setq-default inferior-ess-program inferior-S-program-name)
866
;;- (setq inferior-S-program
867
;;- (cond ((string= S-proc-prefix "S") "Splus")
868
;;- ((string= S-proc-prefix "R") "R")
873
(defcustom inferior-ess-start-args ""
874
"*String of arguments passed to the ESS process.
875
Useful for R and SAS. This is generic."
1098
(defvar inferior-ess-start-args ""
1099
"String of arguments passed to the ESS process.
1100
If you wish to pass arguments to a process, see e.g. `inferior-R-args'.")
879
1102
(defcustom inferior-ess-start-file nil
880
1103
"*File dumped into process, if non-nil."
881
1104
:group 'ess-proc
1105
:type '(choice (const nil) file))
884
1107
(defcustom inferior-ess-pager "cat"
885
1108
"*Pager to use for reporting help files and similar things."
1007
1209
This format string should use %s to substitute an object name."
1008
1210
:group 'ess-command
1011
1213
(make-variable-buffer-local 'inferior-ess-exit-command)
1012
1214
(setq-default inferior-ess-exit-command "q()\n")
1014
(defcustom inferior-ess-search-list-command "search()\n"
1216
(defvar inferior-ess-search-list-command nil
1015
1217
"`ess-language' command that prints out the search list;
1016
1218
i.e. the list of directories and (recursive) objects that `ess-language' uses
1017
1219
when it searches for objects.
1019
Really set in <ess-lang>-customize-alist in ess[dl]-*.el"
1221
Really set in <ess-lang>-customize-alist in ess[dl]-*.el")
1222
;; and hence made buffer-local via that scheme...
1024
1224
(defcustom inferior-ess-names-command "names(%s)\n"
1025
"Format string for ess command to extract names from an object.
1225
"Format string for ESS command to extract names from an object.
1027
1227
%s is replaced by the object name -- usually a list or data frame."
1028
1228
:group 'ess-command
1031
(defcustom inferior-ess-objects-command "ls()\n" ;; others: in (S) or (R)
1032
"Format string for ess command to get a list of objects at position %d
1034
Don't include a newline at the end! Used in ess-execute-objects."
1038
(make-variable-buffer-local 'inferior-ess-objects-command)
1039
(setq-default inferior-ess-objects-command "ls()\n")
1041
1231
(defcustom inferior-ess-get-prompt-command "options()$prompt\n"
1042
1232
"Command to find the value of the current S prompt."
1043
1233
:group 'ess-command
1236
(defvar ess-cmd-delay nil
1237
"*Set to a positive number if ESS will include delays proportional to
1238
`ess-cmd-delay' in some places. These delays are introduced to
1239
prevent timeouts in certain processes, such as completion.")
1240
(make-variable-buffer-local 'ess-cmd-delay)
1242
(defcustom ess-R-cmd-delay nil
1243
"used to initialize `ess-cmd-delay'."
1245
:type '(choice (const nil) number))
1247
(defcustom ess-S+-cmd-delay 1.0
1248
"used to initialize `ess-cmd-delay'."
1250
:type '(choice (const nil) number))
1046
1252
;;*;; Regular expressions
1048
(defcustom inferior-ess-prompt nil
1254
(defvar inferior-ess-prompt nil
1049
1255
"The regular expression inferior ess mode uses for recognizing prompts.
1050
1256
Constructed at run time from `inferior-ess-primary-prompt' and
1051
`inferior-ess-secondary-prompt'."
1257
`inferior-ess-secondary-prompt' within `inferior-ess-mode'.")
1055
1259
(make-variable-buffer-local 'inferior-ess-prompt)
1057
(defcustom ess-change-sp-regexp
1058
"\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|require(\\|source(\\)"
1059
"The regexp for matching the ess commands that change the search path."
1261
(defvar ess-change-sp-regexp ""
1262
"The regexp for matching the S/R/.. commands that change the search path.")
1263
(make-variable-buffer-local 'ess-change-sp-regexp)
1265
(defcustom ess-S+-change-sp-regexp
1266
"\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|module(\\|source(\\)"
1267
"The regexp for matching the S-plus commands that change the search path."
1271
(defcustom ess-S-change-sp-regexp
1272
"\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)"
1273
"The regexp for matching the S commands that change the search path."
1277
(defcustom ess-R-change-sp-regexp
1278
"\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)"
1279
"The regexp for matching the R commands that change the search path."
1063
1284
;;*;; Process-dependent variables
1065
1286
(defvar ess-search-list nil
1066
"Cache of list of directories and objects to search for ess objects.")
1287
"Cache of list of directories and objects to search for ESS objects.")
1068
1289
(make-variable-buffer-local 'ess-search-list)
1146
1374
:type 'boolean)
1148
(defvar ess-mode-font-lock-keywords
1149
'(("<<-\\|<-\\|_\\|->"
1150
. font-lock-reference-face)
1151
("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>"
1152
. font-lock-type-face)
1153
("\\<\\(library\\|attach\\|detach\\|source\\)\\>"
1154
. font-lock-reference-face)
1155
("\\<\\(while\\|for\\|in\\|repeat\\|if\\|else\\|switch\\|break\\|next\\|return\\|stop\\|warning\\|function\\)\\>"
1156
. font-lock-keyword-face)
1157
("\\s\"?\\(\\(\\sw\\|\\s_\\)+\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*function"
1158
1 font-lock-function-name-face t))
1159
"Font-lock patterns used in `ess-mode' buffers.")
1161
(defvar inferior-ess-font-lock-keywords
1162
'(("<<-\\|<-\\|_\\|->"
1163
. font-lock-reference-face) ; assign
1164
("^\\*\\*\\*.*\\*\\*\\*\\s *$"
1165
. font-lock-comment-face) ; ess-mode msg
1166
("\\[,?[1-9][0-9]*,?\\]"
1167
. font-lock-reference-face) ; Vector/matrix labels
1168
("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>"
1169
. font-lock-type-face) ; keywords
1170
("\\<\\(library\\|attach\\|detach\\|source\\)\\>"
1171
. font-lock-reference-face) ; modify search list or source new definitions
1173
. font-lock-reference-face);inferior-ess problems or errors
1175
. font-lock-reference-face)
1177
. font-lock-reference-face)
1179
. font-lock-reference-face)
1180
("^Warning messages:"
1181
. font-lock-reference-face)
1183
. font-lock-comment-face) ; comment
1185
(1 font-lock-comment-face keep t)) ; comments
1186
("\\s\"?\\(\\(\\sw\\|\\s_\\)+\\)\\s\"?\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*function"
1187
1 font-lock-function-name-face t) ; function name
1188
("\\<\\(while\\|for\\|in\\|repeat\\|if\\|else\\|switch\\|break\\|next\\|return\\|stop\\|warning\\|function\\)\\>"
1189
. font-lock-keyword-face) ; keywords
1191
"Font-lock patterns used in inferior-ess-mode buffers.")
1193
;; add-to-list() places keywords in front of the previous keywords
1194
;; input and prompt must appear in inferior-ess-font-lock-keywords
1195
;; in the order prompt error, hence they appear here in the reverse
1198
(if (not inferior-ess-font-lock-input)
1199
(add-to-list 'inferior-ess-font-lock-keywords
1200
'("^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1201
(1 font-lock-variable-name-face keep t));don't font-lock input
1203
(add-to-list 'inferior-ess-font-lock-keywords
1204
'("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; prompt
1206
(defvar ess-trans-font-lock-keywords
1207
inferior-ess-font-lock-keywords
1208
"Font-lock patterns used in `ess-transcript-mode' buffers.")
1211
;;(defvar ess-mode-font-lock-keywords
1212
;; '(("\\s\"?\\(\\(\\sw\\|\\s_\\)+\\)\\s\"?\\s-*\\(<-\\|_\\)\\(\\s-\\|\n\\)*function" 1 font-lock-function-name-face t)
1213
;; ("<<?-\\|_" . font-lock-reference-face)
1214
;; ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>" . font-lock-type-face)
1215
;; ("\\<\\(library\\|attach\\|detach\\|source\\)\\>" . font-lock-reference-face)
1216
;; "\\<\\(while\\|for\\|in\\|repeat\\|if\\|else\\|switch\\|break\\|next\\|return\\|stop\\|warning\\|function\\)\\>")
1217
;; "Font-lock patterns used in ess-mode bufffers.")
1219
;;(defvar essd-S-inferior-font-lock-keywords
1220
;; '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face) ; prompt
1221
;; ("^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1222
;; (1 font-lock-variable-name-face keep t)) ; input
1223
;; ("<-\\|_" . font-lock-reference-face) ; assign
1224
;; ("^\\*\\*\\\*.*\\*\\*\\*\\s *$" . font-lock-comment-face) ; ess-mode msg
1225
;; ("\\[,?[1-9][0-9]*,?\\]" . font-lock-reference-face) ; Vector/matrix labels
1226
;; ("^Syntax error:" . font-lock-reference-face) ; error message
1227
;; ("^Error:" . font-lock-reference-face) ; error message
1228
;; ("^Error in" . font-lock-reference-face) ; error message
1229
;; ("^Dumped" . font-lock-reference-face) ; error message
1230
;; ("^Warning:" . font-lock-reference-face) ; warning message
1231
;; ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>"
1232
;; . font-lock-type-face)) ; keywords
1233
;; "Font-lock patterns for dialects of S, used in highlighting process
1234
;; buffers and transcripts.")
1236
;;(defvar inferior-ess-font-lock-keywords
1237
;; essd-S-inferior-font-lock-keywords
1238
;; "Font-lock patterns used in inferior-ess-mode buffers.")
1240
;;(defvar ess-trans-font-lock-keywords
1241
;; essd-S-inferior-font-lock-keywords
1242
;; "Font-lock patterns used in ess-transcript-mode buffers.")
1376
(defvar ess-R-constants
1377
'("TRUE" "FALSE" "NA" "NULL" "Inf" "NaN"))
1379
(defvar ess-S-constants
1380
(append ess-R-constants '("T" "F")))
1382
;; first the common ones
1383
(defvar ess-S-modifyiers
1384
'("library" "attach" "detach" "source" "module"))
1385
(defvar ess-R-modifyiers
1386
'("library" "attach" "detach" "source" "require"))
1388
(defvar ess-R-keywords
1389
'("while" "for" "in" "repeat" "if" "else" "switch" "break" "next"
1390
"function" "return" "message" "warning" "stop"))
1391
(defvar ess-S-keywords
1392
(append ess-R-keywords '("terminate")))
1394
(defvar ess-R-message-prefixes
1395
'("Error:" "Error in"
1396
"Warning:" "Warning in"
1397
"Warning messages?"))
1398
(defvar ess-S-message-prefixes
1399
(append ess-R-message-prefixes
1400
'("Syntax error:" "Dumped")))
1403
(defvar ess-R-assign-ops
1404
'("<<-" "<-" "->") ; don't want "=" here which is not only for assign
1406
(defvar ess-S-assign-ops
1407
'("<<-" "<-" "_" "->") ; don't want "=" here which is not only for assign
1410
(defvar ess-R-function-name-regexp
1411
(concat "\\s\"?\\(\\(\\sw\\|\\s_\\)+"
1412
"\\(<-\\)?\\)\\s\"?\\s-*\\(<-\\)"
1413
"\\(\\s-\\|\n\\)*function")
1415
(defvar ess-S-function-name-regexp
1416
ess-R-function-name-regexp ; since "_" is deprecated for S-plus as well
1420
(defvar ess-R-mode-font-lock-keywords
1422
(cons (regexp-opt ess-R-assign-ops)
1423
'font-lock-reference-face) ; assign
1424
(cons (concat "\\<" (regexp-opt ess-R-constants 'enc-paren) "\\>")
1425
'font-lock-type-face) ; constants
1426
(cons (concat "\\<" (regexp-opt ess-R-modifyiers 'enc-paren) "\\>")
1427
'font-lock-reference-face) ; modify search list or source
1429
(cons (concat "\\<" (regexp-opt ess-R-keywords 'enc-paren) "\\>")
1430
'font-lock-keyword-face) ; keywords
1431
(cons ess-R-function-name-regexp
1432
'(1 font-lock-function-name-face t))
1435
"Font-lock patterns used in `R-mode' buffers.")
1437
(defvar ess-S-mode-font-lock-keywords
1439
(cons (regexp-opt ess-S-assign-ops)
1440
'font-lock-reference-face) ; assign
1441
(cons (concat "\\<" (regexp-opt ess-S-constants 'enc-paren) "\\>")
1442
'font-lock-type-face) ; constants
1443
(cons (concat "\\<" (regexp-opt ess-S-modifyiers 'enc-paren) "\\>")
1444
'font-lock-reference-face) ; modify search list or source
1446
(cons (concat "\\<" (regexp-opt ess-S-keywords 'enc-paren) "\\>")
1447
'font-lock-keyword-face) ; keywords
1448
(cons ess-S-function-name-regexp
1449
'(1 font-lock-function-name-face t))
1452
"Font-lock patterns used in `S-mode' buffers.")
1457
(defvar inferior-ess-R-font-lock-keywords
1459
'(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1461
(if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1462
(list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1463
'(1 font-lock-variable-name-face keep t))) )
1465
ess-R-mode-font-lock-keywords
1468
(cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face); ess-mode msg
1469
(cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1470
(cons (concat "^" (regexp-opt ess-R-message-prefixes 'enc-paren))
1471
'font-lock-reference-face) ; inferior-ess problems or errors
1472
(cons "#" 'font-lock-comment-face) ; comment
1473
(cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1475
"Font-lock patterns used in inferior-R-mode buffers.")
1477
(defvar inferior-ess-S-font-lock-keywords
1479
'(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be first
1481
(if (not inferior-ess-font-lock-input) ;; don't font-lock input :
1482
(list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
1483
'(1 font-lock-variable-name-face keep t))) )
1485
ess-S-mode-font-lock-keywords
1488
(cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face) ; ess-mode msg
1489
(cons "\\[,?[1-9][0-9]*,?\\]" 'font-lock-reference-face);Vector/matrix labels
1490
(cons (concat "^" (regexp-opt ess-S-message-prefixes 'enc-paren))
1491
'font-lock-reference-face) ; inferior-ess problems or errors
1492
(cons "#" 'font-lock-comment-face) ; comment
1493
(cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
1495
"Font-lock patterns used in inferior-S-mode buffers.")
1497
;; use the inferior-* ones directly in ess-trns.el
1498
;; (defvar ess-trans-font-lock-keywords
1499
;; inferior-ess-font-lock-keywords
1500
;; "Font-lock patterns used in `ess-transcript-mode' buffers.")
1245
1503
;;;*;;; ess-help variables