1 \input texinfo @c -*-texinfo-*-
2 @comment %**start of header
4 @settitle ESS --- Emacs Speaks Statistics
5 @comment %**end of header
11 @title ESS --- Emacs Speaks Statistics
12 ESS @w{version @ESSVER}
14 @author The ESS Developers (A.J. Rossini, R.M. Heiberger, K. Hornik,
15 @author M. Maechler, R.A. Sparapani and S.J. Eglen)
16 @c @author (Formerly by: Doug Bates, Ed Kademan, Frank Ritter
17 @c @author and David Smith)
22 @author Current Documentation by The ESS Developers
23 @author Copyright @copyright{} 2002--2006 The ESS Developers
24 @author Copyright @copyright{} 1996--2001 A.J. Rossini
25 @c (@email{rossini@@biostat.washington.edu})
26 @c @author Department of Biostatistics
27 @c @author University of Washington, USA.
28 @author Original Documentation by David M. Smith
29 @author Copyright @copyright{} 1992--1995 David M. Smith
30 @c (@email{D.M.Smith@@lancaster.ac.uk})
31 @c @author Department of Mathematics and Statistics
32 @c @author Lancaster University, UK
34 @c @vskip 0pt plus 1filll
36 @author Permission is granted to make and distribute verbatim copies of this
37 @author manual provided the copyright notice and this permission notice are
38 @author preserved on all copies.
39 @author Permission is granted to copy and distribute modified versions of this
40 @author manual under the conditions for verbatim copying, provided that the
41 @author entire resulting derived work is distributed under the terms of a
42 @author permission notice identical to this one.
47 @majorheading ESS --- Emacs Speaks Statistics
51 * ESS: (ess). Emacs Speaks Statistics (S/S+/R, SAS, BUGS, Stata, XLisp-Stat).
53 @c node-name, next, previous, up
54 @node Top, Introduction, (dir), (dir)
55 @top ESS: Emacs Speaks Statistics
70 @c Bates, Ed Kademan, Frank Ritter and David Smith).
72 Emacs Speaks Statistics (ESS) provides an intelligent, consistent
73 interface between the user and the software. ESS interfaces with
74 SAS, S-PLUS, R, BUGS and other statistical analysis packages under
75 the Unix, Microsoft Windows, and Apple Mac operating systems. ESS
76 is itself a package within the emacs text editor and uses emacs
77 features to streamline the creation and use of statistical software.
78 ESS knows the syntax and grammar of statistical analysis packages
79 and provides consistent display and editing features based on that
80 knowledge. ESS assists in interactive and batch execution of
81 statements written in these statistical analysis languages.
87 * Introduction:: Overview of features provided by this package
88 * Installation:: Installing ESS on your system
90 * Interactive ESS:: Interacting with statistical programs
91 * Entering commands:: Interacting with the ESS process
92 * Transcript Mode:: Manipulating saved transcript files
94 * ESS for the S family::
95 * Editing:: How to create/edit objects and functions
96 * Editing R documentation files::
97 * Help:: Reading help files
102 * Miscellaneous:: Other features of ESS
103 * Mailing lists/bug reports:: How to get assistance with ESS
104 * Customization:: Customizing ESS
108 * Variable and command index::
111 @c --- The Detailed Node Listing ---
113 @c Introduction to ESS
115 @c * Features:: Why should I use ESS?
117 @c * Credits:: Authors of and contributors to ESS
118 @c * Latest version:: Getting the latest version of ESS
119 @c * Manual:: How to read this manual
121 @c Installing ESS on your system
122 @c * Unix installation:: Installing ESS on your Unix system
123 @c * Microsoft Windows installation:: Installing ESS on your MS Windows system
124 @c * Requirements:: emacs, Operating Systems and Statistical Packages
125 @c * System dependent:: Other variables you may need to change
127 @c Starting the ESS process
129 @c * Multiple ESS processes::
130 @c * ESS processes on Remote Computers::
131 @c * Customizing startup:: Changing the startup actions
133 @c Help for the S family
135 @c * ESS(S)--Editing files::
136 @c * iESS(S)--Inferior ESS processes::
137 @c * Handling and Reusing Transcripts::
138 @c * ESS-help--assistance with viewing help::
139 @c * Philosophies for using ESS(S)::
140 @c * Scenarios for use (possibilities--based on actual usage)::
141 @c * Customization Examples and Solutions to Problems::
145 @c * ESS(SAS)--Design philosophy::
146 @c * ESS(SAS)--Editing files::
147 @c * iESS(SAS)--Interactive SAS processes::
148 @c * ESS(SAS)--Batch SAS processes::
149 @c * ESS(SAS)--Function keys for batch processing::
150 @c * ESS(SAS)--TAB key::
151 @c * ESS(SAS)--Usage scenarios::
152 @c * iESS(SAS)--Common problems::
153 @c * ESS(SAS)--MS Windows::
155 @c Interacting with the ESS process
157 @c * Command-line editing:: Entering commands and fixing mistakes
158 @c * Completion:: Completion of object names
159 @c * Completion details:: Advanced completion concepts
160 @c * Transcript:: Manipulating the transcript
161 @c * Command History:: Command History
162 @c * History expansion:: References to historical commands
163 @c * Hot keys:: Hot keys for common commands
164 @c * Statistical Process running in ESS?::
165 @c * Other:: Other commands provided by inferior-ESS
167 @c Manipulating the transcript
169 @c * Last command:: Manipulating the output from the last command
170 @c * Process buffer motion:: Viewing older commands
171 @c * Transcript resubmit:: Re-submitting commands from the transcript
172 @c * Saving transcripts:: Keeping a record of your S session
174 @c Editing S functions
176 @c * Edit buffer:: Edit objects in a specialized buffer
177 @c * Loading:: Loading source files into the ESS process
178 @c * Error Checking:: Detecting errors in source files
179 @c * Evaluating code:: Sending code to the ESS process
180 @c * Indenting:: Indenting and formatting @Sl{} code
181 @c * Other edit buffer commands:: Commands for motion, completion and more
182 @c * Source Files:: Maintaining @Sl{} source files
183 @c * Source Directories:: Names and locations of dump files
185 @c Manipulating saved transcript files
187 @c * Resubmit:: Resubmitting commands from the transcript file
188 @c * Clean:: Cleaning transcript files
190 @c Other features of ESS
192 @c * Highlighting:: Syntactic highlighting of buffers
193 @c * Graphics:: Using graphics with ESS
194 @c * Object Completion::
196 @c Using graphics with ESS
198 @c * printer:: The printer() graphics driver
199 @c * X11:: The X11() (and other X-windows based) driver
201 @c Bugs and Bug Reporting, Mailing Lists
204 @c * Reporting Bugs::
209 @c * Variables:: Variables for customization
210 @c * Hooks:: Customizing ESS with hooks
211 @c * Keybindings:: Changing the default ESS keybindings
213 @c Variables for customization
215 @c * Variables for starting ESS:: Variables for starting ESS
216 @c * Dump file variables:: Variables for dump files
217 @c * Indentation variables:: Variables controlling indentation
218 @c * Variables controlling interaction:: Variables controlling interaction
219 @c with the ESS process
223 @comment node-name, next, previous, up
224 @node Introduction, Installation, Top, Top
225 @chapter Introduction to ESS
228 The S family (@Sl{}, Splus and R) and SAS statistical analysis packages
229 provide sophisticated statistical and graphical routines for manipulating
230 data. @b{E}macs @b{S}peaks @b{S}tatistics (ESS) is based on the merger
231 of two pre-cursors, S-mode and SAS-mode, which provided support for the
232 S family and SAS respectively. Later on, Stata-mode was also incorporated.
234 ESS provides a common, generic, and useful interface, through emacs, to
235 many statistical packages. It currently supports the S family, SAS, BUGS,
236 Stata and XLisp-Stat with the level of support roughly in that order.
238 A bit of notation before we begin. @emph{emacs} refers to both
239 @emph{GNU Emacs} by the Free Software Foundation, as well as
240 @emph{XEmacs} by the XEmacs Project. The emacs major
241 mode @code{ESS[language]}, where @code{language} can take values such as
242 @code{S}, @code{SAS}, or @code{XLS}. The inferior process interface
243 (the connection between emacs and the running process) referred to as inferior ESS
244 (@code{iESS}), is denoted in the modeline by @code{ESS[dialect]}, where
245 @code{dialect} can take values such as @code{S3}, @code{S4}, @code{S+3},
246 @code{S+4}, @code{S+5}, @code{S+6}, @code{S+7}, @code{R}, @code{XLS}, @code{VST}, @code{SAS}.
248 Currently, the documentation contains many references to @cite{`S'}
249 where actually any supported (statistics) language is meant, i.e., `S'
250 could also mean `XLisp-Stat' or `SAS'.
252 @cindex interactive use of S
254 @cindex using S interactively
255 For exclusively interactive users of S, ESS provides a number of
256 features to make life easier. There is an easy to use command history
257 mechanism, including a quick prefix-search history. To reduce typing,
258 command-line completion is provided for all @Sl{} objects and ``hot
259 keys'' are provided for common @Sl{} function calls. Help files are
260 easily accessible, and a paging mechanism is provided to view them.
261 Finally, an incidental (but very useful) side-effect of ESS is that a
262 transcript of your session is kept for later saving or editing.
264 @cindex transcripts of S sessions
265 No special knowledge of Emacs is necessary when using @Sl{}
266 interactively under ESS.
268 @cindex programming in S
269 For those that use @Sl{} in the typical edit--test--revise cycle when
270 programming @Sl{} functions, ESS provides for editing of @Sl{} functions
271 in Emacs edit buffers. Unlike the typical use of @Sl{} where the editor
272 is restarted every time an object is edited, ESS uses the current Emacs
273 session for editing. In practical terms, this means that you can edit
274 more than one function at once, and that the ESS process is still
275 available for use while editing. Error checking is performed on
276 functions loaded back into S, and a mechanism to jump directly to the
277 error is provided. ESS also provides for maintaining text versions of
278 your @Sl{} functions in specified source directories.
281 * Features:: Why should I use ESS?
283 * Credits:: Authors of and contributors to ESS
284 * Latest version:: Getting the latest version of ESS
285 * Manual:: How to read this manual
288 @comment node-name, next, previous, up
289 @node Features, New features, Introduction, Introduction
290 @section Why should I use ESS?
292 Statistical packages are powerful software systems for manipulating and
293 analyzing data, but their user interfaces often leave something something
294 to be desired: they offer weak editor functionality and they differ
295 among themselves so markedly that you have to re-learn how to do those
296 things for each package. ESS is a package which is designed to make
297 editing and interacting with statistical packages more uniform,
298 user-friendly and give you the power of emacs as well.
300 ESS provides several features which make it easier to interact with the
301 ESS process (a connection between your buffer and the statistical
302 package which is waiting for you to input commands). These include:
306 @b{Command-line editing} for fixing mistakes in commands before they are
307 entered. The @samp{-e} flag for S-plus provides something similar to
308 this, but here you have the full range of Emacs commands rather than a
309 limited subset. However, other packages such as XLisp-Stat and S3 do not
310 necessarily have features like this built-in.
311 @xref{Command-line editing}.
314 @b{Searchable command history} for recalling previously-submitted
315 commands. This provides all the features of the @samp{Splus -e} history
316 mechanism, plus added features such as history searching.
317 @xref{Command History}.
320 @b{Command-line completion} of both object and file names for quick
321 entry. This is similar to @code{tcsh}'s facility for filenames; here it
322 also applies to object names and list components.
326 @b{Hot-keys} for quick entry of commonly-used commands in `S' such as
327 @code{objects()} and @code{search()}.
331 @b{Transcript recording} for a complete record of all the actions in an
336 @b{Interface to the help system}, with a specialized mode for viewing S
342 If you commonly create or modify @Sl{} functions, you will have found
343 the standard facilities for this (the @samp{fix()} function, for
344 example) severely limiting. Using S's standard features, one can only
345 edit one function at a time, and you can't continue to use @Sl{} while
346 editing. ESS corrects these problems by introducing the following
351 @b{Object editing}. ESS allows you to edit more than one function
352 simultaneously in dedicated Emacs buffers. The ESS process may
353 continue to be used while functions are being edited.
357 @b{A specialized editing mode} for @Sl{} code, which provides syntactic
358 indentation and highlighting.
362 @b{Facilities for loading and error-checking source files}, including a
363 keystroke to jump straight to the position of an error in a source file.
364 @xref{Error Checking}.
367 @b{Source code revision maintenance}, which allows you to keep historic
368 versions of @Sl{} source files.
372 @b{Facilities for evaluating @Sl{} code} such as portions of source
373 files, or line-by-line evaluation of files (useful for debugging).
374 @xref{Evaluating code}.
377 Finally, ESS provides features for re-submitting commands from saved
378 transcript files, including:
383 @b{Evaluation of previously entered commands}, stripping away
385 @xref{Transcript resubmit}.
389 @comment node-name, next, previous, up
390 @node New features, Credits, Features, Introduction
391 @section New features in ESS
393 @include newfeat.texi
395 @comment node-name, next, previous, up
396 @node Credits, Latest version, New features, Introduction
397 @section Authors of and contributors to ESS
399 @include credits.texi
401 @comment node-name, next, previous, up
402 @node Latest version, Manual, Credits, Introduction
403 @section Getting the latest version of ESS
405 @include getting.texi
407 @comment node-name, next, previous, up
408 @node Manual, , Latest version, Introduction
409 @section How to read this manual
411 If you need to install ESS, read @ref{Installation} for details on what
412 needs to be done before proceeding to the next chapter.
414 In this manual we use the standard notation for describing the
415 keystrokes used to invoke certain commands. @kbd{C-<chr>} means hold
416 the CONTROL key while typing the character <chr>. @kbd{M-<chr>} means
417 hold the META or EDIT or ALT key down while typing <chr>. If there is no
418 META, EDIT or ALT key, instead press and release the ESC key and then
421 All ESS commands can be invoked by typing @kbd{M-x command}. Most of
422 the useful commands are bound to keystrokes for ease of use. Also, the
423 most popular commands are also available through the emacs menubar, and
424 finally, if available, a small subset are provided on the toolbar.
425 Where possible, keybindings are similar to other modes in emacs to
426 strive for a consistent user interface within emacs, regardless of the
427 details of which programming language is being edited, or process being
430 Some commands, such as @kbd{M-x R} can accept an optional `prefix'
431 argument. To specify the prefix argument, you would type @kbd{C-u}
432 before giving the command. e.g. If you type @kbd{C-u M-x R}, you will
433 be asked for command line options that you wish to invoke the R process
436 Emacs is often referred to as a `self-documenting' text editor. This
437 applies to ESS in two ways. First, limited documentation about each ESS
438 command can be obtained by typing @kbd{C-h f}. For example, if you type
439 @kbd{C-h f ess-eval-region}, documentation for that command will appear
440 in a separate *Help* buffer. Second, a complete list of keybindings
441 that are available in each ESS mode and brief description of that mode
442 is available by typing @kbd{C-h m} within an ESS buffer.
444 Emacs is a versatile editor written in both C and lisp; ESS is written
445 in the Emacs lisp dialect (termed `elisp') and thus benefits from the
446 flexible nature of lisp. In particular, many aspects of ESS behaviour
447 can be changed by suitable customization of lisp variables. This manual
448 mentions some of the most frequent variables. A full list of them
449 however is available by using the Custom facility within emacs. (Type
450 @kbd{M-x customize-group RET ess RET} to get started.)
451 @ref{Customization} provides details of common user variables you can
452 change to customize ESS to your taste, but it is recommended that you
453 defer this section until you are more familiar with ESS.
455 @comment node-name, next, previous, up
456 @node Installation, Interactive ESS, Introduction, Top
457 @chapter Installing ESS on your system
460 The following section details those steps necessary to get ESS running
464 * Unix installation:: Installing ESS on your Unix system
465 * Microsoft Windows installation:: Installing ESS on your MS Windows system
466 * Requirements:: emacs, Operating Systems and Statistical Packages
469 @c FIXME: the following contains @node s *and* is also included by readme.texi
470 @c ----- which does *not* include 'requires.texi'
471 @c ==> *must* give node pointer problems!
472 @include inst_tar.texi
474 @node Requirements, , Microsoft Windows installation, Installation
475 @comment node-name, next, previous, up
476 @section Requirements
477 @include requires.texi
480 @comment node-name, next, previous, up
481 @node Interactive ESS, Entering commands, Installation, Top
482 @chapter Interacting with statistical programs
484 As well as using ESS to edit your source files for statistical programs,
485 you can use ESS to run these statistical programs. In this chapter, we
486 mostly will refer by example to running S from within emacs. The emacs
487 convention is to name such processes running under its control as
488 `inferior processes'. This term can be slightly misleading, in which
489 case these processes can be thought of `interactive processes'. Either
490 way, we use the term `iESS' to refer to the Emacs mode used to interact
491 with statistical programs.
494 @comment node-name, next, previous, up
497 * Multiple ESS processes::
498 * ESS processes on Remote Computers::
499 * S+elsewhere and ESS-elsewhere::
500 * Customizing startup::
503 @node Starting up, Multiple ESS processes, Interactive ESS, Interactive ESS
504 @section Starting an ESS process
508 To start an @Sl{} session on Unix or on Windows when you
509 use the Cygwin bash shell, simply type @kbd{M-x S RET}.
511 To start an @Sl{} session on Windows when you
512 use the MSDOS prompt shell, simply type @kbd{M-x S+6-msdos RET}.
516 @cindex ESS process directory
517 @cindex starting directory
518 @cindex working directory
521 S will then (by default) ask the question
523 S starting data directory?
526 Enter the name of the directory you wish to start @Sl{} from (that is,
527 the directory you would have @code{cd}'d to before starting @Sl{} from
528 the shell). This directory should have a @file{.Data} subdirectory.
530 You will then be popped into a buffer
531 @cindex ESS process buffer
532 @cindex process buffer
533 with name @samp{*S*} which will be used
534 for interacting with the ESS process, and you can start entering commands.
537 @comment node-name, next, previous, up
538 @node Multiple ESS processes, ESS processes on Remote Computers, Starting up, Interactive ESS
539 @section Running more than one ESS process
540 @cindex Multiple ESS processes
542 ESS allows you to run more than one ESS process simultaneously in the
543 same session. Each process has a name and a number; the initial process
544 @cindex process names
545 (process 1) is simply named (using S-PLUS as an example) @samp{S+3:1}.
546 @comment You may start a new process by passing a numeric argument to
547 @comment @kbd{M-x S}. For example, typing @kbd{ESC 2 M-x S} starts up
548 @comment an ESS process with name @samp{S2}, in a buffer whose name
549 @comment is initially @samp{*S2*}.
550 The name of the process is shown in the mode line in square brackets
551 (for example, @samp{[S+3:2]}); this is useful if the process buffer is
552 renamed. Without a prefix argument, @kbd{M-x S} starts a new ESS
553 process, using the first available process number. With a prefix
554 argument (for R), @kbd{C-u M-x R} allows for the specification of
555 command line options.
557 @pindex ess-request-a-process
558 You can switch to any active ESS process with the command
559 @samp{M-x ess-request-a-process}. Just enter the name of the process
560 you require; completion is provided over the names of all running S
561 processes. This is a good command to consider binding to a global key.
563 @c SJE - commented outl the default behaviour now is to label *S* rather
565 @c @vindex ess-plain-first-buffername
566 @c For the predecessor to ESS (S-mode 4.8), the initial process was not
567 @c visibly numbered, i.e. S instead of S1 was used in the mode-line. To
568 @c obtain this behavior, set the variable @code{ess-plain-first-buffername}
569 @c to @code{t}. See @file{ess-site} for how to set this for all users.
572 @comment node-name, next, previous, up
573 @node ESS processes on Remote Computers, S+elsewhere and ESS-elsewhere, Multiple ESS processes, Interactive ESS
574 @section ESS processes on Remote Computers
575 @cindex Remote Computers
577 @pindex ESS-elsewhere
580 ESS works with processes on remote computers as easily as with
581 processes on the local machine. The recommended way to access a
582 statistical program on remote computer is to start it from a telnet or
583 ssh buffer and then connect ESS to that buffer.
586 @item Start a new telnet or ssh buffer and connect to the remote computer
587 (e.g. use @samp{M-x telnet} or @samp{M-x ssh}; ssh.el is available at
588 @uref{ftp://ftp.splode.com/pub/users/friedman/emacs-lisp/ssh.el}).
590 @item Start the ESS process on the remote machine, for example with one of
591 the commands @samp{Splus}, or @samp{R}, or @samp{sas -stdio}.
593 @item Enter the ESS command @samp{M-x ess-remote}. You will be prompted for
594 a program name. Enter @samp{sp6} or @samp{r} or @samp{sas} or another
595 valid name. Your telnet process is now known to ESS. All the usual
596 ESS commands (@samp{C-c C-n} and its relatives) now work with the S
597 language processes. For SAS you need to use a different command
598 @samp{C-c i} (that is a regular @samp{i}, not a @samp{C-i}) to send
599 lines from your @file{myfile.sas} to the remote SAS process.
600 @samp{C-c i} sends lines over invisibly.
601 @c and lets SAS display them formatted correctly as in a SAS log file.
602 With ess-remote you get teletype behavior---the data input, the
603 log, and the listing all appear in the same buffer. To make this work,
604 you need to end every PROC and DATA step with a "RUN;" statement. The
605 "RUN;" statement is what tells SAS that it should process the preceding
608 @item Graphics (interactive) on the remote machine. If you run X11
609 (@xref{X11}, X-windows)
610 on both the local and remote machines then you should be able to
611 display the graphs locally by setting the @samp{DISPLAY} environment
612 variable appropriately. Windows users can download @samp{xfree86}
615 @item Graphics (static) on the remote machine.
616 If you don't run the X window system on the local machine, then you can write
617 graphics to a file on the remote machine, and display the file in
618 a graphics viewer on the local machine. Most statistical software can
619 write one or more of postscript, GIF, or JPEG files.
620 Depending on the versions of emacs and the operating system that you
621 are running, emacs itself may display @samp{.gif} and @samp{.jpg}
622 files. Otherwise, a graphics file viewer will be needed.
623 Ghostscript/ghostview may be downloaded to display @samp{.ps} and
624 @samp{.eps} files. Viewers for GIF and JPEG are usually included with
625 operating systems. @xref{ESS(SAS)--Function keys for batch processing},
626 for more information on using the F12 key for displaying graphics files
630 Should you or a colleague inadvertently start a statistical process in
631 an ordinary @samp{*shell*} buffer, the @samp{ess-remote} command can
632 be used to convert it to an ESS buffer and allow you to use the ESS
635 We have two older commands, now deprecated, for accessing ESS processes
637 @xref{S+elsewhere and ESS-elsewhere}.
640 @comment node-name, next, previous, up
641 @node S+elsewhere and ESS-elsewhere, Customizing startup, ESS processes on Remote Computers, Interactive ESS
642 @section S+elsewhere and ESS-elsewhere
644 These commands are now deprecated. We recommend @samp{ess-remote}. We
645 have two versions of the elsewhere function. @samp{S+elsewhere} is
646 specific for the S-Plus program. The more general function
647 @samp{ESS-elsewhere} is not as stable.
650 @item Enter @samp{M-x S+elsewhere}.
651 You will be prompted for a starting directory. I usually give it my
652 project directory on the local machine, say @samp{~myname/myproject/}
654 Or enter @samp{M-x ESS-elsewhere}. You will be prompted for an ESS
655 program and for a starting directory. I usually give it my project
656 directory on the local machine, say @samp{~myname/myproject/}
658 @item The @samp{*S+3*} buffer will appear with a prompt from the
659 local operating system (the unix prompt on a unix workstation or with
660 cygwin bash on a PC, or the msdos prompt on a PC without bash). emacs
661 may freeze because the cursor is at the wrong place. Unfreeze it with
662 @samp{C-g} then move the cursor to the end with @samp{M->}.
663 With @samp{S+elsewhere} the buffer name is based on the name of the ESS program.
665 @samp{telnet myname@@other.machine} (or @samp{ssh myname@@other.machine}).
666 You will be prompted for your password on the remote machine.
668 @samp{M-x send-invisible}
669 before typing the password itself.
671 @item Before starting the ESS process, type @samp{stty -echo nl}
672 at the unix prompt. The @samp{-echo} turns off the echo, the
673 @samp{nl} turns off the newline that you see as @samp{^M}.
675 @item You are now talking to the unix prompt on the other machine in the
676 @samp{*S+3*} buffer. cd into the directory for the current project and start
677 the ESS process by entering
678 @samp{Splus} or @samp{R} or @samp{sas -stdio}
679 as appropriate. If you can login remotely to your Windows 2000, then
680 you should be able to run @samp{Sqpe} on the Windows machine. I haven't
681 tested this and noone has reported their tests to me. You will not be
682 able to run the GUI through this text-only connection.
684 @item Once you get the S or R or SAS prompt, then you are completely connected.
685 All the @samp{C-c C-n} and related commands work correctly in sending
686 commands from @samp{myfile.s} or @samp{myfile.r} on the PC to the
687 @samp{*S+3*} buffer running the S or R or SAS program on the remote machine.
689 @item Graphics on the remote machine works fine. If you run the X window
690 system on the remote unix machine you should be able to display them in
691 @samp{xfree86} on your PC. If you don't run X11, then you can write
692 graphics to the postscript device and copy it to your PC with dired and
693 display it with ghostscript.
697 @comment node-name, next, previous, up
698 @node Customizing startup, , S+elsewhere and ESS-elsewhere, Interactive ESS
699 @section Changing the startup actions
701 If you do not wish ESS to prompt for a starting directory when starting
702 a new process, set the variable @code{ess-ask-for-ess-directory} to
703 @vindex ess-ask-for-ess-directory
704 @code{nil}. In this case, the starting directory will be set using
705 one of the following methods:
709 @item If the variable @code{ess-directory-function} stores the name of a
710 function, the value returned by this function is used. The default for
711 this variable is nil.
713 @item Otherwise, if the variable @code{ess-directory} stores the name of a
714 directory (ending in a slash), this value is used. The default for this
717 @item Otherwise, the working directory of the current buffer is used.
721 If @code{ess-ask-for-ess-directory} has a non-@code{nil} value (as it
722 does by default) then the value determined by the above rules provides
723 the default when prompting for the starting directory. Incidentally,
724 @code{ess-directory} is an ideal variable to set in
725 @code{ess-pre-run-hook}.
727 If you like to keep a record of your @Sl{} sessions, set the variable
728 @code{ess-ask-about-transfile} to @code{t}, and you will be asked for a
729 filename for the transcript before the ESS process starts.
731 @defvr {User Option} ess-ask-about-transfile
732 If non-@code{nil}, as for a file name in which to save the session
736 @cindex transcript file
737 Enter the name of a file in which to save the transcript at the prompt.
738 If the file doesn't exist it will be created (and you should give it a
739 file name ending in @samp{.St}); if the file already exists the
740 transcript will be appended to the file. (Note: if you don't set this
741 variable but you still want to save the transcript, you can still do it
742 later --- @pxref{Saving transcripts}.)
744 Once these questions are answered (if they are asked at all) the S
745 process itself is started by calling the program name specified in the
746 variable @code{inferior-ess-program}.
747 @vindex inferior-ess-program
748 If you need to pass any arguments to this program, they may be specified
749 in the variable @code{inferior-@var{S_program_name}-args} (e.g. if
750 @code{inferior-ess-program} is @code{"S+"} then the variable to set is
751 @code{inferior-S+-args}.
752 @cindex arguments to S program
753 It is not normally necessary to pass arguments to the @Sl{} program; in
754 particular do not pass the @samp{-e} option to @code{Splus}, since ESS
755 provides its own command history mechanism.
757 By default, the new process will be displayed in the same window in the
758 current frame. If you wish your S process to appear in a separate
759 variable, customize the variable @code{inferior-ess-own-frame}.
760 Alternatively, change @code{inferior-ess-same-window} if you wish the
761 process to appear within another window of the current frame.
763 @comment node-name, next, previous, up
764 @node Entering commands, Transcript Mode, Interactive ESS, Top
765 @chapter Interacting with the ESS process
766 @cindex entering commands
768 @cindex sending input
770 The primary function of the ESS package is to provide an easy-to-use
771 front end to the @Sl{} interpreter. This is achieved by running the S
772 process from within an Emacs buffer, so that the Emacs editing commands
773 are available to correct mistakes in commands, etc. The features of
774 Inferior @Sl{} mode are similar to those provided by the standard Emacs
775 shell mode (@pxref{Shell Mode,,, emacs, The Gnu Emacs Reference
776 Manual}). Command-line completion of @Sl{} objects and a number of `hot
777 keys' for commonly-used @Sl{} commands are also provided for ease of
781 * Command-line editing:: Entering commands and fixing mistakes
782 * Completion:: Completion of object names
783 * Completion details:: Advanced completion concepts
784 * Transcript:: Manipulating the transcript
785 * Command History:: Command History
786 * History expansion:: References to historical commands
787 * Hot keys:: Hot keys for common commands
788 * Statistical Process running in ESS?::
789 * Emacsclient:: Using emacsclient
790 * Other:: Other commands provided by inferior-ESS
793 @comment node-name, next, previous, up
794 @node Command-line editing, Completion, Entering commands, Entering commands
795 @section Entering commands and fixing mistakes
796 @cindex command-line editing
798 Sending a command to the ESS process is as simple as typing it in
799 and pressing the @key{RETURN} key:
803 @kbd{RET} (@code{inferior-ess-send-input}) @*
804 @pindex inferior-ess-send-input
805 Send the command on the current line to the ESS process.
808 If you make a typing error before pressing @kbd{RET} all the usual Emacs
809 editing commands are available to correct it (@pxref{Basic, Basic, Basic
810 editing commands, emacs, The GNU Emacs Reference Manual}). Once the
811 command has been corrected you can press @key{RETURN} (even if the
812 cursor is not at the end of the line) to send the corrected command to
815 ESS provides some other commands which are useful for fixing mistakes:
819 @kbd{C-c C-w} (@code{backward-kill-word}) @*
820 @pindex backward-kill-word
821 Deletes the previous word (such as an object name) on the command line.
824 @kbd{C-c C-u} (@code{comint-kill-input}) @*
825 @pindex comint-kill-input
826 Deletes everything from the prompt to point. Use this to abandon a
827 command you have not yet sent to the ESS process.
830 @kbd{C-c C-a} (@code{comint-bol}) @*
832 Move to the beginning of the line, and then skip forwards past the
836 @xref{Shell Mode,,, emacs, The Gnu Emacs Reference Manual}, for other
837 commands relevant to entering input.
839 @comment node-name, next, previous, up
840 @node Completion, Completion details, Command-line editing, Entering commands
841 @section Completion of object names
842 @cindex completion of object names
843 @cindex command-line completion
845 In the process buffer, the @key{TAB} key is for completion, similar to
846 that provided by Shell Mode for filenames. In Inferior @Sl{} mode,
847 pressing the @key{TAB} key when the cursor is following the first few
848 characters of an object name @emph{completes} the object name; if the
849 cursor is following a file name @kbd{TAB} completes the file name.
853 @kbd{TAB} (@code{comint-dynamic-complete}) @*
854 @pindex comint-dynamic-complete
855 Complete the @Sl{} object name or filename before point.
858 When the cursor is just after a partially-completed object name,
859 pressing @key{TAB} provides completion in a similar fashion to
862 except that completion is performed over all known @Sl{} object names
863 instead of file names. ESS maintains a list of all objects known to S
864 at any given time, which basically consists of all objects (functions
865 and datasets) in every attached directory listed by the @code{search()}
868 along with the component objects of attached data frames
870 (if your version of @Sl{} supports them).
872 For example, consider the three functions (available in Splus version
873 3.0) called @code{binomplot()}, @code{binom.test()} and
874 @code{binomial()}. Typing @kbd{bin TAB} after the @Sl{} prompt will
875 insert the characters @samp{om}, completing the longest prefix
876 (@samp{binom}) which distinguishes these three commands. Pressing
877 @kbd{TAB} once more provides a list of the three commands which have
878 this prefix, allowing you to add more characters (say, @samp{.}) which
879 specify the function you desire. After entering more characters
880 pressing @kbd{TAB} yet again will complete the object name up to
881 uniqueness, etc. If you just wish to see what completions exist without
882 adding any extra characters, type @kbd{M-?}.
886 @kbd{M-?} (@code{ess-list-object-completions}) @*
887 @pindex ess-list-object-completions
888 List all possible completions of the object name at point.
891 ESS also provides completion over the components of named lists accessed
892 using the @samp{$} notation, to any level of nested lists. This feature
893 is particularly useful for checking what components of a list object
894 exist while partway through entering a command: simply type the object
895 name and @samp{$} and press @kbd{TAB} to see the names of existing list
896 components for that object.
897 @cindex lists, completion on
898 @cindex completion on lists
900 @cindex completion on file names
901 Completion is also provided over file names, which is particularly
902 useful when using @Sl{} functions such as @code{get()} or @code{scan()}
903 which require fully expanded file names. Whenever the cursor is within
904 an @Sl{} string, pressing @kbd{TAB} completes the file name before
905 point, and also expands any @samp{~} or environment variable references.
907 If the cursor is not in a string and does not follow a (partial) object
908 name, the @key{TAB} key has a third use: it expands history references.
909 @xref{History expansion}.
911 @comment node-name, next, previous, up
912 @node Completion details, Transcript, Completion, Entering commands
913 @section Completion details
915 ESS automatically keeps track of any objects added or deleted to the
916 system (such as new objects created, or directories added to the search
917 list) to make completion as accurate as possible. Whenever ESS notices
918 that search list has changed
919 @vindex ess-change-sp-regexp
920 @footnote{The variable @code{ess-change-sp-regexp} is a regular
921 expression matching commands which change the search list. You will
922 need to modify this variable if you have defined custom commands (other
923 than @code{attach}, @code{detach}, @code{collection} or @code{library})
924 which modify the search list.} when you attach a directory or data
925 frame, the objects associated with it immediately become available for a
926 completion; when it is detached completion is no longer available on
929 To maintain a list of accessible objects for completion, ESS needs to
930 determine which objects are contained in each directory or data frame on
931 the search list. This is done at the start of each @Sl{} session, by
932 running the @code{objects()} command on every element of the search
935 @c On some systems, however, this can be rather slow; it's doubly
936 @c frustrating when you consider that most of the directories on the search
937 @c list are the standard @Sl{} libraries, which never change anyway! When
938 @c ESS was installed, a database of the standard object names should have
939 @c been created which should speed up this process at the start of an S
940 @c session; if it has not been created you will get a warning like
941 @c `S-namedb.el does not exist'. @xref{Installation}, for information on
942 @c how to create this database.
944 Efficiency in completion is gained by maintaining a cache of objects
945 currently known to S; when a new object becomes available or is deleted,
946 only one component of the cache corresponding to the associated
947 directory needs to be refreshed. If ESS ever becomes confused about
948 what objects are available for completion (such as when if refuses to
949 complete an object you @strong{know} is there), the command @kbd{M-x
952 forces the @emph{entire} cache to be refreshed, which should fix the
955 @comment node-name, next, previous, up
956 @node Transcript, Command History, Completion details, Entering commands
957 @section Manipulating the transcript
959 Most of the time, the cursor spends most of its time at the bottom of
960 the ESS process buffer, entering commands. However all the input
961 and output from the current (and previous) ESS sessions is stored in
962 the process buffer (we call this the transcript) and often we want to
964 move back up through the buffer, to look at the output from previous
965 commands for example.
967 Within the process buffer, a paragraph
968 @cindex paragraphs in the process buffer
969 is defined as the prompt, the command after the prompt, and the output
970 from the command. Thus @kbd{M-@{} and @kbd{M-@}} move you backwards and
971 forwards, respectively, through commands in the transcript. A
972 particularly useful command is @kbd{M-h} (@code{mark-paragraph}) which
973 will allow you to mark a command and its entire output (for deletion,
974 perhaps). For more information about paragraph commands,
975 @pxref{Paragraphs, Paragraphs, Paragraphs, emacs, The GNU Emacs
978 If an ESS process finishes and you restart it in the same process
979 buffer, the output from the new ESS process appears after the output
980 from the first ESS process separated by a form-feed (@samp{^L})
981 character. Thus pages in the ESS
982 @cindex pages in the process buffer
983 process buffer correspond to ESS sessions. Thus, for example, you may
984 use @kbd{C-x [} and @kbd{C-x ]} to move backward and forwards through
985 ESS sessions in a single ESS process buffer. For more information about
986 page commands, @pxref{Pages, Pages, Pages, emacs, The GNU Emacs
990 * Last command:: Manipulating the output from the last command
991 * Process buffer motion:: Viewing older commands
992 * Transcript resubmit:: Re-submitting commands from the transcript
993 * Saving transcripts:: Keeping a record of your S session
996 @comment node-name, next, previous, up
997 @node Last command, Process buffer motion, Transcript, Transcript
998 @subsection Manipulating the output from the last command
1000 Viewing the output of the command you have just entered is a common
1001 occurrence and ESS provides a number of facilities for doing this.
1002 @c Within the ESS process buffer, the variable @code{scroll-step}
1003 @c @vindex scroll-step
1004 @c is set to 4 (you can redefine this using @code{inferior-ess-mode-hook}
1005 @c @vindex inferior-ess-hook
1006 @c if you wish - @pxref{Hooks},) so that the cursor is usually near the
1007 @c bottom of the window.
1008 Whenever a command produces a longish output, it is possible that the
1009 window will scroll, leaving the next prompt near the middle of the
1010 window. The first part of the command output may have scrolled off the
1011 top of the window, even though the entire output would fit in the window
1012 if the prompt were near the bottom of the window. If this happens, you
1017 @kbd{C-c C-e} (@code{comint-show-maximum-output}) @*
1018 @pindex comint-show-maximum-output
1019 Move to the end of the buffer, and place cursor on bottom line of
1024 to make more of the last output visible. (To make this happen
1025 automatically for all inputs, set the variable
1026 @code{comint-scroll-to-bottom-on-input} to @code{t}.)
1028 If the first part of the output is still obscured, use
1029 @cindex reading long command outputs
1032 @kbd{C-c C-r} (@code{comint-show-output}) @*
1033 @pindex comint-show-output
1034 Moves cursor to the previous command line and and places it at the top
1039 to view it. Finally, if you want to discard the last command output
1044 @kbd{C-c C-o} (@code{comint-kill-output}) @*
1045 @pindex comint-kill-output
1046 @cindex deleting output
1047 Deletes everything from the last command to the current prompt.
1051 to delete it. Use this command judiciously to keep your transcript to a
1052 more manageable size.
1054 @comment node-name, next, previous, up
1055 @node Process buffer motion, Transcript resubmit, Last command, Transcript
1056 @subsection Viewing older commands
1058 If you want to view the output from more historic commands than the
1059 previous command, commands are also provided to move backwards and
1060 forwards through previously entered commands in the process buffer:
1064 @kbd{C-c C-p} (@code{comint-previous-input}) @*
1065 @pindex comint-previous-input
1066 Moves point to the preceding command in the process buffer.
1069 @kbd{C-c C-n} (@code{comint-next-input}) @*
1070 @pindex comint-next-input
1071 Moves point to the next command in the process buffer.
1075 Note that these two commands are analogous to @kbd{C-p} and @kbd{C-n}
1076 but apply to command lines rather than text lines. And just like
1077 @kbd{C-p} and @kbd{C-n}, passing a prefix argument to these commands
1078 means to move to the @var{ARG}'th next (or previous) command. (These
1079 commands are also discussed in @ref{Shell History Copying,,Shell History
1080 Copying,emacs, The GNU Emacs Reference Manual}.)
1082 There are also two similar commands (not bound to any keys by default)
1083 which move to preceding or succeeding commands, but which first prompt
1084 for a regular expression (@pxref{Regexps,,Syntax of Regular
1085 Expression,emacs, The GNU Emacs Reference Manual}), and then moves to
1086 the next (previous) command matching the pattern.
1090 @code{(comint-backward-matching-input regexp arg)} @*
1091 @pindex comint-backward-matching-input
1092 @code{(comint-forward-matching-input regexp arg)} @*
1093 @pindex comint-forward-matching-input
1094 Search backward (forward) through the transcript buffer for the
1095 @var{arg}'th previous (next) command matching @var{regexp}. @var{arg}
1096 is the prefix argument; @var{regexp} is prompted for in the minibuffer.
1099 @comment node-name, next, previous, up
1100 @node Transcript resubmit, Saving transcripts, Process buffer motion, Transcript
1101 @subsection Re-submitting commands from the transcript
1103 When moving through the transcript, you may wish to re-execute some of
1104 the commands you find there. ESS provides three commands to do this;
1105 these commands may be used whenever the cursor is within a command line
1106 in the transcript (if the cursor is within some command @emph{output},
1107 an error is signalled). Note all three commands involve the @key{RETURN}
1112 @kbd{RET} (@code{inferior-ess-send-input}) @*
1113 @pindex inferior-ess-send-input
1114 Copy the command under the cursor to the current command line, and
1118 @kbd{C-c RET} (@code{comint-copy-old-input}) @*
1119 @pindex comint-copy-old-input
1120 Copy the command under the cursor to the current command line, but don't
1121 execute it. Leaves the cursor on the command line so that the copied
1122 command may be edited.
1125 @kbd{M-RET} (@code{ess-transcript-send-command-and-move}) @*
1126 @pindex ess-transcript-send-command-and-move
1127 Copy the command under the cursor to the current command line, and
1128 execute it. Moves the cursor to the following command.
1131 When the cursor is not after the current prompt, the @key{RETURN} key
1132 has a slightly different behavior than usual. Pressing @kbd{RET} on any
1133 line containing a command that you entered (i.e. a line beginning with a
1134 prompt) sends that command to the ESS process once again. If you
1135 wish to edit the command before executing it, use @kbd{C-c RET} instead;
1136 it copies the command to the current prompt but does not execute it,
1137 allowing you to edit it before submitting it.
1139 These two commands leave the cursor at the new command line, allowing
1140 you to continue with interactive use of S. If you wish to resubmit a
1141 series of commands from the transcript, consider using @kbd{M-RET}
1142 instead, which leaves the cursor at the command line following the one
1143 you re-submitted. Thus by using @kbd{M-RET} repeatedly, you can
1144 re-submit a whole series of commands.
1146 These commands work even if if the current line is a continuation line
1147 (i.e. the prompt is @samp{+} instead of @samp{>}) --- in this case all
1148 the lines that form the multi-line command are concatenated together and
1149 the resulting command is sent to the ESS process (currently this is
1150 the only way to resubmit a multi-line command to the ESS process in
1151 one go). If the current line does
1152 @cindex multi-line commands, resubmitting
1153 not begin with a prompt, an error is signalled. This feature, coupled
1154 with the command-based motion commands described above, could be used as
1155 a primitive history mechanism. ESS provides a more sophisticated
1156 mechanism, however, which is described in @ref{Command History}.
1158 @comment node-name, next, previous, up
1159 @node Saving transcripts, , Transcript resubmit, Transcript
1160 @subsection Keeping a record of your S session
1162 To keep a record of your @Sl{} session in a disk file, use the Emacs
1163 command @kbd{C-x C-w} (@code{write-file}) to attach a file to the
1164 ESS process buffer. The name of the process buffer will (probably)
1165 change to the name of the file, but this is not a problem. You can
1166 still use @Sl{} as usual; just remember to save the file before you quit
1167 Emacs with @kbd{C-x C-s}. You can make ESS prompt you for a filename in
1168 which to save the transcript every time you start @Sl{} by setting the
1170 @vindex ess-ask-about-transfile
1171 @code{ess-ask-about-transfile} to @code{t}; see @ref{Customizing startup}.
1172 @cindex transcript file names
1173 We recommend you save your transcripts with filenames that end in
1174 @samp{.St}. There is a special mode (ESS transcript mode ---
1175 @pxref{Transcript Mode}) for editing transcript files which is
1176 automatically selected for files with this suffix.
1178 @cindex editing transcripts
1179 S transcripts can get very large, so some judicious editing is
1180 appropriate if you are saving it in a file. Use @kbd{C-c C-o} whenever
1181 a command produces excessively long output (printing large arrays, for
1182 example). Delete erroneous commands (and the resulting error messages
1183 or other output) by moving to the command (or its output) and typing
1184 @kbd{M-h C-w}. Also, remember that @kbd{C-c C-e} (and other hot keys)
1185 may be used for commands whose output you do not wish to appear in the
1186 transcript. These suggestions are appropriate even if you are not
1187 saving your transcript to disk, since the larger the transcript, the
1188 more memory your Emacs process will use on the host machine.
1190 Finally, if you intend to produce @Sl{} source code (suitable for using
1191 with @code{source()} or inclusion in an @Sl{} function) from a
1192 transcript, then the command @kbd{M-x ess-transcript-clean-region} may
1194 @pindex ess-transcript-clean-region
1195 This command works in any Emacs buffer, and removes all prompts and
1196 command output from an ESS transcript within the current region, leaving
1197 only the commands. Don't forget to remove any erroneous commands first!
1199 @comment node-name, next, previous, up
1200 @node Command History, History expansion, Transcript, Entering commands
1201 @section Command History
1202 @cindex command history
1203 @cindex editing commands
1204 @cindex re-executing commands
1206 ESS provides easy-to-use facilities for re-executing or editing previous
1207 commands. An input history of the last few commands is maintained (by
1208 default the last 50 commands are stored, although this can be changed by
1209 setting the variable @code{comint-input-ring-size} in
1210 @vindex comint-input-ring-size
1211 @code{inferior-ess-mode-hook}.) The simplest history commands simply
1212 select the next and previous commands in the input history:
1216 @kbd{M-p} (@code{comint-previous-input}) @*
1217 @pindex comint-previous-input
1218 Select the previous command in the input history.
1221 @kbd{M-n} (@code{comint-next-input}) @*
1222 @pindex comint-next-input
1223 Select the next command in the input history.
1227 For example, pressing @kbd{M-p} once will re-enter the last command into
1228 the process buffer after the prompt but does not send it to the ESS
1229 process, thus allowing editing or correction of the command before the
1230 ESS process sees it. Once corrections have been made, press
1231 @kbd{RET} to send the edited command to the ESS process.
1233 If you want to select a particular command from the history by matching
1234 it against a regular expression (@pxref{Regexps,,Syntax of Regular
1235 Expression,emacs, The GNU Emacs Reference Manual}), to search for a
1236 particular variable name for example, these commands are also available:
1240 @kbd{M-r} (@code{comint-previous-matching-input}) @*
1241 @pindex comint-previous-matching-input
1242 Prompt for a regular expression, and search backwards through the input
1243 history for a command matching the expression.
1246 @kbd{M-s} (@code{comint-next-matching-input}) @*
1247 @pindex comint-next-matching-input
1248 Prompt for a regular expression, and search backwards through the input
1249 history for a command matching the expression.
1253 A common type of search is to find the last command that began with a
1254 particular sequence of characters; the following two commands provide an
1255 easy way to do this:
1259 @kbd{A-M-r} (@code{comint-previous-matching-input-from-input}) @*
1260 @pindex comint-previous-matching-input-from-input
1261 Select the previous command in the history which matches the string
1265 @kbd{A-M-s} (@code{comint-next-matching-input-from-input}) @*
1266 @pindex comint-next-matching-input-from-input
1267 Select the next command in the history which matches the string typed so
1272 Instead of prompting for a regular expression to match against, as they
1273 instead select commands starting with those characters already entered.
1274 For instance, if you wanted to re-execute the last @code{attach()}
1275 command, you may only need to type @kbd{att} and then @kbd{A-M-r} and
1276 @kbd{RET}. (Note: you may not have an @key{ALT} key on your keyboard,
1277 in which case it may be a good idea to bind these commands to some other
1280 @xref{Shell Ring,,Shell History Ring,emacs, The GNU Emacs Reference
1281 Manual}, for a more detailed discussion of the history mechanism.
1283 @comment node-name, next, previous, up
1284 @node History expansion, Hot keys, Command History, Entering commands
1285 @section References to historical commands
1287 Instead of searching through the command history using the command
1288 described in the previous section, you can alternatively refer to a
1289 historical command directly using a notation very similar to that used
1290 in @code{csh}. History references are introduced by a @samp{!} or
1291 @samp{^} character and have meanings as follows:
1295 The immediately previous command
1298 The @var{N}th previous command
1301 The last command beginning with the string @samp{text}
1304 The last command containing the string @samp{text}
1307 In addition, you may follow the reference with a @dfn{word designator}
1308 to select particular @dfn{words} of the input. A word is defined as a
1309 sequence of characters separated by whitespace. (You can modify this
1310 definition by setting the value of @code{comint-delimiter-argument-list}
1311 to a list of characters that are allowed to separate words and
1312 @vindex comint-delimiter-argument-list
1313 themselves form words.) Words are numbered beginning with zero. The
1314 word designator usually begins with a @samp{:} (colon) character;
1315 however it may be omitted if the word reference begins with a @samp{^},
1316 @samp{$}, @samp{*} or @samp{-}. If the word is to be selected from the
1317 previous command, the second @samp{!} character can be omitted from the
1318 event specification. For instance, @samp{!!:1} and @samp{!:1} both
1319 refer to the first word of the previous command, while @samp{!!$} and
1320 @samp{!$} both refer to the last word in the previous command. The
1321 format of word designators is as follows:
1325 The zeroth word (i.e. the first one on the command line)
1328 The @var{n}th word, where @var{n} is a number
1331 The first word (i.e. the second one on the command line)
1336 @item @var{x}-@var{y}
1337 A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}
1340 All the words except the zeroth word, or nothing if the command had just
1341 one word (the zeroth)
1344 Abbreviates @var{x}-$
1347 Like @samp{@var{x}*}, but omitting the last word
1350 In addition, you may surround the entire reference except for the first
1351 @samp{!} by braces to allow it to be followed by other (non-whitespace)
1352 characters (which will be appended to the expanded reference).
1354 Finally, ESS also provides quick substitution; a reference like
1355 @samp{^old^new^} means ``the last command, but with the first occurrence
1356 of the string @samp{old} replaced with the string @samp{new}'' (the last
1357 @samp{^} is optional). Similarly, @samp{^old^} means ``the last
1358 command, with the first occurrence of the string @samp{old} deleted''
1359 (again, the last @samp{^} is optional).
1361 To convert a history reference as described above to an input suitable
1362 for S, you need to @dfn{expand} the history reference, using the
1363 @key{TAB} key. For this to work, the cursor must be preceded by a space
1364 (otherwise it would try to complete an object name) and not be within a
1365 string (otherwise it would try to complete a filename). So to expand
1366 the history reference, type @kbd{SPC TAB}. This will convert the
1367 history reference into an @Sl{} command from the history, which you can
1368 then edit or press @key{RET} to execute.
1370 For example, to execute the last command that referenced the variable
1371 @code{data}, type @kbd{!?data SPC TAB RET}.
1373 @comment node-name, next, previous, up
1374 @node Hot keys, Statistical Process running in ESS?, History expansion, Entering commands
1375 @section Hot keys for common commands
1377 ESS provides a number of commands for executing the commonly used
1378 functions. These commands below are basically information-gaining
1379 commands (such as @code{objects()} or @code{search()}) which tend to
1380 clutter up your transcript and for this reason some of the hot keys
1381 display their output in a temporary buffer instead of the process buffer
1382 by default. This behavior is controlled by the variable
1383 @code{ess-execute-in-process-buffer} which, if
1384 @vindex ess-execute-in-process-buffer
1385 non-@code{nil}, means that these commands will produce their output in
1386 the process buffer instead. In any case, passing a prefix argument to
1387 the commands (with @kbd{C-u}) will reverse the meaning of
1388 @code{ess-execute-in-process-buffer} for that command, i.e. the output
1389 will be displayed in the process buffer if it usually goes to a
1390 temporary buffer, and vice-versa. These are the hot keys that behave in
1395 @kbd{C-c C-x} (@code{ess-execute-objects}) @*
1396 @pindex ess-execute-objects
1397 Sends the @code{objects()}
1399 command to the ESS process. A prefix argument specifies the
1400 position on the search list (use a negative argument to toggle
1401 @code{ess-execute-in-process-buffer} as well). A quick way to see what
1402 objects are in your working directory.
1407 @kbd{C-c C-s} (@code{ess-execute-search}) @*
1408 @pindex ess-execute-search
1409 Sends the @code{search()}
1411 command to the ESS process.
1416 @kbd{C-c C-e} (@code{ess-execute}) @*
1418 Prompt for an ESS expression, and evaluate it.
1421 @code{ess-execute} may seem pointless when you could just type the
1422 command in anyway, but it proves useful for `spot' calculations which
1423 would otherwise clutter your transcript, or for evaluating an expression
1424 while partway through entering a command. You can also use this command
1425 to generate new hot keys using the Emacs keyboard macro facilities;
1426 @pxref{Keyboard Macros, Keyboard Macros, Keyboard Macros, emacs, The GNU
1427 Emacs Reference Manual}.
1429 @cindex keyboard short cuts
1431 The following hot keys do not use @code{ess-execute-in-process-buffer}
1432 to decide where to display the output --- they either always display in
1433 the process buffer or in a separate buffer, as indicated:
1437 @kbd{C-c C-a} (@code{ess-execute-attach}) @*
1438 @pindex ess-execute-attach
1439 Prompts for a directory to attach to the ESS process with the
1440 @code{attach()} command.
1442 If a numeric prefix argument is given it is used as the position on the
1443 search list to attach the directory; otherwise the @Sl{} default of 2 is
1444 used. The @code{attach()} command actually executed appears in the
1448 @kbd{C-c C-l} (@code{ess-load-file}) @*
1449 @pindex ess-load-file
1450 Prompts for a file to load into the ESS process using
1451 @code{source()}. If there is an error during loading, you can jump to
1452 the error in the file with @kbd{C-x `} (@code{ess-parse-errors}).
1453 @pindex ess-parse-errors
1454 @xref{Error Checking}, for more details.
1457 @kbd{C-c C-v} (@code{ess-display-help-on-object}) @* Pops up a help
1458 buffer for an @Sl{} object or function. See @ref{Help} for more
1462 @kbd{C-c C-q} (@code{ess-quit}) @*
1463 @cindex quitting from ESS
1464 @cindex killing the ESS process
1465 Sends the @code{q()}
1467 command to the ESS process (or @code{(exit)}
1469 to the @b{XLS} process), and cleans up any temporary buffers (such as
1470 help buffers or edit buffers) you may have created along the way. Use
1471 this command when you have finished your @Sl{} session instead of simply
1472 typing @code{q()} yourself, otherwise you will need to issue the command
1473 @kbd{M-x ess-cleanup}
1476 @cindex temporary buffers, killing
1477 @cindex killing temporary buffers
1478 command explicitly to make sure that all the files that need to be saved
1479 have been saved, and that all the temporary buffers have been killed.
1482 @comment node-name, next, previous, up
1483 @node Statistical Process running in ESS?, Emacsclient, Hot keys, Entering commands
1484 @section Is the Statistical Process running under ESS?
1488 For the S languages (S, S-Plus, R) ESS sets an option in the current
1489 process that programs in the language can check to determine the
1490 environment in which they are currently running.
1493 @code{options(STERM="iESS")} for S language processes running in an
1494 inferior @code{@iESS{[S]}} or @code{@iESS{[R]}} buffer.
1497 @code{options(STERM="ddeESS")} for independent S-Plus for Windows
1498 processes running in the GUI and communicating with ESS via
1499 the DDE (Microsoft Dynamic Data Exchange) protocol through a
1500 @code{ddeESS[S]} buffer.
1502 Other values of @code{options()$STERM} that we recommend are:
1505 @item @code{length}: Fixed length xterm or telnet window.
1506 @item @code{scrollable}: Unlimited length xterm or telnet window.
1507 @item @code{server}: S-Plus Stat Server.
1508 @item @code{BATCH}: BATCH.
1509 @item @code{Rgui}: R GUI.
1510 @item @code{Commands}: S-Plus GUI without DDE interface to ESS.
1513 Additional values may be recommended in the future as new interaction
1514 protocols are created. Unlike the values @code{iESS} and @code{ddeESS},
1515 ESS can't set these other values since the S language program is not
1516 under the control of ESS.
1518 @comment node-name, next, previous, up
1519 @node Emacsclient, Other, Statistical Process running in ESS?, Entering commands
1520 @section Using emacsclient
1524 When starting R or S under Unix, ESS sets
1525 @code{options(editor="emacsclient")}. (Under Microsoft Windows, it will
1526 use gnuclient.exe rather than emacsclient, but the same principle
1527 applies.) Within your R session, for example, if you have a function
1528 called @code{iterator}, typing @code{fix(iterator)}, will show that
1529 function in a temporary Emacs buffer. You can then correct the
1530 function. When you kill the buffer, the definition of the function is
1531 updated. Using @code{edit()} rather than @code{fix()} means that the
1532 function is not updated. Finally, the S function @code{page(x)} will
1533 also show a text representation of the object @code{x} in a temporary
1537 @comment node-name, next, previous, up
1538 @node Other, , Emacsclient, Entering commands
1539 @section Other commands provided by inferior-ESS
1541 The following commands are also provided in the process buffer:
1545 @kbd{C-c C-c} (@code{comint-interrupt-subjob}) @*
1546 @pindex comint-interrupt-subjob
1547 Sends a Control-C signal to the ESS process. This has the effect of
1548 @cindex aborting S commands
1549 @cindex interrupting S commands
1550 aborting the current command.
1553 @kbd{C-c C-z} (@code{ess-abort}) @*
1555 @pindex comint-stop-subjob
1556 Sends a STOP signal to the ESS process, killing it immediately.
1557 It's not a good idea to use this, in general: Neither @code{q()} nor
1558 @code{.Last} will be executed and device drivers will not finish
1559 cleanly. This command is provided as a safety to
1560 @code{comint-stop-subjob}, which is usually bound to @kbd{C-c C-z}. If
1561 you want to quit from S, use @kbd{C-c C-q} (@code{ess-quit}) instead.
1563 @cindex aborting the ESS process
1566 @kbd{C-c C-d} (@code{ess-dump-object-into-edit-buffer}) @*
1567 @pindex ess-dump-object-into-edit-buffer
1568 Prompts for an object to be edited in an edit buffer. @xref{Editing}.
1571 Other commands available in Inferior @Sl{} mode are discussed in
1572 @ref{Shell Mode,,, emacs, The Gnu Emacs Reference Manual}.
1574 @comment node-name, next, previous, up
1575 @node Transcript Mode, ESS for the S family, Entering commands, Top
1576 @chapter Manipulating saved transcript files
1578 Inferior @Sl{} mode records the transcript (the list of all commands
1579 executed, and their output) in the process buffer, which can be saved as
1580 a @dfn{transcript file}, which should normally have the suffix
1581 @file{.St}. The most obvious use for a transcript file is as a static
1582 record of the actions you have performed in a particular @Sl{} session.
1583 Sometimes, however, you may wish to re-execute commands recorded in the
1584 transcript file by submitting them to a running ESS process. This
1585 is what Transcript Mode is for.
1587 If you load file a with the suffix @file{.St} into Emacs, it is placed
1588 in S Transcript Mode. Transcript Mode is similar to Inferior @Sl{} mode
1589 (@pxref{Entering commands}):
1590 @cindex transcript mode motion
1591 @cindex motion in transcript mode
1592 paragraphs are defined as a command and its output, and you can move
1593 though commands either with the paragraph commands or with @kbd{C-c C-p}
1597 * Resubmit:: Resubmitting commands from the transcript file
1598 * Clean:: Cleaning transcript files
1601 @comment node-name, next, previous, up
1602 @node Resubmit, Clean, Transcript Mode, Transcript Mode
1603 @section Resubmitting commands from the transcript file
1605 Three commands are provided to re-submit command lines from the
1606 transcript file to a running ESS process. They are:
1610 @kbd{RET} (@code{ess-transcript-send-command}) @*
1611 Send the current command line to the ESS process, and execute it.
1612 @pindex ess-transcript-send-command
1615 @kbd{C-c RET} (@code{ess-transcript-copy-command}) @*
1616 Copy the current command to the ESS process, and switch to the
1617 ESS process buffer (ready to edit the copied command).
1618 @pindex ess-transcript-copy-command
1621 @kbd{M-RET} (@code{ess-transcript-send-command-and-move}) @*
1622 Send the current command to the ESS process, and move to the next
1623 command line. This command is useful for submitting a series of
1628 Note that these commands are similar to those on the same keys in
1629 Inferior @Sl{} Mode. In all three cases, the commands should be
1630 executed when the cursor is on a command line in the transcript; the
1631 prompt is automatically removed before the command is submitted.
1633 @comment node-name, next, previous, up
1634 @node Clean, , Resubmit, Transcript Mode
1635 @section Cleaning transcript files
1637 Yet another use for transcript files is to extract the command lines for
1638 inclusion in an @Sl{} source file or function. Transcript mode provides
1639 one command which does just this:
1643 @kbd{C-c C-w} (@code{ess-transcript-clean-region}) @*
1644 Deletes all prompts and command output in the region, leaving only the
1645 commands themselves.
1649 The remaining command lines may then be copied to a source file or edit
1650 buffer for inclusion in a function definition, or may be evaluated
1651 directly (@pxref{Evaluating code}) using the code evaluation commands
1652 from @Sl{} mode, also available in @Sl{} Transcript Mode.
1655 @comment node-name, next, previous, up
1656 @node ESS for the S family, Editing, Transcript Mode, Top
1657 @chapter ESS for the S family
1659 * ESS(S)--Editing files::
1660 * iESS(S)--Inferior ESS processes::
1661 * ESS-help--assistance with viewing help::
1662 * Philosophies for using ESS(S)::
1663 * Scenarios for use (possibilities--based on actual usage)::
1664 * Customization Examples and Solutions to Problems::
1666 @include help-s.texi
1668 @comment node-name, next, previous, up
1669 @node Editing, Editing R documentation files, ESS for the S family, Top
1670 @chapter Editing S functions
1672 @cindex editing functions
1673 ESS provides facilities for editing @Sl{} objects within your Emacs
1674 session. Most editing is performed on @Sl{} functions, although in
1675 theory you may edit datasets as well. Edit buffers are always
1676 associated with files, although you may choose to make these files
1677 temporary if you wish. Alternatively, you may make use of a simple yet
1678 powerful mechanism for maintaining backups of text representations of
1679 @Sl{} functions. Error-checking is performed when @Sl{} code is loaded
1680 into the ESS process.
1683 * Edit buffer:: Edit objects in a specialized buffer
1684 * Loading:: Loading source files into the ESS process
1685 * Error Checking:: Detecting errors in source files
1686 * Evaluating code:: Sending code to the ESS process
1687 * Indenting:: Indenting and formatting S code
1688 * Other edit buffer commands:: Commands for motion, completion and more
1689 * Source Files:: Maintaining @Sl{} source files
1690 * Source Directories:: Names and locations of dump files
1693 @comment node-name, next, previous, up
1694 @node Edit buffer, Loading, Editing, Editing
1695 @section Creating or modifying S objects
1698 To edit an @Sl{} object, type
1702 @kbd{C-c C-d} (@code{ess-dump-object-into-edit-buffer}) @*
1703 @pindex ess-dump-object-into-edit-buffer
1704 Edit an @Sl{} object in its own edit buffer.
1707 from within the ESS process buffer (@code{*S*}). You will then be
1708 prompted for an object to edit: you may either type in the name of an
1709 existing object (for which completion is available using the @kbd{TAB}
1711 @cindex completion, when prompted for object names
1712 or you may enter the name of a new object.
1713 @cindex creating new objects
1714 @cindex new objects, creating
1715 A buffer will be created containing the text representation of the
1716 requested object or, if you entered the name of a non-existent object at
1717 the prompt and the variable @code{ess-function-template}
1718 @vindex ess-function-template
1719 is non-@code{nil}, you will be presented with a template defined by that
1720 variable, which defaults to a skeleton function construct.
1722 You may then edit the function as required. The edit buffer generated
1723 by @code{ess-dump-object-into-edit-buffer} is placed in the @code{ESS}
1724 major mode which provides a number of commands to facilitate editing
1725 @Sl{} source code. Commands are provided to intelligently indent @Sl{}
1726 code, evaluate portions of @Sl{} code and to move around @Sl{} code
1730 @cindex reverting function definitions
1731 Note: when you dump a file with @kbd{C-c C-d}, ESS first checks
1732 to see whether there already exists an edit buffer containing that
1733 object and, if so, pops you directly to that buffer. If not, ESS next
1734 checks whether there is a file in the appropriate place with the
1735 appropriate name (@pxref{Source Files}) and if so, reads in that file.
1736 You can use this facility to return to an object you were editing in a
1737 previous session (and which possibly was never loaded to the @Sl{}
1738 session). Finally, if both these tests fail, the ESS process is
1739 consulted and a @code{dump()} command issued.
1741 If you want to force ESS to ask the ESS process for the object's
1742 definition (say, to reformat an unmodified buffer or to revert back to
1743 S's idea of the object's definition) pass a prefix argument to
1744 @code{ess-dump-object-into-edit-buffer} by typing @kbd{C-u C-c C-d}.
1746 @comment node-name, next, previous, up
1747 @node Loading, Error Checking, Edit buffer, Editing
1748 @section Loading source files into the ESS process
1750 The best way to get information --- particularly function definitions
1751 --- into @Sl{} is to load them in as source file, using S's
1752 @code{source} function. You have already seen how to create source
1753 files using @kbd{C-c C-d}; ESS provides a complementary command for
1754 loading source files (even files not created with ESS!) into the ESS
1759 @kbd{C-c C-l} (@code{ess-load-file}) @*
1760 @pindex ess-load-file
1761 Loads a file into the ESS process using @code{source()}.
1766 After typing @kbd{C-c C-l} you will prompted for the name of the file to
1767 load into S; usually this is the current buffer's file which is the
1768 default value (selected by simply pressing @kbd{RET} at the prompt).
1769 You will be asked to save the buffer first if it has been modified (this
1770 happens automatically if the buffer was generated with @kbd{C-c C-d}).
1771 The file will then be loaded, and if it loads successfully you will be
1772 returned to the ESS process.
1774 @comment node-name, next, previous, up
1775 @node Error Checking, Evaluating code, Loading, Editing
1776 @section Detecting errors in source files
1778 @cindex parsing errors
1779 If any errors occur when loading a file with @code{C-c C-l}, ESS will
1780 inform you of this fact. In this case, you can jump directly to the
1781 line in the source file which caused the error by typing @kbd{C-c `}
1782 (@code{ess-parse-errors}).
1783 @pindex ess-parse-errors
1784 You will be returned to the offending file (loading it into a buffer if
1785 necessary) with point at the line @Sl{} reported as containing the
1786 error. You may then correct the error, and reload the file. Note that
1787 none of the commands in an @Sl{} source file will take effect if any
1788 part of the file contains errors.
1790 Sometimes the error is not caused by a syntax error (loading a
1791 non-existent file for example). In this case typing @kbd{C-c `} will
1792 simply display a buffer containing S's error message. You can force
1793 this behavior (and avoid jumping to the file when there @emph{is} a
1794 syntax error) by passing a prefix argument to @code{ess-parse-errors}
1795 with @kbd{C-u C-c `}.
1797 @comment node-name, next, previous, up
1798 @node Evaluating code, Indenting, Error Checking, Editing
1799 @section Sending code to the ESS process
1801 Other commands are also available for evaluating portions of code in the
1802 S process. These commands cause the selected code to be evaluated
1803 directly by the ESS process as if you had typed them in at the
1804 command line; the @code{source()} function is not used. You may choose
1805 whether both the commands and their output appear in the process buffer
1806 (as if you had typed in the commands yourself) or if the output alone is
1807 echoed. The behavior is controlled by the variable
1808 @code{ess-eval-visibly-p} whose default is @code{nil}
1809 @vindex ess-eval-visibly-p
1810 (display output only). Passing a prefix argument (@kbd{C-u}) to any of
1811 the following commands, however, reverses the meaning of
1812 @code{ess-eval-visibly-p} for that command only --- for example @kbd{C-u
1813 C-c C-j} echoes the current line of S (or other) code in the ESS
1814 process buffer, followed by its output. This method of evaluation is an
1815 alternative to S's @code{source()} function
1817 @cindex echoing commands when evaluating
1818 @cindex evaluating code with echoed commands
1819 when you want the input as well as the output to be displayed. (You can
1820 sort of do this with @code{source()} when the option @code{echo=T} is
1821 set, except that prompts do not get displayed. ESS puts prompts in the
1822 right places.) The commands for evaluating code are:
1825 @cindex evaluating S expressions
1827 @kbd{C-c C-j} (@code{ess-eval-line}) @*
1828 @pindex ess-eval-line
1829 Send the line containing point to the ESS process.
1832 @kbd{C-c M-j} (@code{ess-eval-line-and-go}) @*
1833 @pindex ess-eval-line-and-go
1834 As above, but returns you to the ESS process buffer as well.
1837 @kbd{C-c C-f} or @kbd{ESC C-x} (aka @kbd{M-C-x}) (@code{ess-eval-function}) @*
1838 @pindex ess-eval-function
1839 Send the @Sl{} function containing point to the ESS process.
1842 @kbd{C-c M-f} (@code{ess-eval-function-and-go}) @*
1843 @pindex ess-eval-function-and-go
1844 As above, but returns you to the ESS process buffer as well.
1847 @kbd{C-c C-r} (@code{ess-eval-region}) @*
1848 @pindex ess-eval-region
1849 Send the text between point and mark to the ESS process.
1852 @kbd{C-c M-r} (@code{ess-eval-region-and-go}) @*
1853 @pindex ess-eval-region-and-go
1854 As above, but returns you to the ESS process buffer as well.
1857 @kbd{C-c C-b} (@code{ess-eval-buffer}) @*
1858 @pindex ess-eval-buffer
1859 Send the contents of the edit buffer to the ESS process.
1862 @kbd{C-c M-b} (@code{ess-eval-buffer-and-go}) @*
1863 @pindex ess-eval-function-and-go
1864 As above, but returns you to the ESS process buffer as well.
1867 @kbd{C-c C-n} (@code{ess-eval-line-and-step}) @*
1868 @pindex ess-eval-line-and-step
1869 @cindex stepping through code
1870 @cindex debugging S functions
1871 Sends the current line to the ESS process, echoing it in the process
1872 buffer, and moves point to the next line. Useful when debugging for
1873 stepping through your code.
1876 It should be stressed once again that these @code{ess-eval-} commands
1877 should only be used for evaluating small portions of code for debugging
1878 purposes, or for generating transcripts from source files. When editing
1879 S functions, @kbd{C-c C-l} is the command to use to update the
1880 function's value. In particular, @code{ess-eval-buffer} is now largely
1883 One final command is provided for spot-evaluations of @Sl{} code:
1886 @kbd{C-c C-t} (@code{ess-execute-in-tb}) @*
1887 @pindex ess-execute-in-tb
1888 Prompt for an @Sl{} expression and evaluate it. Displays result in a
1893 This is useful for quick calculations, etc.
1895 All the above commands are useful for evaluating small amounts of code
1896 and observing the results in the process buffer. A useful way to work
1897 is to divide the frame into two windows; one containing the source code
1898 and the other containing the process buffer. If you wish to make the
1899 process buffer scroll automatically when the output reaches the bottom
1900 of the window, you will need to set the variable
1901 @code{comint-scroll-to-bottom-on-output} to @code{'others} or @code{t}.
1904 @comment node-name, next, previous, up
1905 @node Indenting, Other edit buffer commands, Evaluating code, Editing
1906 @section Indenting and formatting S code
1908 ESS now provides a sophisticated mechanism for indenting @Sl{} source
1909 code (thanks to Ken'ichi Shibayama). Compound statements (delimited by
1910 @samp{@{} and @samp{@}}) are indented relative to their enclosing block.
1911 In addition, the braces have been electrified to automatically indent to
1912 the correct position when inserted, and optionally insert a newline at
1913 the appropriate place as well. Lines which continue an incomplete
1914 expression are indented relative to the first line of the expression.
1915 Function definitions, @code{if} statements, calls to @code{expression()}
1916 and loop constructs are all recognized and indented appropriately. User
1917 variables are provided to control the amount if indentation in each
1918 case, and there are also a number of predefined indentation styles to
1921 @cindex comments in S
1922 Comments are also handled specially by ESS, using an idea borrowed from
1923 the Emacs-Lisp indentation style. By default,
1924 comments beginning with @samp{###}
1925 are aligned to the beginning of the line. Comments beginning with
1926 @samp{##} are aligned to the current level of indentation for the block
1927 containing the comment. Finally, comments beginning with @samp{#} are
1928 aligned to a column on the right (the 40th column by default, but this
1929 value is controlled by the variable @code{comment-column},)
1930 @vindex comment-column
1931 or just after the expression on the line containing the comment if it
1932 extends beyond the indentation column. You turn off the default
1933 behavior by adding the line
1934 @code{(setq ess-fancy-comments nil)} to your @file{.emacs} file.
1935 @vindex ess-fancy-comments
1937 The indentation commands provided by ESS are:
1939 @cindex formatting source code
1943 @kbd{TAB} (@code{ess-indent-command}) @*
1944 Indents the current line as @Sl{} code. If a prefix argument is given,
1945 all following lines which are part of the same (compound) expression are
1946 indented by the same amount (but relative indents are preserved).
1949 @kbd{RET} (@code{newline-and-indent}) @*
1950 @kbd{LFD} (@emph{newline-and-indent}) @*
1951 Insert a newline, and indent the next line. (Note that most keyboards
1952 nowadays do not have a @key{LINEFEED} key, but @kbd{C-j} is equivalent.)
1955 @kbd{ESC C-q} aka @kbd{M-C-q} aka @kbd{C-M-q} (@code{ess-indent-exp}) @*
1956 Indents each line in the @Sl{} (compound) expression which follows point.
1957 Very useful for beautifying your @Sl{} code.
1960 @kbd{@{} and @kbd{@}} (@code{ess-electric-brace}) @*
1961 The braces automatically indent to the correct position when typed.
1964 @kbd{M-;} (@code{indent-for-comment}) @*
1965 Indents an existing comment line appropriately, or inserts an
1966 appropriate comment marker.
1969 @kbd{M-x ess-set-style} @*
1970 Set the formatting style in this buffer to be one of the predefined
1971 styles: @code{GNU}, @code{BSD}, @code{K&R}, @code{CLB}, and @code{C++}.
1972 The @code{DEFAULT} style uses the default values for the indenting
1973 variables (unless they have been modified in your @file{.emacs} file.)
1974 @cindex @file{.emacs} file
1975 This command causes all of the formatting variables to be buffer-local.
1978 @comment node-name, next, previous, up
1979 @node Other edit buffer commands, Source Files, Indenting, Editing
1980 @section Commands for motion, completion and more
1982 A number of commands are provided to move across function definitions
1986 @kbd{ESC C-a} aka @kbd{C-M-a} (@code{ess-beginning-of-function}) @*
1987 @pindex ess-beginning-of-function
1988 Moves point to the beginning of the function containing point.
1991 @kbd{ESC C-e} aka @kbd{C-M-e} (@code{ess-end-of-function}) @*
1992 @pindex ess-end-of-function
1993 Moves point to the end of the function containing point.
1996 @kbd{ESC C-h} aka @kbd{C-M-h} (@code{ess-mark-function}) @*
1997 Places point at the beginning of the @Sl{} function containing point, and
2001 Don't forget the usual Emacs commands for moving over balanced
2002 expressions and parentheses: @xref{Lists, Lists and Sexps, Lists and
2003 Sexps, Emacs, The GNU Emacs Reference Manual}.
2005 @cindex completion in edit buffer
2006 Completion is provided in the edit buffer in a similar fashion to the
2007 process buffer: @kbd{M-TAB} completes file names and @kbd{M-?} lists
2008 file completions. Since @key{TAB} is used for indentation in the edit
2009 buffer, object completion is now performed with @kbd{C-c TAB}. Note
2010 however that completion is only provided over globally known S objects
2011 (such as system functions) --- it will @emph{not} work for arguments to
2012 functions or other variables local to the function you are editing.
2014 Finally, two commands are provided for returning to the ESS process buffer:
2018 @kbd{C-c C-z} (@code{ess-switch-to-end-of-ESS}) @*
2019 @pindex ess-switch-to-end-of-ESS
2020 Returns you to the ESS process buffer, placing point at the end of the
2024 @kbd{C-c C-y} (@code{ess-switch-to-ESS}) @*
2025 @pindex ess-switch-to-ESS
2026 Also returns to to the ESS process buffer, but leaves point where it was.
2029 In addition some commands available in the process buffer are also
2030 available in the edit buffer. You can still read help files with
2031 @kbd{C-c C-v}, edit another function with @kbd{C-c C-d} and of course
2032 @kbd{C-c C-l} can be used to load a source file into S. @xref{Other},
2033 for more details on these commands.
2035 @comment node-name, next, previous, up
2036 @node Source Files, Source Directories, Other edit buffer commands, Editing
2037 @section Maintaining S source files
2039 Every edit buffer in ESS is associated with a @dfn{dump file} on disk.
2040 Dump files are created whenever you type @kbd{C-c C-d}
2041 (@code{ess-dump-object-into-edit-buffer}), and may either be deleted
2042 after use, or kept as a backup file or as a means of keeping several
2043 versions of an @Sl{} function.
2046 @defvr {User Option} ess-delete-dump-files
2047 If non-@code{nil}, dump files created with C-c C-d are deleted
2048 immediately after they are created by the ess-process.
2051 Since immediately after @Sl{} dumps an object's definition to a disk
2052 file the source code on disk corresponds exactly to S's idea of the
2053 object's definition, the disk file isn't needed; deleting it now has the
2054 advantage that if you @emph{don't} modify the file (say, because you
2055 just wanted to look at the definition of one of the standard S
2056 functions) the source dump file won't be left around when you kill the
2057 buffer. Note that this variable only applies to files generated with
2058 S's @code{dump} function; it doesn't apply to source files which already
2059 exist. The default value is @code{t}.
2061 @defvr {User Option} ess-keep-dump-files
2062 Option controlling what to do with the dump file after an object has
2063 been successfully loaded into S. Valid values are @code{nil} (always
2064 delete), @code{ask} (always ask whether to delete), @code{check} (delete
2065 files generated with @kbd{C-c C-d} in this Emacs session, otherwise ask
2066 --- this is the default) and @code{t} (never delete). This variable is
2070 After an object has been successfully (i.e. without error) loaded
2071 back into @Sl{} with @kbd{C-c C-l}, the disk file again corresponds
2072 exactly (well, almost --- see below) to S's record of the object's
2073 definition, and so some people prefer to delete the disk file rather
2074 than unnecessarily use up space. This option allows you to do just
2078 @cindex project work in S
2079 @cindex historic backups
2080 If the value of @code{ess-keep-dump-files} is @code{t}, dump files are
2081 never deleted after they are loaded. Thus you can maintain a complete
2082 text record of the functions you have edited within ESS. Backup files
2083 are kept as usual, and so by using the Emacs numbered backup facility ---
2084 @pxref{Backup Names, Single or Numbered Backups, Single or Numbered
2085 Backups, emacs, The Gnu Emacs Reference Manual}, you can keep a historic
2086 record of function definitions. Another possibility is to maintain the
2087 files with a version-control system such as RCS @xref{Version Control,
2088 Version Control, Version Control, emacs, The Gnu Emacs Reference
2089 Manual}. As long as a dump file exists in the appropriate place for a
2090 particular object, editing that object with @kbd{C-c C-d} finds that
2091 file for editing (unless a prefix argument is given) --- the ESS
2092 process is not consulted. Thus you can keep comments @emph{outside} the
2093 function definition as a means of documentation that does not clutter
2094 the @Sl{} object itself. Another useful feature is that you may format
2095 the code in any fashion you please without @Sl{} re-indenting the code
2096 every time you edit it. These features are particularly useful for
2099 If the value of @code{ess-keep-dump-files} is nil, the dump file is always
2100 silently deleted after a successful load with @kbd{C-c C-l}. While this
2101 is useful for files that were created with @kbd{C-c C-d} it also applies
2102 to any other file you load (say, a source file of function
2103 definitions), and so can be dangerous to use unless you are careful.
2104 Note that since @code{ess-keep-dump-files} is buffer-local, you can make
2105 sure particular files are not deleted by setting it to @code{t} in the
2106 Local Variables section of the file @xref{File Variables, Local
2107 Variables in Files, Local Variables in Files, emacs, The Gnu Emacs
2110 A safer option is to set @code{ess-keep-dump-files} to @code{ask}; this
2111 means that ESS will always ask for confirmation before deleting the
2112 file. Since this can get annoying if you always want to delete dump
2113 files created with @code{C-c C-d}, but not any other files, setting
2114 @code{ess-keep-dump-files} to @code{check} (the default value) will
2115 silently delete dump files created with @kbd{C-c C-d} in the current
2116 Emacs session, but query for any other file. Note that in any case you
2117 will only be asked for confirmation once per file, and your answer is
2118 remembered for the rest of the Emacs session.
2120 Note that in all cases, if an error (such as a syntax error) is detected
2121 while loading the file with @kbd{C-c C-l}, the dump file is @emph{never}
2122 deleted. This is so that you can edit the file in a new Emacs session
2123 if you happen to quit Emacs before correcting the error.
2126 Dump buffers are always autosaved, regardless of the value of
2127 @code{ess-keep-dump-files}.
2129 @comment node-name, next, previous, up
2130 @node Source Directories, , Source Files, Editing
2131 @section Names and locations of dump files
2133 @cindex dump file names
2134 Every dump file should be given a unique file name, usually the dumped
2135 object name with some additions.
2137 @defvr {User Option} ess-dump-filename-template
2138 Template for filenames of dumped objects. @code{%s} is replaced by the
2143 By default, dump file names are the user name, followed by @samp{.} and
2144 the object and ending with @samp{.S}. Thus if user @code{joe} dumps the
2145 object @code{myfun} the dump file will have name @file{joe.myfun.S}.
2146 The username part is included to avoid clashes when dumping into a
2147 publicly-writable directory, such as @file{/tmp}; you may wish to remove
2148 this part if you are dumping into a directory owned by you.
2150 @cindex dump file directories
2151 You may also specify the directory in which dump files are written:
2153 @defvr {User Option} ess-source-directory
2154 Directory name (ending in a slash) where @Sl{} dump files are to be written.
2157 By default, dump files are always written to @file{/tmp}, which is fine
2158 when @code{ess-keep-dump-files} is @code{nil}. If you are keeping dump
2159 files, then you will probably want to keep them somewhere in your home
2160 directory, say @file{~/S-source}. This could be achieved by including
2161 the following line in your @file{.emacs} file:
2162 @cindex @file{.emacs} file
2164 (setq ess-source-directory (expand-file-name "~/S-source/"))
2167 If you would prefer to keep your dump files in separate directories
2168 depending on the value of some variable, ESS provides a facility for
2169 this also. By setting @code{ess-source-directory} to a lambda
2170 expression which evaluates to a directory name, you have a great deal of
2171 flexibility in selecting the directory for a particular source file to
2172 appear in. The lambda expression is evaluated with the process buffer
2173 as the current buffer and so you can use the variables local to that
2174 buffer to make your choice. For example, the following expression
2175 causes source files to be saved in the subdirectory @file{Src} of the
2176 directory the ESS process was run in.
2179 (setq ess-source-directory
2181 (concat ess-directory "Src/")))
2185 @vindex ess-directory
2186 (@code{ess-directory} is a buffer-local variable in process buffers
2187 which records the directory the ESS process was run from.) This is
2188 useful if you keep your dump files and you often edit objects with the
2189 same name in different ESS processes. Alternatively, if you often
2190 change your @Sl{} working directory during an @Sl{} session, you may
2191 like to keep dump files in some subdirectory of the directory pointed to
2192 by the first element of the current search list. This way you can edit
2193 objects of the same name in different directories during the one S
2196 @cindex working directory
2198 (setq ess-source-directory
2200 (file-name-as-directory
2201 (expand-file-name (concat
2202 (car ess-search-list)
2205 @vindex ess-search-list
2207 If the directory generated by the lambda function does not exist but can
2208 be created, you will be asked whether you wish to create the directory.
2209 If you choose not to, or the directory cannot be created, you will not
2210 be able to edit functions.
2212 @node Editing R documentation files, Help, Editing, Top
2213 @chapter Editing R documentation files
2215 ESS also provides support for editing @dfn{R documentation} (``Rd'')
2216 files. @R{} objects are documented in files written in Rd format, a
2217 simple markup language closely resembling (La)@TeX{}, which can be
2218 processed into a variety of formats, including La@TeX{}, @acronym{HTML},
2219 and plain text. Rd format is described in section ``Rd format'' of the
2220 ``Writing R Extensions'' manual in the R distribution.
2222 Visiting an Rd file as characterized by its extension @file{Rd} will
2223 activate Rd Mode, which provides several facilities for making editing R
2224 documentation files more convenient, by helping with indentation,
2225 insertions, even doing some of the typing for you (with Abbrev Mode),
2226 and by showing Rd keywords, strings, etc.@: in different faces (with
2229 Note that R also accepts Rd files with extension @file{rd}; to activate
2230 @ESS{[Rd]} support for this extension, you may need to add
2233 (add-to-list 'auto-mode-alist '("\\.rd\\'" . Rd-mode))
2237 to one of your Emacs startup files.
2239 In Rd mode, the following special Emacs commands can be used in addition
2240 to the standard Emacs commands.
2244 Describe the features of Rd mode.
2248 Reindent the current line, insert a newline and indent the new line
2249 (@code{reindent-then-newline-and-indent}). An abbrev before point is
2250 expanded if @code{abbrev-mode} is non-@code{nil}.
2253 Indent current line based on its contents and on previous lines
2254 (@code{indent-according-to-mode}).
2257 Insert a ``skeleton'' with Rd markup for at least all mandatory entries
2258 in Rd files (@code{Rd-mode-insert-skeleton}). Note that many users
2259 might prefer to use the R function @code{prompt} on an existing R object
2260 to generate a non-empty Rd ``shell'' documenting the object (which
2261 already has all information filled in which can be obtained from the
2265 Insert ``font'' specifiers for some of the Rd markup commands markup
2266 available for emphasizing or quoting text, including markup for URLs and
2267 email addresses (@code{Rd-font}). @kbd{C-c C-f} is only a prefix; see
2268 e.g.@: @kbd{C-c C-f TAB} for the available bindings. Note that
2269 currently, not all of the Rd text markup as described in section
2270 ``Marking text'' of ``Writing R Extensions'' can be accessed via
2274 Insert a suitably indented @samp{\item@{} on the next line
2275 (@code{Rd-mode-insert-item}).
2278 Preview a plain text version (``help file'', @pxref{Help}) generated
2279 from the Rd file (@code{Rd-preview-help}).
2282 In addition, when editing Rd files one can interact with a running R
2283 process in a similar way as when editing R language files. E.g.,
2284 @kbd{C-c C-v} provides access to on-line help, and @kbd{C-c C-n} sends
2285 the current line to the R process for evaluation. This interaction is
2286 particularly useful when editing the examples in the Rd file. See
2287 @kbd{C-h m} for all available commands.
2289 Rd mode also provides access to abbreviations for most of the Rd markup
2290 commands. Type @kbd{M-x list-abbrevs} with Abbrev mode turned on to
2291 list all available abbrevs. Note that all Rd abbrevs start with a grave
2294 Rd mode can be customized via the following variables.
2298 Hook to be run when Rd mode is entered.
2299 @item Rd-indent-level
2300 The indentation of Rd code with respect to containing blocks. Default
2302 @item Rd-to-help-command
2303 The shell command used for converting Rd source to help text. Default
2304 is @samp{R CMD Rd2txt}.
2307 To automatically turn on the abbrev and font-lock features of Rd mode,
2308 add the following lines to one of your Emacs startup files:
2311 (add-hook 'Rd-mode-hook
2314 (font-lock-mode 1)))
2318 @comment node-name, next, previous, up
2319 @node Help, ESS for SAS, Editing R documentation files, Top
2320 @chapter Reading help files
2323 ESS provides an easy-to-use facility for reading @Sl{} help files from
2324 within Emacs. From within the ESS process buffer or any ESS edit
2325 buffer, typing @kbd{C-c C-v} (@code{ess-display-help-on-object})
2326 @pindex ess-display-help-on-object
2327 will prompt you for the name of an object for which you would like
2328 documentation. Completion is provided over all objects which have help
2331 If the requested object has documentation, you will be popped into a
2332 buffer (named @code{*help(@var{obj-name})*}) containing the help file.
2333 This buffer is placed in a special `S Help' mode which disables the
2334 usual editing commands but which provides a number of keys for paging
2335 through the help file:
2341 @kbd{?} (@code{ess-describe-help-mode}) @*
2342 @pindex ess-describe-help-mode
2343 Pops up a help buffer with a list of the commands available in @Sl{} help
2347 @kbd{h} (@code{ess-display-help-on-object}) @*
2348 @pindex ess-display-help-on-object
2349 Pop up a help buffer for a different object
2353 @cindex paging commands in help buffers
2355 @kbd{b} or @kbd{DEL} (@code{scroll-down}) @*
2356 Move one page backwards through the help file.
2359 @kbd{SPC} (@code{scroll-up}) @*
2360 Move one page forwards through the help file.
2363 @kbd{>} (@code{beginning-of-buffer}) and @kbd{<} (@code{end-of-buffer})
2365 Move to the beginning and end of the help file, respectively.
2367 Section-based motion commands:
2370 @kbd{n} (@code{ess-skip-to-next-section}) and @kbd{p}
2371 (@code{ess-skip-to-previous-section}) @* Move to the next and previous
2372 @pindex ess-skip-to-next-section
2373 @pindex ess-skip-to-previous-section
2374 section header in the help file, respectively. A section header
2375 consists of a number of capitalized words, followed by a colon.
2377 In addition, the @kbd{s} key followed by one of the following letters
2378 will jump to a particular section in the help file.
2379 Note that R uses capitalized instead of all-capital section headers,
2380 e.g., @samp{Description:} instead of @samp{DESCRIPTION:} and also
2381 only some versions of S(-plus) have
2382 sections @samp{BACKGROUND}, @samp{BUGS}, @samp{OPTIONAL ARGUMENTS},
2383 @samp{REQUIRED ARGUMENTS}, and @samp{SIDE EFFECTS}.
2384 @c The bindings are all in ../lisp/essl-s.el
2385 @c ess-help-*-sec-keys-alist
2388 @c @item b BACKGROUND:
2390 @c @item O OPTIONAL ARGUMENTS:
2391 @c @item R REQUIRED ARGUMENTS:
2393 @c S and S-plus only:
2394 @c @item S SIDE EFFECTS:
2395 Do use @kbd{s ?} to get the current list of active key bindings.
2396 @pindex ess-skip-to-help-section
2441 Jumps to beginning of file
2444 Jumps to end of file
2447 Pops up a help buffer with a list of the defined section motion keys.
2453 @kbd{l} (@code{ess-eval-line-and-step}) @*
2454 @pindex ess-eval-line-and-step
2455 Evaluates the current line in the ESS process, and moves to the next
2456 line. Useful for running examples in help files.
2459 @kbd{r} (@code{ess-eval-region}) @*
2460 @pindex ess-eval-region
2461 Send the contents of the current region to the ESS process. Useful
2462 for running examples in help files.
2465 @kbd{/} (@code{isearch-forward}) @*
2471 @kbd{q} (@code{ess-switch-to-end-of-ESS}) @*
2472 @pindex ess-switch-to-end-of-ESS
2473 Returns to the ESS process buffer in another window, leaving the
2474 help window visible.
2477 @kbd{k} (@code{kill-buffer}) @*
2478 Kills the help buffer.
2481 @kbd{x} (@code{ess-kill-buffer-and-go}) @*
2482 Return to the ESS process, killing this help buffer.
2485 In addition, all of the ESS commands available in the edit buffers are
2486 also available in @Sl{} help mode (@pxref{Edit buffer}). Of course, the
2487 usual (non-editing) Emacs commands are available, and for convenience
2488 the digits and @key{-} act as prefix arguments.
2490 If a help buffer already exists for an object for which help is
2491 requested, that buffer is popped to immediately; the ESS process is
2492 not consulted at all. If the contents of the help file have changed,
2493 you either need to kill the help buffer first, or pass a prefix argument
2494 (with @kbd{C-u}) to @code{ess-display-help-on-object}.
2496 Help buffers are marked as temporary buffers in ESS, and are deleted
2497 when @code{ess-quit} or @code{ess-cleanup} are called.
2499 Help buffers normally appear in another window within the current
2500 frame. If you wish help buffers to appear in their own frame (either
2501 one per help buffer, or one for all help buffers), you can customize the
2502 variable @code{ess-help-own-frame}.
2506 @cindex temporary buffers
2508 @comment node-name, next, previous, up
2509 @node ESS for SAS, ESS for BUGS, Help, Top
2510 @chapter ESS for SAS
2513 * ESS(SAS)--Design philosophy::
2514 * ESS(SAS)--Editing files::
2515 * ESS(SAS)--TAB key::
2516 * ESS(SAS)--Batch SAS processes::
2517 * ESS(SAS)--Function keys for batch processing::
2518 * iESS(SAS)--Interactive SAS processes::
2519 * iESS(SAS)--Common problems::
2520 * ESS(SAS)--Graphics::
2521 * ESS(SAS)--Windows::
2523 @include help-sas.texi
2525 @comment node-name, next, previous, up
2526 @node ESS for BUGS, Miscellaneous, ESS for SAS, Top
2527 @chapter ESS for BUGS
2530 * ESS(BUGS)--Model files::
2531 * ESS(BUGS)--Command files::
2532 * ESS(BUGS)--Log files::
2534 @include help-bugs.texi
2536 @comment node-name, next, previous, up
2537 @node Miscellaneous, Mailing lists/bug reports, ESS for BUGS, Top
2538 @chapter Other features of ESS
2540 ESS has a few miscellaneous features, which didn't fit anywhere else.
2543 * Highlighting:: Syntactic highlighting of buffers
2544 * Parens:: Parenthesis matching
2545 * Graphics:: Using graphics with ESS
2546 * Imenu:: Support for Imenu in ESS
2547 * Toolbar:: Support for toolbar in ESS
2548 * TAGS:: Using TAGS for S files
2549 * Rdired:: Directory editor for R objects
2552 @comment node-name, next, previous, up
2553 @node Highlighting, Parens, Miscellaneous, Miscellaneous
2554 @section Syntactic highlighting of buffers
2556 ESS provides Font-Lock (@pxref{Faces,,Using Multiple Typefaces,
2557 emacs, The Gnu Emacs Reference Manual}) patterns for Inferior @Sl{} Mode, S
2558 Mode, and @Sl{} Transcript Mode buffers.
2559 @cindex Font-lock mode
2560 @cindex highlighting
2562 To activate highlighting, you need to turn on Font Lock mode in the
2563 appropriate buffers. This can be done on a per-buffer basis with
2564 @kbd{M-x font-lock-mode}, or may be done by adding
2565 @code{turn-on-font-lock} to @code{inferior-ess-mode-hook},
2566 @code{ess-mode-hook} and @code{ess-transcript-mode-hook}. Your systems
2567 administrator may have done this for you in @file{ess-site.el}
2568 (@pxref{Customization}).
2570 The font-lock patterns are defined in three variables, which you may
2573 @defvar inferior-ess-font-lock-keywords
2574 Font-lock patterns for Inferior ESS Mode. The default value
2575 highlights prompts, inputs, assignments, output messages, vector and
2576 matrix labels, and literals such as @samp{NA} and @code{TRUE}.
2579 @defvar ess-mode-font-lock-keywords
2580 Font-lock patterns for ESS programming mode. The default value
2581 highlights function names, literals, assignments, source functions and
2585 @defvar ess-trans-font-lock-keywords
2586 Font-lock patterns for ESS Transcript Mode. The default value
2587 highlights the same patterns as in Inferior ESS Mode.
2590 @comment node-name, next, previous, up
2591 @node Parens, Graphics, Highlighting, Miscellaneous
2592 @section Parenthesis matching
2594 Emacs and XEmacs have facilities for highlighting the parenthesis
2595 matching the parenthesis at point. This feature is very useful when
2596 trying to examine which parentheses match each other. This highlighting
2597 also indicates when parentheses are not matching. Depending on what
2598 version of emacs you use, one of the following should work in your
2599 initialisation file:
2602 (paren-set-mode 'paren) ;for XEmacs
2603 (show-paren-mode t) ;for Emacs
2610 @comment node-name, next, previous, up
2611 @node Graphics, Imenu, Parens, Miscellaneous
2612 @section Using graphics with ESS
2615 One of the main features of the @code{S} package is its ability to
2616 generate high-resolution graphics plots, and ESS provides a number of
2617 features for dealing with such plots.
2620 * printer:: The printer() graphics driver
2621 * X11:: The X11() (and other X-windows based) driver
2622 * winjava:: Java Graphics Device
2625 @comment node-name, next, previous, up
2626 @node printer, X11, Graphics, Graphics
2627 @subsection Using ESS with the @code{printer()} driver
2629 This is the simplest (and least desirable) method of using graphics
2630 within ESS. S's @code{printer()} device driver produces crude character
2631 based plots which can be contained within the ESS process buffer
2632 itself. To start using character graphics, issue the @Sl{} command
2637 (the @code{width=79} argument prevents Emacs line-wrapping at column
2638 80 on an 80-column terminal. Use a different value for a terminal with
2639 a different number of columns.) Plotting commands do not generate
2640 graphics immediately, but are stored until the @code{show()} command
2641 is issued, which displays the current figure.
2643 @comment node-name, next, previous, up
2644 @node X11, winjava, printer, Graphics
2645 @subsection Using ESS with windowing devices
2648 Of course, the ideal way to use graphics with ESS is to use a windowing
2649 system. Under X11, this requires that the DISPLAY environment
2650 variable be appropriately set, which may not always be the case within
2651 your Emacs process. ESS provides a facility for setting the value of
2652 DISPLAY before the ESS process is started if the variable
2653 @code{ess-ask-about-display}
2654 @pindex ess-ask-about-display
2657 @comment node-name, next, previous, up
2658 @node winjava, , X11, Graphics
2659 @subsection Java Graphics Device
2663 S+6.1 and newer on Windows contains a java library that supports graphics. Send
2671 @noindent to start the graphics driver. This allows you to use ESS for both
2672 interaction and graphics within S-PLUS. (Thanks to Tim Hesterberg for
2675 @comment node-name, next, previous, up
2676 @node Imenu, Toolbar, Graphics, Miscellaneous
2679 Imenu is an Emacs tool for providing mode-specific buffer indexes. In
2680 some of the ESS editing modes (currently SAS and S), support for Imenu
2681 is provided. For example, in S mode buffers, the menubar should display
2682 an item called "Imenu-S". Within this menubar you will then be offered
2683 bookmarks to particular parts of your source file (such as the starting
2684 point of each function definition).
2686 Imenu works by searching your buffer for lines that match what ESS
2687 thinks is the beginning of a suitable entry, e.g. the beginning of a
2688 function definition. To examine the regular expression that ESS uses,
2689 check the value of @code{imenu-generic-expression}. This value is set
2690 by various ESS variables such as @code{ess-imenu-S-generic-expression}.
2692 @comment node-name, next, previous, up
2693 @node Toolbar, TAGS, Imenu, Miscellaneous
2696 The R and S editing modes have support for a toolbar. This toolbar
2697 provides icons to act as shortcuts for starting new S/R processes, or
2698 for evaluating regions of your source buffers. The toolbar should be
2699 present if your emacs can display images. @xref{Customization}, for ways
2700 to change the toolbar.
2702 @comment node-name, next, previous, up
2703 @node TAGS, Rdired, Toolbar, Miscellaneous
2706 The Emacs tags facility can be used to navigate around your files
2707 containing definitions of S functions. This facility is independent of
2708 ESS usage, but is written here since ESS users may wish to take
2709 advantage of TAGS facility. Read more about emacs tags in an emacs
2712 Etags, the program that generates the TAGS file, does not yet know the
2713 syntax to recognise function definitions in S files. Hence, you will
2714 need to provide a regexp that matches your function definitions. Here
2715 is an example call (broken over two lines; type as one line) that should
2719 etags --language=none
2720 --regex='/\([^ \t]+\)[ \t]*<-[ \t]*function/\1/' *.R
2723 This will find entries in your source file of the form:
2726 some.name <- function
2729 with the function name starting in column 0. Windows users may need to
2730 change the single quotes to double quotes.
2732 @comment node-name, next, previous, up
2733 @node Rdired, , TAGS, Miscellaneous
2736 Ess-rdired provides a dired-like buffer for viewing, editing and
2737 plotting objects in your current R session. If you are used to using
2738 the dired (directory editor) facility in Emacs, this mode gives you
2739 similar functionality for R objects.
2741 To get started, first make sure you can load ess-rdired. Add the
2742 following to your .emacs and then restart emacs.
2744 (autoload 'ess-rdired "ess-rdired"
2745 "View *R* objects in a dired-like buffer." t)
2748 Start an R session with @kbd{M-x R} and then store a few
2752 s <- sin(seq(from=0, to=8*pi, length=100))
2758 Then use @kbd{M-x ess-rdired} to create a buffer listing the
2759 objects in your current environment and display it in a new window:
2768 Type @kbd{C-h m} or @kbd{?} to get a list of the keybindings for this
2769 mode. For example, with your point on the line of a variable, `p' will
2770 plot the object, `v' will view it, and `d' will mark the object for
2771 deletion (`x' will actually perform the deletion).
2773 @comment node-name, next, previous, up@chapter Using S4
2774 @node Mailing lists/bug reports, Customization, Miscellaneous, Top
2775 @chapter Bugs and Bug Reporting, Mailing Lists
2784 @node Bugs, Reporting Bugs, Mailing lists/bug reports, Mailing lists/bug reports
2789 @comment node-name, next, previous, up
2790 @node Reporting Bugs, Mailing Lists, Bugs, Mailing lists/bug reports
2791 @section Reporting Bugs
2793 @pindex ess-submit-bug-report
2794 @include bugrept.texi
2796 @comment node-name, next, previous, up
2797 @node Mailing Lists, Help with emacs, Reporting Bugs, Mailing lists/bug reports
2798 @section Mailing Lists
2800 @include mailing.texi
2802 @comment node-name, next, previous, up
2803 @node Help with emacs, , Mailing Lists, Mailing lists/bug reports
2804 @section Help with emacs
2806 Emacs is a complex editor with many abilities that we do not have space
2807 to describe here. If you have problems with other features of emacs
2808 (e.g. printing), there are several sources to consult, including the
2809 emacs FAQs (try @kbd{M-x xemacs-www-faq} or @kbd{M-x view-emacs-FAQ})
2810 and EmacsWiki (@uref{http://www.emacswiki.org}). Please consult them
2811 before asking on the mailing list about issues that are not specific to
2815 @c _not_yet_ @node Help OS, Installation, Help for Statistical Packages, Top
2816 @c _not_yet_ @comment node-name, next, previous, up
2817 @c _not_yet_ @chapter Help, arranged by Operating System
2820 @c _not_yet_ * Unix installation::
2821 @c _not_yet_ * Microsoft Windows installation::
2822 @c _not_yet_ * System dependent:: Other variables you may need to change
2823 @c _not_yet_ @end menu
2827 @comment node-name, next, previous, up
2828 @node Customization, Key Index, Mailing lists/bug reports, Top
2829 @appendix Customizing ESS
2830 @cindex customization
2832 ESS can be easily customized to your taste simply by including the
2833 appropriate lines in your @file{.emacs} file. There are numerous
2834 variables which affect the behavior of ESS in certain situations which
2835 can be modified to your liking. Keybindings may be set or changed to
2836 your preferences, and for per-buffer customizations hooks are also
2839 Most of these variables can be viewed and set using the Custom facility
2840 within Emacs. Type @kbd{M-x customize-group RET ess RET} to see all the
2841 ESS variables that can be customized. Variables are grouped by subject
2842 to make it easy to find related variables.
2844 @c Stephen deleted incomplete variable list Wed 25 Aug 2004.
2846 @node Key Index, Concept Index, Customization, Top
2847 @unnumbered Key (Character) Index
2851 @c @node Command Index, Concept Index, Key Index, Top
2852 @c @unnumbered Command and Function Index
2856 @comment node-name, next, previous, up
2857 @node Concept Index, Variable and command index, Key Index, Top
2858 @unnumbered Concept Index
2861 @node Variable and command index, , Concept Index, Top
2862 @unnumbered Variable and command index
2868 @c Remember to delete these lines before creating the info file.
2869 @c Why? I makeinfo all of the time without following this advice.
2872 @bindingoffset = 0.5in
2876 @comment Local Variables:
2877 @comment TeX-master: "ess.texi"