ESS[SAS]: somebody forgot about the SUM statement (probably me)
[ess.git] / lisp / ess-site.el
blob5b7c37be117c61746e439f9adb16884a275e27b6
1 ;;; ess-site.el --- user customization of ESS
3 ;; Copyright (C) 1993 David M. Smith
4 ;; Copyright (C) 1997--2007 A.J. Rossini, Rich M. Heiberger, Martin
5 ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
7 ;; Original Author: David Smith <D.M.Smith@lancaster.ac.uk>
8 ;; Created: 12 Nov 1993
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)
18 ;; any later version.
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.
29 ;;; Commentary:
31 ;;; This file defines all the site-specific customizations for ESS.
32 ;;; It should be edited on a per-site basis. Read the comments (1.1
33 ;;; in Section 1 to see if ess-site.el must be edited. The final
34 ;;; directory location of this file must be supplied in
35 ;;; ess-lisp-directory. The editing of remaining sections is
36 ;;; optional. It should then be byte-compiled, and users who wish to
37 ;;; use ESS should add the line:
38 ;;; (load "/PATH/TO/THIS/FILE/ess-site")
39 ;;; (where /PATH/TO/THIS/FILE is the path to ess-site.elc: i.e. the
40 ;;; value of ess-lisp-directory, below) to their .emacs file.
41 ;;;
42 ;;; Alternatively, if the file is already in a directory specified by
43 ;;; the load-path variable:
44 ;;; (require 'ess-site)
45 ;;; will work.
46 ;;;
47 ;;; with XEmacs, this is simply:
48 ;;; (add-path "/path/to/ess/lisp-directory")
49 ;;; with Emacs (and in general):
50 ;;; (setq load-path (cons "/path/to/ess/lisp-directory" load-path)
51 ;;;
53 ;; provide here; otherwise we'll get infinite loops of (require ..):
54 (provide 'ess-site)
56 ;;; Code:
58 ;;;; 1. Load path, autoloads, and major modes
59 ;;;; ========================================
60 ;;;
61 ;;; (1.1) For most users the variable ess-lisp-directory will
62 ;;; automatically be set correctly. If you are working with an old
63 ;;; emacs, one in which file-truename is not defined, then you might
64 ;;; need to change the value of ess-lisp-directory to the directory
65 ;;; which is to contain the file ess-site.elc. This is probably the
66 ;;; current directory, or the value of LISPDIR if it was set in the
67 ;;; Makefile.
69 (eval-and-compile
71 ;; Not important in XEmacs, if unpacking from ../xemacs/site-lisp/
72 ;; directory.
74 ;; WARNING: with Emacs 20.2 (and 20.3 in one case),
75 ;; ======= MUST USE ONE OF THE NON-DEFAULT SETTINGS BELOW
77 ;; NOTE again: MOST people should NOT change anything here !!!
78 ;; ==== ==== ================
80 ;; A nice default
81 (defvar ess-lisp-directory
82 (directory-file-name
83 (file-name-directory
84 (if (and (boundp 'load-file-name) load-file-name) ;; A nice default
85 (file-truename load-file-name)
86 (locate-library "ess-site") )))
87 "Directory containing ess-site.el(c) and other ESS lisp files.")
90 ;; NON DEFAULTS:
91 ;;(defvar ess-lisp-directory
92 ;;(directory-file-name "/usr/local/lib/xemacs/site-lisp/ess-/lisp"))
93 ;; >> or replace "ess-" above by "ESS" which would be a symbolic link..
94 ;; >> This way, your .emacs (or default.el or site-start.el)
95 ;; >> won't have to change with each version of ESS
97 ;; example of "local" or personal use
98 ;;(defvar ess-lisp-directory
99 ;;(directory-file-name "/stat2/faculty/rossini/ESS/lisp"))
103 ;; emacs 19.28 and 19.29 don't have functions we need.
104 (if (not (fboundp 'file-name-sans-extension))
105 ;; take the definition from emacs-20.6/lisp/files.el:
106 (defun file-name-sans-extension (filename)
107 "Return FILENAME sans final \"extension\".
108 The extension, in a file name, is the part that follows the last `.'."
109 (save-match-data
110 (let ((file (file-name-sans-versions
111 (file-name-nondirectory filename)))
112 directory)
113 (if (string-match "\\.[^.]*\\'" file)
114 (if (setq directory (file-name-directory filename))
115 (expand-file-name (substring file 0 (match-beginning 0))
116 directory)
117 (substring file 0 (match-beginning 0)))
118 filename)))))
120 (add-to-list 'load-path (file-name-as-directory ess-lisp-directory))
122 ;; Need these as early as here [also in ./ess-comp.el] :
123 (if (not (boundp 'ess-show-load-messages))
124 (defvar ess-show-load-messages nil
125 "If t, show many more \"loading ..\" messages."))
126 (if (not (fboundp 'ess-message))
127 (defun ess-message (format-string &rest args)
128 "Shortcut for \\[message] only if `ess-show-load-messages' is non-nil."
129 (if ess-show-load-messages (message format-string args)))
130 )); eval-*-compile
132 ;; DEBUG: (setq ess-show-load-messages t); instead of nil above
134 (ess-message
135 (format "[ess-site:] ess-lisp-directory = '%s'" ess-lisp-directory))
137 ;; load code to figure out what version/strain of Emacs we are running
138 ;; must come *AFTER* load-path is set !
140 ;;; The following require sets the following ess-local-custom-available to
141 ;;; true if custom is provided at this point. If we think it will be,
142 ;;; then we can use the following (uncommented out) to make sure that
143 ;;; it will be. (AJR).
144 (require 'ess-emcs)
145 ;; This will override what Emacs thinks it can detect.
146 ;;(setq ess-local-custom-available t); if custom is available, uncomment
148 ;; SJE Thu 13 May 2004
149 ;; Maybe ess-etc-directory should not be defcustom, since its value
150 ;; depends on ess-lisp-directory, and is needed by other modes that are
151 ;; loaded before the custom code.
152 (defvar ess-etc-directory nil
153 "*Location of the ESS etc/ directory.
154 The ESS etc directory stores various auxillary files that are useful
155 for ESS, such as icons.")
157 (defvar ess-etc-directory-list
158 '("../etc/ess/" "../etc/" "../../etc/ess/" "./etc/")
159 "*List of directories, relative to `ess-lisp-directory', to search for etc.")
161 (while (and (listp ess-etc-directory-list) (consp ess-etc-directory-list))
162 (setq ess-etc-directory
163 (expand-file-name (concat ess-lisp-directory "/"
164 (car ess-etc-directory-list))))
165 (if (file-directory-p ess-etc-directory)
166 (setq ess-etc-directory-list nil)
167 (setq ess-etc-directory nil)
168 (setq ess-etc-directory-list (cdr ess-etc-directory-list))
169 (when (null ess-etc-directory-list)
170 (beep 0) (beep 0)
171 (message (concat
172 "ERROR:ess-site.el:ess-etc-directory\n"
173 "Relative to ess-lisp-directory, one of the following must exist:\n"
174 "../etc/ess, ../etc, ../../etc/ess or ./etc"))
175 (sit-for 4))))
177 (defvar ess-info-directory nil
178 "*Location of the ESS info/ directory.
179 The ESS info directory stores the ESS info files.")
181 ;;(1.2) If ess.info is not found, then ess-lisp-directory/../doc/info is added
182 ;; resurrecting Stephen's version with a bug-fix & xemacs compatibility
183 (unless
184 ;; challenge: can this become more elegant?
185 (member t
186 (mapcar 'file-exists-p
187 (mapcar
188 '(lambda(x) (concat (file-name-as-directory x) "ess.info"))
189 (if (featurep 'xemacs) Info-directory-list
190 Info-default-directory-list))))
191 (add-to-list (if (featurep 'xemacs)
192 'Info-directory-list 'Info-default-directory-list)
193 (expand-file-name "../doc/info/" ess-lisp-directory)))
195 ;;; (1.3) Files ending in .q and .S are considered to be S source files
196 ;;; Files ending in .St are considered to be S transcript files
198 ;;; NB: in standard Emacs, files ending in .s are assembler files. If you
199 ;;; want to use assembler, you can comment the appropriate line below. Of
200 ;;; course, different users will want different modes. If a user wants to
201 ;;; restore default the default modes for assembly file extensions, the
202 ;;; following can go into ~/.emacs:
204 ;;; (add-hook 'ess-mode-hook 'ess-restore-asm-extns)
205 ;;; (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns)
207 (autoload 'Rd-mode "essddr" "Major mode for editing R documentation." t)
209 ;; This is thanks to Ed L Cashin <ecashin@uga.edu>, 03 Mar 2004 :
210 (defun ess-restore-asm-extns ()
211 "take away the S-Plus mode association for .s and .S files added by ESS
212 Putting the following in ~/.emacs restores emacs' default association
213 between .s or .S files and assembly mode.
215 (add-hook 'ess-mode-hook 'ess-restore-asm-extns)
216 (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns)
218 (interactive)
219 (when (assoc "\\.[qsS]\\'" auto-mode-alist)
220 (setq auto-mode-alist
221 (remassoc "\\.[qsS]\\'" auto-mode-alist))
222 ;; put .q extention back
223 ;; (add-to-list is in xemacs and GNU emacs)
224 (add-to-list 'auto-mode-alist '("\\.q\\'" . S-mode))))
226 ;; Be careful when editing the following. MISTAKES WILL RESULT IN
227 ;; *.sty BEING TREATED AS ESS[S], rather than LaTeX-mode!
229 (if (assoc "\\.[rR]\\'" auto-mode-alist) nil
230 (setq auto-mode-alist
231 (append
232 '(("\\.sp\\'" . S-mode) ;; re: Don MacQueen <macq@llnl.gov>
233 ("\\.[qsS]\\'" . S-mode) ;; q,s,S [see ess-restore-asm-extns above!]
234 ("\\.ssc\\'" . S-mode) ;; Splus 4.x script files.
235 ("\\.[rR]\\'" . R-mode)
236 ("\\.[rR]nw\\'" . Rnw-mode)
237 ("\\.[sS]nw\\'" . Snw-mode); currently identical to Rnw-mode
238 ("\\.[rR]profile\\'" . R-mode)
239 ("NAMESPACE\\'" . R-mode)
240 ("\\.omg\\'" . omegahat-mode)
241 ("\\.hat\\'" . omegahat-mode) ;; Duncan's pref'd...
242 ("\\.lsp\\'" . XLS-mode)
243 ("\\.do\\'" . STA-mode)
244 ("\\.ado\\'" . STA-mode)
245 ("\\.[Ss][Aa][Ss]\\'" . SAS-mode)
246 ;; Many .log/.lst files, not just SAS
247 ;;("\\.log\\'" . SAS-log-mode)
248 ;;("\\.lst\\'" . SAS-listing-mode)
249 ("\\.[Ss]t\\'" . S-transcript-mode)
250 ("\\.[Ss]out" . S-transcript-mode)
251 ("\\.[Rr]t\\'" . R-transcript-mode)
252 ("\\.[Rr]out" . R-transcript-mode)
253 ("\\.Rd\\'" . Rd-mode)
254 ;("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode)
255 ("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode)
256 ("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode)
257 ("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode)
259 auto-mode-alist)))
261 ;; (1.4) Customize the dialects for your setup.
263 ;;; AS OF ESS 5.1.14, if you are using Emacs 20.x, x>3, or XEmacs
264 ;;; 21.x, x>0, you can now use the "Customize" facility for
265 ;;; customization.
267 ;;;; Choices for *(), where * is from inferior-*-program....
268 ;;; Most sites will not need to use these customized program-names. They are
269 ;;; provided for cases where the program is not on the standard default path.
270 ;;; If the program doesn't get located correctly by the default use of
271 ;;; M-x S+3 (for example), then put the path name for your system into the
272 ;;; the variable inferior-S+3-program-name. If for any reason you want the
273 ;;; default use of M-x S to refer to a different program than S+3, then
274 ;;; redefine inferior-S-program-name.
276 ;;(setq-default inferior-S3-program-name "/disk05/s/S")
277 ;;(setq-default inferior-S+3-program-name "Splus34")
278 ;;(setq-default inferior-S4-program-name "/disk05/s4/S")
279 ;;(setq-default inferior-S+4-program-name "Splus")
280 ;;(setq-default inferior-S+5-program-name "Splus5")
281 ;;(setq-default inferior-S+6-program-name "Splus7") ; unix systems
282 ;;(setq-default inferior-R-program-name "R") ; unix systems
283 ;;(setq-default inferior-R-program-name "Rterm") ; msdos systems
284 ;;(setq-default inferior-R-program-name "C:\\Program Files\\R\rw1081\\bin\\Rterm.exe") ; msdos systems
285 ;;(setq-default inferior-XLS-program-name "xlispstat")
286 ;;(setq-default inferior-ARC-program-name "arc")
287 ;;(setq-default inferior-VST-program-name "vista")
288 ;;(setq-default inferior-SAS-program-name "sas")
289 ;;(setq-default inferior-OMG-program-name "/home/rossini/src/anoncvs/Omegahat/org/omegahat/bin/omegahat")
290 (setq-default inferior-OMG-program-name "omegahat")
292 ;;; ESS on the Windows NT/95/98 assumes you have installed gnuclient
293 ;;; with your NTemacs.
294 ;;; http://www.cs.washington.edu/homes/voelker/ntemacs/contrib/gnuserv.zip
295 ;;; Should you choose not to use gnuclient, you will need to uncomment
296 ;;; the notepad definitions below.
298 ;;; Send Print from S+4 GUI Commands window print icon to emacs.
299 ;;; StatSci's S+4 default print destination for the commands window is
300 ;;(setq-default inferior-S+4-print-command "notepad/p")
302 ;;; The line below is the ESS default and sends the commands window
303 ;;; to emacs, giving the user the opportunity to
304 ;;; (1) edit the output into a clean ess-transcript file before printing, or
305 ;;; (2) print a region of the file.
306 ;;(setq-default inferior-S+4-print-command "S_PRINT_COMMAND=gnuclientw.exe")
308 ;;; The editor and pager output from S+4 and Sqpe+4 are sent by
309 ;;; StatSci default to notepad, effectively using the definition:
310 ;;(setq-default inferior-S+4-editor-pager-command
311 ;; "options(editor='notepad', pager='notepad')")
313 ;;; ESS sends the output from both commands to an emacs buffer using
314 ;;; the definition:
315 ;;(setq-default inferior-S+4-editor-pager-command
316 ;; "options(editor='gnuclient.exe', pager='gnuclientw.exe')")
318 ;;; These commands are for running the PC version of Sqpe of S+4 and
319 ;;; S+6 in an emacs buffer, using the same technology as ESS uses for
320 ;;; Unix S-Plus. Interactive graphics with javagraph are available
321 ;;; in this mode beginning with S-Plus 6.1.
322 ;;; See essd-sp4.el or essd-sp6w.el
324 ;;; -----> configuration now via custom, see ./ess-cust.el and look for
325 ;;; inferior-Sqpe+... e.g. inferior-Sqpe+6-program-name
327 ;;; These ddeclient values will be buffer-local on MS-Windows 9x/NT
328 (setq-default inferior-ess-ddeclient "Initial")
329 (setq-default inferior-ess-client-name "Initial")
330 (setq-default inferior-ess-client-command "Initial")
332 ;;; S-Plus 6 for Windows startup time depends on the amount of RAM and
333 ;;; the processor speed. ESS needs to build a delay into the M-x S+6
334 ;;; sequence to allow time for S-Plus 6 to open the Commands window.
335 ;;; We then send several lines to the Commands window before returning
336 ;;; control to the user. On a 300 MHz machine with 96MB of RAM the
337 ;;; delay is 60 seconds. On a ???? MHz machine with 523MB the delay is
338 ;;; 10 seconds. The user may need to adjust this number.
339 (defvar ess-S+6-startup-delay 15 ;; <- 2005-01-03; MM
340 "*Number of seconds to wait for the Commands window to appear before
341 sending `inferior-ess-language-start' to S-Plus.")
344 ;;; see essd-els.el
346 ;;(setq-default inferior-S-elsewhere-program-name "sh")
347 ;;(setq-default inferior-S-elsewhere-program-name "ssh")
348 ;;; You might consider using ssh, if you can! (and if you really do
349 ;;; this, use ssh-agent, etc, for securing your sessions).
352 ;;;; Choice for S().
353 ;;(setq-default inferior-S-program-name inferior-S+3-program-name)
359 ;; (1.5) Require the needed dialects for your setup.
360 (if (< max-specpdl-size 700) ;;; ESS won't load at the default of 600
361 (setq max-specpdl-size 700))
363 (ess-message "[ess-site:] Before requiring dialect 'essd-** ....")
364 (ess-message "[ess-site:] require 'essd-r ...")
365 (require 'essd-r) ;; R
366 ;; (ess-message "[ess-site:] require 'essd-s4 ...")
367 ;; (require 'essd-s4) ; has become VERY RARE ..
369 ;;(ess-message "[ess-site:] require 'essd-s3 ...")
370 ;;(require 'essd-s3) ; THIS IS RARE. You probably do not have this.
372 ;; "sp" refers to S-PLUS (MathSoft/StatSci/Insightful):
373 (ess-message "[ess-site:] require 'essd-sp3 ...")
374 (require 'essd-sp3)
376 (if ess-microsoft-p
377 (progn
378 (ess-message "[ess-site:] require 'essd-sp4 ...")
379 (require 'essd-sp4)
380 (ess-message "[ess-site:] require 'essd-sp6w ...")
381 (require 'essd-sp6w))
382 ;; else: decent OS
383 (ess-message "[ess-site:] require 'essd-sp5 ...")
384 (require 'essd-sp5)
385 (ess-message "[ess-site:] require 'essd-sp6 ...")
386 (require 'essd-sp6))
388 (ess-message "[ess-site:] require 'essd-sta ...")
389 (require 'essd-sta) ;; for Stata.
390 (ess-message "[ess-site:] require 'essd-xls ...")
391 (require 'essd-xls) ;; XLispStat
392 (ess-message "[ess-site:] require 'essd-vst ...")
393 (require 'essd-vst) ;; ViSta
394 (ess-message "[ess-site:] require 'essd-arc ...")
395 (require 'essd-arc) ;; Arc
396 (ess-message "[ess-site:] require 'essd-sas ...")
397 (require 'essd-sas)
398 (ess-message "[ess-site:] require 'essd-els ...")
399 (require 'essd-els) ;; S-elsewhere, on another machine by telnet
400 (ess-message "[ess-site:] require 'essd-omg ...")
401 (require 'essd-omg) ;; for omegahat
402 (ess-message "[ess-site:] require 'essl-bugs ...")
403 (require 'essl-bugs) ;; for batch BUGS
405 (ess-write-to-dribble-buffer
406 (format "[ess-site.el]: ess-customize-alist=%s \n"
407 ess-customize-alist))
409 ;;; (1.7) Literate Data Analysis
410 (require 'ess-noweb)
411 (require 'ess-swv); for Sweave
413 ;; ALWAYS:
414 (ess-message "[ess-site:] require 'ess *ITSELF* ...")
415 (require 'ess); -> loads ess-cust.el and more
417 (ess-write-to-dribble-buffer
418 (format "[ess-site.el _2_]: ess-customize-alist=%s \n"
419 ess-customize-alist))
421 ;; (1.8) Speedbar and mouse
423 (require 'ess-menu)
424 (require 'ess-mous)
426 ;; (1.9) Toolbar support
428 ;; To remove toolbar support under ESS, either comment-out
429 ;; (require 'ess-toolbar) below, or add "(setq ess-use-toolbar nil)"
430 ;; to your .emacs before (require 'ess-site).
431 (require 'ess-toolbar)
433 ;;; 2. Site Specific setup
434 ;;;; ===============================================
436 ;;; Set this to the name of the program you use to run S or S-PLUS. It
437 ;;; can be an absolute pathname, if you wish.
438 ;;(setq inferior-ess-program "Splus")
439 ;;(setq inferior-ess-program (concat (getenv "SHOME") "/Splus"))
441 ;;; You will need to change the following two variables if you use a
442 ;;; non-standard S prompt.
443 ;; (setq inferior-ess-primary-prompt "[a-zA-Z0-9() ]*> ?")
444 ;; (setq inferior-ess-secondary-prompt "+ ?")
447 ;;; 2.1 Backwards compatibility (roll your own!)
448 ;;; What you want S and R to call...
450 (autoload 'ess-transcript-mode "ess-trns"
451 "Major mode for editing S transcript files." t)
453 (autoload 'ess-rdired "ess-rdired"
454 "View *R* objects in a dired-like buffer." t)
456 ;;; On a PC, the default is S+6.
457 ;; Elsewhere (unix and linux) the default is S+6
458 (cond (ess-microsoft-p ; MS-Windows
459 (fset 'S 'S+6)
460 (fset 'Sqpe 'Sqpe+6)
461 (fset 's-mode 'S+6-mode)
462 (fset 's-transcript-mode 'S+6-transcript-mode))
464 ((eq system-type 'gnu/linux) ; Linux -- no S+3
465 (fset 'S 'S+6)
466 (fset 's-mode 'S+6-mode)
467 (fset 's-transcript-mode 'S+6-transcript-mode))
469 (t ; Other Unixen
470 (fset 'S 'S+6)
471 (fset 's-mode 'S+6-mode)
472 (fset 's-transcript-mode 'S+6-transcript-mode)))
475 ;;;;* Alias S-mode to s-mode
476 ;;; Emacs will set the mode for a file based on the file's header.
477 ;;; The mode name is indicated by putting it between -*- on the top line.
478 ;;; (Other commands can go here too, see an Emacs manual.)
479 ;;; For a file you also load, you will want a leading # (comment to S)
480 ;;; Emacs will downcase the name of the mode, e.g., S, so we must provide
481 ;;; s-mode in lower case too. That is, "#-*- S-*-" invokes s-mode and
482 ;;; not S-mode.
483 (fset 'S-transcript-mode 's-transcript-mode)
484 (fset 'S-mode 's-mode)
486 ;;; Create functions for calling different (older or newer than default)
487 ;;; versions of R and S(qpe).
488 (defvar ess-r-versions-created nil)
490 (let ( (ess-s-versions-created)
491 (ess-versions-created)
492 (R-newest-list '("R-newest"))
494 (if ess-microsoft-p
495 (progn
496 (setq ess-s-versions-created
497 (ess-sqpe-versions-create)) ;; use ess-SHOME-versions
498 (setq ess-rterm-version-paths (ess-find-rterm))
500 ;;else real OS :
501 (setq ess-s-versions-created
502 (ess-s-versions-create)) ;; use ess-s-versions
505 (setq ess-r-versions-created ;; for Unix *and* Windows, using either
506 (ess-r-versions-create));; ess-r-versions or ess-rterm-version-paths
508 ;; Add the new defuns, if any, to the menu.
509 ;; Check that each variable exists, before adding.
510 ;; e.g. ess-sqpe-versions-created will not be created on Unix.
511 (setq ess-versions-created
512 (ess-flatten-list
513 (mapcar (lambda(x) (if (boundp x) (symbol-value x) nil))
514 '(R-newest-list
515 ess-r-versions-created
516 ess-s-versions-created))))
518 (when ess-versions-created
519 ;; new-menu will be a list of 3-vectors, of the form:
520 ;; ["R-1.8.1" R-1.8.1 t]
521 (let ((new-menu (mapcar '(lambda(x) (vector x (intern x) t))
522 ess-versions-created)))
523 (easy-menu-add-item ess-mode-menu '("Start Process")
524 (cons "Other" new-menu)))))
526 ;; Check to see that inferior-R-program-name points to a working version
527 ;; of R; if not, try to find the newest version:
528 (ess-check-R-program-name) ;; -> (ess-find-newest-R) if needed, in ./essd-r.el
530 ;;; 3. Customization (and commented out examples) for your site
531 ;;;; ===============================================
534 ;;; (3.01) SOME PEOPLE (who will remain nameless) worry that novices
535 ;;; won't like fancy buffer names for their first (and only :-)
536 ;;; process. To number all processes, uncomment the next line.
537 ;;(setq ess-plain-first-buffername nil)
539 ;;; (3.02) Some people have requested using the program name as part
540 ;;; of the buffer. Turned on for R.
541 ;;(setq ess-use-inferior-program-name-in-buffer-name t)
544 ;;; (3.1) Font-lock
545 ;; The following two expressions automatically enable font-lock-mode
546 ;; for ess-mode and inferior-ess-mode buffers.
548 ;; FIXME: XEmacs and Emacs 21.x has font-lock for ttys, as well.
549 ;; So we need a better check! [or do this unconditionally -working everywhere ??]
550 (when (and window-system ess-font-lock-mode)
551 (add-hook 'ess-mode-hook 'turn-on-font-lock t)
552 (add-hook 'ess-transcript-mode-hook 'turn-on-font-lock t)
553 (add-hook 'inferior-ess-mode-hook 'turn-on-font-lock t))
555 ;; If nil, then don't font-lock the input
556 ;; if t, font-lock (default).
557 (setq inferior-ess-font-lock-input t) ; from RMH
559 ;;; (3.2) Framepop. Windows produced by ess-execute-objects etc. are
560 ;;; often unnecessarily large. The framepop package makes such
561 ;;; windows appear in a separate, shrink-wrapped frame. This will
562 ;;; also affect other "temporary" windows such as those produced by
563 ;;; C-h k, etc. To enable, uncomment both lines of code below).
565 ;;; Works only with Emacs at this time.
566 ;; (cond (window-system
567 ;; (require 'framepop)))
569 ;;; (3.3) ess-keep-dump-files.
570 ;;; Documentation:
571 ;;; *Variable controlling whether to delete dump files after a successful load.
572 ;;; If nil: always delete. If `ask', confirm to delete. If `check', confirm
573 ;;; to delete, except for files created with ess-dump-object-into-edit-buffer.
574 ;;; Anything else (for example `always'): always keep and never delete.
575 ;;; This variable only affects the behavior
576 ;;; of ess-load-file. Dump files are never deleted if an error occurs
577 ;;; during the load.
579 ;;; RH sez: I find the default `always' keep to be imperative. The previous
580 ;;; default was to throw away
581 ;;; files at the wrong time (I think it was something like, if you M-x
582 ;;; ess-load a file twice, while you are working on it, the file is
583 ;;; deleted). I believe source is real and the ESS object is temporary.
584 ;;; The previous default behavior is dangerous for people who believe this way.
585 ;;; It made sense only for people who believe the object is real
586 ;;; and the source file temporary.
587 (setq ess-keep-dump-files "always")
589 ;;; (3.4) ess-ask-for-ess-directory
590 ;;; If t, will ask for the directory to use. If nil, assumes the
591 ;;; default (usually, the users home directory...).
592 ;;now rather in ./ess-cust.el : (setq ess-ask-for-ess-directory t)
594 ;;; (3.5) ess-directory default (correlated with above)
595 ;;; The default location for running the subprocess is configurable.
596 ;;; By default, that is the default-directory (a lisp variable which
597 ;;; initially contains the directory from which the inferior ESS
598 ;;; statistical package/process is started).
599 ;;; For example, the following function (added to the pre-run-hook, by
600 ;;; the line following it) will set the default directory to be your
601 ;;; home directory:
603 ;;(defun ajr:ess-set-directory ()
604 ;; "Set ess-directory to home."
605 ;; (setq-default ess-directory (file-name-as-directory (getenv "HOME"))))
606 ;;(add-hook 'ess-pre-run-hook 'ajr:ess-set-directory)
608 ;;; If you replace the setq-default line with:
610 ;; (setq-default ess-directory (file-name-as-directory
611 ;; (concat (getenv "HOME") "/ess/")))
613 ;;; then it will always start up in the directory "ess" in your home
614 ;;; directory.
616 ;;; The default is to have ess to start up in the current buffer's
617 ;;; directory (the one in which you started the inferior ESS
618 ;;; statistical package/process). This is obtained
619 ;;; by setting ess-directory to nil, i.e.
620 ;; (setq-default ess-directory nil) ; this is the default.
622 (if ess-microsoft-p
623 (add-hook 'ess-post-run-hook
624 '(lambda()
625 (if (string= ess-dialect "R")
626 (ess-eval-linewise "options(chmhelp = FALSE)"
627 nil nil nil 'wait)))))
630 ;;; 3.6 Example of formatting changes
632 ;;; Formatting and indentation patterns are defined in ess-cust.el, please
633 ;;; see ess-cust.el for exact definitions of these variable settings.
634 ;;; To change them, uncomment one or both of the following lines:
635 ;;; (eg, follow changes suggested by Terry Therneau)
636 ;;(setq ess-fancy-comments nil)
637 ;;(setq ess-default-style 'CLB)
639 ;;; 4.0 SAS configuration
641 ;;; Beginning with ESS 5.1.13, we have editing options in SAS-mode.
642 ;;; The default behavior is as it was in prior releases.
644 ;;; There are two sets of alternatives.
645 ;;; 1. Editing SAS-mode files.
646 ;;; 1a. Default: TAB is bound to sas-indent-line.
647 ;;; Current line is correctly indented as SAS code. Equivalent to
648 ;;;(setq ess-sas-edit-keys-toggle nil) ;; default TAB in sas-mode
649 ;;; 1b. Optional: TAB is bound to tab-to-tab-stop and inserts up to 4
650 ;;; columns at a time. C-TAB moves backwards and deletes characters
651 ;;; up to 4 columns at a time.
652 ;;; Uncomment the following line for the optional behavior.
653 ;;;(setq ess-sas-edit-keys-toggle t) ;; optional TAB and C-TAB in sas-mode
654 ;;; Use the function call (ess-sas-edit-keys-toggle)
655 ;;; to change the setting after the first SAS-mode buffer has been created.
656 ;;; 1c. You can also define C-TAB in all modes by Option 2b (below).
658 ;;; 2. Managing submitted SAS jobs with function keys.
659 ;;; 2a. Default: To define the function keys in ESS[SAS] mode only,
660 ;;; uncomment at most one of the following two lines.
661 ;;;(setq ess-sas-local-unix-keys t) ;; F2-F12 bound in ESS[SAS] mode
662 ;;;(setq ess-sas-local-pc-keys t) ;; F2-F12 bound in ESS[SAS] mode
664 ;;; 2b. Options: To define the function keys in all modes,
665 ;;; uncomment at most one of the following two lines.
666 ;;;(setq ess-sas-global-unix-keys t) ;; F2-F12 bound in all modes
667 ;;;(setq ess-sas-global-pc-keys t) ;; F2-F12 bound in all modes
669 ;;; 3. If it is more convenient to have "*Async Shell Command*"
670 ;;; in same-window-buffer-names, then uncomment the following line
671 ;;;(ess-same-window-async)
673 ;;;(defvar sas-program "sas" "*Name of program which runs sas.")
675 ;;;(defvar sas-indent-width 4 "*Amount to indent sas statements")
677 \f ; Local variables section
679 ;;; This file is automatically placed in Outline minor mode.
680 ;;; The file is structured as follows:
681 ;;; Chapters: ^L ;
682 ;;; Sections: ;;*;;
683 ;;; Subsections: ;;;*;;;
684 ;;; Components: defuns, defvars, defconsts
685 ;;; Random code beginning with a ;;;;* comment
686 ;;; Local variables:
687 ;;; mode: emacs-lisp
688 ;;; mode: outline-minor
689 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
690 ;;; End:
692 ;;; ess-site.el ends here