1 ;;; essd-sp5.el --- S-plus 5 customization
3 ;; Copyright (C) 1998 A.J. Rossini
4 ;; Copyright (C) 1999--2004 A.J. Rossini, Rich M. Heiberger, Martin
5 ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
7 ;; Original Author: A.J. Rossini <rossini@biostat.washington.edu>
9 ;; Maintainers: ESS-core <ESS-core@stat.math.ethz.ch>
11 ;; Keywords: start up, configuration.
13 ;; This file is part of ESS.
15 ;; This file is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; This file is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to
27 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
30 ;;; AJR copied S4 to be S+5.
31 ;;; DB contributed the changes from essd-sp3.el to
32 ;;; essd-s4.el. (removed the old ugly approach).
33 ;;; This file defines Sp5 customizations for ess-mode. Lots of thanks
34 ;;; to RMH and JMC for code and suggestions
35 ;;; Thanks to MM for making this sensible.
37 ;;; Requires and Autoloads:
41 (autoload 'inferior-ess
"ess-inf" "Run an ESS process.")
42 (autoload 'ess-mode
"ess-mode" "Edit an ESS process.")
46 ;; You now need to make sure you've defined if you are running 5.0 or 5.1.
47 ;; Lots of things are broken between them, GRR...
49 (defvar S
+5-dialect-name
"S+5"
50 "Name of 'dialect' for S-PLUS 5.");easily changeable in a user's .emacs
52 (defvar S
+5-customize-alist
53 '((ess-local-customize-alist .
'S
+5-customize-alist
)
55 (ess-dialect . S
+5-dialect-name
)
57 (ess-mode-editing-alist . S-editing-alist
)
58 (ess-mode-syntax-table . S-syntax-table
)
59 (ess-help-sec-regex . ess-help-S
+-sec-regex
)
60 ;or just "^[A-Z. ---]+:$"
61 (ess-help-sec-keys-alist . S
+-help-sec-keys-alist
)
63 (ess-function-template .
" <- \n#\nfunction()\n{\n\n}\n")
64 (ess-loop-timeout . ess-S-loop-timeout
)
65 (ess-dump-filename-template .
(replace-regexp-in-string
66 "S$" ess-suffix
; in the one from custom:
67 ess-dump-filename-template-proto
))
68 (ess-object-name-db-file .
"ess-sp5-namedb.el")
69 (ess-dumped-missing-re
70 .
"\\(\\(<-\\|=\\)\nDumped\n\\'\\)\\|\\(\\(<-\\|=\\)\\(\\s \\|\n\\)*\\'\\)")
72 .
"\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$")
73 (ess-retr-lastvalue-command
74 .
".Last.value <- get(\".ess.lvsave\",frame=0)\n")
75 (ess-save-lastvalue-command
76 .
"assign(\".ess.lvsave\",.Last.value,frame=0)\n")
77 (inferior-ess-program . inferior-S
+5-program-name
)
78 (inferior-ess-objects-command .
"objects(%d)\n")
79 (inferior-ess-objects-pattern .
".*") ; for new s4 stuff
80 (inferior-ess-help-command .
"help(\"%s\",pager=\"slynx -dump\",window=F)\n")
81 ;; "paths": get the "/" needed by (ess-dir-modtime dir) in ./ess-inf.el:
82 (inferior-ess-search-list-command .
"search(\"paths\")\n")
83 (inferior-ess-exit-command .
"q()\n")
84 (comint-use-prompt-regexp-instead-of-fields . t
) ;; emacs 21 and up
85 (inferior-ess-primary-prompt .
"[a-zA-Z0-9() ]*> ?")
86 (inferior-ess-secondary-prompt .
"+ ?")
88 (ess-editor . S-editor
)
90 (inferior-ess-language-start .
(eval inferior-S-language-start
))
92 "Variables to customize for S+5.")
95 ;; For loading up the S code required for the above.
96 ;;(add-hook 'ess-post-run-hook
100 ;; "if(exists(\"Sversion\")) library(emacs) else source(\""
103 ;; (if ess-mode-run-file2
105 ;; (concat "source(\"" ess-mode-run-file2 "\")\n")))))
108 (defun S+5 (&optional proc-name
)
109 "Call 'Splus5', based on S version 4, from Bell Labs.
112 (setq ess-customize-alist S
+5-customize-alist
)
113 (ess-write-to-dribble-buffer
114 (format "\n(S+5): ess-dialect=%s, buf=%s\n" ess-dialect
(current-buffer)))
116 (if inferior-ess-language-start
117 (ess-eval-linewise inferior-ess-language-start
)))
119 (defun S+5-mode
(&optional proc-name
)
120 "Major mode for editing S+5 source. See `ess-mode' for more help."
122 (setq ess-customize-alist S
+5-customize-alist
)
123 (ess-mode S
+5-customize-alist proc-name
)
124 (if ess-imenu-use-S
(ess-imenu-S)))
126 (defun S+5-transcript-mode
()
127 "S-PLUS 5 transcript mode."
129 (ess-transcript-mode S
+5-customize-alist
))
135 \f ; Local variables section
137 ;;; This file is automatically placed in Outline minor mode.
138 ;;; The file is structured as follows:
141 ;;; Subsections: ;;;*;;;
142 ;;; Components: defuns, defvars, defconsts
143 ;;; Random code beginning with a ;;;;* comment
147 ;;; outline-minor-mode: nil
148 ;;; mode: outline-minor
149 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
152 ;;; essd-sp5.el ends here