;;; ess-site.el --- user customization of ESS12;; Copyright (C) 1993 David M. Smith3;; Copyright (C) 1997--2012 A.J. Rossini, Richard M. Heiberger, Martin4;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.56;; Author: David Smith <[email protected]>7;; Created: 12 Nov 19938;; Maintainer: ESS-core <[email protected]>9;; Keywords: local1011;; This file is part of ESS1213;; This file is free software; you can redistribute it and/or modify14;; it under the terms of the GNU General Public License as published by15;; the Free Software Foundation; either version 2, or (at your option)16;; any later version.1718;; This file is distributed in the hope that it will be useful,19;; but WITHOUT ANY WARRANTY; without even the implied warranty of20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21;; GNU General Public License for more details.2223;; A copy of the GNU General Public License is available at24;; http://www.r-project.org/Licenses/252627;;; Commentary:2829;; This file defines all the site-specific customizations for ESS. It should be30;; edited on a per-site basis. Read the comments (1.1 in Section 1 to see if31;; ess-site.el must be edited. The final directory location of this file must be32;; supplied in ess-lisp-directory. The editing of remaining sections is33;; optional. It should then be byte-compiled, and users who wish to use ESS34;; should add the line:35;;36;; (load "/PATH/TO/THIS/FILE/ess-site")37;;38;; (where /PATH/TO/THIS/FILE is the path to ess-site.elc: i.e. the value of39;; `ess-lisp-directory', below) to their .emacs file.40;;41;; Alternatively, if the file is already in a directory specified by42;; the load-path variable:43;;44;; (require 'ess-site)45;;46;; will work.47;;48;; with XEmacs, this is simply:49;;50;; (add-path "/path/to/ess/lisp-directory")51;;52;; with Emacs (and in general):53;;54;; (setq load-path (cons "/path/to/ess/lisp-directory" load-path))5556;;; Code:5758;; provide here; otherwise we'll get infinite loops of (require ..):59(provide 'ess-site)60;;(require 'ess-sp6-d)6162;;;; 1. Load path, autoloads, and major modes63;;;; ========================================64;;;65;;; (1.1) For most users the variable ess-lisp-directory will66;;; automatically be set correctly. If you are working with an old67;;; emacs, one in which file-truename is not defined, then you might68;;; need to change the value of ess-lisp-directory to the directory69;;; which is to contain the file ess-site.elc. This is probably the70;;; current directory, or the value of LISPDIR if it was set in the71;;; Makefile.7273(eval-and-compile7475;; Not important in XEmacs, if unpacking from ../xemacs/site-lisp/76;; directory.7778;; WARNING: with Emacs 20.2 (and 20.3 in one case),79;; ======= MUST USE ONE OF THE NON-DEFAULT SETTINGS BELOW8081;; NOTE again: MOST people should NOT change anything here !!!82;; ==== ==== ================8384;; A nice default85(defvar ess-lisp-directory86(directory-file-name87(file-name-directory88(if (and (boundp 'load-file-name) load-file-name) ;; A nice default89(file-truename load-file-name)90(locate-library "ess-site") )))91"Directory containing ess-site.el(c) and other ESS lisp files.")929394;; NON DEFAULTS:95;;(defvar ess-lisp-directory96;;(directory-file-name "/usr/local/lib/xemacs/site-lisp/ess-/lisp"))97;; >> or replace "ess-" above by "ESS" which would be a symbolic link..98;; >> This way, your .emacs (or default.el or site-start.el)99;; >> won't have to change with each version of ESS100101;; example of "local" or personal use102;;(defvar ess-lisp-directory103;;(directory-file-name "/stat2/faculty/rossini/ESS/lisp"))104105;;)106107;; emacs 19.28 and 19.29 don't have functions we need.108(if (not (fboundp 'file-name-sans-extension))109;; take the definition from emacs-20.6/lisp/files.el:110(defun file-name-sans-extension (filename)111"Return FILENAME sans final \"extension\".112The extension, in a file name, is the part that follows the last `.'."113(save-match-data114(let ((file (file-name-sans-versions115(file-name-nondirectory filename)))116directory)117(if (string-match "\\.[^.]*\\'" file)118(if (setq directory (file-name-directory filename))119(expand-file-name (substring file 0 (match-beginning 0))120directory)121(substring file 0 (match-beginning 0)))122filename)))))123124(add-to-list 'load-path (file-name-as-directory ess-lisp-directory))125126;; Need these as early as here [also in ./ess-comp.el] :127(if (not (boundp 'ess-show-load-messages))128(defvar ess-show-load-messages nil129"If t, show many more \"loading ..\" messages."))130(if (not (fboundp 'ess-message))131(defun ess-message (format-string &rest args)132"Shortcut for \\[message] only if `ess-show-load-messages' is non-nil."133(if ess-show-load-messages (message format-string args)))134)); eval-*-compile135136;; DEBUG: (setq ess-show-load-messages t); instead of nil above137138(ess-message139(format "[ess-site:] ess-lisp-directory = '%s'" ess-lisp-directory))140141;; load code to figure out what version/strain of Emacs we are running142;; must come *AFTER* load-path is set !143144;;; The following require sets ess-local-custom-available to145;;; true if custom is provided at this point.146(require 'ess-compat)147;;; If it is not provided, but we think it will be available when necessary,148;;; then we can use the following line (uncommented) to make sure that149;;; it will be used. If you have to ask, then you don't need this.150;;(setq ess-local-custom-available t)151152;; SJE Thu 13 May 2004153;; Maybe ess-etc-directory should not be defcustom, since its value154;; depends on ess-lisp-directory, and is needed by other modes that are155;; loaded before the custom code.156(defvar ess-etc-directory nil157"Location of the ESS etc/ directory.158The ESS etc directory stores various auxillary files that are useful159for ESS, such as icons.")160161(defvar ess-etc-directory-list162'("../etc/ess/" "../etc/" "../../etc/ess/" "./etc/")163"List of directories, relative to `ess-lisp-directory', to search for etc.")164165(while (and (listp ess-etc-directory-list) (consp ess-etc-directory-list))166(setq ess-etc-directory167(expand-file-name (concat ess-lisp-directory "/"168(car ess-etc-directory-list))))169(if (file-directory-p ess-etc-directory)170(setq ess-etc-directory-list nil)171(setq ess-etc-directory nil)172(setq ess-etc-directory-list (cdr ess-etc-directory-list))173(when (null ess-etc-directory-list)174(beep 0) (beep 0)175(message (concat176"ERROR:ess-site.el:ess-etc-directory\n"177"Relative to ess-lisp-directory, one of the following must exist:\n"178"../etc/ess, ../etc, ../../etc/ess or ./etc"))179(sit-for 4))))180181;;-- no longer used thanks to the (unless ...) clause below --182;; (defvar ess-info-directory nil183;; "*Location of the ESS info/ directory.184;; The ESS info directory stores the ESS info files.")185186187;;(1.2) If ess.info is not found, then ess-lisp-directory/../doc/info is added188;; resurrecting Stephen's version with a bug-fix & xemacs compatibility189(if (fboundp 'locate-file) (progn190(unless (locate-file "ess.info"191(if (featurep 'xemacs)192Info-directory-list193Info-default-directory-list))194(add-to-list (if (featurep 'xemacs)195'Info-directory-list 'Info-default-directory-list)196(expand-file-name "../doc/info/" ess-lisp-directory)))))197198199;; ALWAYS:200(ess-message "[ess-site:] require 'ess *ITSELF* ...")201(require 'ess); -> loads ess-custom.el and more202(ess-message "[ess-site:] .. after requiring 'ess ...")203204205;;; (1.3) Files ending in .q and .S are considered to be S source files206;;; Files ending in .St are considered to be S transcript files207;;;208;;; NB: in standard Emacs, files ending in .s are assembler files. If you209;;; want to use assembler. If a user wants to210;;; restore the default modes for assembly file extensions, the211;;; following can go into ~/.emacs or ~/.xemacs/init.el212;;;213;;; (add-hook 'ess-mode-hook 'ess-restore-asm-extns)214;;; (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns)215216(autoload 'Rd-mode "ess-rd" "Major mode for editing R documentation." t)217218; Here is a workaround for an Emacs bug related to indirect buffers and219; spurious lockfiles that rears its ugly head with .Rd files220; http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-02/msg01368.html221; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14328222(if (featurep 'xemacs) nil223;; (add-hook 'Rd-mode-hook (lambda ()224;; (set (make-local-variable create-lockfiles) nil)))225226(make-local-variable 'create-lockfiles)227228(add-hook 'Rd-mode-hook (lambda () (setq create-lockfiles nil)))229)230231;; This is thanks to Ed L Cashin <[email protected]>, 03 Mar 2004 :232(defun ess-restore-asm-extns ()233"Remove the S-Plus mode association for .s and .S files added by ESS.234Putting the following in ~/.emacs restores emacs' default association235between .s or .S files and assembly mode.236237(add-hook 'ess-mode-hook 'ess-restore-asm-extns)238(add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns)"239(interactive)240(when (assoc "\\.[qsS]\\'" auto-mode-alist)241(setq auto-mode-alist242(remassoc "\\.[qsS]\\'" auto-mode-alist))243;; put .q extention back244;; (add-to-list is in xemacs and GNU emacs)245;; R-mode when in a R/ subdirectory, otherwise S-mode:246(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . R-mode))247(add-to-list 'auto-mode-alist '("\\.q\\'" . S-mode))248))249250;; Be careful when editing the following. MISTAKES WILL RESULT IN251;; *.sty BEING TREATED AS ESS[S], rather than LaTeX-mode!252253(if (assoc "\\.[rR]\\'" auto-mode-alist) nil254(setq auto-mode-alist255(append256'(("\\.sp\\'" . S-mode) ;; re: Don MacQueen <[email protected]>257("/R/.*\\.q\\'" . R-mode) ;; R/*.q is R code (e.g., in package)258("\\.[qsS]\\'" . S-mode) ;; s,S [see ess-restore-asm-extns above!]259("\\.ssc\\'" . S-mode) ;; Splus (>= 4.x) script files.260("\\.SSC\\'" . S-mode) ;; ditto for windoze261("\\.[rR]\\'" . R-mode)262("\\.[rR]nw\\'" . Rnw-mode)263("\\.[sS]nw\\'" . Snw-mode); currently identical to Rnw-mode264("\\.[rR]profile\\'" . R-mode)265("NAMESPACE\\'" . R-mode)266("CITATION\\'" . R-mode)267("\\.omg\\'" . omegahat-mode)268("\\.hat\\'" . omegahat-mode) ;; Duncan's pref'd...269("\\.lsp\\'" . XLS-mode)270("\\.do\\'" . STA-mode)271("\\.ado\\'" . STA-mode)272("\\.[Ss][Aa][Ss]\\'" . SAS-mode)273;; Many .log/.lst files, not just SAS274;;("\\.log\\'" . SAS-log-mode)275;;("\\.[Ll][Ss][Tt]\\'" . SAS-listing-mode)276("\\.[Ss]t\\'" . S-transcript-mode)277("\\.Sout" . S-transcript-mode)278;;("\\.[Rr]t\\'" . R-transcript-mode)279("\\.[Rr]out" . R-transcript-mode)280("\\.Rd\\'" . Rd-mode)281("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode)282("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode)283("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode)284("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode)285("\\.[Jj][Oo][Gg]\\'" . ess-jags-mode)286("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode)287)288auto-mode-alist)))289290;; Rscript and littler interpreters recognized. XEmacs entries can291;; be regexps, which complicates matters as "r" on its own matches292;; other interpeters like "perl".293(add-to-list 'interpreter-mode-alist '("Rscript" . r-mode))294(add-to-list 'interpreter-mode-alist295(cons (if (featurep 'xemacs) "r$" "r") 'r-mode))296297298;; (1.4) Customize the dialects for your setup.299300;;; AS OF ESS 5.1.14, if you are using Emacs 20.x, x>3, or XEmacs301;;; 21.x, x>0, you can now use the "Customize" facility for302;;; customization.303304;;;; Choices for *(), where * is from inferior-*-program....305;;; Most sites will not need to use these customized program-names. They are306;;; provided for cases where the program is not on the standard default path.307;;; If the program doesn't get located correctly by the default use of308;;; M-x S+3 (for example), then put the path name for your system into the309;;; the variable inferior-S+3-program-name. If for any reason you want the310;;; default use of M-x S to refer to a different program than S+3, then311;;; redefine inferior-S-program-name.312313;;(setq-default inferior-S3-program-name "/disk05/s/S")314;;(setq-default inferior-S+3-program-name "Splus34")315;;(setq-default inferior-S4-program-name "/disk05/s4/S")316;;(setq-default inferior-S+4-program-name "Splus")317;;(setq-default inferior-S+5-program-name "Splus5")318;;(setq-default inferior-S+-program-name "Splus7") ; unix systems ; or319;;(setq-default inferior-S+-program-name "Splus") ; unix systems320;;321;; If you wish to call other versions of R on a Unix system, ESS322;; should auto-detect other versions of R, according to matches to the323;; variable `ess-r-versions' as described in its docstring. Consider324;; changing that variable rather than changing inferior-R-program-name325;; if your version of R is not already auto-detected.326;;(setq-default inferior-R-program-name "R") ; unix systems327;;(setq-default inferior-R-program-name "Rterm") ; MS Windows, see below for path as well328;;(setq-default inferior-R-program-name "C:\\Program Files\\R\\R-2.5.0\\bin\\Rterm.exe")329;;(setq-default inferior-XLS-program-name "xlispstat")330;;(setq-default inferior-ARC-program-name "arc")331;;(setq-default inferior-VST-program-name "vista")332;;(setq-default inferior-SAS-program-name "sas")333;;(setq-default inferior-OMG-program-name "/home/rossini/src/anoncvs/Omegahat/org/omegahat/bin/omegahat")334(setq-default inferior-OMG-program-name "omegahat")335336;;; The line below is the ESS default and sends the commands window337;;; to emacs, giving the user the opportunity to338;;; (1) edit the output into a clean ess-transcript file before printing, or339;;; (2) print a region of the file.340;;(setq-default inferior-S+4-print-command "S_PRINT_COMMAND=emacsclientw.exe")341342;;; The editor and pager output from S+4 and Sqpe+4 are sent by343;;; StatSci default to notepad, effectively using the definition:344;;(setq-default inferior-S+4-editor-pager-command345;; "options(editor='notepad', pager='notepad')")346;;;347;;; ESS sends the output from both commands to an emacs buffer using348;;; the definition:349;;(setq-default inferior-S+4-editor-pager-command350;; "options(editor='emacsclient.exe', pager='emacsclientw.exe')")351352;;; These commands are for running the PC version of Sqpe of S+4 and353;;; S+6 in an emacs buffer, using the same technology as ESS uses for354;;; Unix S-Plus. Interactive graphics with javagraph are available355;;; in this mode beginning with S-Plus 6.1.356;;; See ess-sp4-d.el or ess-sp6w-d.el357358;;; -----> configuration now via custom, see ./ess-custom.el and look for359;;; inferior-Sqpe+... e.g. inferior-Sqpe+6-program-name360361;;; These ddeclient values will be buffer-local on MS-Windows 9x/NT362(setq-default inferior-ess-ddeclient "Initial")363(setq-default inferior-ess-client-name "Initial")364(setq-default inferior-ess-client-command "Initial")365366;;; S-Plus 6 for Windows startup time depends on the amount of RAM and367;;; the processor speed. ESS needs to build a delay into the M-x S+6368;;; sequence to allow time for S-Plus 6 to open the Commands window.369;;; We then send several lines to the Commands window before returning370;;; control to the user. On a 300 MHz machine with 96MB of RAM the371;;; delay is 60 seconds. On a ???? MHz machine with 523MB the delay is372;;; 10 seconds. The user may need to adjust this number.373(defvar ess-S+6-startup-delay 15 ;; <- 2005-01-03; MM374"*Number of seconds to wait for the Commands window to appear before375sending `inferior-ess-language-start' to S-Plus.")376377378;;; see essd-els.el379380;;(setq-default inferior-S-elsewhere-program-name "sh")381;;(setq-default inferior-S-elsewhere-program-name "ssh")382;;; You might consider using ssh, if you can! (and if you really do383;;; this, use ssh-agent, etc, for securing your sessions).384385386;;;; Choice for S().387;;(setq-default inferior-S-program-name inferior-S+3-program-name)388389390391392393;; (1.5) Require the needed dialects for your setup.394395(ess-message "[ess-site:] Before requiring dialect 'ess-*-d ....")396(ess-message "[ess-site:] require 'ess-r-d ...")397(require 'ess-r-d) ;; R398(require 'ess-julia)399;; (ess-message "[ess-site:] require 'ess-s4-d ...")400;; (require 'ess-s4-d) ; has become VERY RARE ..401402;;(ess-message "[ess-site:] require 'ess-s3-d ...")403;;(require 'ess-s3-d) ; THIS IS RARE. You probably do not have this.404405;; "sp" refers to S-PLUS (MathSoft/StatSci/Insightful/TIBCO):406(ess-message "[ess-site:] require 'ess-sp3-d ...")407(require 'ess-sp3-d)408409(if ess-microsoft-p410(progn411;; (ess-message "[ess-site:] require 'ess-sp4-d ...")412;; (require 'ess-sp4-d)413(ess-message "[ess-site:] require 'ess-sp6w-d ...")414(require 'ess-sp6w-d))415;; else: decent OS416;; (ess-message "[ess-site:] require 'ess-sp5-d ...")417;; (require 'ess-sp5-d)418(ess-message "[ess-site:] require 'ess-sp6-d ...")419(require 'ess-sp6-d))420421(ess-message "[ess-site:] require 'ess-sta-d ...")422(require 'ess-sta-d) ;; for Stata.423;; (ess-message "[ess-site:] require 'ess-xls-d ...")424;; (require 'ess-xls-d) ;; XLispStat425;; (ess-message "[ess-site:] require 'ess-vst-d ...")426;; (require 'ess-vst-d) ;; ViSta427;; (ess-message "[ess-site:] require 'ess-arc-d ...")428;; (require 'ess-arc-d) ;; Arc429(ess-message "[ess-site:] require 'ess-sas-d ...")430(require 'ess-sas-d)431(ess-message "[ess-site:] require 'essd-els ...")432(require 'essd-els) ;; S-elsewhere, on another machine by telnet433;; (ess-message "[ess-site:] require 'ess-omg-d ...")434;; (require 'ess-omg-d) ;; for omegahat435(ess-message "[ess-site:] require 'ess-bugs-l ...")436(require 'ess-bugs-l) ;; for batch BUGS437438(ess-write-to-dribble-buffer439(format "[ess-site.el]: ess-customize-alist=%s \n"440ess-customize-alist))441442;;; (1.7) Literate Data Analysis443(require 'ess-noweb)444(require 'ess-swv); for Sweave445446(ess-write-to-dribble-buffer447(format "[ess-site.el _2_]: ess-customize-alist=%s \n"448ess-customize-alist))449450;; (1.8) Speedbar and mouse451452(ess-message "[ess-site:] require 'ess-menu ...")453(require 'ess-menu)454(require 'ess-mouse)455456;; (1.9) Toolbar support457458;; To remove toolbar support under ESS, add "(setq ess-use-toolbar nil)"459;; to your ~/.emacs or ~/.xemacs/init.el before (require 'ess-site)460(ess-message "[ess-site:] require 'ess-toolbar ...")461(require 'ess-toolbar)462463;;; 2. Site Specific setup464;;;; ===============================================465466;;; Set this to the name of the program you use to run S or S-PLUS. It467;;; can be an absolute pathname, if you wish.468;;(setq inferior-ess-program "Splus")469;;(setq inferior-ess-program (concat (getenv "SHOME") "/Splus"))470471472;;; 2.1 Backwards compatibility (roll your own!)473;;; What you want S and R to call...474475(autoload 'ess-transcript-mode "ess-trns"476"Major mode for editing S transcript files." t)477(autoload 'ess-transcript-clean-region "ess-trns" no-doc t)478479(autoload 'ess-rdired "ess-rdired"480"View *R* objects in a dired-like buffer." t)481482483;;; On a PC, the default is S+.484;; Elsewhere (unix and linux) the default is S+485(cond (ess-microsoft-p486;; MS-Windows-------------------------------------------------487488;; (fset 'S489;; (if (equal (file-name-nondirectory shell-file-name) "cmdproxy.exe")490;; 'S+-msdos491;; 'S+))492(defun S-by-icon (&rest x)493(interactive)494(message "Please start S+ from the icon.495Then you can connect emacs to it with `M-x S-existing'.")496)497(fset 'S 'S-by-icon)498(fset 'S-existing499(if (equal (file-name-nondirectory shell-file-name) "cmdproxy.exe")500'S+-msdos-existing501'S+-existing))502(fset 'Sqpe 'Sqpe+)503(fset 's-mode 'S+-mode)504(fset 's-transcript-mode 'S+-transcript-mode))505506(t ;;((eq system-type 'gnu/linux)507;; Linux etc (including Mac OSX !?) --------------------------508(fset 'S 'S+)509(fset 's-mode 'S+-mode)510(fset 's-transcript-mode 'S+-transcript-mode)))511512513;;;;* Alias S-mode to s-mode514;;; Emacs will set the mode for a file based on the file's header.515;;; The mode name is indicated by putting it between -*- on the top line.516;;; (Other commands can go here too, see an Emacs manual.)517;;; For a file you also load, you will want a leading # (comment to S)518;;; Emacs will downcase the name of the mode, e.g., S, so we must provide519;;; s-mode in lower case too. That is, "#-*- S-*-" invokes s-mode and520;;; not S-mode.521(fset 'S-transcript-mode 's-transcript-mode)522(fset 'S-mode 's-mode)523524;;; Create functions for calling different (older or newer than default)525;;; versions of R and S(qpe).526(defvar ess-versions-created nil527"List of strings of all S- and R-versions found on the system.")528529;; is currently used (updated) by ess-find-newest-R530(defvar ess-r-versions-created nil531"List of strings of all R-versions found on the system.")532;; FIXME: should then update ess-versions-created as well (easy),533;; ----- *and* update the "Start Process" menu (below)534;; -> To this: wrap the following in functions that can be re-called535536(defun ess-r-s-versions-creation ()537"(Re)Create ESS R-<..> commands FILENAME sans final \"extension\".538The extension, in a file name, is the part that follows the last `.'."539540(interactive)541(ess-message "[ess-site:] before creating ess-versions-* ...")542;; Create ess-versions-created,543;; ess-r-versions-created,544;; and on Windows, ess-rterm-version-paths -----------------------------------------545(let ((R-newest-list '("R-newest"))546(ess-s-versions-created (if ess-microsoft-p547(nconc548(ess-sqpe-versions-create ess-SHOME-versions) ;; 32-bit549(ess-sqpe-versions-create ess-SHOME-versions-64 "-64-bit")) ;; 64-bit550(ess-s-versions-create)))) ;; use ess-s-versions551(if ess-microsoft-p552(setq ess-rterm-version-paths ;; (ess-find-rterm))553(ess-flatten-list554(ess-uniq-list555(if (not ess-directory-containing-R)556(if (getenv "ProgramW6432")557(let ((P-1 (getenv "ProgramFiles(x86)"))558(P-2 (getenv "ProgramW6432")))559(nconc560;; always 32 on 64 bit OS, nil on 32 bit OS561(ess-find-rterm (concat P-1 "/R/") "bin/Rterm.exe")562(ess-find-rterm (concat P-1 "/R/") "bin/i386/Rterm.exe")563;; keep this both for symmetry and because it can happen:564(ess-find-rterm (concat P-1 "/R/") "bin/x64/Rterm.exe")565566;; always 64 on 64 bit OS, nil on 32 bit OS567(ess-find-rterm (concat P-2 "/R/") "bin/Rterm.exe")568(ess-find-rterm (concat P-2 "/R/") "bin/i386/Rterm.exe")569(ess-find-rterm (concat P-2 "/R/") "bin/x64/Rterm.exe")570))571(let ((PF (getenv "ProgramFiles")))572(nconc573;; always 32 on 32 bit OS, depends on 32 or 64 process on 64 bit OS574(ess-find-rterm (concat PF "/R/") "bin/Rterm.exe")575(ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe")576(ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe")577))578)579(let ((PF ess-directory-containing-R))580(nconc581(ess-find-rterm (concat PF "/R/") "bin/Rterm.exe")582(ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe")583(ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe")584))585)))))586(ess-message "[ess-site:] (let ... before (ess-r-versions-create) ...")587588(setq ess-r-versions-created ;; for Unix *and* Windows, using either589(ess-r-versions-create));; ess-r-versions or ess-rterm-version-paths (above!)590591;; Add the new defuns, if any, to the menu.592;; Check that each variable exists, before adding.593;; e.g. ess-sqpe-versions-created will not be created on Unix.594(setq ess-versions-created595(ess-flatten-list596(mapcar (lambda(x) (if (boundp x) (symbol-value x) nil))597'(R-newest-list598ess-r-versions-created599ess-s-versions-created)))))600)601602(ess-message "[ess-site:] before (ess-r-s-versions-creation) ...")603(ess-r-s-versions-creation)604605(when ess-versions-created606;; new-menu will be a list of 3-vectors, of the form:607;; ["R-1.8.1" R-1.8.1 t]608(let ((new-menu (mapcar (lambda(x) (vector x (intern x) t))609ess-versions-created)))610(easy-menu-add-item ess-mode-menu '("Start Process")611(cons "Other" new-menu))))612613(ess-message "[ess-site:] after ess-versions-created ...")614615;; Check to see that inferior-R-program-name points to a working version616;; of R; if not, try to find the newest version:617(ess-check-R-program-name) ;; -> (ess-find-newest-R) if needed, in ./ess-r-d.el618(ess-message "[ess-site:] after ess-check-R-prog... ...")619620;;; 3. Customization (and examples) for your site621;;;; ===============================================622623624;;; (3.01) SOME PEOPLE (who will remain nameless) worry that novices625;;; won't like fancy buffer names for their first (and only :-)626;;; process. To number all processes:627;;(setq ess-plain-first-buffername nil)628629;;; (3.02) Some people have requested using the program name as part630;;; of the buffer. Turned on for R.631;;(setq ess-use-inferior-program-name-in-buffer-name t)632633634;;; (3.1) Font-lock635;; The following two expressions automatically enable font-lock-mode636;; for ess-mode and inferior-ess-mode buffers.637638;; no longer requiring (window-system) here:639(when ess-font-lock-mode640(add-hook 'ess-mode-hook 'turn-on-font-lock t)641(add-hook 'ess-transcript-mode-hook 'turn-on-font-lock t)642(add-hook 'Rd-mode-hook 'turn-on-font-lock t)643(add-hook 'inferior-ess-mode-hook 'turn-on-font-lock t))644645646;;; (3.2) Framepop. Windows produced by ess-execute-objects etc. are647;;; often unnecessarily large. The framepop package makes such648;;; windows appear in a separate, shrink-wrapped frame. This will649;;; also affect other "temporary" windows such as those produced by650;;; C-h k, etc. To enable:651;;;652;;; Works only with Emacs at this time.653;; (cond (window-system654;; (require 'framepop)))655656;;; (3.3) ess-keep-dump-files.657;;; Documentation:658;;; *Variable controlling whether to delete dump files after a successful load.659;;; If nil: always delete. If `ask', confirm to delete. If `check', confirm660;;; to delete, except for files created with ess-dump-object-into-edit-buffer.661;;; Anything else (for example `always'): always keep and never delete.662;;; This variable only affects the behavior663;;; of ess-load-file. Dump files are never deleted if an error occurs664;;; during the load.665;;;666;;; RH sez: I find the default `always' keep to be imperative. The previous667;;; default was to throw away668;;; files at the wrong time (I think it was something like, if you M-x669;;; ess-load a file twice, while you are working on it, the file is670;;; deleted). I believe source is real and the ESS object is temporary.671;;; The previous default behavior is dangerous for people who believe this way.672;;; It made sense only for people who believe the object is real673;;; and the source file temporary.674(setq ess-keep-dump-files "always")675676;;; (3.4) ess-ask-for-ess-directory677;;; If t, will ask for the directory to use. If nil, assumes the678;;; default (usually, the users home directory...).679;;now rather in ./ess-custom.el : (setq ess-ask-for-ess-directory t)680681;;; (3.5) ess-directory default (correlated with above)682;;; The default location for running the subprocess is configurable.683;;; By default, that is the default-directory (a lisp variable which684;;; initially contains the directory from which the inferior ESS685;;; statistical package/process is started).686;;; For example, the following function (added to the pre-run-hook, by687;;; the line following it) will set the default directory to be your688;;; home directory:689;;;690;;(defun ajr:ess-set-directory ()691;; "Set ess-directory to home."692;; (setq-default ess-directory (file-name-as-directory (getenv "HOME"))))693;;(add-hook 'ess-pre-run-hook 'ajr:ess-set-directory)694;;;695;;; If you replace the setq-default line with:696;;;697;; (setq-default ess-directory (file-name-as-directory698;; (concat (getenv "HOME") "/ess/")))699;;;700;;; then it will always start up in the directory "ess" in your home701;;; directory.702;;;703;;; The default is to have ess to start up in the current buffer's704;;; directory (the one in which you started the inferior ESS705;;; statistical package/process). This is obtained706;;; by setting ess-directory to nil, i.e.707;; (setq-default ess-directory nil) ; this is the default.708709(when ess-microsoft-p710(add-hook 'ess-post-run-hook711(lambda()712(when (string= ess-dialect "R")713(ess-eval-linewise "options(chmhelp=FALSE, help_type=\"text\")"714nil nil nil 'wait)))))715716717;;; 3.6 Example of formatting changes718719;;; Formatting and indentation patterns are defined in ess-custom.el, please720;;; see ess-custom.el for exact definitions of these variable settings.721;;; To change them (eg, follow changes suggested by Terry Therneau),722;;; you need one or both of the following lines:723;;;724;;(setq ess-fancy-comments nil)725;;(setq ess-default-style 'CLB)726727;;; 4.0 SAS configuration728729;;; Beginning with ESS 5.1.13, we have editing options in SAS-mode.730;;; The default behavior is as it was in prior releases.731;;;732;;; There are two sets of alternatives.733;;; 1. Editing SAS-mode files.734;;; 1a. Default: TAB is bound to sas-indent-line.735;;; Current line is correctly indented as SAS code. Equivalent to736;;;(setq ess-sas-edit-keys-toggle nil) ;; default TAB in sas-mode737;;; 1b. Optional: TAB is bound to tab-to-tab-stop and inserts up to 4738;;; columns at a time. C-TAB moves backwards and deletes characters739;;; up to 4 columns at a time.740;;; The following line is for the optional behavior.741;;;(setq ess-sas-edit-keys-toggle t) ;; optional TAB and C-TAB in sas-mode742;;; Use the function call (ess-sas-edit-keys-toggle)743;;; to change the setting after the first SAS-mode buffer has been created.744;;; 1c. You can also define C-TAB in all modes by Option 2b (below).745;;;746;;; 2. Managing submitted SAS jobs with function keys.747;;; 2a. Default: To define the function keys in ESS[SAS] mode only,748;;; you will need, at most, one of the following two lines.749;;;(setq ess-sas-local-unix-keys t) ;; F2-F12 bound in ESS[SAS] mode750;;;(setq ess-sas-local-pc-keys t) ;; F2-F12 bound in ESS[SAS] mode751;;;752;;; 2b. Options: To define the function keys in all modes,753;;; you will need, at most, one of the following two lines.754;;;(setq ess-sas-global-unix-keys t) ;; F2-F12 bound in all modes755;;;(setq ess-sas-global-pc-keys t) ;; F2-F12 bound in all modes756;;;757;;; 3. If it is more convenient to have "*Async Shell Command*"758;;; in same-window-buffer-names, then:759;;;(ess-same-window-async)760;;;761;;;(defvar sas-program "sas" "*Name of program which runs sas.")762;;;763;;;(defvar sas-indent-width 4 "*Amount to indent sas statements")764765(ess-message "[ido:]")766(if (featurep 'emacs)767(require 'ido nil t))768769; Local variables section770(ess-message "[ess-site:] *very* end ...")771772;;; This file is automatically placed in Outline minor mode.773;;; The file is structured as follows:774;;; Chapters: ^L ;775;;; Sections: ;;*;;776;;; Subsections: ;;;*;;;777;;; Components: defuns, defvars, defconsts778;;; Random code beginning with a ;;;;* comment779;;; Local variables:780;;; mode: emacs-lisp781;;; mode: outline-minor782;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"783;;; End:784785;;; ess-site.el ends here786787788