Initial Commit
[packages] / xemacs-packages / ess / lisp / essd-sp6.el
1 ;;; essd-sp6.el --- S-Plus 6  customization
2
3 ;; Copyright (C) 2001--2004 A.J. Rossini, Rich M. Heiberger, Martin
4 ;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
5
6 ;; Original Author: A.J. Rossini <rossini@u.washington.edu>
7 ;; Created: 2001/02/06
8 ;; Maintainer: ESS Core Team <ESS-core@stat.math.ethz.ch>
9
10 ;; Keywords: start up, configuration.
11
12 ;; This file is part of ESS.
13
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.
18
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.
23
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.
27
28 ;;; Commentary:
29 ;;; AJR copied S+5 to be S+6.
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.
36
37 ;;; Requires and Autoloads:
38
39 (require 'essl-s)
40
41 (autoload 'inferior-ess "ess-inf" "Run an ESS process.")
42 (autoload 'ess-mode     "ess-mode" "Edit an ESS process.")
43
44 ;;; Code:
45
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...
48
49 (defvar S+6-dialect-name "S+6"
50   "Name of 'dialect' for S-PLUS 6.");easily changeable in a user's .emacs
51
52 (defun S+6-directory-p (directory)
53   "Splus 5++ directories have a .Data directory and a __Meta directory within."
54   (and directory
55        (file-directory-p (concat directory ".Data"))
56        (file-directory-p (concat directory ".Data/__Meta"))))
57
58 (defvar S+6-directory-function
59   #'(lambda ()
60       (if (S+6-directory-p default-directory)
61           default-directory
62         (or ess-directory default-directory))))
63
64 (defvar S+6-setup-directory-function
65   #'(lambda (startdir)
66       (if (and startdir (S+6-directory-p startdir))
67           (progn
68             (setenv "S_WORK"
69                     (if (getenv "S_WORK")
70                         (concat startdir ":" (getenv "S_WORK"))
71                       ;;(message "adding %s to S_WORK" startdir)
72                       startdir))
73             ))))
74
75 (defvar S+6-customize-alist
76   (append
77   '((ess-local-customize-alist     . 'S+6-customize-alist)
78     (ess-dialect                   . S+6-dialect-name)
79      (ess-loop-timeout                  . ess-S-loop-timeout);fixme: dialect spec.
80      (ess-function-pattern              . ess-R-function-pattern)
81
82     (ess-object-name-db-file       . "ess-sp6-namedb.el")
83     (inferior-ess-program          . inferior-S+6-program-name)
84     (inferior-ess-help-command     . "help(\"%s\",pager=\"slynx -dump\",window=F)\n")
85      (inferior-ess-search-list-command  . "searchPaths()\n")
86
87      (ess-directory-function            . S+6-directory-function)
88      (ess-setup-directory-function      . S+6-setup-directory-function)
89      (inferior-ess-start-args       . inferior-Splus-args)
90     (ess-STERM  . "iESS")
91     )
92    S+common-cust-alist)
93
94   "Variables to customize for S+6.")
95
96
97 (defun S+6 (&optional proc-name)
98   "Call 'Splus6', based on S version 4, from Bell Labs.
99 New way to do it."
100   (interactive)
101   (setq ess-customize-alist S+6-customize-alist)
102   (ess-write-to-dribble-buffer
103    (format "\n(S+6): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
104   (inferior-ess)
105   (if inferior-ess-language-start
106       (ess-eval-linewise inferior-ess-language-start)))
107
108
109 (defun S+6-mode (&optional proc-name)
110   "Major mode for editing S+6 source.  See `ess-mode' for more help."
111   (interactive)
112   (setq ess-customize-alist S+6-customize-alist)
113   (ess-mode S+6-customize-alist proc-name)
114   (if (fboundp 'ess-add-toolbar) (ess-add-toolbar))
115   (if ess-imenu-use-S (ess-imenu-S)))
116
117 (defun S+6-transcript-mode ()
118   "S-PLUS 6 transcript mode."
119   (interactive)
120   (ess-transcript-mode S+6-customize-alist))
121
122 \f ; Provide package
123
124 (provide 'essd-sp6)
125
126 \f ; Local variables section
127
128 ;;; This file is automatically placed in Outline minor mode.
129 ;;; The file is structured as follows:
130 ;;; Chapters:     ^L ;
131 ;;; Sections:    ;;*;;
132 ;;; Subsections: ;;;*;;;
133 ;;; Components:  defuns, defvars, defconsts
134 ;;;              Random code beginning with a ;;;;* comment
135
136 ;;; Local variables:
137 ;;; mode: emacs-lisp
138 ;;; outline-minor-mode: nil
139 ;;; mode: outline-minor
140 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
141 ;;; End:
142
143 ;;; essd-sp6.el ends here