~ubuntu-branches/ubuntu/oneiric/ess/oneiric

1 by Camm Maguire
Import upstream version 5.1.20
1
\input texinfo   @c -*-texinfo-*-
2
@comment %**start of header
3
@setfilename ess.info
4
@settitle ESS --- Emacs Speaks Statistics
5
@comment %**end of header
6
7
@synindex pg vr
8
1.1.2 by Camm Maguire
Import upstream version 5.2.3
9
@include ess-defs.texi
1.1.1 by Camm Maguire
Import upstream version 5.1.24
10
@titlepage
1.1.2 by Camm Maguire
Import upstream version 5.2.3
11
@title ESS --- Emacs Speaks Statistics
1.2.2 by Camm Maguire
Import upstream version 5.2.11
12
ESS @w{version @ESSVER}
1.1.2 by Camm Maguire
Import upstream version 5.2.3
13
14
@author The ESS Developers (A.J. Rossini, R.M. Heiberger, K. Hornik,
1.3.12 by Dirk Eddelbuettel
Import upstream version 5.8
15
@author M. Maechler, R.A. Sparapani, S.J. Eglen,
16
@author S.P. Luque and H. Redestig)
1.1.1 by Camm Maguire
Import upstream version 5.1.24
17
@c @author (Formerly by: Doug Bates, Ed Kademan, Frank Ritter
18
@c @author                and David Smith)
19
@c @ifhtml
20
@c <P><HR></P>
21
@c @end ifhtml
1.1.2 by Camm Maguire
Import upstream version 5.2.3
22
@c
23
@author Current Documentation by The ESS Developers
1.3.12 by Dirk Eddelbuettel
Import upstream version 5.8
24
@author Copyright @copyright{} 2002--2010 The ESS Developers
1.1.2 by Camm Maguire
Import upstream version 5.2.3
25
@author Copyright @copyright{} 1996--2001 A.J. Rossini
1.1.1 by Camm Maguire
Import upstream version 5.1.24
26
@c (@email{rossini@@biostat.washington.edu})
27
@c @author Department of Biostatistics
28
@c @author University of Washington, USA.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
29
@author Original Documentation by David M. Smith
1.1.1 by Camm Maguire
Import upstream version 5.1.24
30
@author Copyright @copyright{} 1992--1995 David M. Smith
31
@c (@email{D.M.Smith@@lancaster.ac.uk})
32
@c @author Department of Mathematics and Statistics
33
@c @author Lancaster University, UK
34
@c @page
35
@c @vskip 0pt plus 1filll
36
@c @sp 2
37
@author Permission is granted to make and distribute verbatim copies of this
38
@author manual provided the copyright notice and this permission notice are
39
@author preserved on all copies.
40
@author Permission is granted to copy and distribute modified versions of this
41
@author manual under the conditions for verbatim copying, provided that the
42
@author entire resulting derived work is distributed under the terms of a
43
@author permission notice identical to this one.
44
45
@end titlepage
46
1.1.2 by Camm Maguire
Import upstream version 5.2.3
47
@ifnottex
1.1.1 by Camm Maguire
Import upstream version 5.1.24
48
@majorheading ESS --- Emacs Speaks Statistics
1.1.2 by Camm Maguire
Import upstream version 5.2.3
49
2.1.2 by Camm Maguire
* repair broken replace-regexp-in-string -> ess-replace-regexp-in-string
50
@dircategory Emacs
1.2.1 by Camm Maguire
Import upstream version 5.2.6
51
@direntry
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
52
* ESS: (ess). Emacs Speaks Statistics (S/S+/R, SAS, BUGS/JAGS, Stata, XLisp-Stat).
1.2.1 by Camm Maguire
Import upstream version 5.2.6
53
@end direntry
1.1.2 by Camm Maguire
Import upstream version 5.2.3
54
@c node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
55
@node Top, Introduction, (dir), (dir)
56
@top ESS: Emacs Speaks Statistics
57
1.1.2 by Camm Maguire
Import upstream version 5.2.3
58
ESS version
1.1.1 by Camm Maguire
Import upstream version 5.1.24
59
@include ../VERSION
60
61
@display
1.1.2 by Camm Maguire
Import upstream version 5.2.3
62
by  A.J. Rossini,
63
    R.M. Heiberger,
64
    K. Hornik,
65
    M. Maechler,
1.3.12 by Dirk Eddelbuettel
Import upstream version 5.8
66
    R.A. Sparapani,
67
    S.J. Eglen,
68
    S.P. Luque
69
and H. Redestig.
1.1.1 by Camm Maguire
Import upstream version 5.1.24
70
@end display
71
72
@c (Formerly: Doug
73
@c Bates, Ed Kademan, Frank Ritter and David Smith).
1 by Camm Maguire
Import upstream version 5.1.20
74
@quotation
1.1.2 by Camm Maguire
Import upstream version 5.2.3
75
Emacs Speaks Statistics (ESS) provides an intelligent, consistent
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
76
interface between the user and the software.  ESS interfaces with SAS,
77
S-PLUS, R, BUGS/JAGS and other statistical analysis packages on Unix,
78
Linux and Microsoft Windows.  ESS is itself a package within the emacs
79
text editor and uses emacs features to streamline the creation and use
80
of statistical software.  ESS knows the syntax and grammar of
81
statistical analysis packages and provides consistent display and
82
editing features based on that knowledge.  ESS assists in interactive
83
and batch execution of statements written in these statistical
84
analysis languages.
1 by Camm Maguire
Import upstream version 5.1.20
85
@end quotation
86
1.1.2 by Camm Maguire
Import upstream version 5.2.3
87
@end ifnottex
1 by Camm Maguire
Import upstream version 5.1.20
88
89
@menu
90
* Introduction::                Overview of features provided by this package
1.1.1 by Camm Maguire
Import upstream version 5.1.24
91
* Installation::                Installing ESS on your system
1.1.2 by Camm Maguire
Import upstream version 5.2.3
92
93
* Interactive ESS::             Interacting with statistical programs
94
* Entering commands::           Interacting with the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
95
* Transcript Mode::             Manipulating saved transcript files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
96
97
* ESS for the S family::
98
* Editing::                     How to create/edit objects and functions
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
99
* Editing R documentation::
1.1.2 by Camm Maguire
Import upstream version 5.2.3
100
* Help::                        Reading help files
101
102
* ESS for SAS::
103
* ESS for BUGS::
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
104
* ESS for JAGS::
1.1.2 by Camm Maguire
Import upstream version 5.2.3
105
1 by Camm Maguire
Import upstream version 5.1.20
106
* Miscellaneous::               Other features of ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
107
* Mailing lists/bug reports::   How to get assistance with ESS
1 by Camm Maguire
Import upstream version 5.1.20
108
* Customization::               Customizing ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
109
110
* Key Index::
111
* Concept Index::
112
* Variable and command index::
113
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
114
@c @detailmenu
115
@c  --- The Detailed Node Listing ---
1.1.2 by Camm Maguire
Import upstream version 5.2.3
116
@c
117
@c Introduction to ESS
118
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
119
@c * Features::                    Why should I use ESS?
1.1.2 by Camm Maguire
Import upstream version 5.2.3
120
@c * New features::
1.1.1 by Camm Maguire
Import upstream version 5.1.24
121
@c * Credits::                     Authors of and contributors to ESS
122
@c * Latest version::              Getting the latest version of ESS
123
@c * Manual::                      How to read this manual
1.1.2 by Camm Maguire
Import upstream version 5.2.3
124
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
125
@c Installing ESS on your system
126
@c * Unix installation::              Installing ESS on your Unix system
127
@c * Microsoft Windows installation:: Installing ESS on your MS Windows system
1.1.2 by Camm Maguire
Import upstream version 5.2.3
128
@c * Requirements::         emacs, Operating Systems and Statistical Packages
1.1.1 by Camm Maguire
Import upstream version 5.1.24
129
@c * System dependent::               Other variables you may need to change
1.1.2 by Camm Maguire
Import upstream version 5.2.3
130
@c
131
@c Starting the ESS process
132
@c
133
@c * Multiple ESS processes::
1.1.1 by Camm Maguire
Import upstream version 5.1.24
134
@c * ESS processes on Remote Computers::
135
@c * Customizing startup::         Changing the startup actions
1.1.2 by Camm Maguire
Import upstream version 5.2.3
136
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
137
@c Help for the S family
1.1.2 by Camm Maguire
Import upstream version 5.2.3
138
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
139
@c * ESS(S)--Editing files::
140
@c * iESS(S)--Inferior ESS processes::
141
@c * Handling and Reusing Transcripts::
142
@c * ESS-help--assistance with viewing help::
143
@c * Philosophies for using ESS(S)::
144
@c * Scenarios for use (possibilities--based on actual usage)::
145
@c * Customization Examples and Solutions to Problems::
1.1.2 by Camm Maguire
Import upstream version 5.2.3
146
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
147
@c Help for SAS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
148
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
149
@c * ESS(SAS)--Design philosophy::
150
@c * ESS(SAS)--Editing files::
151
@c * iESS(SAS)--Interactive SAS processes::
152
@c * ESS(SAS)--Batch SAS processes::
153
@c * ESS(SAS)--Function keys for batch processing::
154
@c * ESS(SAS)--TAB key::
155
@c * ESS(SAS)--Usage scenarios::
156
@c * iESS(SAS)--Common problems::
157
@c * ESS(SAS)--MS Windows::
1.1.2 by Camm Maguire
Import upstream version 5.2.3
158
@c
159
@c Interacting with the ESS process
160
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
161
@c * Command-line editing::        Entering commands and fixing mistakes
162
@c * Completion::                  Completion of object names
163
@c * Completion details::          Advanced completion concepts
164
@c * Transcript::                  Manipulating the transcript
165
@c * Command History::             Command History
166
@c * History expansion::           References to historical commands
167
@c * Hot keys::                    Hot keys for common commands
1.1.2 by Camm Maguire
Import upstream version 5.2.3
168
@c * Statistical Process running in ESS?::
1.1.1 by Camm Maguire
Import upstream version 5.1.24
169
@c * Other::                       Other commands provided by inferior-ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
170
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
171
@c Manipulating the transcript
1.1.2 by Camm Maguire
Import upstream version 5.2.3
172
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
173
@c * Last command::                Manipulating the output from the last command
1.1.2 by Camm Maguire
Import upstream version 5.2.3
174
@c * Process buffer motion::       Viewing older commands
1.1.1 by Camm Maguire
Import upstream version 5.1.24
175
@c * Transcript resubmit::         Re-submitting commands from the transcript
1.1.2 by Camm Maguire
Import upstream version 5.2.3
176
@c * Saving transcripts::          Keeping a record of your S session
177
@c
178
@c Editing S functions
179
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
180
@c * Edit buffer::                 Edit objects in a specialized buffer
1.1.2 by Camm Maguire
Import upstream version 5.2.3
181
@c * Loading::                     Loading source files into the ESS process
1.1.1 by Camm Maguire
Import upstream version 5.1.24
182
@c * Error Checking::              Detecting errors in source files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
183
@c * Evaluating code::             Sending code to the ESS process
184
@c * Indenting::                   Indenting and formatting @Sl{} code
1.1.1 by Camm Maguire
Import upstream version 5.1.24
185
@c * Other edit buffer commands::  Commands for motion, completion and more
1.1.2 by Camm Maguire
Import upstream version 5.2.3
186
@c * Source Files::                Maintaining @Sl{} source files
1.1.1 by Camm Maguire
Import upstream version 5.1.24
187
@c * Source Directories::          Names and locations of dump files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
188
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
189
@c Manipulating saved transcript files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
190
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
191
@c * Resubmit::                    Resubmitting commands from the transcript file
192
@c * Clean::                       Cleaning transcript files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
193
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
194
@c Other features of ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
195
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
196
@c * Highlighting::                Syntactic highlighting of buffers
197
@c * Graphics::                    Using graphics with ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
198
@c * Object Completion::
199
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
200
@c Using graphics with ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
201
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
202
@c * printer::                     The printer() graphics driver
203
@c * X11::                         The X11() (and other X-windows based) driver
1.1.2 by Camm Maguire
Import upstream version 5.2.3
204
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
205
@c Bugs and Bug Reporting, Mailing Lists
1.1.2 by Camm Maguire
Import upstream version 5.2.3
206
@c
207
@c * Bugs::
208
@c * Reporting Bugs::
209
@c * Mailing Lists::
210
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
211
@c Customizing ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
212
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
213
@c * Variables::                   Variables for customization
214
@c * Hooks::                       Customizing ESS with hooks
215
@c * Keybindings::                 Changing the default ESS keybindings
1.1.2 by Camm Maguire
Import upstream version 5.2.3
216
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
217
@c Variables for customization
1.1.2 by Camm Maguire
Import upstream version 5.2.3
218
@c
1.1.1 by Camm Maguire
Import upstream version 5.1.24
219
@c * Variables for starting ESS::  Variables for starting ESS
220
@c * Dump file variables::         Variables for dump files
221
@c * Indentation variables::       Variables controlling indentation
222
@c * Variables controlling interaction::  Variables controlling interaction
1.1.2 by Camm Maguire
Import upstream version 5.2.3
223
@c 					with the ESS process
1.1.1 by Camm Maguire
Import upstream version 5.1.24
224
@c @end detailmenu
1 by Camm Maguire
Import upstream version 5.1.20
225
@end menu
226
1.1.1 by Camm Maguire
Import upstream version 5.1.24
227
@comment node-name,  next,  previous,  up
228
@node Introduction, Installation, Top, Top
1.1.2 by Camm Maguire
Import upstream version 5.2.3
229
@chapter Introduction to ESS
1 by Camm Maguire
Import upstream version 5.1.20
230
@cindex introduction
231
1.1.2 by Camm Maguire
Import upstream version 5.2.3
232
The S family (@Sl{}, Splus and R) and SAS statistical analysis packages
233
provide sophisticated statistical and graphical routines for manipulating
234
data.   @b{E}macs @b{S}peaks @b{S}tatistics (ESS) is based on the merger
1.1.1 by Camm Maguire
Import upstream version 5.1.24
235
of two pre-cursors, S-mode and SAS-mode, which provided support for the
236
S family and SAS respectively.  Later on, Stata-mode was also incorporated.
237
1.1.2 by Camm Maguire
Import upstream version 5.2.3
238
ESS provides a common, generic, and useful interface, through emacs, to
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
239
many statistical packages.  It currently supports the S family, SAS, BUGS/JAGS,
1.1.1 by Camm Maguire
Import upstream version 5.1.24
240
Stata and XLisp-Stat with the level of support roughly in that order.
241
242
A bit of notation before we begin.  @emph{emacs} refers to both
243
@emph{GNU Emacs} by the Free Software Foundation, as well as
244
@emph{XEmacs} by the XEmacs Project.  The emacs major
1.1.2 by Camm Maguire
Import upstream version 5.2.3
245
mode @code{ESS[language]}, where @code{language} can take values such as
246
@code{S}, @code{SAS}, or @code{XLS}.  The inferior process interface
1.1.1 by Camm Maguire
Import upstream version 5.1.24
247
(the connection between emacs and the running process) referred to as inferior ESS
1 by Camm Maguire
Import upstream version 5.1.20
248
(@code{iESS}), is denoted in the modeline by @code{ESS[dialect]}, where
1.1.1 by Camm Maguire
Import upstream version 5.1.24
249
@code{dialect} can take values such as @code{S3}, @code{S4}, @code{S+3},
1.2.1 by Camm Maguire
Import upstream version 5.2.6
250
@code{S+4}, @code{S+5}, @code{S+6}, @code{S+7}, @code{R}, @code{XLS}, @code{VST}, @code{SAS}.
1 by Camm Maguire
Import upstream version 5.1.20
251
252
Currently, the documentation contains many references to @cite{`S'}
253
where actually any supported (statistics) language is meant, i.e., `S'
254
could also mean `XLisp-Stat' or `SAS'.
255
256
@cindex interactive use of S
257
1.1.2 by Camm Maguire
Import upstream version 5.2.3
258
@cindex using S interactively
1 by Camm Maguire
Import upstream version 5.1.20
259
For exclusively interactive users of S, ESS provides a number of
260
features to make life easier.  There is an easy to use command history
261
mechanism, including a quick prefix-search history.  To reduce typing,
1.1.2 by Camm Maguire
Import upstream version 5.2.3
262
command-line completion is provided for all @Sl{} objects and ``hot
263
keys'' are provided for common @Sl{} function calls.  Help files are
1 by Camm Maguire
Import upstream version 5.1.20
264
easily accessible, and a paging mechanism is provided to view them.
265
Finally, an incidental (but very useful) side-effect of ESS is that a
266
transcript of your session is kept for later saving or editing.
267
1.1.2 by Camm Maguire
Import upstream version 5.2.3
268
@cindex transcripts of S sessions
269
No special knowledge of Emacs is necessary when using @Sl{}
1 by Camm Maguire
Import upstream version 5.1.20
270
interactively under ESS.
271
1.1.2 by Camm Maguire
Import upstream version 5.2.3
272
@cindex programming in S
273
For those that use @Sl{} in the typical edit--test--revise cycle when
274
programming @Sl{} functions, ESS provides for editing of @Sl{} functions
275
in Emacs edit buffers.  Unlike the typical use of @Sl{} where the editor
1 by Camm Maguire
Import upstream version 5.1.20
276
is restarted every time an object is edited, ESS uses the current Emacs
277
session for editing.  In practical terms, this means that you can edit
1.1.2 by Camm Maguire
Import upstream version 5.2.3
278
more than one function at once, and that the ESS process is still
1 by Camm Maguire
Import upstream version 5.1.20
279
available for use while editing.  Error checking is performed on
280
functions loaded back into S, and a mechanism to jump directly to the
281
error is provided.  ESS also provides for maintaining text versions of
1.1.2 by Camm Maguire
Import upstream version 5.2.3
282
your @Sl{} functions in specified source directories.
1 by Camm Maguire
Import upstream version 5.1.20
283
284
@menu
285
* Features::                    Why should I use ESS?
1.1.2 by Camm Maguire
Import upstream version 5.2.3
286
* New features::
1 by Camm Maguire
Import upstream version 5.1.20
287
* Credits::                     Authors of and contributors to ESS
288
* Latest version::              Getting the latest version of ESS
289
* Manual::                      How to read this manual
290
@end menu
291
1.1.1 by Camm Maguire
Import upstream version 5.1.24
292
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
293
@node Features, New features, Introduction, Introduction
294
@section Why should I use ESS?
295
1.1.2 by Camm Maguire
Import upstream version 5.2.3
296
Statistical packages are powerful software systems for manipulating and
297
analyzing data, but their user interfaces often leave something something
298
to be desired:  they offer weak editor functionality and they differ
299
among themselves so markedly that you have to re-learn how to do those
300
things for each package.  ESS is a package which is designed to make
301
editing and interacting with statistical packages more uniform,
302
user-friendly and give you the power of emacs as well.
1 by Camm Maguire
Import upstream version 5.1.20
303
304
ESS provides several features which make it easier to interact with the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
305
ESS process (a connection between your buffer and the statistical
306
package which is waiting for you to input commands).  These include:
1 by Camm Maguire
Import upstream version 5.1.20
307
308
@itemize @bullet
309
@item
310
@b{Command-line editing} for fixing mistakes in commands before they are
311
entered.  The @samp{-e} flag for S-plus provides something similar to
312
this, but here you have the full range of Emacs commands rather than a
313
limited subset.  However, other packages such as XLisp-Stat and S3 do not
314
necessarily have features like this built-in.
315
@xref{Command-line editing}.
316
317
@item
318
@b{Searchable command history} for recalling previously-submitted
319
commands.  This provides all the features of the @samp{Splus -e} history
320
mechanism, plus added features such as history searching.
321
@xref{Command History}.
322
323
@item
324
@b{Command-line completion} of both object and file names for quick
325
entry.  This is similar to @code{tcsh}'s facility for filenames; here it
326
also applies to object names and list components.
327
@xref{Completion}.
328
329
@item
330
@b{Hot-keys} for quick entry of commonly-used commands in `S' such as
331
@code{objects()} and @code{search()}.
332
@xref{Hot keys}.
333
334
@item
335
@b{Transcript recording} for a complete record of all the actions in an
336
S session.
337
@xref{Transcript}.
338
339
@item
340
@b{Interface to the help system}, with a specialized mode for viewing S
341
help files.
342
@xref{Help}.
343
344
@end itemize
345
1.1.2 by Camm Maguire
Import upstream version 5.2.3
346
If you commonly create or modify @Sl{} functions, you will have found
1 by Camm Maguire
Import upstream version 5.1.20
347
the standard facilities for this (the @samp{fix()} function, for
348
example) severely limiting.  Using S's standard features, one can only
1.1.2 by Camm Maguire
Import upstream version 5.2.3
349
edit one function at a time, and you can't continue to use @Sl{} while
1 by Camm Maguire
Import upstream version 5.1.20
350
editing.  ESS corrects these problems by introducing the following
351
features:
352
353
@itemize @bullet
354
@item
355
@b{Object editing}.  ESS allows you to edit more than one function
1.1.2 by Camm Maguire
Import upstream version 5.2.3
356
simultaneously in dedicated Emacs buffers.  The ESS process may
1 by Camm Maguire
Import upstream version 5.1.20
357
continue to be used while functions are being edited.
358
@xref{Edit buffer}.
359
360
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
361
@b{A specialized editing mode} for @Sl{} code, which provides syntactic
1 by Camm Maguire
Import upstream version 5.1.20
362
indentation and highlighting.
363
@xref{Indenting}.
364
365
@item
366
@b{Facilities for loading and error-checking source files}, including a
367
keystroke to jump straight to the position of an error in a source file.
368
@xref{Error Checking}.
369
370
@item
371
@b{Source code revision maintenance}, which allows you to keep historic
1.1.2 by Camm Maguire
Import upstream version 5.2.3
372
versions of @Sl{} source files.
1 by Camm Maguire
Import upstream version 5.1.20
373
@xref{Source Files}.
374
375
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
376
@b{Facilities for evaluating @Sl{} code} such as portions of source
1 by Camm Maguire
Import upstream version 5.1.20
377
files, or line-by-line evaluation of files (useful for debugging).
378
@xref{Evaluating code}.
379
@end itemize
380
381
Finally, ESS provides features for re-submitting commands from saved
382
transcript files, including:
383
384
@itemize @bullet
385
386
@item
387
@b{Evaluation of previously entered commands}, stripping away
388
unnecessary prompts.
389
@xref{Transcript resubmit}.
390
391
@end itemize
392
1.1.1 by Camm Maguire
Import upstream version 5.1.24
393
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
394
@node New features, Credits, Features, Introduction
395
@section New features in ESS
396
397
@include newfeat.texi
1.4.2 by Dirk Eddelbuettel
Import upstream version 5.4
398
@include onewfeat.texi
1 by Camm Maguire
Import upstream version 5.1.20
399
1.1.1 by Camm Maguire
Import upstream version 5.1.24
400
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
401
@node Credits, Latest version, New features, Introduction
402
@section Authors of and contributors to ESS
403
404
@include credits.texi
405
1.1.1 by Camm Maguire
Import upstream version 5.1.24
406
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
407
@node Latest version, Manual, Credits, Introduction
408
@section Getting the latest version of ESS
409
410
@include getting.texi
411
1.1.1 by Camm Maguire
Import upstream version 5.1.24
412
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
413
@node Manual,  , Latest version, Introduction
414
@section How to read this manual
415
416
If you need to install ESS, read @ref{Installation} for details on what
417
needs to be done before proceeding to the next chapter.
418
1.1.2 by Camm Maguire
Import upstream version 5.2.3
419
In this manual we use the standard notation for describing the
420
keystrokes used to invoke certain commands.  @kbd{C-<chr>} means hold
421
the CONTROL key while typing the character <chr>. @kbd{M-<chr>} means
422
hold the META or EDIT or ALT key down while typing <chr>. If there is no
423
META, EDIT or ALT key, instead press and release the ESC key and then
424
type <chr>.
425
426
All ESS commands can be invoked by typing @kbd{M-x command}.  Most of
427
the useful commands are bound to keystrokes for ease of use.  Also, the
428
most popular commands are also available through the emacs menubar, and
429
finally, if available, a small subset are provided on the toolbar.
430
Where possible, keybindings are similar to other modes in emacs to
431
strive for a consistent user interface within emacs, regardless of the
432
details of which programming language is being edited, or process being
433
run.
434
435
Some commands, such as @kbd{M-x R} can accept an optional `prefix'
436
argument.  To specify the prefix argument, you would type @kbd{C-u}
437
before giving the command.  e.g. If you type @kbd{C-u M-x R}, you will
438
be asked for command line options that you wish to invoke the R process
439
with.
440
441
Emacs is often referred to as a `self-documenting' text editor.  This
442
applies to ESS in two ways.  First, limited documentation about each ESS
443
command can be obtained by typing @kbd{C-h f}.  For example, if you type
444
@kbd{C-h f ess-eval-region}, documentation for that command will appear
445
in a separate *Help* buffer.  Second, a complete list of keybindings
446
that are available in each ESS mode and brief description of that mode
447
is available by typing @kbd{C-h m} within an ESS buffer.
448
449
Emacs is a versatile editor written in both C and lisp; ESS is written
450
in the Emacs lisp dialect (termed `elisp') and thus benefits from the
451
flexible nature of lisp.  In particular, many aspects of ESS behaviour
452
can be changed by suitable customization of lisp variables.  This manual
453
mentions some of the most frequent variables.  A full list of them
454
however is available by using the Custom facility within emacs.  (Type
455
@kbd{M-x customize-group RET ess RET} to get started.)
456
@ref{Customization} provides details of common user variables you can
457
change to customize ESS to your taste, but it is recommended that you
458
defer this section until you are more familiar with ESS.
1.2.1 by Camm Maguire
Import upstream version 5.2.6
459
1.1.1 by Camm Maguire
Import upstream version 5.1.24
460
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
461
@node Installation, Interactive ESS, Introduction, Top
462
@chapter Installing ESS on your system
1.1.1 by Camm Maguire
Import upstream version 5.1.24
463
@cindex installation
464
465
The following section details those steps necessary to get ESS running
466
on your system.
467
468
@menu
469
* Unix installation::              Installing ESS on your Unix system
470
* Microsoft Windows installation:: Installing ESS on your MS Windows system
1.1.2 by Camm Maguire
Import upstream version 5.2.3
471
* Requirements::         emacs, Operating Systems and Statistical Packages
1.1.1 by Camm Maguire
Import upstream version 5.1.24
472
@end menu
473
1.1.2 by Camm Maguire
Import upstream version 5.2.3
474
@c FIXME: the following contains @node s  *and* is also included by readme.texi
475
@c -----  which does *not* include 'requires.texi'
476
@c         ==> *must* give node pointer problems!
1.4.1 by Dirk Eddelbuettel
Import upstream version 5.3.11
477
@c @include inst_tar.texi
478
479
@include unixlike.texi
480
@include windows.texi
1.1.1 by Camm Maguire
Import upstream version 5.1.24
481
1.1.2 by Camm Maguire
Import upstream version 5.2.3
482
@node Requirements, , Microsoft Windows installation, Installation
483
@comment node-name,  next,  previous,  up
484
@section Requirements
485
@include requires.texi
486
487
488
@comment  node-name,  next,  previous,  up
489
@node Interactive ESS, Entering commands, Installation, Top
490
@chapter Interacting with statistical programs
491
492
As well as using ESS to edit your source files for statistical programs,
493
you can use ESS to run these statistical programs.  In this chapter, we
494
mostly will refer by example to running S from within emacs.  The emacs
1.2.2 by Camm Maguire
Import upstream version 5.2.11
495
convention is to name such processes running under its control as
1.1.2 by Camm Maguire
Import upstream version 5.2.3
496
`inferior processes'.  This term can be slightly misleading, in which
497
case these processes can be thought of `interactive processes'.  Either
498
way, we use the term `iESS' to refer to the Emacs mode used to interact
499
with statistical programs.
500
501
502
@comment  node-name,  next,  previous,  up
503
@menu
504
* Starting up::
505
* Multiple ESS processes::
506
* ESS processes on Remote Computers::
507
* S+elsewhere and ESS-elsewhere::
508
* Customizing startup::
509
@end menu
510
511
@node Starting up, Multiple ESS processes, Interactive ESS, Interactive ESS
512
@section Starting an ESS process
1 by Camm Maguire
Import upstream version 5.1.20
513
@cindex starting ESS
514
@cindex running S
515
1.3.1 by Camm Maguire
Import upstream version 5.3.0
516
To start an @Sl{} session on Unix or on Windows when you
517
use the Cygwin bash shell, simply type @kbd{M-x S RET}.
518
519
To start an @Sl{} session on Windows when you
520
use the MSDOS prompt shell, simply type @kbd{M-x S+6-msdos RET}.
521
1 by Camm Maguire
Import upstream version 5.1.20
522
@pindex S
523
1.1.2 by Camm Maguire
Import upstream version 5.2.3
524
@cindex ESS process directory
1 by Camm Maguire
Import upstream version 5.1.20
525
@cindex starting directory
526
@cindex working directory
527
@cindex directories
528
529
S will then (by default) ask the question
530
@example
531
S starting data directory?
532
@end example
533
@noindent
1.1.2 by Camm Maguire
Import upstream version 5.2.3
534
Enter the name of the directory you wish to start @Sl{} from (that is,
535
the directory you would have @code{cd}'d to before starting @Sl{} from
1 by Camm Maguire
Import upstream version 5.1.20
536
the shell).  This directory should have a @file{.Data} subdirectory.
537
538
You will then be popped into a buffer
1.1.2 by Camm Maguire
Import upstream version 5.2.3
539
@cindex ESS process buffer
1 by Camm Maguire
Import upstream version 5.1.20
540
@cindex process buffer
541
with name @samp{*S*} which will be used
1.1.2 by Camm Maguire
Import upstream version 5.2.3
542
for interacting with the ESS process, and you can start entering commands.
1.2.1 by Camm Maguire
Import upstream version 5.2.6
543
544
1 by Camm Maguire
Import upstream version 5.1.20
545
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
546
@node Multiple ESS processes, ESS processes on Remote Computers, Starting up, Interactive ESS
547
@section Running more than one ESS process
548
@cindex Multiple ESS processes
1 by Camm Maguire
Import upstream version 5.1.20
549
1.1.2 by Camm Maguire
Import upstream version 5.2.3
550
ESS allows you to run more than one ESS process simultaneously in the
1 by Camm Maguire
Import upstream version 5.1.20
551
same session.  Each process has a name and a number; the initial process
552
@cindex process names
553
(process 1) is simply named (using S-PLUS as an example) @samp{S+3:1}.
554
@comment You may start a new process by passing a numeric argument to
555
@comment @kbd{M-x S}.  For example, typing @kbd{ESC 2 M-x S} starts up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
556
@comment an ESS process with name @samp{S2}, in a buffer whose name
1 by Camm Maguire
Import upstream version 5.1.20
557
@comment is initially @samp{*S2*}.
558
The name of the process is shown in the mode line in square brackets
559
(for example, @samp{[S+3:2]}); this is useful if the process buffer is
1.1.2 by Camm Maguire
Import upstream version 5.2.3
560
renamed.  Without a prefix argument, @kbd{M-x S} starts a new ESS
1 by Camm Maguire
Import upstream version 5.1.20
561
process, using the first available process number.  With a prefix
562
argument (for R), @kbd{C-u M-x R} allows for the specification of
1.1.2 by Camm Maguire
Import upstream version 5.2.3
563
command line options.
1 by Camm Maguire
Import upstream version 5.1.20
564
565
@pindex ess-request-a-process
1.1.2 by Camm Maguire
Import upstream version 5.2.3
566
You can switch to any active ESS process with the command
567
@samp{M-x ess-request-a-process}.  Just enter the name of the process
1 by Camm Maguire
Import upstream version 5.1.20
568
you require; completion is provided over the names of all running S
569
processes.  This is a good command to consider binding to a global key.
570
1.1.2 by Camm Maguire
Import upstream version 5.2.3
571
@c SJE - commented outl the default behaviour now is to label *S* rather
572
@c than *S:1*.
573
@c @vindex ess-plain-first-buffername
574
@c For the predecessor to ESS (S-mode 4.8), the initial process was not
575
@c visibly numbered, i.e. S instead of S1 was used in the mode-line.  To
576
@c obtain this behavior, set the variable @code{ess-plain-first-buffername}
577
@c to @code{t}.  See @file{ess-site} for how to set this for all users.
1.2.1 by Camm Maguire
Import upstream version 5.2.6
578
579
1.1.1 by Camm Maguire
Import upstream version 5.1.24
580
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
581
@node ESS processes on Remote Computers, S+elsewhere and ESS-elsewhere, Multiple ESS processes, Interactive ESS
1.1.1 by Camm Maguire
Import upstream version 5.1.24
582
@section ESS processes on Remote Computers
583
@cindex Remote Computers
1.1.2 by Camm Maguire
Import upstream version 5.2.3
584
@pindex ess-remote
585
@pindex ESS-elsewhere
586
@pindex S+elsewhere
1.1.1 by Camm Maguire
Import upstream version 5.1.24
587
588
ESS works with processes on remote computers as easily as with
589
processes on the local machine.  The recommended way to access a
590
statistical program on remote computer is to start it from a telnet or
591
ssh buffer and then connect ESS to that buffer.
592
593
@enumerate
1.1.2 by Camm Maguire
Import upstream version 5.2.3
594
@item Start a new telnet or ssh buffer and connect to the remote computer
595
(e.g. use @samp{M-x telnet} or @samp{M-x ssh}; ssh.el is available at
596
@uref{ftp://ftp.splode.com/pub/users/friedman/emacs-lisp/ssh.el}).
1.1.1 by Camm Maguire
Import upstream version 5.1.24
597
598
@item Start the ESS process on the remote machine, for example with one of
599
the commands @samp{Splus}, or @samp{R}, or @samp{sas -stdio}.
600
601
@item Enter the ESS command @samp{M-x ess-remote}.  You will be prompted for
602
a program name.  Enter @samp{sp6} or @samp{r} or @samp{sas} or another
603
valid name.  Your telnet process is now known to ESS.  All the usual
604
ESS commands (@samp{C-c C-n} and its relatives) now work with the S
605
language processes.  For SAS you need to use a different command
606
@samp{C-c i} (that is a regular @samp{i}, not a @samp{C-i}) to send
607
lines from your @file{myfile.sas} to the remote SAS process.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
608
@samp{C-c i} sends lines over invisibly.
609
@c and lets SAS display them formatted correctly as in a SAS log file.
610
With ess-remote you get teletype behavior---the data input, the
611
log, and the listing all appear in the same buffer.  To make this work,
612
you need to end every PROC and DATA step with a "RUN;" statement.  The
613
"RUN;" statement is what tells SAS that it should process the preceding
614
input statements.
1.1.1 by Camm Maguire
Import upstream version 5.1.24
615
616
@item Graphics (interactive) on the remote machine.  If you run X11
617
(@xref{X11}, X-windows)
618
on both the local and remote machines then you should be able to
619
display the graphs locally by setting the @samp{DISPLAY} environment
620
variable appropriately.  Windows users can download @samp{xfree86}
621
from cygwin.
622
1.1.2 by Camm Maguire
Import upstream version 5.2.3
623
@item Graphics (static) on the remote machine.
624
If you don't run the X window system on the local machine, then you can write
1.1.1 by Camm Maguire
Import upstream version 5.1.24
625
graphics to a file on the remote machine, and display the file in
626
a graphics viewer on the local machine.  Most statistical software can
627
write one or more of postscript, GIF, or JPEG files.
628
Depending on the versions of emacs and the operating system that you
629
are running, emacs itself may display @samp{.gif} and @samp{.jpg}
630
files.  Otherwise, a graphics file viewer will be needed.
631
Ghostscript/ghostview may be downloaded to display @samp{.ps} and
632
@samp{.eps} files.  Viewers for GIF and JPEG are usually included with
633
operating systems.  @xref{ESS(SAS)--Function keys for batch processing},
634
for more information on using the F12 key for displaying graphics files
635
with SAS.
636
@end enumerate
637
638
Should you or a colleague inadvertently start a statistical process in
639
an ordinary @samp{*shell*} buffer, the @samp{ess-remote} command can
640
be used to convert it to an ESS buffer and allow you to use the ESS
641
commands with it.
642
643
We have two older commands, now deprecated, for accessing ESS processes
644
on remote computers.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
645
@xref{S+elsewhere and ESS-elsewhere}.
1.1.1 by Camm Maguire
Import upstream version 5.1.24
646
647
648
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
649
@node S+elsewhere and ESS-elsewhere, Customizing startup, ESS processes on Remote Computers, Interactive ESS
650
@section S+elsewhere and ESS-elsewhere
651
652
These commands are now deprecated.  We recommend @samp{ess-remote}.  We
653
have two versions of the elsewhere function.  @samp{S+elsewhere} is
654
specific for the S-Plus program.  The more general function
655
@samp{ESS-elsewhere} is not as stable.
1.1.1 by Camm Maguire
Import upstream version 5.1.24
656
657
@enumerate
658
@item Enter @samp{M-x S+elsewhere}.
659
You will be prompted for a starting directory.  I usually give it my
660
project directory on the local machine, say  @samp{~myname/myproject/}
661
1.1.2 by Camm Maguire
Import upstream version 5.2.3
662
Or enter @samp{M-x ESS-elsewhere}.  You will be prompted for an ESS
1.1.1 by Camm Maguire
Import upstream version 5.1.24
663
program and for a starting directory.  I usually give it my project
664
directory on the local machine, say @samp{~myname/myproject/}
665
666
@item The @samp{*S+3*} buffer will appear with a prompt from the
667
local operating system (the unix prompt on a unix workstation or with
668
cygwin bash on a PC, or the msdos prompt on a PC without bash).  emacs
669
may freeze because the cursor is at the wrong place.  Unfreeze it with
670
@samp{C-g} then move the cursor to the end with @samp{M->}.
671
With @samp{S+elsewhere} the buffer name is based on the name of the ESS program.
672
@item Enter
673
@samp{telnet myname@@other.machine} (or @samp{ssh myname@@other.machine}).
674
You will be prompted for your password on the remote machine.
675
Use
676
@samp{M-x send-invisible}
677
before typing the password itself.
678
679
@item Before starting the ESS process, type @samp{stty -echo nl}
680
at the unix prompt.  The @samp{-echo} turns off the echo, the
681
@samp{nl} turns off the newline that you see as @samp{^M}.
682
683
@item You are now talking to the unix prompt on the other machine in the
684
@samp{*S+3*} buffer.  cd into the directory for the current project and start
685
the ESS process by entering
686
@samp{Splus} or @samp{R} or @samp{sas -stdio}
687
as appropriate.  If you can login remotely to your Windows 2000, then
688
you should be able to run @samp{Sqpe} on the Windows machine.  I haven't
689
tested this and noone has reported their tests to me.  You will not be
690
able to run the GUI through this text-only connection.
691
692
@item Once you get the S or R or SAS prompt, then you are completely connected.
693
All the @samp{C-c C-n} and related commands work correctly in sending
694
commands from @samp{myfile.s} or @samp{myfile.r} on the PC to the
695
@samp{*S+3*} buffer running the S or R or SAS program on the remote machine.
696
1.1.2 by Camm Maguire
Import upstream version 5.2.3
697
@item Graphics on the remote machine works fine.  If you run the X window
1.2.2 by Camm Maguire
Import upstream version 5.2.11
698
system on the remote unix machine you should be able to display them in
1.1.2 by Camm Maguire
Import upstream version 5.2.3
699
@samp{xfree86} on your PC.  If you don't run X11, then you can write
700
graphics to the postscript device and copy it to your PC with dired and
701
display it with ghostscript.
1.1.1 by Camm Maguire
Import upstream version 5.1.24
702
@end enumerate
703
704
705
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
706
@node Customizing startup,  , S+elsewhere and ESS-elsewhere, Interactive ESS
1 by Camm Maguire
Import upstream version 5.1.20
707
@section Changing the startup actions
708
709
If you do not wish ESS to prompt for a starting directory when starting
710
a new process, set the variable @code{ess-ask-for-ess-directory} to
711
@vindex ess-ask-for-ess-directory
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
712
@code{nil}.  In this case, the starting directory will be set using
713
one of the following methods:
714
715
@enumerate
716
717
@item If the variable @code{ess-directory-function} stores the name of a
718
function, the value returned by this function is used.  The default for
719
this variable is nil.
720
721
@item Otherwise, if the variable @code{ess-directory} stores the name of a
722
directory (ending in a slash), this value is used.  The default for this
723
variable is nil.
724
725
@item Otherwise, the working directory of the current buffer is used.
726
727
@end enumerate
728
729
If @code{ess-ask-for-ess-directory} has a non-@code{nil} value (as it
730
does by default) then the value determined by the above rules provides
731
the default when prompting for the starting directory.  Incidentally,
732
@code{ess-directory} is an ideal variable to set in
733
@code{ess-pre-run-hook}.
1 by Camm Maguire
Import upstream version 5.1.20
734
1.1.2 by Camm Maguire
Import upstream version 5.2.3
735
If you like to keep a record of your @Sl{} sessions, set the variable
1 by Camm Maguire
Import upstream version 5.1.20
736
@code{ess-ask-about-transfile} to @code{t}, and you will be asked for a
1.1.2 by Camm Maguire
Import upstream version 5.2.3
737
filename for the transcript before the ESS process starts.
1 by Camm Maguire
Import upstream version 5.1.20
738
739
@defvr {User Option} ess-ask-about-transfile
740
If non-@code{nil}, as for a file name in which to save the session
741
transcript.
742
@end defvr
743
744
@cindex transcript file
745
Enter the name of a file in which to save the transcript at the prompt.
746
If the file doesn't exist it will be created (and you should give it a
1.1.2 by Camm Maguire
Import upstream version 5.2.3
747
file name ending in @samp{.St}); if the file already exists the
1 by Camm Maguire
Import upstream version 5.1.20
748
transcript will be appended to the file.  (Note: if you don't set this
749
variable but you still want to save the transcript, you can still do it
750
later --- @pxref{Saving transcripts}.)
751
752
Once these questions are answered (if they are asked at all) the S
753
process itself is started by calling the program name specified in the
754
variable @code{inferior-ess-program}.
755
@vindex inferior-ess-program
756
If you need to pass any arguments to this program, they may be specified
757
in the variable @code{inferior-@var{S_program_name}-args} (e.g. if
758
@code{inferior-ess-program} is @code{"S+"} then the variable to set is
759
@code{inferior-S+-args}.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
760
@cindex arguments to S program
761
It is not normally necessary to pass arguments to the @Sl{} program; in
1 by Camm Maguire
Import upstream version 5.1.20
762
particular do not pass the @samp{-e} option to @code{Splus}, since ESS
763
provides its own command history mechanism.
764
1.2.2 by Camm Maguire
Import upstream version 5.2.11
765
By default, the new process will be displayed in the same window in the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
766
current frame.  If you wish your S process to appear in a separate
767
variable, customize the variable @code{inferior-ess-own-frame}.
1.2.2 by Camm Maguire
Import upstream version 5.2.11
768
Alternatively, change @code{inferior-ess-same-window} if you wish the
769
process to appear within another window of the current frame.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
770
771
@comment  node-name,  next,  previous,  up
772
@node Entering commands, Transcript Mode, Interactive ESS, Top
773
@chapter Interacting with the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
774
@cindex entering commands
775
@cindex commands
776
@cindex sending input
777
778
The primary function of the ESS package is to provide an easy-to-use
1.1.2 by Camm Maguire
Import upstream version 5.2.3
779
front end to the @Sl{} interpreter.  This is achieved by running the S
1 by Camm Maguire
Import upstream version 5.1.20
780
process from within an Emacs buffer, so that the Emacs editing commands
781
are available to correct mistakes in commands, etc.  The features of
1.1.2 by Camm Maguire
Import upstream version 5.2.3
782
Inferior @Sl{} mode are similar to those provided by the standard Emacs
1 by Camm Maguire
Import upstream version 5.1.20
783
shell mode (@pxref{Shell Mode,,, emacs, The Gnu Emacs Reference
1.1.2 by Camm Maguire
Import upstream version 5.2.3
784
Manual}).  Command-line completion of @Sl{} objects and a number of `hot
785
keys' for commonly-used @Sl{} commands are also provided for ease of
1 by Camm Maguire
Import upstream version 5.1.20
786
typing.
787
788
@menu
789
* Command-line editing::        Entering commands and fixing mistakes
790
* Completion::                  Completion of object names
791
* Completion details::          Advanced completion concepts
792
* Transcript::                  Manipulating the transcript
793
* Command History::             Command History
794
* History expansion::           References to historical commands
795
* Hot keys::                    Hot keys for common commands
1.1.2 by Camm Maguire
Import upstream version 5.2.3
796
* Statistical Process running in ESS?::
797
* Emacsclient::                 Using emacsclient
1 by Camm Maguire
Import upstream version 5.1.20
798
* Other::                       Other commands provided by inferior-ESS
799
@end menu
800
1.1.1 by Camm Maguire
Import upstream version 5.1.24
801
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
802
@node Command-line editing, Completion, Entering commands, Entering commands
803
@section Entering commands and fixing mistakes
804
@cindex command-line editing
805
1.1.2 by Camm Maguire
Import upstream version 5.2.3
806
Sending a command to the ESS process is as simple as typing it in
1 by Camm Maguire
Import upstream version 5.1.20
807
and pressing the @key{RETURN} key:
808
809
@itemize @bullet
810
@item
811
@kbd{RET} (@code{inferior-ess-send-input}) @*
812
@pindex inferior-ess-send-input
1.1.2 by Camm Maguire
Import upstream version 5.2.3
813
Send the command on the current line to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
814
@end itemize
815
816
If you make a typing error before pressing @kbd{RET} all the usual Emacs
817
editing commands are available to correct it (@pxref{Basic, Basic, Basic
818
editing commands, emacs, The GNU Emacs Reference Manual}).  Once the
819
command has been corrected you can press @key{RETURN} (even if the
820
cursor is not at the end of the line) to send the corrected command to
1.1.2 by Camm Maguire
Import upstream version 5.2.3
821
the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
822
823
ESS provides some other commands which are useful for fixing mistakes:
824
825
@itemize @bullet
826
@item
827
@kbd{C-c C-w} (@code{backward-kill-word}) @*
828
@pindex backward-kill-word
829
Deletes the previous word (such as an object name) on the command line.
830
831
@item
832
@kbd{C-c C-u} (@code{comint-kill-input}) @*
833
@pindex comint-kill-input
834
Deletes everything from the prompt to point.  Use this to abandon a
1.1.2 by Camm Maguire
Import upstream version 5.2.3
835
command you have not yet sent to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
836
837
@item
838
@kbd{C-c C-a} (@code{comint-bol}) @*
839
@pindex comint-bol
840
Move to the beginning of the line, and then skip forwards past the
841
prompt, if any.
842
@end itemize
843
844
@xref{Shell Mode,,, emacs, The Gnu Emacs Reference Manual}, for other
845
commands relevant to entering input.
846
1.1.1 by Camm Maguire
Import upstream version 5.1.24
847
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
848
@node  Completion, Completion details, Command-line editing, Entering commands
849
@section Completion of object names
850
@cindex completion of object names
851
@cindex command-line completion
852
853
In the process buffer, the @key{TAB} key is for completion, similar to
1.1.2 by Camm Maguire
Import upstream version 5.2.3
854
that provided by Shell Mode for filenames.  In Inferior @Sl{} mode,
1 by Camm Maguire
Import upstream version 5.1.20
855
pressing the @key{TAB} key when the cursor is following the first few
856
characters of an object name @emph{completes} the object name; if the
857
cursor is following a file name @kbd{TAB} completes the file name.
858
859
@itemize @bullet
860
@item
861
@kbd{TAB} (@code{comint-dynamic-complete}) @*
862
@pindex comint-dynamic-complete
1.1.2 by Camm Maguire
Import upstream version 5.2.3
863
Complete the @Sl{} object name or filename before point.
1 by Camm Maguire
Import upstream version 5.1.20
864
@end itemize
865
866
When the cursor is just after a partially-completed object name,
867
pressing @key{TAB} provides completion in a similar fashion to
868
@code{tcsh}
869
@cindex tcsh
1.1.2 by Camm Maguire
Import upstream version 5.2.3
870
except that completion is performed over all known @Sl{} object names
1 by Camm Maguire
Import upstream version 5.1.20
871
instead of file names.  ESS maintains a list of all objects known to S
872
at any given time, which basically consists of all objects (functions
873
and datasets) in every attached directory listed by the @code{search()}
874
command
875
@pindex search()
876
along with the component objects of attached data frames
877
@cindex data frames
1.1.2 by Camm Maguire
Import upstream version 5.2.3
878
(if your version of @Sl{} supports them).
1 by Camm Maguire
Import upstream version 5.1.20
879
880
For example, consider the three functions (available in Splus version
881
3.0) called @code{binomplot()}, @code{binom.test()} and
1.1.2 by Camm Maguire
Import upstream version 5.2.3
882
@code{binomial()}.  Typing @kbd{bin TAB} after the @Sl{} prompt will
1 by Camm Maguire
Import upstream version 5.1.20
883
insert the characters @samp{om}, completing the longest prefix
884
(@samp{binom}) which distinguishes these three commands.  Pressing
885
@kbd{TAB} once more provides a list of the three commands which have
886
this prefix, allowing you to add more characters (say, @samp{.}) which
887
specify the function you desire.  After entering more characters
888
pressing @kbd{TAB} yet again will complete the object name up to
889
uniqueness, etc.  If you just wish to see what completions exist without
890
adding any extra characters, type @kbd{M-?}.
891
892
@itemize @bullet
893
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
894
@kbd{M-?} (@code{ess-list-object-completions}) @*
895
@pindex ess-list-object-completions
1 by Camm Maguire
Import upstream version 5.1.20
896
List all possible completions of the object name at point.
897
@end itemize
898
899
ESS also provides completion over the components of named lists accessed
900
using the @samp{$} notation, to any level of nested lists.  This feature
901
is particularly useful for checking what components of a list object
902
exist while partway through entering a command: simply type the object
903
name and @samp{$} and press @kbd{TAB} to see the names of existing list
904
components for that object.
905
@cindex lists, completion on
906
@cindex completion on lists
907
908
@cindex completion on file names
909
Completion is also provided over file names, which is particularly
1.1.2 by Camm Maguire
Import upstream version 5.2.3
910
useful when using @Sl{} functions such as @code{get()} or @code{scan()}
1 by Camm Maguire
Import upstream version 5.1.20
911
which require fully expanded file names.  Whenever the cursor is within
1.1.2 by Camm Maguire
Import upstream version 5.2.3
912
an @Sl{} string, pressing @kbd{TAB} completes the file name before
1.2.17 by Dirk Eddelbuettel
Import upstream version 5.11
913
point.  Since ESS 5.11, it no longer also expands any @samp{~} or
914
environment variable references.
1 by Camm Maguire
Import upstream version 5.1.20
915
916
If the cursor is not in a string and does not follow a (partial) object
917
name, the @key{TAB} key has a third use: it expands history references.
918
@xref{History expansion}.
919
1.1.1 by Camm Maguire
Import upstream version 5.1.24
920
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
921
@node Completion details, Transcript, Completion, Entering commands
922
@section Completion details
923
924
ESS automatically keeps track of any objects added or deleted to the
925
system (such as new objects created, or directories added to the search
926
list) to make completion as accurate as possible.  Whenever ESS notices
927
that search list has changed
1.1.2 by Camm Maguire
Import upstream version 5.2.3
928
@vindex ess-change-sp-regexp
929
@footnote{The variable @code{ess-change-sp-regexp} is a regular
1 by Camm Maguire
Import upstream version 5.1.20
930
expression matching commands which change the search list.  You will
931
need to modify this variable if you have defined custom commands (other
932
than @code{attach}, @code{detach}, @code{collection} or @code{library})
933
which modify the search list.}  when you attach a directory or data
934
frame, the objects associated with it immediately become available for a
935
completion; when it is detached completion is no longer available on
936
those objects.
937
938
To maintain a list of accessible objects for completion, ESS needs to
939
determine which objects are contained in each directory or data frame on
1.1.2 by Camm Maguire
Import upstream version 5.2.3
940
the search list.  This is done at the start of each @Sl{} session, by
1 by Camm Maguire
Import upstream version 5.1.20
941
running the @code{objects()} command on every element of the search
1.2.2 by Camm Maguire
Import upstream version 5.2.11
942
list.
1.2.1 by Camm Maguire
Import upstream version 5.2.6
943
944
@c On some systems, however, this can be rather slow; it's doubly
945
@c frustrating when you consider that most of the directories on the search
946
@c list are the standard @Sl{} libraries, which never change anyway!  When
947
@c ESS was installed, a database of the standard object names should have
948
@c been created which should speed up this process at the start of an S
949
@c session; if it has not been created you will get a warning like
950
@c `S-namedb.el does not exist'.  @xref{Installation}, for information on
951
@c how to create this database.
1 by Camm Maguire
Import upstream version 5.1.20
952
953
Efficiency in completion is gained by maintaining a cache of objects
954
currently known to S; when a new object becomes available or is deleted,
955
only one component of the cache corresponding to the associated
956
directory needs to be refreshed.  If ESS ever becomes confused about
957
what objects are available for completion (such as when if refuses to
958
complete an object you @strong{know} is there), the command @kbd{M-x
959
ess-resynch}
960
@pindex ess-resynch
961
forces the @emph{entire} cache to be refreshed, which should fix the
962
problem.
963
1.1.1 by Camm Maguire
Import upstream version 5.1.24
964
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
965
@node Transcript, Command History, Completion details, Entering commands
966
@section Manipulating the transcript
967
968
Most of the time, the cursor spends most of its time at the bottom of
1.1.2 by Camm Maguire
Import upstream version 5.2.3
969
the ESS process buffer, entering commands.  However all the input
970
and output from the current (and previous) ESS sessions is stored in
1 by Camm Maguire
Import upstream version 5.1.20
971
the process buffer (we call this the transcript) and often we want to
972
@cindex transcript
973
move back up through the buffer, to look at the output from previous
974
commands for example.
975
976
Within the process buffer, a paragraph
977
@cindex paragraphs in the process buffer
978
is defined as the prompt, the command after the prompt, and the output
979
from the command.  Thus @kbd{M-@{} and @kbd{M-@}} move you backwards and
980
forwards, respectively, through commands in the transcript.  A
981
particularly useful command is @kbd{M-h} (@code{mark-paragraph}) which
982
will allow you to mark a command and its entire output (for deletion,
983
perhaps).  For more information about paragraph commands,
984
@pxref{Paragraphs, Paragraphs, Paragraphs, emacs, The GNU Emacs
985
Reference Manual}.
986
987
If an ESS process finishes and you restart it in the same process
988
buffer, the output from the new ESS process appears after the output
989
from the first ESS process separated by a form-feed (@samp{^L})
990
character.  Thus pages in the ESS
991
@cindex pages in the process buffer
992
process buffer correspond to ESS sessions.  Thus, for example, you may
993
use @kbd{C-x [} and @kbd{C-x ]} to move backward and forwards through
994
ESS sessions in a single ESS process buffer.  For more information about
995
page commands, @pxref{Pages, Pages, Pages, emacs, The GNU Emacs
996
Reference Manual}.
997
998
@menu
999
* Last command::                Manipulating the output from the last command
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1000
* Process buffer motion::       Viewing older commands
1 by Camm Maguire
Import upstream version 5.1.20
1001
* Transcript resubmit::         Re-submitting commands from the transcript
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1002
* Saving transcripts::          Keeping a record of your S session
1 by Camm Maguire
Import upstream version 5.1.20
1003
@end menu
1004
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1005
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1006
@node Last command, Process buffer motion, Transcript, Transcript
1007
@subsection Manipulating the output from the last command
1008
1009
Viewing the output of the command you have just entered is a common
1010
occurrence and ESS provides a number of facilities for doing this.
1011
@c Within the ESS process buffer, the variable @code{scroll-step}
1012
@c @vindex scroll-step
1013
@c is set to 4 (you can redefine this using @code{inferior-ess-mode-hook}
1014
@c @vindex inferior-ess-hook
1015
@c if you wish - @pxref{Hooks},) so that the cursor is usually near the
1016
@c bottom of the window.
1017
Whenever a command produces a longish output, it is possible that the
1018
window will scroll, leaving the next prompt near the middle of the
1019
window.  The first part of the command output may have scrolled off the
1020
top of the window, even though the entire output would fit in the window
1021
if the prompt were near the bottom of the window.  If this happens, you
1022
can use the command
1023
1024
@itemize @bullet
1025
@item
1026
@kbd{C-c C-e} (@code{comint-show-maximum-output}) @*
1027
@pindex comint-show-maximum-output
1028
Move to the end of the buffer, and place cursor on bottom line of
1029
window.
1030
@end itemize
1031
1032
@noindent
1033
to make more of the last output visible.  (To make this happen
1034
automatically for all inputs, set the variable
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1035
@code{comint-scroll-to-bottom-on-input} to @code{t}.)
1 by Camm Maguire
Import upstream version 5.1.20
1036
1037
If the first part of the output is still obscured, use
1038
@cindex reading long command outputs
1039
@itemize @bullet
1040
@item
1041
@kbd{C-c C-r} (@code{comint-show-output}) @*
1042
@pindex comint-show-output
1043
Moves cursor to the previous command line and and places it at the top
1044
of the window.
1045
@end itemize
1046
1047
@noindent
1048
to view it.  Finally, if you want to discard the last command output
1049
altogether, use
1050
1051
@itemize @bullet
1052
@item
1053
@kbd{C-c C-o} (@code{comint-kill-output}) @*
1054
@pindex comint-kill-output
1055
@cindex deleting output
1056
Deletes everything from the last command to the current prompt.
1057
@end itemize
1058
1059
@noindent
1060
to delete it.  Use this command judiciously to keep your transcript to a
1061
more manageable size.
1062
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1063
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1064
@node Process buffer motion, Transcript resubmit, Last command, Transcript
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1065
@subsection Viewing older commands
1 by Camm Maguire
Import upstream version 5.1.20
1066
1067
If you want to view the output from more historic commands than the
1068
previous command, commands are also provided to move backwards and
1069
forwards through previously entered commands in the process buffer:
1070
1071
@itemize @bullet
1072
@item
1073
@kbd{C-c C-p} (@code{comint-previous-input}) @*
1074
@pindex comint-previous-input
1075
Moves point to the preceding command in the process buffer.
1076
1077
@item
1078
@kbd{C-c C-n} (@code{comint-next-input}) @*
1079
@pindex comint-next-input
1080
Moves point to the next command in the process buffer.
1081
@end itemize
1082
1083
@noindent
1084
Note that these two commands are analogous to @kbd{C-p} and @kbd{C-n}
1085
but apply to command lines rather than text lines.  And just like
1086
@kbd{C-p} and @kbd{C-n}, passing a prefix argument to these commands
1087
means to move to the @var{ARG}'th next (or previous) command.  (These
1088
commands are also discussed in @ref{Shell History Copying,,Shell History
1089
Copying,emacs, The GNU Emacs Reference Manual}.)
1090
1091
There are also two similar commands (not bound to any keys by default)
1092
which move to preceding or succeeding commands, but which first prompt
1093
for a regular expression (@pxref{Regexps,,Syntax of Regular
1094
Expression,emacs, The GNU Emacs Reference Manual}), and then moves to
1095
the next (previous) command matching the pattern.
1096
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1097
@itemize @bullet
1098
@item
1099
@code{(comint-backward-matching-input regexp arg)} @*
1100
@pindex comint-backward-matching-input
1101
@code{(comint-forward-matching-input regexp arg)} @*
1102
@pindex comint-forward-matching-input
1 by Camm Maguire
Import upstream version 5.1.20
1103
Search backward (forward) through the transcript buffer for the
1104
@var{arg}'th previous (next) command matching @var{regexp}.  @var{arg}
1105
is the prefix argument; @var{regexp} is prompted for in the minibuffer.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1106
@end itemize
1 by Camm Maguire
Import upstream version 5.1.20
1107
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1108
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1109
@node Transcript resubmit, Saving transcripts, Process buffer motion, Transcript
1110
@subsection Re-submitting commands from the transcript
1111
1112
When moving through the transcript, you may wish to re-execute some of
1113
the commands you find there.  ESS provides three commands to do this;
1114
these commands may be used whenever the cursor is within a command line
1115
in the transcript (if the cursor is within some command @emph{output},
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1116
an error is signalled).  Note all three commands involve the @key{RETURN}
1 by Camm Maguire
Import upstream version 5.1.20
1117
key.
1118
1119
@itemize @bullet
1120
@item
1121
@kbd{RET} (@code{inferior-ess-send-input}) @*
1122
@pindex inferior-ess-send-input
1123
Copy the command under the cursor to the current command line, and
1124
execute it.
1125
1126
@item
1127
@kbd{C-c RET} (@code{comint-copy-old-input}) @*
1128
@pindex comint-copy-old-input
1129
Copy the command under the cursor to the current command line, but don't
1130
execute it.  Leaves the cursor on the command line so that the copied
1131
command may be edited.
1132
1133
@item
1134
@kbd{M-RET} (@code{ess-transcript-send-command-and-move}) @*
1135
@pindex ess-transcript-send-command-and-move
1136
Copy the command under the cursor to the current command line, and
1137
execute it.  Moves the cursor to the following command.
1138
@end itemize
1139
1140
When the cursor is not after the current prompt, the @key{RETURN} key
1141
has a slightly different behavior than usual.  Pressing @kbd{RET} on any
1142
line containing a command that you entered (i.e. a line beginning with a
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1143
prompt) sends that command to the ESS process once again.  If you
1 by Camm Maguire
Import upstream version 5.1.20
1144
wish to edit the command before executing it, use @kbd{C-c RET} instead;
1145
it copies the command to the current prompt but does not execute it,
1146
allowing you to edit it before submitting it.
1147
1148
These two commands leave the cursor at the new command line, allowing
1149
you to continue with interactive use of S.  If you wish to resubmit a
1150
series of commands from the transcript, consider using @kbd{M-RET}
1151
instead, which leaves the cursor at the command line following the one
1152
you re-submitted.  Thus by using @kbd{M-RET} repeatedly, you can
1153
re-submit a whole series of commands.
1154
1155
These commands work even if if the current line is a continuation line
1156
(i.e. the prompt is @samp{+} instead of @samp{>}) --- in this case all
1157
the lines that form the multi-line command are concatenated together and
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1158
the resulting command is sent to the ESS process (currently this is
1159
the only way to resubmit a multi-line command to the ESS process in
1 by Camm Maguire
Import upstream version 5.1.20
1160
one go).  If the current line does
1161
@cindex multi-line commands, resubmitting
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1162
not begin with a prompt, an error is signalled.  This feature, coupled
1 by Camm Maguire
Import upstream version 5.1.20
1163
with the command-based motion commands described above, could be used as
1164
a primitive history mechanism.  ESS provides a more sophisticated
1165
mechanism, however, which is described in @ref{Command History}.
1166
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1167
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1168
@node Saving transcripts,  , Transcript resubmit, Transcript
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1169
@subsection Keeping a record of your S session
1 by Camm Maguire
Import upstream version 5.1.20
1170
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1171
To keep a record of your @Sl{} session in a disk file, use the Emacs
1 by Camm Maguire
Import upstream version 5.1.20
1172
command @kbd{C-x C-w} (@code{write-file}) to attach a file to the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1173
ESS process buffer.  The name of the process buffer will (probably)
1 by Camm Maguire
Import upstream version 5.1.20
1174
change to the name of the file, but this is not a problem.  You can
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1175
still use @Sl{} as usual; just remember to save the file before you quit
1 by Camm Maguire
Import upstream version 5.1.20
1176
Emacs with @kbd{C-x C-s}.  You can make ESS prompt you for a filename in
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1177
which to save the transcript every time you start @Sl{} by setting the
1 by Camm Maguire
Import upstream version 5.1.20
1178
variable
1179
@vindex ess-ask-about-transfile
1180
@code{ess-ask-about-transfile} to @code{t}; see @ref{Customizing startup}.
1181
@cindex transcript file names
1182
We recommend you save your transcripts with filenames that end in
1183
@samp{.St}.  There is a special mode (ESS transcript mode ---
1184
@pxref{Transcript Mode}) for editing transcript files which is
1185
automatically selected for files with this suffix.
1186
1187
@cindex editing transcripts
1188
S transcripts can get very large, so some judicious editing is
1189
appropriate if you are saving it in a file.  Use @kbd{C-c C-o} whenever
1190
a command produces excessively long output (printing large arrays, for
1191
example).  Delete erroneous commands (and the resulting error messages
1192
or other output) by moving to the command (or its output) and typing
1193
@kbd{M-h C-w}.  Also, remember that @kbd{C-c C-e} (and other hot keys)
1194
may be used for commands whose output you do not wish to appear in the
1195
transcript.  These suggestions are appropriate even if you are not
1196
saving your transcript to disk, since the larger the transcript, the
1197
more memory your Emacs process will use on the host machine.
1198
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1199
Finally, if you intend to produce @Sl{} source code (suitable for using
1200
with @code{source()} or inclusion in an @Sl{} function) from a
1201
transcript, then the command @kbd{M-x ess-transcript-clean-region} may
1202
be of use.
1203
@pindex ess-transcript-clean-region
1 by Camm Maguire
Import upstream version 5.1.20
1204
This command works in any Emacs buffer, and removes all prompts and
1205
command output from an ESS transcript within the current region, leaving
1206
only the commands.  Don't forget to remove any erroneous commands first!
1207
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1208
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1209
@node Command History, History expansion, Transcript, Entering commands
1210
@section Command History
1211
@cindex command history
1212
@cindex editing commands
1213
@cindex re-executing commands
1214
1215
ESS provides easy-to-use facilities for re-executing or editing previous
1216
commands.  An input history of the last few commands is maintained (by
1217
default the last 50 commands are stored, although this can be changed by
1218
setting the variable @code{comint-input-ring-size} in
1219
@vindex comint-input-ring-size
1220
@code{inferior-ess-mode-hook}.) The simplest history commands simply
1221
select the next and previous commands in the input history:
1222
1223
@itemize @bullet
1224
@item
1225
@kbd{M-p} (@code{comint-previous-input}) @*
1226
@pindex comint-previous-input
1227
Select the previous command in the input history.
1228
1229
@item
1230
@kbd{M-n}  (@code{comint-next-input}) @*
1231
@pindex comint-next-input
1232
Select the next command in the input history.
1233
@end itemize
1234
1235
@noindent
1236
For example, pressing @kbd{M-p} once will re-enter the last command into
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1237
the process buffer after the prompt but does not send it to the ESS
1 by Camm Maguire
Import upstream version 5.1.20
1238
process, thus allowing editing or correction of the command before the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1239
ESS process sees it.  Once corrections have been made, press
1240
@kbd{RET} to send the edited command to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1241
1242
If you want to select a particular command from the history by matching
1243
it against a regular expression (@pxref{Regexps,,Syntax of Regular
1244
Expression,emacs, The GNU Emacs Reference Manual}), to search for a
1245
particular variable name for example, these commands are also available:
1246
1247
@itemize @bullet
1248
@item
1249
@kbd{M-r} (@code{comint-previous-matching-input}) @*
1250
@pindex comint-previous-matching-input
1251
Prompt for a regular expression, and search backwards through the input
1252
history for a command matching the expression.
1253
1254
@item
1255
@kbd{M-s} (@code{comint-next-matching-input}) @*
1256
@pindex comint-next-matching-input
1257
Prompt for a regular expression, and search backwards through the input
1258
history for a command matching the expression.
1259
@end itemize
1260
1261
@noindent
1262
A common type of search is to find the last command that began with a
1263
particular sequence of characters; the following two commands provide an
1264
easy way to do this:
1265
1266
@itemize @bullet
1267
@item
1268
@kbd{A-M-r} (@code{comint-previous-matching-input-from-input}) @*
1269
@pindex comint-previous-matching-input-from-input
1270
Select the previous command in the history which matches the string
1271
typed so far.
1272
1273
@item
1274
@kbd{A-M-s} (@code{comint-next-matching-input-from-input}) @*
1275
@pindex comint-next-matching-input-from-input
1276
Select the next command in the history which matches the string typed so
1277
far.
1278
@end itemize
1279
1280
@noindent
1281
Instead of prompting for a regular expression to match against, as they
1282
instead select commands starting with those characters already entered.
1283
For instance, if you wanted to re-execute the last @code{attach()}
1284
command, you may only need to type @kbd{att} and then @kbd{A-M-r} and
1285
@kbd{RET}.  (Note: you may not have an @key{ALT} key on your keyboard,
1286
in which case it may be a good idea to bind these commands to some other
1287
keys.)
1288
1289
@xref{Shell Ring,,Shell History Ring,emacs, The GNU Emacs Reference
1290
Manual}, for a more detailed discussion of the history mechanism.
1291
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1292
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1293
@node History expansion, Hot keys, Command History, Entering commands
1294
@section References to historical commands
1295
1296
Instead of searching through the command history using the command
1297
described in the previous section, you can alternatively refer to a
1298
historical command directly using a notation very similar to that used
1299
in @code{csh}.  History references are introduced by a @samp{!} or
1300
@samp{^} character and have meanings as follows:
1301
1302
@table @samp
1303
@item !!
1304
The immediately previous command
1305
1306
@item !-@var{N}
1307
The @var{N}th previous command
1308
1309
@item !text
1310
The last command beginning with the string @samp{text}
1311
1312
@item !?text
1313
The last command containing the string @samp{text}
1314
@end table
1315
1316
In addition, you may follow the reference with a @dfn{word designator}
1317
to select particular @dfn{words} of the input.  A word is defined as a
1318
sequence of characters separated by whitespace.  (You can modify this
1319
definition by setting the value of @code{comint-delimiter-argument-list}
1320
to a list of characters that are allowed to separate words and
1321
@vindex comint-delimiter-argument-list
1322
themselves form words.)  Words are numbered beginning with zero.  The
1323
word designator usually begins with a @samp{:} (colon) character;
1324
however it may be omitted if the word reference begins with a @samp{^},
1325
@samp{$}, @samp{*} or @samp{-}.  If the word is to be selected from the
1326
previous command, the second @samp{!}  character can be omitted from the
1327
event specification.  For instance, @samp{!!:1} and @samp{!:1} both
1328
refer to the first word of the previous command, while @samp{!!$} and
1329
@samp{!$} both refer to the last word in the previous command.  The
1330
format of word designators is as follows:
1331
1332
@table @samp
1333
@item 0
1334
The zeroth word (i.e. the first one on the command line)
1335
1336
@item @var{n}
1337
The @var{n}th word, where @var{n} is a number
1338
1339
@item ^
1340
The first word (i.e. the second one on the command line)
1341
1342
@item $
1343
The last word
1344
1345
@item @var{x}-@var{y}
1346
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}
1347
1348
@item *
1349
All the words except the zeroth word, or nothing if the command had just
1350
one word (the zeroth)
1351
1352
@item @var{x}*
1353
Abbreviates @var{x}-$
1354
1355
@item @var{x}-
1356
Like @samp{@var{x}*}, but omitting the last word
1357
@end table
1358
1359
In addition, you may surround the entire reference except for the first
1360
@samp{!} by braces to allow it to be followed by other (non-whitespace)
1361
characters (which will be appended to the expanded reference).
1362
1363
Finally, ESS also provides quick substitution; a reference like
1364
@samp{^old^new^} means ``the last command, but with the first occurrence
1365
of the string @samp{old} replaced with the string @samp{new}'' (the last
1366
@samp{^} is optional).  Similarly, @samp{^old^} means ``the last
1367
command, with the first occurrence of the string @samp{old} deleted''
1368
(again, the last @samp{^} is optional).
1369
1370
To convert a history reference as described above to an input suitable
1371
for S, you need to @dfn{expand} the history reference, using the
1372
@key{TAB} key.  For this to work, the cursor must be preceded by a space
1373
(otherwise it would try to complete an object name) and not be within a
1374
string (otherwise it would try to complete a filename).  So to expand
1375
the history reference, type @kbd{SPC TAB}.  This will convert the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1376
history reference into an @Sl{} command from the history, which you can
1 by Camm Maguire
Import upstream version 5.1.20
1377
then edit or press @key{RET} to execute.
1378
1379
For example, to execute the last command that referenced the variable
1380
@code{data}, type @kbd{!?data SPC TAB RET}.
1381
1382
@comment  node-name,  next,  previous,  up
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1383
@node Hot keys, Statistical Process running in ESS?, History expansion, Entering commands
1 by Camm Maguire
Import upstream version 5.1.20
1384
@section Hot keys for common commands
1385
1386
ESS provides a number of commands for executing the commonly used
1387
functions.  These commands below are basically information-gaining
1388
commands (such as @code{objects()} or @code{search()}) which tend to
1389
clutter up your transcript and for this reason some of the hot keys
1390
display their output in a temporary buffer instead of the process buffer
1391
by default.  This behavior is controlled by the variable
1392
@code{ess-execute-in-process-buffer} which, if
1393
@vindex ess-execute-in-process-buffer
1394
non-@code{nil}, means that these commands will produce their output in
1395
the process buffer instead.  In any case, passing a prefix argument to
1396
the commands (with @kbd{C-u}) will reverse the meaning of
1397
@code{ess-execute-in-process-buffer} for that command, i.e. the output
1398
will be displayed in the process buffer if it usually goes to a
1399
temporary buffer, and vice-versa.  These are the hot keys that behave in
1400
this way:
1401
1402
@itemize @bullet
1403
@item
1404
@kbd{C-c C-x} (@code{ess-execute-objects}) @*
1405
@pindex ess-execute-objects
1406
Sends the @code{objects()}
1407
@pindex objects()
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1408
command to the ESS process.  A prefix argument specifies the
1 by Camm Maguire
Import upstream version 5.1.20
1409
position on the search list (use a negative argument to toggle
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1410
@code{ess-execute-in-process-buffer} as well).  A quick way to see what
1 by Camm Maguire
Import upstream version 5.1.20
1411
objects are in your working directory.
1412
@cindex objects
1413
@pindex objects()
1414
1415
@item
1416
@kbd{C-c C-s} (@code{ess-execute-search}) @*
1417
@pindex ess-execute-search
1418
Sends the @code{search()}
1419
@pindex search()
1420
command to the ESS process.
1421
@cindex search list
1422
@pindex search()
1423
1424
@item
1425
@kbd{C-c C-e} (@code{ess-execute}) @*
1426
@pindex ess-execute
1427
Prompt for an ESS expression, and evaluate it.
1428
@end itemize
1429
1430
@code{ess-execute} may seem pointless when you could just type the
1431
command in anyway, but it proves useful for `spot' calculations which
1432
would otherwise clutter your transcript, or for evaluating an expression
1433
while partway through entering a command.  You can also use this command
1434
to generate new hot keys using the Emacs keyboard macro facilities;
1435
@pxref{Keyboard Macros, Keyboard Macros, Keyboard Macros, emacs, The GNU
1436
Emacs Reference Manual}.
1437
@cindex hot keys
1438
@cindex keyboard short cuts
1439
1440
The following hot keys do not use @code{ess-execute-in-process-buffer}
1441
to decide where to display the output --- they either always display in
1442
the process buffer or in a separate buffer, as indicated:
1443
1444
@itemize @bullet
1445
@item
1446
@kbd{C-c C-a} (@code{ess-execute-attach}) @*
1447
@pindex ess-execute-attach
1448
Prompts for a directory to attach to the ESS process with the
1449
@code{attach()} command.
1450
@pindex attach()
1451
If a numeric prefix argument is given it is used as the position on the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1452
search list to attach the directory; otherwise the @Sl{} default of 2 is
1 by Camm Maguire
Import upstream version 5.1.20
1453
used.  The @code{attach()} command actually executed appears in the
1454
process buffer.
1455
1456
@item
1457
@kbd{C-c C-l} (@code{ess-load-file}) @*
1458
@pindex ess-load-file
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1459
Prompts for a file to load into the ESS process using
1 by Camm Maguire
Import upstream version 5.1.20
1460
@code{source()}.  If there is an error during loading, you can jump to
1461
the error in the file with @kbd{C-x `} (@code{ess-parse-errors}).
1462
@pindex ess-parse-errors
1463
@xref{Error Checking}, for more details.
1464
1465
@item
1466
@kbd{C-c C-v} (@code{ess-display-help-on-object}) @* Pops up a help
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1467
buffer for an @Sl{} object or function.  See @ref{Help} for more
1 by Camm Maguire
Import upstream version 5.1.20
1468
details.
1469
1470
@item
1471
@kbd{C-c C-q} (@code{ess-quit}) @*
1472
@cindex quitting from ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1473
@cindex killing the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
1474
Sends the @code{q()}
1475
@pindex q()
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1476
command to the ESS process (or @code{(exit)}
1477
@pindex exit()
1 by Camm Maguire
Import upstream version 5.1.20
1478
to the @b{XLS} process), and cleans up any temporary buffers (such as
1479
help buffers or edit buffers) you may have created along the way.  Use
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1480
this command when you have finished your @Sl{} session instead of simply
1 by Camm Maguire
Import upstream version 5.1.20
1481
typing @code{q()} yourself, otherwise you will need to issue the command
1482
@kbd{M-x ess-cleanup}
1483
@pindex ess-cleanup
1484
@cindex cleaning up
1485
@cindex temporary buffers, killing
1486
@cindex killing temporary buffers
1487
command explicitly to make sure that all the files that need to be saved
1488
have been saved, and that all the temporary buffers have been killed.
1489
@end itemize
1490
1491
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1492
@node Statistical Process running in ESS?, Emacsclient, Hot keys, Entering commands
1 by Camm Maguire
Import upstream version 5.1.20
1493
@section Is the Statistical Process running under ESS?
1494
1495
@cindex STERM
1496
@pindex STERM
1497
For the S languages (S, S-Plus, R) ESS sets an option in the current
1498
process that programs in the language can check to determine the
1499
environment in which they are currently running.
1500
1501
ESS sets
1502
@code{options(STERM="iESS")} for S language processes running in an
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1503
inferior @code{@iESS{[S]}} or @code{@iESS{[R]}} buffer.
1 by Camm Maguire
Import upstream version 5.1.20
1504
1505
ESS sets
1506
@code{options(STERM="ddeESS")} for independent S-Plus for Windows
1507
processes running in the GUI and communicating with ESS via
1508
the DDE (Microsoft Dynamic Data Exchange) protocol through a
1509
@code{ddeESS[S]} buffer.
1510
1511
Other values of @code{options()$STERM} that we recommend are:
1512
1513
@itemize @bullet
1514
@item @code{length}:     Fixed length xterm or telnet window.
1515
@item @code{scrollable}: Unlimited length xterm or telnet window.
1516
@item @code{server}:     S-Plus Stat Server.
1517
@item @code{BATCH}:      BATCH.
1518
@item @code{Rgui}:       R GUI.
1519
@item @code{Commands}:   S-Plus GUI without DDE interface to ESS.
1520
@end itemize
1521
1522
Additional values may be recommended in the future as new interaction
1523
protocols are created.  Unlike the values @code{iESS} and @code{ddeESS},
1524
ESS can't set these other values since the S language program is not
1525
under the control of ESS.
1526
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1527
@comment  node-name,  next,  previous,  up
1528
@node Emacsclient, Other, Statistical Process running in ESS?, Entering commands
1529
@section Using emacsclient
1530
1531
@cindex emacsclient
1532
1533
When starting R or S under Unix, ESS sets
1534
@code{options(editor="emacsclient")}.  (Under Microsoft Windows, it will
1535
use gnuclient.exe rather than emacsclient, but the same principle
1536
applies.)  Within your R session, for example, if you have a function
1537
called @code{iterator}, typing @code{fix(iterator)}, will show that
1538
function in a temporary Emacs buffer.  You can then correct the
1539
function.  When you kill the buffer, the definition of the function is
1540
updated.  Using @code{edit()} rather than @code{fix()} means that the
1541
function is not updated.  Finally, the S function @code{page(x)} will
1542
also show a text representation of the object @code{x} in a temporary
1543
Emacs buffer.
1544
1545
1546
@comment  node-name,  next,  previous,  up
1547
@node Other,  , Emacsclient, Entering commands
1 by Camm Maguire
Import upstream version 5.1.20
1548
@section Other commands provided by inferior-ESS
1549
1550
The following commands are also provided in the process buffer:
1551
1552
@itemize @bullet
1553
@item
1554
@kbd{C-c C-c} (@code{comint-interrupt-subjob}) @*
1555
@pindex comint-interrupt-subjob
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1556
Sends a Control-C signal to the ESS process.  This has the effect of
1557
@cindex aborting S commands
1558
@cindex interrupting S commands
1 by Camm Maguire
Import upstream version 5.1.20
1559
aborting the current command.
1560
1561
@item
1562
@kbd{C-c C-z} (@code{ess-abort}) @*
1563
@pindex ess-abort
1564
@pindex comint-stop-subjob
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1565
Sends a STOP signal to the ESS process, killing it immediately.
1 by Camm Maguire
Import upstream version 5.1.20
1566
It's not a good idea to use this, in general: Neither @code{q()} nor
1567
@code{.Last} will be executed and device drivers will not finish
1568
cleanly.  This command is provided as a safety to
1569
@code{comint-stop-subjob}, which is usually bound to @kbd{C-c C-z}.  If
1570
you want to quit from S, use @kbd{C-c C-q} (@code{ess-quit}) instead.
1571
@pindex ess-quit
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1572
@cindex aborting the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
1573
1574
@item
1575
@kbd{C-c C-d} (@code{ess-dump-object-into-edit-buffer}) @*
1576
@pindex ess-dump-object-into-edit-buffer
1577
Prompts for an object to be edited in an edit buffer.  @xref{Editing}.
1578
@end itemize
1579
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1580
Other commands available in Inferior @Sl{} mode are discussed in
1 by Camm Maguire
Import upstream version 5.1.20
1581
@ref{Shell Mode,,, emacs, The Gnu Emacs Reference Manual}.
1582
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1583
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1584
@node Transcript Mode, ESS for the S family, Entering commands, Top
1585
@chapter Manipulating saved transcript files
1586
1587
Inferior @Sl{} mode records the transcript (the list of all commands
1588
executed, and their output) in the process buffer, which can be saved as
1589
a @dfn{transcript file}, which should normally have the suffix
1590
@file{.St}.  The most obvious use for a transcript file is as a static
1591
record of the actions you have performed in a particular @Sl{} session.
1592
Sometimes, however, you may wish to re-execute commands recorded in the
1593
transcript file by submitting them to a running ESS process.  This
1594
is what Transcript Mode is for.
1595
1596
If you load file a with the suffix @file{.St} into Emacs, it is placed
1597
in S Transcript Mode.  Transcript Mode is similar to Inferior @Sl{} mode
1598
(@pxref{Entering commands}):
1599
@cindex transcript mode motion
1600
@cindex motion in transcript mode
1601
paragraphs are defined as a command and its output, and you can move
1602
though commands either with the paragraph commands or with @kbd{C-c C-p}
1603
and @kbd{C-c C-n}.
1604
1605
@menu
1606
* Resubmit::                    Resubmitting commands from the transcript file
1607
* Clean::                       Cleaning transcript files
1608
@end menu
1609
1610
@comment  node-name,  next,  previous,  up
1611
@node Resubmit, Clean, Transcript Mode, Transcript Mode
1612
@section Resubmitting commands from the transcript file
1613
1614
Three commands are provided to re-submit command lines from the
1615
transcript file to a running ESS process.  They are:
1616
1617
@itemize @bullet
1618
@item
1619
@kbd{RET} (@code{ess-transcript-send-command}) @*
1620
Send the current command line to the ESS process, and execute it.
1621
@pindex ess-transcript-send-command
1622
1623
@item
1624
@kbd{C-c RET} (@code{ess-transcript-copy-command}) @*
1625
Copy the current command to the ESS process, and switch to the
1626
ESS process buffer (ready to edit the copied command).
1627
@pindex ess-transcript-copy-command
1628
1629
@item
1630
@kbd{M-RET} (@code{ess-transcript-send-command-and-move}) @*
1631
Send the current command to the ESS process, and move to the next
1632
command line.  This command is useful for submitting a series of
1633
commands.
1634
@end itemize
1635
1636
@noindent
1637
Note that these commands are similar to those on the same keys in
1638
Inferior @Sl{} Mode.  In all three cases, the commands should be
1639
executed when the cursor is on a command line in the transcript; the
1640
prompt is automatically removed before the command is submitted.
1641
1642
@comment  node-name,  next,  previous,  up
1643
@node Clean,  , Resubmit, Transcript Mode
1644
@section Cleaning transcript files
1645
1646
Yet another use for transcript files is to extract the command lines for
1647
inclusion in an @Sl{} source file or function.  Transcript mode provides
1648
one command which does just this:
1649
1650
@itemize @bullet
1651
@item
1652
@kbd{C-c C-w} (@code{ess-transcript-clean-region}) @*
1653
Deletes all prompts and command output in the region, leaving only the
1654
commands themselves.
1655
@end itemize
1656
1657
@noindent
1658
The remaining command lines may then be copied to a source file or edit
1659
buffer for inclusion in a function definition, or may be evaluated
1660
directly (@pxref{Evaluating code}) using the code evaluation commands
1661
from @Sl{} mode, also available in @Sl{} Transcript Mode.
1662
1663
1664
@comment  node-name,  next,  previous,  up
1665
@node ESS for the S family, Editing, Transcript Mode, Top
1666
@chapter ESS for the S family
1667
@menu
1668
* ESS(S)--Editing files::
1669
* iESS(S)--Inferior ESS processes::
1670
* ESS-help--assistance with viewing help::
1671
* Philosophies for using ESS(S)::
1672
* Scenarios for use (possibilities--based on actual usage)::
1673
* Customization Examples and Solutions to Problems::
1674
@end menu
1675
@include help-s.texi
1676
1677
@comment  node-name,  next,  previous,  up
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
1678
@node Editing, Editing R documentation, ESS for the S family, Top
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1679
@chapter Editing S functions
1 by Camm Maguire
Import upstream version 5.1.20
1680
1681
@cindex editing functions
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1682
ESS provides facilities for editing @Sl{} objects within your Emacs
1683
session.  Most editing is performed on @Sl{} functions, although in
1 by Camm Maguire
Import upstream version 5.1.20
1684
theory you may edit datasets as well.  Edit buffers are always
1685
associated with files, although you may choose to make these files
1686
temporary if you wish.  Alternatively, you may make use of a simple yet
1687
powerful mechanism for maintaining backups of text representations of
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1688
@Sl{} functions.  Error-checking is performed when @Sl{} code is loaded
1689
into the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1690
1691
@menu
1692
* Edit buffer::                 Edit objects in a specialized buffer
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1693
* Loading::                     Loading source files into the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
1694
* Error Checking::              Detecting errors in source files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1695
* Evaluating code::             Sending code to the ESS process
1696
* Indenting::                   Indenting and formatting S code
1 by Camm Maguire
Import upstream version 5.1.20
1697
* Other edit buffer commands::  Commands for motion, completion and more
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1698
* Source Files::                Maintaining @Sl{} source files
1 by Camm Maguire
Import upstream version 5.1.20
1699
* Source Directories::          Names and locations of dump files
1700
@end menu
1701
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1702
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1703
@node Edit buffer, Loading, Editing, Editing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1704
@section Creating or modifying S objects
1 by Camm Maguire
Import upstream version 5.1.20
1705
@cindex edit buffer
1706
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1707
To edit an @Sl{} object, type
1 by Camm Maguire
Import upstream version 5.1.20
1708
1709
@itemize @bullet
1710
@item
1711
@kbd{C-c C-d} (@code{ess-dump-object-into-edit-buffer}) @*
1712
@pindex ess-dump-object-into-edit-buffer
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1713
Edit an @Sl{} object in its own edit buffer.
1 by Camm Maguire
Import upstream version 5.1.20
1714
@end itemize
1715
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1716
from within the ESS process buffer (@code{*S*}).  You will then be
1 by Camm Maguire
Import upstream version 5.1.20
1717
prompted for an object to edit: you may either type in the name of an
1718
existing object (for which completion is available using the @kbd{TAB}
1719
key),
1720
@cindex completion, when prompted for object names
1721
or you may enter the name of a new object.
1722
@cindex creating new objects
1723
@cindex new objects, creating
1724
A buffer will be created containing the text representation of the
1725
requested object or, if you entered the name of a non-existent object at
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1726
the prompt and the variable @code{ess-function-template}
1 by Camm Maguire
Import upstream version 5.1.20
1727
@vindex ess-function-template
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1728
is non-@code{nil}, you will be presented with a template defined by that
1729
variable, which defaults to a skeleton function construct.
1 by Camm Maguire
Import upstream version 5.1.20
1730
1731
You may then edit the function as required.  The edit buffer generated
1732
by @code{ess-dump-object-into-edit-buffer} is placed in the @code{ESS}
1733
major mode which provides a number of commands to facilitate editing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1734
@Sl{} source code.  Commands are provided to intelligently indent @Sl{}
1735
code, evaluate portions of @Sl{} code and to move around @Sl{} code
1 by Camm Maguire
Import upstream version 5.1.20
1736
constructs.
1737
1738
@cindex dump files
1739
@cindex reverting function definitions
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1740
Note: when you dump a file with @kbd{C-c C-d}, ESS first checks
1 by Camm Maguire
Import upstream version 5.1.20
1741
to see whether there already exists an edit buffer containing that
1742
object and, if so, pops you directly to that buffer.  If not, ESS next
1743
checks whether there is a file in the appropriate place with the
1744
appropriate name (@pxref{Source Files}) and if so, reads in that file.
1745
You can use this facility to return to an object you were editing in a
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1746
previous session (and which possibly was never loaded to the @Sl{}
1747
session).  Finally, if both these tests fail, the ESS process is
1 by Camm Maguire
Import upstream version 5.1.20
1748
consulted and a @code{dump()} command issued.
1749
@pindex dump()
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1750
If you want to force ESS to ask the ESS process for the object's
1 by Camm Maguire
Import upstream version 5.1.20
1751
definition (say, to reformat an unmodified buffer or to revert back to
1752
S's idea of the object's definition) pass a prefix argument to
1753
@code{ess-dump-object-into-edit-buffer} by typing @kbd{C-u C-c C-d}.
1754
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1755
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1756
@node Loading, Error Checking, Edit buffer, Editing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1757
@section Loading source files into the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
1758
1759
The best way to get information --- particularly function definitions
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1760
--- into @Sl{} is to load them in as source file, using S's
1 by Camm Maguire
Import upstream version 5.1.20
1761
@code{source} function.  You have already seen how to create source
1762
files using @kbd{C-c C-d}; ESS provides a complementary command for
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1763
loading source files (even files not created with ESS!) into the ESS
1 by Camm Maguire
Import upstream version 5.1.20
1764
process:
1765
1766
@itemize @bullet
1767
@item
1768
@kbd{C-c C-l} (@code{ess-load-file}) @*
1769
@pindex ess-load-file
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1770
Loads a file into the ESS process using @code{source()}.
1 by Camm Maguire
Import upstream version 5.1.20
1771
@pindex source()
1772
@end itemize
1773
1774
@noindent
1775
After typing @kbd{C-c C-l} you will prompted for the name of the file to
1776
load into S; usually this is the current buffer's file which is the
1777
default value (selected by simply pressing @kbd{RET} at the prompt).
1778
You will be asked to save the buffer first if it has been modified (this
1779
happens automatically if the buffer was generated with @kbd{C-c C-d}).
1780
The file will then be loaded, and if it loads successfully you will be
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1781
returned to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1782
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1783
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1784
@node Error Checking, Evaluating code, Loading, Editing
1785
@section Detecting errors in source files
1786
@cindex errors
1787
@cindex parsing errors
1788
If any errors occur when loading a file with @code{C-c C-l}, ESS will
1789
inform you of this fact.  In this case, you can jump directly to the
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1790
line in the source file which caused the error by typing @kbd{C-c `}
1 by Camm Maguire
Import upstream version 5.1.20
1791
(@code{ess-parse-errors}).
1792
@pindex ess-parse-errors
1793
You will be returned to the offending file (loading it into a buffer if
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1794
necessary) with point at the line @Sl{} reported as containing the
1 by Camm Maguire
Import upstream version 5.1.20
1795
error.  You may then correct the error, and reload the file.  Note that
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1796
none of the commands in an @Sl{} source file will take effect if any
1 by Camm Maguire
Import upstream version 5.1.20
1797
part of the file contains errors.
1798
1799
Sometimes the error is not caused by a syntax error (loading a
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1800
non-existent file for example). In this case typing @kbd{C-c `} will
1 by Camm Maguire
Import upstream version 5.1.20
1801
simply display a buffer containing S's error message.  You can force
1802
this behavior (and avoid jumping to the file when there @emph{is} a
1803
syntax error) by passing a prefix argument to @code{ess-parse-errors}
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1804
with @kbd{C-u C-c `}.
1 by Camm Maguire
Import upstream version 5.1.20
1805
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1806
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1807
@node Evaluating code, Indenting, Error Checking, Editing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1808
@section Sending code to the ESS process
1 by Camm Maguire
Import upstream version 5.1.20
1809
1810
Other commands are also available for evaluating portions of code in the
1811
S process.  These commands cause the selected code to be evaluated
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1812
directly by the ESS process as if you had typed them in at the
1 by Camm Maguire
Import upstream version 5.1.20
1813
command line; the @code{source()} function is not used.  You may choose
1814
whether both the commands and their output appear in the process buffer
1815
(as if you had typed in the commands yourself) or if the output alone is
1816
echoed.  The behavior is controlled by the variable
1817
@code{ess-eval-visibly-p} whose default is @code{nil}
1818
@vindex ess-eval-visibly-p
1819
(display output only).  Passing a prefix argument (@kbd{C-u}) to any of
1820
the following commands, however, reverses the meaning of
1821
@code{ess-eval-visibly-p} for that command only --- for example @kbd{C-u
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1822
C-c C-j} echoes the current line of S (or other) code in the ESS
1 by Camm Maguire
Import upstream version 5.1.20
1823
process buffer, followed by its output.  This method of evaluation is an
1824
alternative to S's @code{source()} function
1825
@pindex source()
1826
@cindex echoing commands when evaluating
1827
@cindex evaluating code with echoed commands
1828
when you want the input as well as the output to be displayed.  (You can
1829
sort of do this with @code{source()} when the option @code{echo=T} is
1830
set, except that prompts do not get displayed.  ESS puts prompts in the
1831
right places.) The commands for evaluating code are:
1832
1833
@itemize @bullet
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1834
@cindex evaluating S expressions
1 by Camm Maguire
Import upstream version 5.1.20
1835
@item
1836
@kbd{C-c C-j} (@code{ess-eval-line}) @*
1837
@pindex ess-eval-line
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1838
Send the line containing point to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1839
1840
@item
1841
@kbd{C-c M-j} (@code{ess-eval-line-and-go}) @*
1842
@pindex ess-eval-line-and-go
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1843
As above, but returns you to the ESS process buffer as well.
1 by Camm Maguire
Import upstream version 5.1.20
1844
1845
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1846
@kbd{C-c C-f} or @kbd{ESC C-x} (aka @kbd{M-C-x}) (@code{ess-eval-function}) @*
1 by Camm Maguire
Import upstream version 5.1.20
1847
@pindex ess-eval-function
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1848
Send the @Sl{} function containing point to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1849
1850
@item
1851
@kbd{C-c M-f} (@code{ess-eval-function-and-go}) @*
1852
@pindex ess-eval-function-and-go
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1853
As above, but returns you to the ESS process buffer as well.
1 by Camm Maguire
Import upstream version 5.1.20
1854
1855
@item
1856
@kbd{C-c C-r} (@code{ess-eval-region}) @*
1857
@pindex ess-eval-region
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1858
Send the text between point and mark to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1859
1860
@item
1861
@kbd{C-c M-r} (@code{ess-eval-region-and-go}) @*
1862
@pindex ess-eval-region-and-go
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1863
As above, but returns you to the ESS process buffer as well.
1 by Camm Maguire
Import upstream version 5.1.20
1864
1865
@item
1866
@kbd{C-c C-b} (@code{ess-eval-buffer}) @*
1867
@pindex ess-eval-buffer
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1868
Send the contents of the edit buffer to the ESS process.
1 by Camm Maguire
Import upstream version 5.1.20
1869
1870
@item
1871
@kbd{C-c M-b} (@code{ess-eval-buffer-and-go}) @*
1872
@pindex ess-eval-function-and-go
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1873
As above, but returns you to the ESS process buffer as well.
1 by Camm Maguire
Import upstream version 5.1.20
1874
1875
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1876
@kbd{C-c C-n} (@code{ess-eval-line-and-step}) @*
1877
@pindex ess-eval-line-and-step
1 by Camm Maguire
Import upstream version 5.1.20
1878
@cindex stepping through code
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1879
@cindex debugging S functions
1880
Sends the current line to the ESS process, echoing it in the process
1 by Camm Maguire
Import upstream version 5.1.20
1881
buffer, and moves point to the next line.  Useful when debugging for
1882
stepping through your code.
1883
@end itemize
1884
1885
It should be stressed once again that these @code{ess-eval-} commands
1886
should only be used for evaluating small portions of code for debugging
1887
purposes, or for generating transcripts from source files.  When editing
1888
S functions, @kbd{C-c C-l} is the command to use to update the
1889
function's value.  In particular, @code{ess-eval-buffer} is now largely
1890
obsolete.
1891
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1892
One final command is provided for spot-evaluations of @Sl{} code:
1 by Camm Maguire
Import upstream version 5.1.20
1893
1894
@itemize @bullet
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1895
@kbd{C-c C-t} (@code{ess-execute-in-tb}) @*
1 by Camm Maguire
Import upstream version 5.1.20
1896
@pindex ess-execute-in-tb
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1897
Prompt for an @Sl{} expression and evaluate it.  Displays result in a
1 by Camm Maguire
Import upstream version 5.1.20
1898
temporary buffer.
1899
@end itemize
1900
1901
@noindent
1902
This is useful for quick calculations, etc.
1903
1904
All the above commands are useful for evaluating small amounts of code
1905
and observing the results in the process buffer.  A useful way to work
1906
is to divide the frame into two windows; one containing the source code
1907
and the other containing the process buffer.  If you wish to make the
1908
process buffer scroll automatically when the output reaches the bottom
1909
of the window, you will need to set the variable
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1910
@code{comint-scroll-to-bottom-on-output} to @code{'others} or @code{t}.
1.2.1 by Camm Maguire
Import upstream version 5.2.6
1911
1912
1.1.1 by Camm Maguire
Import upstream version 5.1.24
1913
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
1914
@node Indenting, Other edit buffer commands, Evaluating code, Editing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1915
@section Indenting and formatting S code
1 by Camm Maguire
Import upstream version 5.1.20
1916
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
1917
ESS provides a sophisticated mechanism for indenting @Sl{} source
1 by Camm Maguire
Import upstream version 5.1.20
1918
code (thanks to Ken'ichi Shibayama).  Compound statements (delimited by
1919
@samp{@{} and @samp{@}}) are indented relative to their enclosing block.
1920
In addition, the braces have been electrified to automatically indent to
1921
the correct position when inserted, and optionally insert a newline at
1922
the appropriate place as well.  Lines which continue an incomplete
1923
expression are indented relative to the first line of the expression.
1924
Function definitions, @code{if} statements, calls to @code{expression()}
1925
and loop constructs are all recognized and indented appropriately.  User
1926
variables are provided to control the amount if indentation in each
1927
case, and there are also a number of predefined indentation styles to
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1928
choose from.
1 by Camm Maguire
Import upstream version 5.1.20
1929
1930
@cindex comments in S
1931
Comments are also handled specially by ESS, using an idea borrowed from
1932
the Emacs-Lisp indentation style.  By default,
1933
comments beginning with @samp{###}
1934
are aligned to the beginning of the line.  Comments beginning with
1935
@samp{##} are aligned to the current level of indentation for the block
1936
containing the comment.  Finally, comments beginning with @samp{#} are
1937
aligned to a column on the right (the 40th column by default, but this
1938
value is controlled by the variable @code{comment-column},)
1939
@vindex comment-column
1940
or just after the expression on the line containing the comment if it
1941
extends beyond the indentation column.  You turn off the default
1942
behavior by adding the line
1943
@code{(setq ess-fancy-comments nil)} to your @file{.emacs} file.
1944
@vindex ess-fancy-comments
1945
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
1946
ESS also supports Roxygen entries which is R documentation maintained in
1947
the source code as comments @xref{Roxygen}.
1.3.4 by Dirk Eddelbuettel
Import upstream version 5.3.10
1948
1 by Camm Maguire
Import upstream version 5.1.20
1949
The indentation commands provided by ESS are:
1950
@cindex indenting
1951
@cindex formatting source code
1952
1953
@itemize @bullet
1954
@item
1955
@kbd{TAB} (@code{ess-indent-command}) @*
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1956
Indents the current line as @Sl{} code.  If a prefix argument is given,
1 by Camm Maguire
Import upstream version 5.1.20
1957
all following lines which are part of the same (compound) expression are
1958
indented by the same amount (but relative indents are preserved).
1959
1960
@item
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1961
@kbd{RET} (@code{newline-and-indent}) @*
1962
@kbd{LFD} (@emph{newline-and-indent}) @*
1963
Insert a newline, and indent the next line.  (Note that most keyboards
1964
nowadays do not have a @key{LINEFEED} key, but @kbd{C-j} is equivalent.)
1 by Camm Maguire
Import upstream version 5.1.20
1965
1966
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
1967
@kbd{ESC C-q} aka @kbd{M-C-q} aka @kbd{C-M-q} (@code{ess-indent-exp}) @*
1968
Indents each line in the @Sl{} (compound) expression which follows point.
1969
Very useful for beautifying your @Sl{} code.
1 by Camm Maguire
Import upstream version 5.1.20
1970
1971
@item
1972
@kbd{@{} and @kbd{@}} (@code{ess-electric-brace}) @*
1973
The braces automatically indent to the correct position when typed.
1974
1975
@item
1976
@kbd{M-;} (@code{indent-for-comment}) @*
1.2.2 by Camm Maguire
Import upstream version 5.2.11
1977
Indents an existing comment line appropriately, or inserts an
1978
appropriate comment marker.
1 by Camm Maguire
Import upstream version 5.1.20
1979
1980
@item
1981
@kbd{M-x ess-set-style} @*
1982
Set the formatting style in this buffer to be one of the predefined
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
1983
styles, including @code{GNU}, @code{BSD}, @code{K&R}, @code{CLB}, and
1984
@code{C++}. The @code{DEFAULT} style uses the default values for the
1985
indenting variables;  The @code{OWN} style allows you to use your own
1986
private values of the indentation variable, see below.
1 by Camm Maguire
Import upstream version 5.1.20
1987
@end itemize
1988
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
1989
@menu
1990
* Styles::                     Changing indentation styles
1991
@end menu
1992
1993
@comment  node-name,  next,  previous,  up
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
1994
@node Styles,  , Indenting, Indenting
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
1995
@subsection Changing indentation styles
1996
1997
The combined value of nine variables that control indentation are
1998
collectively termed a @i{style}.  ESS provides several styles covering the
1999
common styles of indentation: @code{DEFAULT}, @code{OWN}, @code{GNU},
2000
@code{BSD}, @code{K&R}, @code{C++}, @code{RRR}, @code{CLB}.  The
2001
variable @code{ess-style-alist} lists the value of each indentation
2002
variable per style.  
2003
2004
If you wish to change from one predefined style to another, change the
2005
variable @code{ess-default-style}, for example:
2006
2007
@example
2008
(setq ess-default-style 'C++)
2009
@end example
2010
2011
The styles @code{DEFAULT} and @code{OWN} are initially identical.  If
2012
you wish to edit some of the default values, set
2013
@code{ess-default-style} to @code{'OWN} and change
2014
@code{ess-own-style-list}.  
2015
@xref{Customization}, for convenient ways to set both these variables.
2016
2017
2018
If you prefer not to use the custom facility, you can change individual
2019
indentation variables within a hook, for example:
2020
2021
@example
2022
(defun myindent-ess-hook ()
2023
  (setq ess-indent-level 4))
2024
(add-hook 'ess-mode-hook 'myindent-ess-hook) 
2025
@end example
2026
2027
In the rare case that you'd like to add an entire new indentation style
2028
of your own, copy the definition of @code{ess-own-style-list} to a new
2029
variable and ensure that the last line of the @code{:set} declaration
2030
calls @code{ess-add-style} with a unique name for your style
2031
(e.g. @code{'MINE}).  Finally, add @code{(setq ess-default-style 'MINE)}
2032
to use your new style.
2033
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2034
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
2035
@node Other edit buffer commands, Source Files, Indenting, Editing
2036
@section Commands for motion, completion and more
2037
2038
A number of commands are provided to move across function definitions
2039
in the edit buffer:
2040
@itemize @bullet
2041
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2042
@kbd{ESC C-a} aka @kbd{C-M-a} (@code{ess-beginning-of-function}) @*
1 by Camm Maguire
Import upstream version 5.1.20
2043
@pindex ess-beginning-of-function
2044
Moves point to the beginning of the function containing point.
2045
2046
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2047
@kbd{ESC C-e} aka @kbd{C-M-e} (@code{ess-end-of-function}) @*
1 by Camm Maguire
Import upstream version 5.1.20
2048
@pindex ess-end-of-function
2049
Moves point to the end of the function containing point.
2050
2051
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2052
@kbd{ESC C-h} aka @kbd{C-M-h} (@code{ess-mark-function}) @*
2053
Places point at the beginning of the @Sl{} function containing point, and
1 by Camm Maguire
Import upstream version 5.1.20
2054
mark at the end.
2055
@end itemize
2056
@noindent
2057
Don't forget the usual Emacs commands for moving over balanced
2058
expressions and parentheses: @xref{Lists, Lists and Sexps, Lists and
2059
Sexps, Emacs, The GNU Emacs Reference Manual}.
2060
2061
@cindex completion in edit buffer
2062
Completion is provided in the edit buffer in a similar fashion to the
2063
process buffer: @kbd{M-TAB} completes file names and @kbd{M-?} lists
2064
file completions.  Since @key{TAB} is used for indentation in the edit
2065
buffer, object completion is now performed with @kbd{C-c TAB}.  Note
2066
however that completion is only provided over globally known S objects
2067
(such as system functions) --- it will @emph{not} work for arguments to
2068
functions or other variables local to the function you are editing.
2069
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2070
Finally, two commands are provided for returning to the ESS process buffer:
1 by Camm Maguire
Import upstream version 5.1.20
2071
2072
@itemize @bullet
2073
@item
2074
@kbd{C-c C-z} (@code{ess-switch-to-end-of-ESS}) @*
2075
@pindex ess-switch-to-end-of-ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2076
Returns you to the ESS process buffer, placing point at the end of the
1 by Camm Maguire
Import upstream version 5.1.20
2077
buffer.
2078
2079
@item
2080
@kbd{C-c C-y} (@code{ess-switch-to-ESS}) @*
2081
@pindex ess-switch-to-ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2082
Also returns to to the ESS process buffer, but leaves point where it was.
1 by Camm Maguire
Import upstream version 5.1.20
2083
@end itemize
2084
2085
In addition some commands available in the process buffer are also
2086
available in the edit buffer.  You can still read help files with
2087
@kbd{C-c C-v}, edit another function with @kbd{C-c C-d} and of course
2088
@kbd{C-c C-l} can be used to load a source file into S.  @xref{Other},
2089
for more details on these commands.
2090
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2091
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
2092
@node Source Files, Source Directories, Other edit buffer commands, Editing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2093
@section Maintaining S source files
1 by Camm Maguire
Import upstream version 5.1.20
2094
2095
Every edit buffer in ESS is associated with a @dfn{dump file} on disk.
2096
Dump files are created whenever you type @kbd{C-c C-d}
2097
(@code{ess-dump-object-into-edit-buffer}), and may either be deleted
2098
after use, or kept as a backup file or as a means of keeping several
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2099
versions of an @Sl{} function.
1 by Camm Maguire
Import upstream version 5.1.20
2100
@cindex dump files
2101
2102
@defvr {User Option} ess-delete-dump-files
2103
If non-@code{nil}, dump files created with C-c C-d are deleted
2104
immediately after they are created by the ess-process.
2105
@end defvr
2106
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2107
Since immediately after @Sl{} dumps an object's definition to a disk
1 by Camm Maguire
Import upstream version 5.1.20
2108
file the source code on disk corresponds exactly to S's idea of the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2109
object's definition, the disk file isn't needed; deleting it now has the
2110
advantage that if you @emph{don't} modify the file (say, because you
2111
just wanted to look at the definition of one of the standard S
1 by Camm Maguire
Import upstream version 5.1.20
2112
functions) the source dump file won't be left around when you kill the
2113
buffer.  Note that this variable only applies to files generated with
2114
S's @code{dump} function; it doesn't apply to source files which already
2115
exist.  The default value is @code{t}.
2116
2117
@defvr {User Option} ess-keep-dump-files
2118
Option controlling what to do with the dump file after an object has
2119
been successfully loaded into S.  Valid values are @code{nil} (always
2120
delete), @code{ask} (always ask whether to delete), @code{check} (delete
2121
files generated with @kbd{C-c C-d} in this Emacs session, otherwise ask
2122
--- this is the default) and @code{t} (never delete).  This variable is
2123
buffer-local.
2124
@end defvr
2125
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2126
After an object has been successfully (i.e. without error) loaded
2127
back into @Sl{} with @kbd{C-c C-l}, the disk file again corresponds
1 by Camm Maguire
Import upstream version 5.1.20
2128
exactly (well, almost --- see below) to S's record of the object's
2129
definition, and so some people prefer to delete the disk file rather
2130
than unnecessarily use up space.  This option allows you to do just
2131
that.
2132
2133
@cindex comments
2134
@cindex project work in S
2135
@cindex historic backups
2136
If the value of @code{ess-keep-dump-files} is @code{t}, dump files are
2137
never deleted after they are loaded.  Thus you can maintain a complete
2138
text record of the functions you have edited within ESS.  Backup files
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2139
are kept as usual, and so by using the Emacs numbered backup facility ---
1 by Camm Maguire
Import upstream version 5.1.20
2140
@pxref{Backup Names, Single or Numbered Backups, Single or Numbered
2141
Backups, emacs, The Gnu Emacs Reference Manual}, you can keep a historic
2142
record of function definitions.  Another possibility is to maintain the
2143
files with a version-control system such as RCS @xref{Version Control,
2144
Version Control, Version Control, emacs, The Gnu Emacs Reference
2145
Manual}.  As long as a dump file exists in the appropriate place for a
2146
particular object, editing that object with @kbd{C-c C-d} finds that
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2147
file for editing (unless a prefix argument is given) --- the ESS
1 by Camm Maguire
Import upstream version 5.1.20
2148
process is not consulted.  Thus you can keep comments @emph{outside} the
2149
function definition as a means of documentation that does not clutter
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2150
the @Sl{} object itself.  Another useful feature is that you may format
2151
the code in any fashion you please without @Sl{} re-indenting the code
1 by Camm Maguire
Import upstream version 5.1.20
2152
every time you edit it.  These features are particularly useful for
2153
project-based work.
2154
2155
If the value of @code{ess-keep-dump-files} is nil, the dump file is always
2156
silently deleted after a successful load with @kbd{C-c C-l}.  While this
2157
is useful for files that were created with @kbd{C-c C-d} it also applies
2158
to any other file you load (say, a source file of function
2159
definitions), and so can be dangerous to use unless you are careful.
2160
Note that since @code{ess-keep-dump-files} is buffer-local, you can make
2161
sure particular files are not deleted by setting it to @code{t} in the
2162
Local Variables section of the file @xref{File Variables, Local
2163
Variables in Files, Local Variables in Files, emacs, The Gnu Emacs
2164
Reference Manual}.
2165
2166
A safer option is to set @code{ess-keep-dump-files} to @code{ask}; this
2167
means that ESS will always ask for confirmation before deleting the
2168
file.  Since this can get annoying if you always want to delete dump
2169
files created with @code{C-c C-d}, but not any other files, setting
2170
@code{ess-keep-dump-files} to @code{check} (the default value) will
2171
silently delete dump files created with @kbd{C-c C-d} in the current
2172
Emacs session, but query for any other file.  Note that in any case you
2173
will only be asked for confirmation once per file, and your answer is
2174
remembered for the rest of the Emacs session.
2175
2176
Note that in all cases, if an error (such as a syntax error) is detected
2177
while loading the file with @kbd{C-c C-l}, the dump file is @emph{never}
2178
deleted.  This is so that you can edit the file in a new Emacs session
2179
if you happen to quit Emacs before correcting the error.
2180
2181
@cindex autosaving
2182
Dump buffers are always autosaved, regardless of the value of
2183
@code{ess-keep-dump-files}.
2184
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2185
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
2186
@node Source Directories,  , Source Files, Editing
2187
@section Names and locations of dump files
2188
2189
@cindex dump file names
2190
Every dump file should be given a unique file name, usually the dumped
2191
object name with some additions.
2192
2193
@defvr {User Option} ess-dump-filename-template
2194
Template for filenames of dumped objects.  @code{%s} is replaced by the
2195
object name.
2196
@end defvr
2197
2198
@noindent
2199
By default, dump file names are the user name, followed by @samp{.} and
2200
the object and ending with @samp{.S}.  Thus if user @code{joe} dumps the
2201
object @code{myfun} the dump file will have name @file{joe.myfun.S}.
2202
The username part is included to avoid clashes when dumping into a
2203
publicly-writable directory, such as @file{/tmp}; you may wish to remove
2204
this part if you are dumping into a directory owned by you.
2205
2206
@cindex dump file directories
2207
You may also specify the directory in which dump files are written:
2208
2209
@defvr {User Option} ess-source-directory
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2210
Directory name (ending in a slash) where @Sl{} dump files are to be written.
1 by Camm Maguire
Import upstream version 5.1.20
2211
@end defvr
2212
2213
By default, dump files are always written to @file{/tmp}, which is fine
2214
when @code{ess-keep-dump-files} is @code{nil}.  If you are keeping dump
2215
files, then you will probably want to keep them somewhere in your home
2216
directory, say @file{~/S-source}.  This could be achieved by including
2217
the following line in your @file{.emacs} file:
2218
@cindex @file{.emacs} file
2219
@example
2220
(setq ess-source-directory (expand-file-name "~/S-source/"))
2221
@end example
2222
2223
If you would prefer to keep your dump files in separate directories
2224
depending on the value of some variable, ESS provides a facility for
2225
this also.  By setting @code{ess-source-directory} to a lambda
2226
expression which evaluates to a directory name, you have a great deal of
2227
flexibility in selecting the directory for a particular source file to
2228
appear in.  The lambda expression is evaluated with the process buffer
2229
as the current buffer and so you can use the variables local to that
2230
buffer to make your choice.  For example, the following expression
2231
causes source files to be saved in the subdirectory @file{Src} of the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2232
directory the ESS process was run in.
1 by Camm Maguire
Import upstream version 5.1.20
2233
2234
@example
2235
(setq ess-source-directory
2236
      (lambda ()
2237
         (concat ess-directory "Src/")))
2238
@end example
2239
2240
@noindent
2241
@vindex ess-directory
2242
(@code{ess-directory} is a buffer-local variable in process buffers
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2243
which records the directory the ESS process was run from.)  This is
1 by Camm Maguire
Import upstream version 5.1.20
2244
useful if you keep your dump files and you often edit objects with the
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2245
same name in different ESS processes.  Alternatively, if you often
2246
change your @Sl{} working directory during an @Sl{} session, you may
1 by Camm Maguire
Import upstream version 5.1.20
2247
like to keep dump files in some subdirectory of the directory pointed to
2248
by the first element of the current search list.  This way you can edit
2249
objects of the same name in different directories during the one S
2250
session:
2251
@cindex search list
2252
@cindex working directory
2253
@example
2254
(setq ess-source-directory
2255
   (lambda ()
2256
       (file-name-as-directory
2257
        (expand-file-name (concat
2258
                           (car ess-search-list)
2259
                           "/.Src")))))
2260
@end example
2261
@vindex ess-search-list
2262
2263
If the directory generated by the lambda function does not exist but can
2264
be created, you will be asked whether you wish to create the directory.
2265
If you choose not to, or the directory cannot be created, you will not
2266
be able to edit functions.
2267
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2268
@node Editing R documentation, Help, Editing, Top
2269
@chapter Editing R documentation
2270
2271
ESS provides two ways of writing documentation for R objects. Either
2272
using the standard R documentation system or using in-source
2273
documentation written as structured comment fields for use with the
2274
Roxygen package.
2275
2276
@menu
2277
* R documentation files::       Edit objects in a specialized buffer
2278
* Roxygen::                     Loading source files into the ESS process
2279
@end menu
2280
2281
@node R documentation files, Roxygen, Editing R documentation, Editing R documentation
2282
@section Editing R documentation (Rd) files
2283
2284
@R{} objects are documented in files written in the @dfn{R
2285
documentation} (``Rd''), a simple markup language closely resembling
2286
(La)@TeX{}, which can be processed into a variety of formats, including
2287
La@TeX{}, @acronym{HTML}, and plain text.  Rd format is described in
2288
section ``Rd format'' of the ``Writing R Extensions'' manual in the R
2289
distribution. ESS has several features that facilitate editing Rd files.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2290
2291
Visiting an Rd file as characterized by its extension @file{Rd} will
2292
activate Rd Mode, which provides several facilities for making editing R
2293
documentation files more convenient, by helping with indentation,
2294
insertions, even doing some of the typing for you (with Abbrev Mode),
2295
and by showing Rd keywords, strings, etc.@: in different faces (with
2296
Font Lock Mode).
2297
2298
Note that R also accepts Rd files with extension @file{rd}; to activate
1.2.2 by Camm Maguire
Import upstream version 5.2.11
2299
@ESS{[Rd]} support for this extension, you may need to add
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2300
2301
@example
2302
(add-to-list 'auto-mode-alist '("\\.rd\\'" . Rd-mode))
2303
@end example
2304
2305
@noindent
2306
to one of your Emacs startup files.
2307
2308
In Rd mode, the following special Emacs commands can be used in addition
2309
to the standard Emacs commands.
2310
2311
@table @kbd
2312
@item C-h m
2313
Describe the features of Rd mode.
2314
2315
@item LFD
2316
@itemx RET
2317
Reindent the current line, insert a newline and indent the new line
2318
(@code{reindent-then-newline-and-indent}).  An abbrev before point is
2319
expanded if @code{abbrev-mode} is non-@code{nil}.
2320
2321
@item TAB
2322
Indent current line based on its contents and on previous lines
2323
(@code{indent-according-to-mode}).
2324
2325
@item C-c C-e
2326
Insert a ``skeleton'' with Rd markup for at least all mandatory entries
2327
in Rd files (@code{Rd-mode-insert-skeleton}).  Note that many users
2328
might prefer to use the R function @code{prompt} on an existing R object
2329
to generate a non-empty Rd ``shell'' documenting the object (which
2330
already has all information filled in which can be obtained from the
2331
object).
2332
2333
@item C-c C-f
2334
Insert ``font'' specifiers for some of the Rd markup commands markup
2335
available for emphasizing or quoting text, including markup for URLs and
2336
email addresses (@code{Rd-font}).  @kbd{C-c C-f} is only a prefix; see
2337
e.g.@: @kbd{C-c C-f TAB} for the available bindings.  Note that
2338
currently, not all of the Rd text markup as described in section
2339
``Marking text'' of ``Writing R Extensions'' can be accessed via
2340
@kbd{C-c C-f}.
2341
2342
@item C-c C-j
2343
Insert a suitably indented  @samp{\item@{} on the next line
2344
(@code{Rd-mode-insert-item}).
2345
2346
@item C-c C-p
2347
Preview a plain text version (``help file'', @pxref{Help}) generated
2348
from the Rd file (@code{Rd-preview-help}).
2349
@end table
2350
2351
In addition, when editing Rd files one can interact with a running R
2352
process in a similar way as when editing R language files.  E.g.,
2353
@kbd{C-c C-v} provides access to on-line help, and @kbd{C-c C-n} sends
2354
the current line to the R process for evaluation.  This interaction is
2355
particularly useful when editing the examples in the Rd file.  See
2356
@kbd{C-h m} for all available commands.
2357
2358
Rd mode also provides access to abbreviations for most of the Rd markup
2359
commands.  Type @kbd{M-x list-abbrevs} with Abbrev mode turned on to
2360
list all available abbrevs.  Note that all Rd abbrevs start with a grave
2361
accent.
2362
2363
Rd mode can be customized via the following variables.
2364
2365
@table @code
2366
@item Rd-mode-hook
2367
Hook to be run when Rd mode is entered.
2368
@item Rd-indent-level
2369
The indentation of Rd code with respect to containing blocks.  Default
2370
is 2.
2371
@item Rd-to-help-command
2372
The shell command used for converting Rd source to help text.  Default
2373
is @samp{R CMD Rd2txt}.
2374
@end table
2375
2376
To automatically turn on the abbrev and font-lock features of Rd mode,
2377
add the following lines to one of your Emacs startup files:
2378
2379
@example
2380
(add-hook 'Rd-mode-hook
2381
          (lambda ()
2382
           (abbrev-mode 1)
2383
           (font-lock-mode 1)))
2384
@end example
2385
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2386
@node Roxygen,  , R documentation files, Editing R documentation
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2387
@section Editing Roxygen documentation
2388
@cindex Roxygen
2389
@cindex roxy
2390
@cindex ess-roxy
2391
2392
The Roxygen R package makes it possible to keep the intended contents
2393
for Rd files as structured comments in the R source files. Roxygen can
2394
then parse R files and generate appropriate Rd files from these
2395
comments, fill the usage fields as well as updating @file{NAMESPACE}
2396
files. See the Roxygen documentation found via @uref{http://roxygen.org}
2397
for more information its usage. An example of an Roxygen entry for a
2398
simple R function can look like this:
2399
2400
@example
2401
@verbatim
2402
##' Description of the function
2403
##'
2404
##' Further details about this function
2405
##' @title A title
2406
##' @param me all parameters must be listed and documented
2407
##' @return Description of the return value
2408
##' @author The author
2409
myfun <- function(me)
2410
  cat("Hello", me, "\n")
2411
@end verbatim
2412
@end example
2413
The entry is immediately preceding the object to document and all lines
2414
start with the Roxygen prefix string, in this case @code{##'}. ESS
2415
provides support to edit these documentation entries by providing line
2416
filling, navigation, template generation etc. Syntax highlighting is
2417
provided for Emacs but not for XEmacs.
2418
2419
Roxygen is customized by the variables in the customization group ``Ess
2420
Roxy''. Customizables include the Roxygen prefix, use of folding
2421
to toggle visibility of Roxygen entries and the Roxygen template.
2422
2423
All ESS Roxygen support is defined in @file{ess-roxy.el} which is loaded
2424
by default in ESS. The following special Emacs commands are provided.
2425
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2426
@itemize @bullet
2427
2428
@item
2429
@kbd{C-c C-o} (@code{ess-roxy-update-entry}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2430
@pindex ess-roxy-update-entry
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2431
Generate a Roxygen template or update the parameter list in Roxygen
2432
entry at point (or above the function at the point). Documented
2433
parameters that are not in the function are placed last in the list,
2434
parameters that are not documented and not in the definition are
2435
dropped. Parameter descriptions are filled if
2436
@code{ess-roxy-fill-param-p} is non-nil.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2437
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2438
@item
2439
@kbd{C-c C-e C-c} (@code{ess-roxy-toggle-roxy-region}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2440
@pindex ess-roxy-toggle-roxy-region
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2441
Toggle the presence of the leading Roxygen string on all lines in the
2442
marked region. Convenient for transferring text to Roxygen entries and
2443
to evaluate example fields.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2444
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2445
@item
2446
@kbd{C-c C-e C-r} (@code{ess-roxy-preview-Rd}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2447
@pindex ess-roxy-preview-Rd
1.2.19 by Dirk Eddelbuettel
Import upstream version 5.13
2448
Use the attached R process to parse the entry at point to obtain the Rd
2449
code. Convenient for previewing and checking syntax. When used with the
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2450
prefix argument, i.e. @kbd{C-u C-c C-e C-r}, place the content in a
2451
buffer associated with a Rd file with the same name as the
2452
documentation. Requires the Roxygen package to be installed.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2453
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2454
@item
1.2.19 by Dirk Eddelbuettel
Import upstream version 5.13
2455
@kbd{C-c C-e C-t} (@code{ess-roxy-preview-HTML}) @*
2456
@pindex ess-roxy-preview-Rd
2457
Use the attached R process to parse the entry at to generate HTML for
2458
the entry and open it in a browser. When used with the prefix argument,
2459
i.e. @kbd{C-u C-c C-e C-t}, visit the generated HTML file instead.
2460
Requires the Roxygen and tools packages to be installed.
2461
2462
@item
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2463
@kbd{C-c C-e p} (@code{ess-roxy-previous-entry}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2464
@pindex ess-roxy-previous-entry
2465
Go to start of the Roxygen entry above point.
2466
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2467
@item 
2468
@kbd{C-c C-e n}  (@code{ess-roxy-next-entry}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2469
@pindex ess-roxy-next-entry
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2470
Go to end of the Roxygen entry above point.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2471
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2472
@item
2473
@kbd{C-c C-e C-h} (@code{ess-roxy-hide-all}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2474
@pindex ess-roxy-hide-all
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2475
Use the hideshow mode to fold away the visibility of all Roxygen
2476
entries. Hide-show support must be enabled for this binding to get
2477
defined.
2478
2479
ESS also advices the following standard editing functions in order to make
2480
Roxygen editing more intuitive: 
2481
2482
@item
2483
@kbd{C-c TAB} (@code{ess-R-complete-object-name}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2484
@pindex ess-R-complete-object-name
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2485
Complete Roxygen tag at point. E.g. doing @kbd{C-c TAB} when the point
2486
is at the end of @code{@@par} completes to @code{@@param}.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2487
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2488
@item
2489
@kbd{M-h} (@code{mark-paragraph}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2490
@pindex mark-paragraph
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2491
If the transient mark mode is active, place mark and point at start end
2492
end of the field at point and activate the mark.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2493
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2494
@item
2495
@kbd{TAB} (@code{ess-indent-command}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2496
@pindex ess-indent-command
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2497
If hide-show support is enabled, fold away the visibility of the Roxygen
2498
entry at point.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2499
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2500
@item
2501
@kbd{M-q} (@code{fill-paragraph}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2502
@pindex fill-paragraph
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2503
Fill the Roxygen field at point.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2504
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2505
@item
2506
@kbd{C-a} (@code{move-beginning-of-line}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2507
@pindex move-beginning-of-line
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2508
Move to the point directly to the right of the Roxygen start string.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2509
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2510
@item
2511
@kbd{ENTER} (@code{newline-and-indent}) @*
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2512
@pindex newline-and-indent
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2513
Insert a new line and the Roxygen prefix string.
2514
@end itemize
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2515
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2516
@comment  node-name,  next,  previous,  up
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2517
@node Help, ESS for SAS, Editing R documentation, Top
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2518
@chapter Reading help files
1 by Camm Maguire
Import upstream version 5.1.20
2519
@cindex help files
2520
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2521
ESS provides an easy-to-use facility for reading @Sl{} help files from
2522
within Emacs.  From within the ESS process buffer or any ESS edit
1 by Camm Maguire
Import upstream version 5.1.20
2523
buffer, typing @kbd{C-c C-v} (@code{ess-display-help-on-object})
2524
@pindex ess-display-help-on-object
2525
will prompt you for the name of an object for which you would like
2526
documentation.  Completion is provided over all objects which have help
2527
files.
2528
2529
If the requested object has documentation, you will be popped into a
2530
buffer (named @code{*help(@var{obj-name})*}) containing the help file.
2531
This buffer is placed in a special `S Help' mode which disables the
2532
usual editing commands but which provides a number of keys for paging
2533
through the help file:
2534
2535
@itemize @bullet
2536
Help commands:
2537
2538
@item
2539
@kbd{?} (@code{ess-describe-help-mode}) @*
2540
@pindex ess-describe-help-mode
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2541
Pops up a help buffer with a list of the commands available in @Sl{} help
1 by Camm Maguire
Import upstream version 5.1.20
2542
mode.
2543
2544
@item
2545
@kbd{h} (@code{ess-display-help-on-object}) @*
2546
@pindex ess-display-help-on-object
2547
Pop up a help buffer for a different object
2548
2549
Paging commands:
2550
2551
@cindex paging commands in help buffers
2552
@item
2553
@kbd{b} or @kbd{DEL} (@code{scroll-down}) @*
2554
Move one page backwards through the help file.
2555
2556
@item
2557
@kbd{SPC} (@code{scroll-up}) @*
2558
Move one page forwards through the help file.
2559
2560
@item
2561
@kbd{>} (@code{beginning-of-buffer}) and @kbd{<} (@code{end-of-buffer})
2562
@*
2563
Move to the beginning and end of the help file, respectively.
2564
2565
Section-based motion commands:
2566
2567
@item
2568
@kbd{n} (@code{ess-skip-to-next-section}) and @kbd{p}
2569
(@code{ess-skip-to-previous-section}) @* Move to the next and previous
2570
@pindex ess-skip-to-next-section
2571
@pindex ess-skip-to-previous-section
2572
section header in the help file, respectively.  A section header
2573
consists of a number of capitalized words, followed by a colon.
2574
2575
In addition, the @kbd{s} key followed by one of the following letters
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2576
will jump to a particular section in the help file.
2577
Note that R uses capitalized instead of all-capital section headers,
2578
e.g., @samp{Description:} instead of  @samp{DESCRIPTION:} and also
2579
only some versions of S(-plus) have
2580
sections @samp{BACKGROUND}, @samp{BUGS}, @samp{OPTIONAL ARGUMENTS},
2581
@samp{REQUIRED ARGUMENTS}, and @samp{SIDE EFFECTS}.
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2582
@c The bindings are all in ../lisp/ess-s-l.el
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2583
@c  ess-help-*-sec-keys-alist
2584
@c
2585
@c S-plus only:
2586
@c @item b			BACKGROUND:
2587
@c @item B			BUGS:
2588
@c @item O			OPTIONAL ARGUMENTS:
2589
@c @item R			REQUIRED ARGUMENTS:
2590
2591
@c S and S-plus only:
2592
@c @item S			SIDE EFFECTS:
2593
Do use @kbd{s ?} to get the current list of active key bindings.
1 by Camm Maguire
Import upstream version 5.1.20
2594
@pindex ess-skip-to-help-section
2595
@table @samp
2596
@item a
2597
ARGUMENTS:
2598
2599
@item b
2600
BACKGROUND:
2601
2602
@item B
2603
BUGS:
2604
2605
@item d
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2606
DESCRIPTION:
2607
2608
@item D
1 by Camm Maguire
Import upstream version 5.1.20
2609
DETAILS:
2610
2611
@item e
2612
EXAMPLES:
2613
2614
@item n
2615
NOTE:
2616
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2617
@item O
1 by Camm Maguire
Import upstream version 5.1.20
2618
OPTIONAL ARGUMENTS:
2619
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2620
@item R
2621
REQUIRED ARGUMENTS:
2622
1 by Camm Maguire
Import upstream version 5.1.20
2623
@item r
2624
REFERENCES:
2625
2626
@item s
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2627
SEE ALSO:
2628
2629
@item S
1 by Camm Maguire
Import upstream version 5.1.20
2630
SIDE EFFECTS:
2631
2632
@item u
2633
USAGE:
2634
2635
@item v
2636
VALUE:
2637
2638
@item <
2639
Jumps to beginning of file
2640
2641
@item >
2642
Jumps to end of file
2643
2644
@item ?
2645
Pops up a help buffer with a list of the defined section motion keys.
2646
@end table
2647
2648
Miscellaneous:
2649
2650
@item
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2651
@kbd{l} (@code{ess-eval-line-and-step}) @*
2652
@pindex ess-eval-line-and-step
2653
Evaluates the current line in the ESS process, and moves to the next
2654
line.  Useful for running examples in help files.
2655
2656
@item
1 by Camm Maguire
Import upstream version 5.1.20
2657
@kbd{r} (@code{ess-eval-region}) @*
2658
@pindex ess-eval-region
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2659
Send the contents of the current region to the ESS process.  Useful
1 by Camm Maguire
Import upstream version 5.1.20
2660
for running examples in help files.
2661
2662
@item
2663
@kbd{/} (@code{isearch-forward}) @*
2664
Same as @kbd{C-s}.
2665
2666
Quit commands:
2667
2668
@item
2669
@kbd{q} (@code{ess-switch-to-end-of-ESS}) @*
2670
@pindex ess-switch-to-end-of-ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2671
Returns to the ESS process buffer in another window, leaving the
1 by Camm Maguire
Import upstream version 5.1.20
2672
help window visible.
2673
2674
@item
2675
@kbd{k} (@code{kill-buffer}) @*
2676
Kills the help buffer.
2677
2678
@item
2679
@kbd{x} (@code{ess-kill-buffer-and-go}) @*
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2680
Return to the ESS process, killing this help buffer.
1 by Camm Maguire
Import upstream version 5.1.20
2681
@end itemize
2682
2683
In addition, all of the ESS commands available in the edit buffers are
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2684
also available in @Sl{} help mode (@pxref{Edit buffer}).  Of course, the
1 by Camm Maguire
Import upstream version 5.1.20
2685
usual (non-editing) Emacs commands are available, and for convenience
2686
the digits and @key{-} act as prefix arguments.
2687
2688
If a help buffer already exists for an object for which help is
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2689
requested, that buffer is popped to immediately; the ESS process is
1 by Camm Maguire
Import upstream version 5.1.20
2690
not consulted at all.  If the contents of the help file have changed,
2691
you either need to kill the help buffer first, or pass a prefix argument
2692
(with @kbd{C-u}) to @code{ess-display-help-on-object}.
2693
2694
Help buffers are marked as temporary buffers in ESS, and are deleted
2695
when @code{ess-quit} or @code{ess-cleanup} are called.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2696
2697
Help buffers normally appear in another window within the current
2698
frame.  If you wish help buffers to appear in their own frame (either
2699
one per help buffer, or one for all help buffers), you can customize the
2700
variable @code{ess-help-own-frame}.
2701
1 by Camm Maguire
Import upstream version 5.1.20
2702
@pindex ess-quit
2703
@pindex ess-cleanup
2704
@cindex temporary buffers
2705
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2706
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2707
@node ESS for SAS, ESS for BUGS, Help, Top
2708
@chapter ESS for SAS
2709
2710
@menu
2711
* ESS(SAS)--Design philosophy::
2712
* ESS(SAS)--Editing files::
2713
* ESS(SAS)--TAB key::
2714
* ESS(SAS)--Batch SAS processes::
2715
* ESS(SAS)--Function keys for batch processing::
2716
* iESS(SAS)--Interactive SAS processes::
2717
* iESS(SAS)--Common problems::
2718
* ESS(SAS)--Graphics::
1.2.2 by Camm Maguire
Import upstream version 5.2.11
2719
* ESS(SAS)--Windows::
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2720
@end menu
2721
@include help-sas.texi
2722
2723
@comment  node-name,  next,  previous,  up
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2724
@node ESS for BUGS, ESS for JAGS, ESS for SAS, Top
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2725
@chapter ESS for BUGS
2726
2727
@menu
2728
* ESS(BUGS)--Model files::
2729
* ESS(BUGS)--Command files::
2730
* ESS(BUGS)--Log files::
2731
@end menu
2732
@include help-bugs.texi
2733
2734
@comment  node-name,  next,  previous,  up
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2735
@node ESS for JAGS, Miscellaneous, ESS for BUGS, Top
2736
@chapter ESS for JAGS
2737
2738
@menu
2739
* ESS(JAGS)--Model files::
2740
* ESS(JAGS)--Command files::
2741
* ESS(JAGS)--Log files::
2742
@end menu
2743
@include help-jags.texi
2744
2745
@comment  node-name,  next,  previous,  up
2746
@node Miscellaneous, Mailing lists/bug reports, ESS for JAGS, Top
1 by Camm Maguire
Import upstream version 5.1.20
2747
@chapter Other features of ESS
2748
2749
ESS has a few miscellaneous features, which didn't fit anywhere else.
2750
2751
@menu
2752
* Highlighting::                Syntactic highlighting of buffers
1.2.2 by Camm Maguire
Import upstream version 5.2.11
2753
* Parens::                      Parenthesis matching
1 by Camm Maguire
Import upstream version 5.1.20
2754
* Graphics::                    Using graphics with ESS
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2755
* Imenu::                       Support for Imenu in ESS
2756
* Toolbar::                     Support for toolbar in ESS
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2757
* TAGS::                        Using TAGS for S files
2758
* Rdired::                      Directory editor for R objects
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2759
* Rutils::                      R object/package management and help utilities
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
2760
* Org::                         Interaction with Org mode
1 by Camm Maguire
Import upstream version 5.1.20
2761
@end menu
2762
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2763
@comment  node-name,  next,  previous,  up
1.2.2 by Camm Maguire
Import upstream version 5.2.11
2764
@node Highlighting, Parens, Miscellaneous, Miscellaneous
1 by Camm Maguire
Import upstream version 5.1.20
2765
@section Syntactic highlighting of buffers
2766
2767
ESS provides Font-Lock (@pxref{Faces,,Using Multiple Typefaces,
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2768
emacs, The Gnu Emacs Reference Manual}) patterns for Inferior @Sl{} Mode, S
2769
Mode, and @Sl{} Transcript Mode buffers.
1 by Camm Maguire
Import upstream version 5.1.20
2770
@cindex Font-lock mode
2771
@cindex highlighting
2772
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2773
Syntax highlighting within ESS buffers is controlled by the variable
1.3.8 by Dirk Eddelbuettel
Import upstream version 5.5
2774
@code{ess-font-lock-mode}, which by default is true.
1.2.4 by Dirk Eddelbuettel
Import upstream version 5.3.8~svn3895
2775
Input to inferior ESS processes is also highlighted syntactically if
2776
@code{inferior-ess-font-lock-input} is non-nil (the default).
2777
If you change the value of either of these varibles, you need to restart
2778
emacs for your changes to take effect.
2779
2780
@c To activate highlighting, you need to turn on Font Lock mode in the
2781
@c appropriate buffers.  This can be done on a per-buffer basis with
2782
@c @kbd{M-x font-lock-mode}, or may be done by adding
2783
@c @code{turn-on-font-lock} to @code{inferior-ess-mode-hook},
2784
@c @code{ess-mode-hook} and @code{ess-transcript-mode-hook}.  Your systems
2785
@c administrator may have done this for you in @file{ess-site.el}
2786
@c (@pxref{Customization}).
2787
2788
The font-lock patterns are defined in the following variables, which you
2789
may modify if desired:
2790
2791
@defvar inferior-ess-R-font-lock-keywords
2792
Font-lock patterns for inferior *R* processes.  (There is a
2793
corresponding @code{inferior-ess-S-font-lock-keywords} for *S*
2794
processes.) The default value highlights prompts, inputs, assignments,
2795
output messages, vector and matrix labels, and literals such as
2796
@samp{NA} and @code{TRUE}.
2797
@end defvar
2798
2799
@defvar ess-R-mode-font-lock-keywords
2800
Font-lock patterns for ESS R programming mode.  (There is a
2801
corresponding @code{ess-S-mode-font-lock-keywords} for S buffers.) The
2802
default value highlights function names, literals, assignments, source
2803
functions and reserved words.
2804
@end defvar
2805
2806
2807
@c 2007-11-08 - this var no longer exists.
2808
@c @defvar ess-trans-font-lock-keywords
2809
@c Font-lock patterns for ESS Transcript Mode.  The default value
2810
@c highlights the same patterns as in Inferior ESS Mode.
2811
@c @end defvar
2812
1 by Camm Maguire
Import upstream version 5.1.20
2813
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2814
@comment  node-name,  next,  previous,  up
1.2.2 by Camm Maguire
Import upstream version 5.2.11
2815
@node Parens, Graphics, Highlighting, Miscellaneous
2816
@section Parenthesis matching
2817
2818
Emacs and XEmacs have facilities for highlighting the parenthesis
2819
matching the parenthesis at point.  This feature is very useful when
2820
trying to examine which parentheses match each other.  This highlighting
2821
also indicates when parentheses are not matching.  Depending on what
2822
version of emacs you use, one of the following should work in your
2823
initialisation file:
2824
2825
@example
2826
(paren-set-mode 'paren) ;for XEmacs
2827
(show-paren-mode t) ;for Emacs
2828
@end example
2829
2830
2831
2832
2833
2834
@comment  node-name,  next,  previous,  up
2835
@node Graphics, Imenu, Parens, Miscellaneous
1 by Camm Maguire
Import upstream version 5.1.20
2836
@section Using graphics with ESS
2837
2838
@cindex graphics
2839
One of the main features of the @code{S} package is its ability to
2840
generate high-resolution graphics plots, and ESS provides a number of
2841
features for dealing with such plots.
2842
2843
@menu
2844
* printer::                     The printer() graphics driver
2845
* X11::                         The X11() (and other X-windows based) driver
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2846
* winjava::                     Java Graphics Device
1 by Camm Maguire
Import upstream version 5.1.20
2847
@end menu
2848
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2849
@comment  node-name,  next,  previous,  up
1 by Camm Maguire
Import upstream version 5.1.20
2850
@node printer, X11, Graphics, Graphics
2851
@subsection Using ESS with the @code{printer()} driver
2852
2853
This is the simplest (and least desirable) method of using graphics
2854
within ESS.  S's @code{printer()} device driver produces crude character
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2855
based plots which can be contained within the ESS process buffer
2856
itself.  To start using character graphics, issue the @Sl{} command
1 by Camm Maguire
Import upstream version 5.1.20
2857
@example
2858
printer(width=79)
2859
@end example
2860
@pindex printer()
2861
(the @code{width=79} argument prevents Emacs line-wrapping at column
2862
80 on an 80-column terminal.  Use a different value for a terminal with
2863
a different number of columns.) Plotting commands do not generate
2864
graphics immediately, but are stored until the @code{show()} command
2865
is issued, which displays the current figure.
2866
1.1.1 by Camm Maguire
Import upstream version 5.1.24
2867
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2868
@node X11, winjava, printer, Graphics
1 by Camm Maguire
Import upstream version 5.1.20
2869
@subsection Using ESS with windowing devices
2870
2871
@cindex X windows
2872
Of course, the ideal way to use graphics with ESS is to use a windowing
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2873
system.  Under X11, this requires that the DISPLAY environment
1 by Camm Maguire
Import upstream version 5.1.20
2874
variable be appropriately set, which may not always be the case within
2875
your Emacs process.  ESS provides a facility for setting the value of
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2876
DISPLAY before the ESS process is started if the variable
1 by Camm Maguire
Import upstream version 5.1.20
2877
@code{ess-ask-about-display}
2878
@pindex ess-ask-about-display
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2879
is non-@code{nil}.
2880
2881
@comment  node-name,  next,  previous,  up
2882
@node winjava,  , X11, Graphics
2883
@subsection Java Graphics Device
2884
2885
@cindex winjava
2886
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2887
S+6.1 and newer on Windows contains a java library that supports graphics.  Send
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2888
the commands:
2889
2890
@example
2891
library(winjava)
2892
java.graph()
2893
@end example
2894
2895
@noindent to start the graphics driver.  This allows you to use ESS for both
2896
interaction and graphics within S-PLUS.  (Thanks to Tim Hesterberg for
2897
this information.)
2898
2899
@comment  node-name,  next,  previous,  up
2900
@node Imenu, Toolbar, Graphics, Miscellaneous
2901
@section Imenu
2902
2903
Imenu is an Emacs tool for providing mode-specific buffer indexes.  In
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2904
some of the ESS editing modes (currently SAS and S), support for Imenu
2905
is provided.  For example, in S mode buffers, the menubar should display
2906
an item called "Imenu-S".  Within this menubar you will then be offered
2907
bookmarks to particular parts of your source file (such as the starting
2908
point of each function definition).
2909
2910
Imenu works by searching your buffer for lines that match what ESS
2911
thinks is the beginning of a suitable entry, e.g. the beginning of a
2912
function definition.  To examine the regular expression that ESS uses,
2913
check the value of @code{imenu-generic-expression}.  This value is set
2914
by various ESS variables such as @code{ess-imenu-S-generic-expression}.
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2915
2916
@comment  node-name,  next,  previous,  up
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2917
@node Toolbar, TAGS, Imenu, Miscellaneous
1.1.2 by Camm Maguire
Import upstream version 5.2.3
2918
@section Toolbar
2919
2920
The R and S editing modes have support for a toolbar.  This toolbar
2921
provides icons to act as shortcuts for starting new S/R processes, or
2922
for evaluating regions of your source buffers.  The toolbar should be
2923
present if your emacs can display images.  @xref{Customization}, for ways
2924
to change the toolbar.
2925
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2926
@comment  node-name,  next,  previous,  up
2927
@node TAGS, Rdired, Toolbar, Miscellaneous
2928
@section TAGS
2929
2930
The Emacs tags facility can be used to navigate around your files
2931
containing definitions of S functions.  This facility is independent of
2932
ESS usage, but is written here since ESS users may wish to take
2933
advantage of TAGS facility.  Read more about emacs tags in an emacs
2934
manual.
2935
2936
Etags, the program that generates the TAGS file, does not yet know the
2937
syntax to recognise function definitions in S files.  Hence, you will
2938
need to provide a regexp that matches your function definitions.  Here
2939
is an example call (broken over two lines; type as one line) that should
2940
be appropriate.
2941
2942
@example
2943
etags --language=none
2944
--regex='/\([^ \t]+\)[ \t]*<-[ \t]*function/\1/' *.R
2945
@end example
2946
2947
This will find entries in your source file of the form:
2948
2949
@example
2950
some.name <- function
2951
@end example
2952
2953
with the function name starting in column 0.  Windows users may need to
2954
change the single quotes to double quotes.
2955
1.4.2 by Dirk Eddelbuettel
Import upstream version 5.4
2956
R version 2.9.0 introduced a front-end script for finding R tags, which
3.1.16 by Dirk Eddelbuettel
lisp/*: Upgraded to svn revision 5352 with a fix by Sebastian Luque
2957
calls the @samp{rtags()} function.  By default, this script will
1.4.2 by Dirk Eddelbuettel
Import upstream version 5.4
2958
recursively search the directories for relevant tags in R/C/Rd files.
2959
To use this script from the command line, try the following to get
2960
started:
2961
2962
@example
2963
R CMD rtags --help
2964
@end example
2965
3.1.16 by Dirk Eddelbuettel
lisp/*: Upgraded to svn revision 5352 with a fix by Sebastian Luque
2966
For further details, see @uref{http://developer.r-project.org/rtags.html}
1.4.2 by Dirk Eddelbuettel
Import upstream version 5.4
2967
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2968
@comment  node-name,  next,  previous,  up
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
2969
@node Rdired, Rutils, TAGS, Miscellaneous
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2970
@section Rdired
2971
2972
Ess-rdired provides a dired-like buffer for viewing, editing and
2973
plotting objects in your current R session.  If you are used to using
2974
the dired (directory editor) facility in Emacs, this mode gives you
2975
similar functionality for R objects.
2976
2977
To get started, first make sure you can load ess-rdired.  Add the
2978
following to your .emacs and then restart emacs.
2979
@example
1.2.2 by Camm Maguire
Import upstream version 5.2.11
2980
(autoload 'ess-rdired "ess-rdired"
1.2.1 by Camm Maguire
Import upstream version 5.2.6
2981
  "View *R* objects in a dired-like buffer." t)
2982
@end example
2983
2984
Start an R session with @kbd{M-x R} and then store a few
2985
variables, such as:
2986
2987
@example
2988
s <- sin(seq(from=0, to=8*pi, length=100))
2989
x <- c(1, 4, 9)
2990
y <- rnorm(20)
2991
z <- TRUE
2992
@end example
2993
2994
Then use @kbd{M-x ess-rdired} to create a buffer listing the
2995
objects in your current environment and display it in a new window:
2996
@example
2997
            mode length
2998
  s      numeric    100
2999
  x      numeric      3
3000
  y      numeric     20
3001
  z      logical      1
3002
@end example
3003
3004
Type @kbd{C-h m} or @kbd{?} to get a list of the keybindings for this
3005
mode.  For example, with your point on the line of a variable, `p' will
3006
plot the object, `v' will view it, and `d' will mark the object for
3007
deletion (`x' will actually perform the deletion).
3008
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
3009
3010
@comment  node-name,  next,  previous,  up
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
3011
@node Rutils, Org, Rdired, Miscellaneous
1.3.13 by Dirk Eddelbuettel
Import upstream version 5.9
3012
@section Rutils
3013
3014
Ess-rutils builds up on ess-rdired, providing key bindings for
3015
performing basic R functions in the inferior-ESS process buffer, such as
3016
loading and managing packages, object manipulation (listing, viewing,
3017
and deleting), and alternatives to @code{help.start()} and
3018
@code{RSiteSearch()} that use the @command{browse-url} Emacs function.
3019
The library can be loaded using @kbd{M-x load-file}, but the easiest is
3020
to include:
3021
3022
@lisp
3023
(require 'ess-rutils)
3024
@end lisp
3025
3026
in your .emacs.  Once R is started with @kbd{M-x R}, and if the value of
3027
the customizable variable @code{ess-rutils-keys} is true, several key
3028
bindings become available in iESS process buffers:
3029
3030
@itemize @bullet
3031
@item
3032
@kbd{C-c C-. l} (@command{ess-rutils-localpkgs}) @*
3033
@pindex ess-rutils-localpkgs
3034
List all packages in all available libraries.
3035
3036
@item
3037
@kbd{C-c C-. r} (@command{ess-rutils-repospkgs}) @*
3038
@pindex ess-rutils-repospkgs
3039
List available packages from repositories listed by
3040
@command{getOptions(``repos'')} in the current R session.
3041
3042
@item
3043
@kbd{C-c C-. u} (@command{ess-rutils-updatepkgs}) @*
3044
@pindex ess-rutils-updatepkgs
3045
Update packages in a particular library and repository.
3046
3047
@item
3048
@kbd{C-c C-. a} (@command{ess-rutils-apropos}) @*
3049
@pindex ess-rutils-apropos
3050
Search for a string using apropos.
3051
3052
@item
3053
@kbd{C-c C-. m} (@command{ess-rutils-rmall}) @*
3054
@pindex ess-rutils-rmall
3055
Remove all R objects.
3056
3057
@item
3058
@kbd{C-c C-. o} (@command{ess-rutils-objs}) @*
3059
@pindex ess-rutils-objs
3060
Manipulate R objects; wrapper for @command{ess-rdired}.
3061
3062
@item
3063
@kbd{C-c C-. w} (@command{ess-rutils-loadwkspc}) @*
3064
@pindex ess-rutils-loadwkspc
3065
Load a workspace file into R.
3066
3067
@item
3068
@kbd{C-c C-. s} (@command{ess-rutils-savewkspc}) @*
3069
@pindex ess-rutils-savewkspc
3070
Save a workspace file.
3071
3072
@item
3073
@kbd{C-c C-. d} (@command{ess-change-directory}) @*
3074
@pindex ess-change-directory
3075
Change the working directory for the current R session.
3076
3077
@item
3078
@kbd{C-c C-. H} (@command{ess-rutils-htmldocs}) @*
3079
@pindex ess-rutils-htmldocs
3080
Use @command{browse-url} to navigate R html documentation.
3081
3082
@end itemize
3083
3084
See the submenu @samp{Rutils} under the iESS menu for alternative access
3085
to these functions.  The function @command{ess-rutils-rsitesearch} is
3086
provided without a particular key binding.  This function is useful in
3087
any Emacs buffer, so can be bound to a user-defined key:
3088
3089
@lisp
3090
(eval-after-load "ess-rutils"
3091
  '(global-set-key [(control c) (f6)] 'ess-rutils-rsitesearch))
3092
@end lisp
3093
@pindex ess-rutils-rsitesearch
3094
3095
Functions for listing objects and packages
3096
(@command{ess-rutils-localpkgs}, @command{ess-rutils-repospkgs}, and
3097
@command{ess-rutils-objs}) show results in a separate buffer and window,
3098
in @code{ess-rutils-mode}, providing useful key bindings in this mode
3099
(type @kbd{?} in this buffer for a description).
3100
3101
3102
1.2.18 by Dirk Eddelbuettel
Import upstream version 5.12
3103
@comment  node-name,  next,  previous,  up
3104
@node Org,  , Rutils, Miscellaneous
3105
@section Interaction with Org mode
3106
3107
Org-mode (@uref{http://orgmode.org} now supports reproducible research
3108
and literate programming in many languages (including R) -- see chapter
3109
14 of the Org manual
3110
(@uref{http://orgmode.org/org.html#Working-With-Source-Code}.  For ESS
3111
users, this offers a document-based work environment within which to
3112
embed ESS usage.  R code lives in code blocks of an Org document, from
3113
which it can be edited in ess-mode, evaluated, extracted ("tangled") to
3114
pure code files.  The code can also be exported ("woven") with the
3115
surrounding text to several formats including HTML and LaTeX.  Results of
3116
evaluation including figures can be captured in the Org document, and
3117
data can be passed from the Org document (e.g. from a table) to the ESS
3118
R process.  (This section contributed by Dan Davison and Eric Schulte.)
3119
1 by Camm Maguire
Import upstream version 5.1.20
3120
@comment  node-name,  next,  previous,  up@chapter Using S4
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3121
@node Mailing lists/bug reports, Customization, Miscellaneous, Top
1 by Camm Maguire
Import upstream version 5.1.20
3122
@chapter Bugs and Bug Reporting, Mailing Lists
3123
3124
@menu
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3125
* Bugs::
3126
* Reporting Bugs::
3127
* Mailing Lists::
1.3.1 by Camm Maguire
Import upstream version 5.3.0
3128
* Help with emacs::
1 by Camm Maguire
Import upstream version 5.1.20
3129
@end menu
3130
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3131
@node Bugs, Reporting Bugs, Mailing lists/bug reports, Mailing lists/bug reports
1 by Camm Maguire
Import upstream version 5.1.20
3132
@section Bugs
3133
@cindex bugs
3134
@include bugs.texi
3135
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3136
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3137
@node Reporting Bugs, Mailing Lists, Bugs, Mailing lists/bug reports
1 by Camm Maguire
Import upstream version 5.1.20
3138
@section Reporting Bugs
3139
@cindex Bug reports
3140
@pindex ess-submit-bug-report
3141
@include bugrept.texi
3142
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3143
@comment  node-name,  next,  previous,  up
1.3.1 by Camm Maguire
Import upstream version 5.3.0
3144
@node Mailing Lists, Help with emacs, Reporting Bugs, Mailing lists/bug reports
1 by Camm Maguire
Import upstream version 5.1.20
3145
@section Mailing Lists
3146
3147
@include mailing.texi
3148
1.3.1 by Camm Maguire
Import upstream version 5.3.0
3149
@comment  node-name,  next,  previous,  up
3150
@node Help with emacs,  , Mailing Lists, Mailing lists/bug reports
3151
@section Help with emacs
3152
3153
Emacs is a complex editor with many abilities that we do not have space
3154
to describe here.  If you have problems with other features of emacs
3155
(e.g. printing), there are several sources to consult, including the
3156
emacs FAQs (try @kbd{M-x xemacs-www-faq} or @kbd{M-x view-emacs-FAQ})
3157
and EmacsWiki (@uref{http://www.emacswiki.org}).  Please consult them
3158
before asking on the mailing list about issues that are not specific to
3159
ESS.
3160
3161
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3162
@c _not_yet_ @node Help OS, Installation, Help for Statistical Packages, Top
3163
@c _not_yet_ @comment  node-name,  next,  previous,  up
3164
@c _not_yet_ @chapter Help, arranged by Operating System
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3165
@c _not_yet_
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3166
@c _not_yet_ @menu
3167
@c _not_yet_ * Unix installation::
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3168
@c _not_yet_ * Microsoft Windows installation::
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3169
@c _not_yet_ * System dependent::            Other variables you may need to change
3170
@c _not_yet_ @end menu
3171
3172
3173
3174
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3175
@node Customization, Key Index, Mailing lists/bug reports, Top
1 by Camm Maguire
Import upstream version 5.1.20
3176
@appendix Customizing ESS
3177
@cindex customization
3178
3179
ESS can be easily customized to your taste simply by including the
3180
appropriate lines in your @file{.emacs} file.  There are numerous
3181
variables which affect the behavior of ESS in certain situations which
3182
can be modified to your liking.  Keybindings may be set or changed to
3183
your preferences, and for per-buffer customizations hooks are also
3184
available.
3185
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3186
Most of these variables can be viewed and set using the Custom facility
3187
within Emacs.  Type @kbd{M-x customize-group RET ess RET} to see all the
3188
ESS variables that can be customized.  Variables are grouped by subject
3189
to make it easy to find related variables.
3190
3191
@c Stephen deleted incomplete variable list Wed 25 Aug 2004.
3192
3193
@node Key Index, Concept Index, Customization, Top
1 by Camm Maguire
Import upstream version 5.1.20
3194
@unnumbered Key (Character) Index
3195
@printindex ky
3196
3197
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3198
@c @node Command Index, Concept Index, Key Index, Top
3199
@c @unnumbered Command and Function Index
3200
@c @printindex fn
1.2.1 by Camm Maguire
Import upstream version 5.2.6
3201
3202
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3203
@comment  node-name,  next,  previous,  up
1.1.2 by Camm Maguire
Import upstream version 5.2.3
3204
@node Concept Index, Variable and command index, Key Index, Top
1 by Camm Maguire
Import upstream version 5.1.20
3205
@unnumbered Concept Index
3206
@printindex cp
3207
3208
@node Variable and command index,  , Concept Index, Top
3209
@unnumbered Variable and command index
3210
@printindex vr
3211
3212
@contents
3213
3214
@bye
3215
@c Remember to delete these lines before creating the info file.
1.1.1 by Camm Maguire
Import upstream version 5.1.24
3216
@c Why?  I makeinfo all of the time without following this advice.
1 by Camm Maguire
Import upstream version 5.1.20
3217
@iftex
3218
@lucidbook
3219
@bindingoffset = 0.5in
3220
@parindent = 0pt
3221
@end iftex
3222
3223
@comment Local Variables:
3224
@comment TeX-master: "ess.texi"
3225
@comment End: