aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-24 21:47:17 +0000
committerRichard M. Stallman1994-04-24 21:47:17 +0000
commita890e1b0e0febe63cec6575e20c5b51073c00e9f (patch)
treed559f9ffa7e5ba3ac875a8add0139f518be36909
parent68e23dc976fb8248db11337964cc8b146283e051 (diff)
downloademacs-a890e1b0e0febe63cec6575e20c5b51073c00e9f.tar.gz
emacs-a890e1b0e0febe63cec6575e20c5b51073c00e9f.zip
*** empty log message ***
-rw-r--r--lispref/display.texi7
-rw-r--r--lispref/internals.texi496
-rw-r--r--lispref/os.texi22
-rw-r--r--lispref/positions.texi86
-rw-r--r--lispref/searching.texi10
5 files changed, 385 insertions, 236 deletions
diff --git a/lispref/display.texi b/lispref/display.texi
index ac8875a5901..165c9bd3259 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -136,7 +136,7 @@ text line are called @dfn{continuation} lines. Normally, a @samp{$} in
136the rightmost column of the window indicates truncation; a @samp{\} on 136the rightmost column of the window indicates truncation; a @samp{\} on
137the rightmost column indicates a line that ``wraps'' or is continued 137the rightmost column indicates a line that ``wraps'' or is continued
138onto the next line. (The display table can specify alternative 138onto the next line. (The display table can specify alternative
139indicators; see @ref{Display Table}.) 139indicators; see @ref{Display Tables}.)
140 140
141 Note that continuation is different from filling; continuation happens 141 Note that continuation is different from filling; continuation happens
142on the screen only, not in the buffer contents, and it breaks a line 142on the screen only, not in the buffer contents, and it breaks a line
@@ -538,8 +538,9 @@ the range of the overlay. This feature may be temporary, like
538@kindex modification-hooks @r{(overlay property)} 538@kindex modification-hooks @r{(overlay property)}
539This property's value is a list of functions to be called if any 539This property's value is a list of functions to be called if any
540character within the overlay is changed or if text is inserted strictly 540character within the overlay is changed or if text is inserted strictly
541within the overlay. Each function receives two arguments: the beginning 541within the overlay. Each function receives three arguments: the
542and end of the part of the buffer being modified. 542overlay, and the beginning and end of the part of the buffer being
543modified.
543 544
544@item insert-in-front-hooks 545@item insert-in-front-hooks
545@kindex insert-in-front-hooks @r{(overlay property)} 546@kindex insert-in-front-hooks @r{(overlay property)}
diff --git a/lispref/internals.texi b/lispref/internals.texi
index 64892ae6aed..ec05340fb5d 100644
--- a/lispref/internals.texi
+++ b/lispref/internals.texi
@@ -58,9 +58,9 @@ named @file{emacs}.
58 58
59 Some operating systems don't support dumping. On those systems, you 59 Some operating systems don't support dumping. On those systems, you
60must start Emacs with the @samp{temacs -l loadup} command each time you 60must start Emacs with the @samp{temacs -l loadup} command each time you
61use it. This takes a long time, but since you need to start Emacs once 61use it. This takes a substantial time, but since you need to start
62a day at most---or once a week if you never log out---the extra time is 62Emacs once a day at most---or once a week if you never log out---the
63not too severe a problem. 63extra time is not too severe a problem.
64 64
65@cindex @file{site-load.el} 65@cindex @file{site-load.el}
66 You can specify additional files to preload by writing a library named 66 You can specify additional files to preload by writing a library named
@@ -72,18 +72,18 @@ decreases as machines get faster. On modern machines, it is usually not
72advisable. 72advisable.
73 73
74@cindex @file{site-init.el} 74@cindex @file{site-init.el}
75 You can specify other things to be done in Lisp just before dumping by 75 You can specify other Lisp expressions to execute just before dumping
76putting them in a library named @file{site-init.el}. However, if these 76by putting them in a library named @file{site-init.el}. However, if
77things might alter the behavior that users expect from an ordinary 77they might alter the behavior that users expect from an ordinary
78unmodified Emacs, it is better to do them in @file{default.el}, so that 78unmodified Emacs, it is better to put them in @file{default.el}, so that
79users can override them if they wish. @xref{Start-up Summary}. 79users can override them if they wish. @xref{Start-up Summary}.
80 80
81 Before @file{emacs} is dumped, the documentation strings for primitive 81 Before @file{loadup.el} dumps the new executable, it finds the
82and preloaded functions (and variables) need to be found in the file 82documentation strings for primitive and preloaded functions (and
83where they are stored. This is done by calling 83variables) in the file where they are stored, by calling
84@code{Snarf-documentation} (@pxref{Accessing Documentation}). These 84@code{Snarf-documentation} (@pxref{Accessing Documentation}). These
85strings were moved out of @file{emacs} to make it smaller. 85strings were moved out of the @file{emacs} executable to make it
86@xref{Documentation Basics}. 86smaller. @xref{Documentation Basics}.
87 87
88@defun dump-emacs to-file from-file 88@defun dump-emacs to-file from-file
89@cindex unexec 89@cindex unexec
@@ -129,16 +129,29 @@ The value of this variable is the version of Emacs being run. It is a
129string such as @code{"19.22.1"}. 129string such as @code{"19.22.1"}.
130@end defvar 130@end defvar
131 131
132 The following two variables did not exist before Emacs version 19.23,
133which reduces their usefulness at present, but we hope they will be
134convenient in the future.
135
136@defvar emacs-major-version
137The major version number of Emacs, as an integer.
138@end defvar
139
140@defvar emacs-minor-version
141The minor version number of Emacs, as an integer. For Emacs version
14219.23, the value is 23.
143@end defvar
144
132@node Pure Storage, Garbage Collection, Building Emacs, GNU Emacs Internals 145@node Pure Storage, Garbage Collection, Building Emacs, GNU Emacs Internals
133@appendixsec Pure Storage 146@appendixsec Pure Storage
134@cindex pure storage 147@cindex pure storage
135 148
136 There are two types of storage in GNU Emacs Lisp for user-created Lisp 149 Emacs Lisp uses two kinds of storage for user-created Lisp objects:
137objects: @dfn{normal storage} and @dfn{pure storage}. Normal storage is 150@dfn{normal storage} and @dfn{pure storage}. Normal storage is where
138where all the new data which is created during an Emacs session is kept; 151all the new data which is created during an Emacs session is kept; see
139see the following section for information on normal storage. Pure 152the following section for information on normal storage. Pure storage
140storage is used for certain data in the preloaded standard Lisp files: 153is used for certain data in the preloaded standard Lisp files---data
141data that should never change during actual use of Emacs. 154that should never change during actual use of Emacs.
142 155
143 Pure storage is allocated only while @file{temacs} is loading the 156 Pure storage is allocated only while @file{temacs} is loading the
144standard preloaded Lisp libraries. In the file @file{emacs}, it is 157standard preloaded Lisp libraries. In the file @file{emacs}, it is
@@ -146,17 +159,17 @@ marked as read-only (on operating systems which permit this), so that
146the memory space can be shared by all the Emacs jobs running on the 159the memory space can be shared by all the Emacs jobs running on the
147machine at once. Pure storage is not expandable; a fixed amount is 160machine at once. Pure storage is not expandable; a fixed amount is
148allocated when Emacs is compiled, and if that is not sufficient for the 161allocated when Emacs is compiled, and if that is not sufficient for the
149preloaded libraries, @file{temacs} crashes. If that happens, you will 162preloaded libraries, @file{temacs} crashes. If that happens, you must
150have to increase the compilation parameter @code{PURESIZE} in the file 163increase the compilation parameter @code{PURESIZE} in the file
151@file{src/puresize.h}. This normally won't happen unless you try to 164@file{src/puresize.h}. This normally won't happen unless you try to
152preload additional libraries or add features to the standard ones. 165preload additional libraries or add features to the standard ones.
153 166
154@defun purecopy object 167@defun purecopy object
155 This function makes a copy of @var{object} in pure storage and returns 168This function makes a copy of @var{object} in pure storage and returns
156it. It copies strings by simply making a new string with the same 169it. It copies strings by simply making a new string with the same
157characters in pure storage. It recursively copies the contents of 170characters in pure storage. It recursively copies the contents of
158vectors and cons cells. It does not make copies of symbols, or any 171vectors and cons cells. It does not make copies of other objects such
159other objects, but just returns them unchanged. It signals an error if 172as symbols, but just returns them unchanged. It signals an error if
160asked to copy markers. 173asked to copy markers.
161 174
162This function is used only while Emacs is being built and dumped; it is 175This function is used only while Emacs is being built and dumped; it is
@@ -164,23 +177,24 @@ called only in the file @file{emacs/lisp/loaddefs.el}.
164@end defun 177@end defun
165 178
166@defvar pure-bytes-used 179@defvar pure-bytes-used
167 The value of this variable is the number of bytes of pure storage 180The value of this variable is the number of bytes of pure storage
168allocated so far. Typically, in a dumped Emacs, this number is very 181allocated so far. Typically, in a dumped Emacs, this number is very
169close to the total amount of pure storage available---if it were not, 182close to the total amount of pure storage available---if it were not,
170we would preallocate less. 183we would preallocate less.
171@end defvar 184@end defvar
172 185
173@defvar purify-flag 186@defvar purify-flag
174 This variable determines whether @code{defun} should make a copy of the 187This variable determines whether @code{defun} should make a copy of the
175function definition in pure storage. If it is non-@code{nil}, then the 188function definition in pure storage. If it is non-@code{nil}, then the
176function definition is copied into pure storage. 189function definition is copied into pure storage.
177 190
178 This flag is @code{t} while loading all of the basic functions for 191This flag is @code{t} while loading all of the basic functions for
179building Emacs initially (allowing those functions to be sharable and 192building Emacs initially (allowing those functions to be sharable and
180non-collectible). It is set to @code{nil} when Emacs is saved out 193non-collectible). Dumping Emacs as an executable always writes
181as @file{emacs}. The flag is set and reset in the C sources. 194@code{nil} in this variable, regardless of the value it actually has
195before and after dumping.
182 196
183 You should not change this flag in a running Emacs. 197You should not change this flag in a running Emacs.
184@end defvar 198@end defvar
185 199
186@node Garbage Collection, Writing Emacs Primitives, Pure Storage, GNU Emacs Internals 200@node Garbage Collection, Writing Emacs Primitives, Pure Storage, GNU Emacs Internals
@@ -189,41 +203,40 @@ as @file{emacs}. The flag is set and reset in the C sources.
189 203
190@cindex memory allocation 204@cindex memory allocation
191 When a program creates a list or the user defines a new function (such 205 When a program creates a list or the user defines a new function (such
192as by loading a library), then that data is placed in normal storage. 206as by loading a library), that data is placed in normal storage. If
193If normal storage runs low, then Emacs asks the operating system to 207normal storage runs low, then Emacs asks the operating system to
194allocate more memory in blocks of 1k bytes. Each block is used for one 208allocate more memory in blocks of 1k bytes. Each block is used for one
195type of Lisp object, so symbols, cons cells, markers, etc.@: are 209type of Lisp object, so symbols, cons cells, markers, etc., are
196segregated in distinct blocks in memory. (Vectors, buffers and certain 210segregated in distinct blocks in memory. (Vectors, long strings,
197other editing types, which are fairly large, are allocated in individual 211buffers and certain other editing types, which are fairly large, are
198blocks, one per object, while strings are packed into blocks of 8k 212allocated in individual blocks, one per object, while small strings are
199bytes.) 213packed into blocks of 8k bytes.)
200 214
201 It is quite common to use some storage for a while, then release it 215 It is quite common to use some storage for a while, then release it by
202by, for example, killing a buffer or deleting the last pointer to an 216(for example) killing a buffer or deleting the last pointer to an
203object. Emacs provides a @dfn{garbage collector} to reclaim this 217object. Emacs provides a @dfn{garbage collector} to reclaim this
204abandoned storage. (This name is traditional, but ``garbage recycler'' 218abandoned storage. (This name is traditional, but ``garbage recycler''
205might be a more intuitive metaphor for this facility.) 219might be a more intuitive metaphor for this facility.)
206 220
207 The garbage collector operates by scanning all the objects that have 221 The garbage collector operates by finding and marking all Lisp objects
208been allocated and marking those that are still accessible to Lisp 222that are still accessible to Lisp programs. To begin with, it assumes
209programs. To begin with, all the symbols, their values and associated 223all the symbols, their values and associated function definitions, and
210function definitions, and any data presently on the stack, are 224any data presently on the stack, are accessible. Any objects which can
211accessible. Any objects which can be reached indirectly through other 225be reached indirectly through other accessible objects are also
212accessible objects are also accessible. 226accessible.
213 227
214 When this is finished, all inaccessible objects are garbage. No 228 When marking is finished, all objects still unmarked are garbage. No
215matter what the Lisp program or the user does, it is impossible to refer 229matter what the Lisp program or the user does, it is impossible to refer
216to them, since there is no longer a way to reach them. Their 230to them, since there is no longer a way to reach them. Their space
217space might as well be reused, since no one will notice. That is what 231might as well be reused, since no one will miss them. The second,
218the garbage collector arranges to do. 232``sweep'' phase of the garbage collector arranges to reuse them.
219 233
220@cindex free list 234@cindex free list
221 Unused cons cells are chained together onto a @dfn{free list} for 235 The sweep phase puts unused cons cells onto a @dfn{free list}
222future allocation; likewise for symbols and markers. The accessible 236for future allocation; likewise for symbols and markers. It compacts
223strings are compacted so they are contiguous in memory; then the rest of 237the accessible strings so they occupy fewer 8k blocks; then it frees the
224the space formerly occupied by strings is made available to the string 238other 8k blocks. Vectors, buffers, windows and other large objects are
225creation functions. Vectors, buffers, windows and other large objects 239individually allocated and freed using @code{malloc} and @code{free}.
226are individually allocated and freed using @code{malloc}.
227 240
228@cindex CL note---allocate more storage 241@cindex CL note---allocate more storage
229@quotation 242@quotation
@@ -241,28 +254,30 @@ collection).
241@end quotation 254@end quotation
242 255
243@deffn Command garbage-collect 256@deffn Command garbage-collect
244 This command runs a garbage collection, and returns information on 257This command runs a garbage collection, and returns information on
245the amount of space in use. (Garbage collection can also occur 258the amount of space in use. (Garbage collection can also occur
246spontaneously if you use more than @code{gc-cons-threshold} bytes of 259spontaneously if you use more than @code{gc-cons-threshold} bytes of
247Lisp data since the previous garbage collection.) 260Lisp data since the previous garbage collection.)
248 261
249 @code{garbage-collect} returns a list containing the following 262@code{garbage-collect} returns a list containing the following
250information: 263information:
251 264
252@smallexample 265@example
253@group 266@group
254((@var{used-conses} . @var{free-conses}) 267((@var{used-conses} . @var{free-conses})
255 (@var{used-syms} . @var{free-syms}) 268 (@var{used-syms} . @var{free-syms})
269@end group
256 (@var{used-markers} . @var{free-markers}) 270 (@var{used-markers} . @var{free-markers})
257 @var{used-string-chars} 271 @var{used-string-chars}
258 @var{used-vector-slots} 272 @var{used-vector-slots}
259 (@var{used-floats} . @var{free-floats})) 273 (@var{used-floats} . @var{free-floats}))
260 274
275@group
261(garbage-collect) 276(garbage-collect)
262 @result{} ((3435 . 2332) (1688 . 0) 277 @result{} ((3435 . 2332) (1688 . 0)
263 (57 . 417) 24510 3839 (4 . 1)) 278 (57 . 417) 24510 3839 (4 . 1))
264@end group 279@end group
265@end smallexample 280@end example
266 281
267Here is a table explaining each element: 282Here is a table explaining each element:
268 283
@@ -306,22 +321,22 @@ operating system, but that are not currently being used.
306@end deffn 321@end deffn
307 322
308@defopt gc-cons-threshold 323@defopt gc-cons-threshold
309 The value of this variable is the number of bytes of storage that must 324The value of this variable is the number of bytes of storage that must
310be allocated for Lisp objects after one garbage collection in order to 325be allocated for Lisp objects after one garbage collection in order to
311request another garbage collection. A cons cell counts as eight bytes, 326trigger another garbage collection. A cons cell counts as eight bytes,
312a string as one byte per character plus a few bytes of overhead, and so 327a string as one byte per character plus a few bytes of overhead, and so
313on. (Space allocated to the contents of buffers does not count.) Note 328on; space allocated to the contents of buffers does not count. Note
314that the new garbage collection does not happen immediately when the 329that the subsequent garbage collection does not happen immediately when
315threshold is exhausted, but only the next time the Lisp evaluator is 330the threshold is exhausted, but only the next time the Lisp evaluator is
316called. 331called.
317 332
318 The initial threshold value is 100,000. If you specify a larger 333The initial threshold value is 100,000. If you specify a larger
319value, garbage collection will happen less often. This reduces the 334value, garbage collection will happen less often. This reduces the
320amount of time spent garbage collecting, but increases total memory use. 335amount of time spent garbage collecting, but increases total memory use.
321You may want to do this when running a program which creates lots of 336You may want to do this when running a program which creates lots of
322Lisp data. 337Lisp data.
323 338
324 You can make collections more frequent by specifying a smaller value, 339You can make collections more frequent by specifying a smaller value,
325down to 10,000. A value less than 10,000 will remain in effect only 340down to 10,000. A value less than 10,000 will remain in effect only
326until the subsequent garbage collection, at which time 341until the subsequent garbage collection, at which time
327@code{garbage-collect} will set the threshold back to 10,000. 342@code{garbage-collect} will set the threshold back to 10,000.
@@ -354,11 +369,11 @@ appearance.)
354@smallexample 369@smallexample
355@group 370@group
356DEFUN ("or", For, Sor, 0, UNEVALLED, 0, 371DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
357 "Eval args until one of them yields non-NIL, then return that value.\n\ 372 "Eval args until one of them yields non-nil, then return that value.\n\
358The remaining args are not evalled at all.\n\ 373The remaining args are not evalled at all.\n\
359@end group 374@end group
360@group 375@group
361If all args return NIL, return NIL.") 376If all args return nil, return nil.")
362 (args) 377 (args)
363 Lisp_Object args; 378 Lisp_Object args;
364@{ 379@{
@@ -368,7 +383,7 @@ If all args return NIL, return NIL.")
368@end group 383@end group
369 384
370@group 385@group
371 if (NULL(args)) 386 if (NULL (args))
372 return Qnil; 387 return Qnil;
373 388
374 args_left = args; 389 args_left = args;
@@ -383,7 +398,7 @@ If all args return NIL, return NIL.")
383 break; 398 break;
384 args_left = Fcdr (args_left); 399 args_left = Fcdr (args_left);
385 @} 400 @}
386 while (!NULL(args_left)); 401 while (!NULL (args_left));
387@end group 402@end group
388 403
389@group 404@group
@@ -394,7 +409,7 @@ If all args return NIL, return NIL.")
394@end smallexample 409@end smallexample
395 410
396 Let's start with a precise explanation of the arguments to the 411 Let's start with a precise explanation of the arguments to the
397@code{DEFUN} macro. Here are the general names for them: 412@code{DEFUN} macro. Here is a template for them:
398 413
399@example 414@example
400DEFUN (@var{lname}, @var{fname}, @var{sname}, @var{min}, @var{max}, @var{interactive}, @var{doc}) 415DEFUN (@var{lname}, @var{fname}, @var{sname}, @var{min}, @var{max}, @var{interactive}, @var{doc})
@@ -402,8 +417,8 @@ DEFUN (@var{lname}, @var{fname}, @var{sname}, @var{min}, @var{max}, @var{interac
402 417
403@table @var 418@table @var
404@item lname 419@item lname
405This is the name of the Lisp symbol to define with this 420This is the name of the Lisp symbol to define as the function name; in
406function; in the example above, it is @code{or}. 421the example above, it is @code{or}.
407 422
408@item fname 423@item fname
409This is the C function name for this function. This is 424This is the C function name for this function. This is
@@ -424,24 +439,24 @@ convention, this name is always @var{fname} with @samp{F} replaced with
424@samp{S}. 439@samp{S}.
425 440
426@item min 441@item min
427This is the minimum number of arguments that the function requires. For 442This is the minimum number of arguments that the function requires. The
428@code{or}, no arguments are required. 443function @code{or} allows a minimum of zero arguments.
429 444
430@item max 445@item max
431This is the maximum number of arguments that the function accepts. 446This is the maximum number of arguments that the function accepts, if
432Alternatively, it can be @code{UNEVALLED}, indicating a special form 447there is a fixed maximum. Alternatively, it can be @code{UNEVALLED},
433that receives unevaluated arguments. A function with the equivalent of 448indicating a special form that receives unevaluated arguments, or
434an @code{&rest} argument would have @code{MANY} in this position. Both 449@code{MANY}, indicating an unlimited number of evaluated arguments (the
435@code{UNEVALLED} and @code{MANY} are macros. This argument must be one 450equivalent of @code{&rest}). Both @code{UNEVALLED} and @code{MANY} are
436of these macros or a number at least as large as @var{min}. It may not 451macros. If @var{max} is a number, it may not be less than @var{min} and
437be greater than six. 452it may not be greater than seven.
438 453
439@item interactive 454@item interactive
440This is an interactive specification, a string such as might be used as 455This is an interactive specification, a string such as might be used as
441the argument of @code{interactive} in a Lisp function. In the case of 456the argument of @code{interactive} in a Lisp function. In the case of
442@code{or}, it is 0 (a null pointer), indicating that @code{or} cannot be 457@code{or}, it is 0 (a null pointer), indicating that @code{or} cannot be
443called interactively. A value of @code{""} indicates an interactive 458called interactively. A value of @code{""} indicates a function that
444function taking no arguments. 459should receive no arguments when called interactively.
445 460
446@item doc 461@item doc
447This is the documentation string. It is written just like a 462This is the documentation string. It is written just like a
@@ -450,13 +465,15 @@ write @samp{\n\} at the end of each line. In particular, the first line
450should be a single sentence. 465should be a single sentence.
451@end table 466@end table
452 467
453 After the call to the @code{DEFUN} macro, you must write the list 468 After the call to the @code{DEFUN} macro, you must write the argument
454of argument names that every C function must have, followed by 469name list that every C function must have, followed by ordinary C
455ordinary C declarations for them. Normally, all the arguments must 470declarations for the arguments. For a function with a fixed maximum
456be declared as @code{Lisp_Object}. If the function has no upper limit 471number of arguments, declare a C argument for each Lisp argument, and
457on the number of arguments in Lisp, then in C it receives two arguments: 472give them all type @code{Lisp_Object}. If the function has no upper
458the number of Lisp arguments, and the address of a block containing their 473limit on the number of arguments in Lisp, then in C it receives two
459values. These have types @code{int} and @w{@code{Lisp_Object *}}. 474arguments: the first is the number of Lisp arguments, and the second is
475the address of a block containing their values. They have types
476@code{int} and @w{@code{Lisp_Object *}}.
460 477
461 Within the function @code{For} itself, note the use of the macros 478 Within the function @code{For} itself, note the use of the macros
462@code{GCPRO1} and @code{UNGCPRO}. @code{GCPRO1} is used to ``protect'' 479@code{GCPRO1} and @code{UNGCPRO}. @code{GCPRO1} is used to ``protect''
@@ -468,55 +485,56 @@ Lisp object that you intend to refer to again must be protected somehow.
468@code{UNGCPRO} cancels the protection of the variables that are 485@code{UNGCPRO} cancels the protection of the variables that are
469protected in the current function. It is necessary to do this explicitly. 486protected in the current function. It is necessary to do this explicitly.
470 487
471 For most data types, it suffices to know that one pointer to the 488 For most data types, it suffices to protect at least one pointer to
472object is protected; as long as the object is not recycled, all pointers 489the object; as long as the object is not recycled, all pointers to it
473to it remain valid. This is not so for strings, because the garbage 490remain valid. This is not so for strings, because the garbage collector
474collector can move them. When a string is moved, any pointers to it 491can move them. When the garbage collector moves a string, it relocates
475that the garbage collector does not know about will not be properly 492all the pointers it knows about; any other pointers become invalid.
476relocated. Therefore, all pointers to strings must be protected across 493Therefore, you must protect all pointers to strings across any point
477any point where garbage collection may be possible. 494where garbage collection may be possible.
478 495
479 The macro @code{GCPRO1} protects just one local variable. If you 496 The macro @code{GCPRO1} protects just one local variable. If you want
480want to protect two, use @code{GCPRO2} instead; repeating @code{GCPRO1} 497to protect two, use @code{GCPRO2} instead; repeating @code{GCPRO1} will
481will not work. There are also @code{GCPRO3} and @code{GCPRO4}. 498not work. Macros @code{GCPRO3} and @code{GCPRO4} also exist.
482 499
483 In addition to using these macros, you must declare the local 500 These macros implicitly use local variables such as @code{gcpro1}; you
484variables such as @code{gcpro1} which they implicitly use. If you 501must declare these explicitly, with type @code{struct gcpro}. Thus, if
485protect two variables, with @code{GCPRO2}, you must declare 502you use @code{GCPRO2}, you must declare @code{gcpro1} and @code{gcpro2}.
486@code{gcpro1} and @code{gcpro2}, as it uses them both. Alas, we can't 503Alas, we can't explain all the tricky details here.
487explain all the tricky details here. 504
488 505 Defining the C function is not enough to make a Lisp primitive
489 Defining the C function is not enough; you must also create the 506available; you must also create the Lisp symbol for the primitive and
490Lisp symbol for the primitive and store a suitable subr object 507store a suitable subr object in its function cell. The code looks like
491in its function cell. This is done by adding code to an initialization 508this:
492routine. The code looks like this:
493 509
494@example 510@example
495defsubr (&@var{subr-structure-name}); 511defsubr (&@var{subr-structure-name});
496@end example 512@end example
497 513
498@noindent 514@noindent
499@var{subr-structure-name} is the name you used as the third argument to 515Here @var{subr-structure-name} is the name you used as the third
500@code{DEFUN}. 516argument to @code{DEFUN}.
501 517
502 If you are adding a primitive to a file that already has Lisp 518 If you add a new primitive to a file that already has Lisp primitives
503primitives defined in it, find the function (near the end of the file) 519defined in it, find the function (near the end of the file) named
504named @code{syms_of_@var{something}}, and add that function call to it. 520@code{syms_of_@var{something}}, and add the call to @code{defsubr}
505If the file doesn't have this function, or if you create a new file, add 521there. If the file doesn't have this function, or if you create a new
506to it a @code{syms_of_@var{filename}} (e.g., @code{syms_of_myfile}). 522file, add to it a @code{syms_of_@var{filename}} (e.g.,
507Then find the spot in @file{emacs.c} where all of these functions are 523@code{syms_of_myfile}). Then find the spot in @file{emacs.c} where all
508called, and add a call to @code{syms_of_@var{filename}} there. 524of these functions are called, and add a call to
525@code{syms_of_@var{filename}} there.
509 526
510 This function @code{syms_of_@var{filename}} is also the place to 527 This function @code{syms_of_@var{filename}} is also the place to
511define any C variables which are to be visible as Lisp variables. 528define any C variables which are to be visible as Lisp variables.
512@code{DEFVAR_LISP} is used to make a C variable of type 529@code{DEFVAR_LISP} makes a C variable of type @code{Lisp_Object} visible
513@code{Lisp_Object} visible in Lisp. @code{DEFVAR_INT} is used to make a 530in Lisp. @code{DEFVAR_INT} makes a C variable of type @code{int}
514C variable of type @code{int} visible in Lisp with a value that is an 531visible in Lisp with a value that is always an integer.
515integer. 532@code{DEFVAR_BOOL} makes a C variable of type @code{int} visible in Lisp
533with a value that is either @code{t} or @code{nil}.
516 534
517 Here is another function, with more complicated arguments. This comes 535 Here is another example function, with more complicated arguments.
518from the code for the X Window System, and it demonstrates the use of 536This comes from the code for the X Window System, and it demonstrates
519macros and functions to manipulate Lisp objects. 537the use of macros and functions to manipulate Lisp objects.
520 538
521@smallexample 539@smallexample
522@group 540@group
@@ -547,9 +565,7 @@ DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
547 if ((XINT (xcoord) < XINT (XWINDOW (window)->left)) 565 if ((XINT (xcoord) < XINT (XWINDOW (window)->left))
548 || (XINT (xcoord) >= (XINT (XWINDOW (window)->left) 566 || (XINT (xcoord) >= (XINT (XWINDOW (window)->left)
549 + XINT (XWINDOW (window)->width)))) 567 + XINT (XWINDOW (window)->width))))
550 @{ 568 return Qnil;
551 return Qnil;
552 @}
553 XFASTINT (xcoord) -= XFASTINT (XWINDOW (window)->left); 569 XFASTINT (xcoord) -= XFASTINT (XWINDOW (window)->left);
554@end group 570@end group
555@group 571@group
@@ -560,9 +576,7 @@ DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
560 if ((XINT (ycoord) < XINT (XWINDOW (window)->top)) 576 if ((XINT (ycoord) < XINT (XWINDOW (window)->top))
561 || (XINT (ycoord) >= (XINT (XWINDOW (window)->top) 577 || (XINT (ycoord) >= (XINT (XWINDOW (window)->top)
562 + XINT (XWINDOW (window)->height)) - 1)) 578 + XINT (XWINDOW (window)->height)) - 1))
563 @{ 579 return Qnil;
564 return Qnil;
565 @}
566@end group 580@end group
567@group 581@group
568 XFASTINT (ycoord) -= XFASTINT (XWINDOW (window)->top); 582 XFASTINT (ycoord) -= XFASTINT (XWINDOW (window)->top);
@@ -571,10 +585,20 @@ DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
571@end group 585@end group
572@end smallexample 586@end smallexample
573 587
574 Note that you cannot directly call functions defined in Lisp as, for 588 Note that C code cannot call functions by name unless they are defined
575example, the primitive function @code{Fcons} is called above. You must 589in C. The way to call a function written in Lisp is to use
576create the appropriate Lisp form, protect everything from garbage 590@code{Ffuncall}, which embodies the Lisp function @code{funcall}. Since
577collection, and @code{Feval} the form, as was done in @code{For} above. 591the Lisp function @code{funcall} accepts an unlimited number of
592arguments, in C it takes two: the number of Lisp-level arguments, and a
593one-dimensional array containing their values. The first Lisp-level
594argument is the Lisp function to call, and the rest are the arguments to
595pass to it. Since @code{Ffuncall} can call the evaluator, you must
596protect pointers from garbage collection around the call to
597@code{Ffuncall}.
598
599 The C functions @code{call0}, @code{call1}, @code{call2}, and so on,
600provide handy ways to call a Lisp function conveniently with a fixed
601number of arguments. They work by calling @code{Ffuncall}.
578 602
579 @file{eval.c} is a very good file to look through for examples; 603 @file{eval.c} is a very good file to look through for examples;
580@file{lisp.h} contains the definitions for some important macros and 604@file{lisp.h} contains the definitions for some important macros and
@@ -592,12 +616,14 @@ for which you compile Emacs, twenty-four to twenty-six bits are used to
592address the object, and the remaining six to eight bits are used for a 616address the object, and the remaining six to eight bits are used for a
593tag that identifies the object's type. 617tag that identifies the object's type.
594 618
595 Because all access to data is through tagged pointers, it is always 619 Because Lisp objects are represented as tagged pointers, it is always
596possible to determine the type of any object. This allows variables to 620possible to determine the Lisp data type of any object. The C data type
597be untyped, and the values assigned to them to be changed without regard 621@code{Lisp_Object} can hold any Lisp object of any data type. Ordinary
598to type. Function arguments also can be of any type; if you want a 622variables have type @code{Lisp_Object}, which means they can hold any
599function to accept only a certain type of argument, you must check the 623type of Lisp value; you can determine the actual data type only at run
600type explicitly using a suitable predicate (@pxref{Type Predicates}). 624time. The same is true for function arguments; if you want a function
625to accept only a certain type of argument, you must check the type
626explicitly using a suitable predicate (@pxref{Type Predicates}).
601@cindex type checking internals 627@cindex type checking internals
602 628
603@menu 629@menu
@@ -637,8 +663,8 @@ This field contains the time when the buffer was last auto-saved.
637This field contains the @code{window-start} position in the buffer as of 663This field contains the @code{window-start} position in the buffer as of
638the last time the buffer was displayed in a window. 664the last time the buffer was displayed in a window.
639 665
640@item undodata 666@item undo_list
641This field points to the buffer's undo stack. @xref{Undo}. 667This field points to the buffer's undo list. @xref{Undo}.
642 668
643@item syntax_table_v 669@item syntax_table_v
644This field contains the syntax table for the buffer. @xref{Syntax Tables}. 670This field contains the syntax table for the buffer. @xref{Syntax Tables}.
@@ -664,9 +690,10 @@ This field contains the buffer's display table, or @code{nil} if it doesn't
664have one. @xref{Display Tables}. 690have one. @xref{Display Tables}.
665 691
666@item markers 692@item markers
667This field contains the chain of all markers that point into the 693This field contains the chain of all markers that currently point into
668buffer. At each deletion or motion of the buffer gap, all of these 694the buffer. Deletion of text in the buffer, and motion of the buffer's
669markers must be checked and perhaps updated. @xref{Markers}. 695gap, must check each of these markers and perhaps update it.
696@xref{Markers}.
670 697
671@item backed_up 698@item backed_up
672This field is a flag which tells whether a backup file has been made 699This field is a flag which tells whether a backup file has been made
@@ -676,15 +703,30 @@ for the visited file of this buffer.
676This field contains the mark for the buffer. The mark is a marker, 703This field contains the mark for the buffer. The mark is a marker,
677hence it is also included on the list @code{markers}. @xref{The Mark}. 704hence it is also included on the list @code{markers}. @xref{The Mark}.
678 705
706@item mark_active
707This field is non-@code{nil} if the buffer's mark is active.
708
679@item local_var_alist 709@item local_var_alist
680This field contains the association list containing all of the variables 710This field contains the association list describing the variables local
681local in this buffer, and their values. The function 711in this buffer, and their values, with the exception of local variables
682@code{buffer-local-variables} returns a copy of this list. 712that have special slots in the buffer object. (Those slots are omitted
683@xref{Buffer-Local Variables}. 713from this table.) @xref{Buffer-Local Variables}.
684 714
685@item mode_line_format 715@item keymap
686This field contains a Lisp object which controls how to display the mode 716This field holds the buffer's local keymap. @xref{Keymaps}.
687line for this buffer. @xref{Mode Line Format}. 717
718@item overlay_center
719This field holds the current overlay center position. @xref{Overlays}.
720
721@item overlays_before
722This field holds a list of the overlays in this buffer that end at or
723before the current overlay center position. They are sorted in order of
724decreasing end position.
725
726@item overlays_after
727This field holds a list of the overlays in this buffer that end after
728the current overlay center position. They are sorted in order of
729increasing beginning position.
688@end table 730@end table
689 731
690@node Window Internals, Process Internals, Buffer Internals, Object Internals 732@node Window Internals, Process Internals, Buffer Internals, Object Internals
@@ -696,64 +738,102 @@ line for this buffer. @xref{Mode Line Format}.
696 738
697@table @code 739@table @code
698@item frame 740@item frame
699 The frame that this window is on. 741The frame that this window is on.
700 742
701@item mini_p 743@item mini_p
702 Non-@code{nil} if this window is a minibuffer window. 744Non-@code{nil} if this window is a minibuffer window.
703
704@item height
705 The height of the window, measured in lines.
706
707@item width
708 The width of the window, measured in columns.
709 745
710@item buffer 746@item buffer
711 The buffer which the window is displaying. This may change often during 747The buffer which the window is displaying. This may change often during
712the life of the window. 748the life of the window.
713 749
714@item dedicated 750@item dedicated
715 Non-@code{nil} if this window is dedicated to its buffer. 751Non-@code{nil} if this window is dedicated to its buffer.
716
717@item start
718 The position in the buffer which is the first character to be displayed
719in the window.
720 752
721@item pointm 753@item pointm
722@cindex window point internals 754@cindex window point internals
723 This is the value of point in the current buffer when this window is 755This is the value of point in the current buffer when this window is
724selected; when it is not selected, it retains its previous value. 756selected; when it is not selected, it retains its previous value.
725 757
758@item start
759he position in the buffer which is the first character to be displayed
760in the window.
761
762@item force_start
763If this flag is non-@code{nil}, it says that the window has been
764scrolled explicitly by the Lisp program. This affects what the next
765redisplay does if point is off the screen: instead of scrolling the
766window to show the text around point, it moves point to a location that
767is on the screen.
768
769@item last_modified
770The @code{modified} field of the window's buffer, as of the last time
771a redisplay completed in this window.
772
773@item last_point
774The buffer's value of point, as of the last time
775a redisplay completed in this window.
776
726@item left 777@item left
727 This is the left-hand edge of the window, measured in columns. (The 778This is the left-hand edge of the window, measured in columns. (The
728leftmost column on the screen is @w{column 0}.) 779leftmost column on the screen is @w{column 0}.)
729 780
730@item top 781@item top
731 This is the top edge of the window, measured in lines. (The top line on 782This is the top edge of the window, measured in lines. (The top line on
732the screen is @w{line 0}.) 783the screen is @w{line 0}.)
733 784
785@item height
786The height of the window, measured in lines.
787
788@item width
789The width of the window, measured in columns.
790
734@item next 791@item next
735 This is the window that is the next in the chain of siblings. 792This is the window that is the next in the chain of siblings. It is
793@code{nil} in a window that is the rightmost or bottommost of a group of
794siblings.
736 795
737@item prev 796@item prev
738 This is the window that is the previous in the chain of siblings. 797This is the window that is the previous in the chain of siblings. It is
798@code{nil} in a window that is the leftmost or topmost of a group of
799siblings.
739 800
740@item force_start 801@item parent
741 This is a flag which, if non-@code{nil}, says that the window has been 802Internally, Emacs arranges windows in a tree; each group of siblings has
742scrolled explicitly by the Lisp program. At the next redisplay, if 803a parent window whose area includes all the siblings. This field points
743point is off the screen, instead of scrolling the window to show the 804to a window's parent.
744text around point, point will be moved to a location that is on the 805
745screen. 806Parent windows do not display buffers, and play little role in display
807except to shape their child windows. Emacs Lisp programs usually have
808no access to the parent windows; they operate on the windows at the
809leaves of the tree, that actually display buffers.
746 810
747@item hscroll 811@item hscroll
748 This is the number of columns that the display in the window is scrolled 812This is the number of columns that the display in the window is scrolled
749horizontally to the left. Normally, this is 0. 813horizontally to the left. Normally, this is 0.
750 814
751@item use_time 815@item use_time
752 This is the last time that the window was selected. The function 816This is the last time that the window was selected. The function
753@code{get-lru-window} uses this field. 817@code{get-lru-window} uses this field.
754 818
755@item display_table 819@item display_table
756 The window's display table, or @code{nil} if none is specified for it. 820The window's display table, or @code{nil} if none is specified for it.
821
822@item update_mode_line
823Non-@code{nil} means this window's mode line needs to be updated.
824
825@item base_line_number
826The line number of a certain position in the buffer, or @code{nil}.
827This is used for displaying the line number of point in the mode line.
828
829@item base_line_pos
830The position in the buffer for which the line number is known, or
831@code{nil} meaning none is known.
832
833@item region_showing
834If the region (or part of it) is highlighted in this window, this field
835holds the mark position that made one end of that region. Otherwise,
836this field is @code{nil}.
757@end table 837@end table
758 838
759@node Process Internals, , Window Internals, Object Internals 839@node Process Internals, , Window Internals, Object Internals
@@ -788,20 +868,40 @@ An integer, the Unix process @sc{id}.
788A flag, non-@code{nil} if this is really a child process. 868A flag, non-@code{nil} if this is really a child process.
789It is @code{nil} for a network connection. 869It is @code{nil} for a network connection.
790 870
791@item flags
792A symbol indicating the state of the process. Possible values include
793@code{run}, @code{stop}, @code{closed}, etc.
794
795@item reason
796An integer, the Unix signal number that the process received that
797caused the process to terminate or stop. If the process has exited,
798then this is the exit code it specified.
799
800@item mark 871@item mark
801A marker indicating the position of end of last output from this process 872A marker indicating the position of end of last output from this process
802inserted into the buffer. This is usually the end of the buffer. 873inserted into the buffer. This is usually the end of the buffer.
803 874
804@item kill_without_query 875@item kill_without_query
805A flag, non-@code{nil} meaning this process should not cause 876If this is non-@code{nil}, killing Emacs while this process is still
806confirmation to be needed if Emacs is killed. 877running does not ask for confirmation about killing the process.
878
879@item raw_status_low
880@itemx raw_status_high
881These two fields record 16 bits each of the process status returned by
882the @code{wait} system call.
883
884@item status
885The process status, as @code{process-status} should return it.
886
887@item tick
888@itemx update_tick
889If these two fields are not equal, a change in the status of the process
890needs to be reported, either by running the sentinel or by inserting a
891message in the process buffer.
892
893@item pty_flag
894Non-@code{nil} if communication with the subprocess uses a @sc{pty};
895@code{nil} if it uses a pipe.
896
897@item infd
898The file descriptor for input from the process.
899
900@item outfd
901The file descriptor for output to the process.
902
903@item subtty
904The file descriptor for the terminal that the subprocess is using. (On
905some systems, there is no need to record this, so the value is
906@code{nil}.)
807@end table 907@end table
diff --git a/lispref/os.texi b/lispref/os.texi
index 533c3a7f4ac..d12c188ad47 100644
--- a/lispref/os.texi
+++ b/lispref/os.texi
@@ -159,7 +159,7 @@ message for someone else.
159contain Lisp code. It is called your @dfn{init file}. The command line 159contain Lisp code. It is called your @dfn{init file}. The command line
160switches @samp{-q} and @samp{-u} affect the use of the init file; 160switches @samp{-q} and @samp{-u} affect the use of the init file;
161@samp{-q} says not to load an init file, and @samp{-u} says to load a 161@samp{-q} says not to load an init file, and @samp{-u} says to load a
162specified user's init file instead of yours. @xref{Entering Emacs, , , 162specified user's init file instead of yours. @xref{Entering Emacs,,,
163emacs, The GNU Emacs Manual}. 163emacs, The GNU Emacs Manual}.
164 164
165@cindex default init file 165@cindex default init file
@@ -182,7 +182,7 @@ should move it into another file named @file{@var{something}.el},
182byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs} 182byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs}
183file load the other file using @code{load} (@pxref{Loading}). 183file load the other file using @code{load} (@pxref{Loading}).
184 184
185 @xref{Init File Examples, , , emacs, The GNU Emacs Manual}, for 185 @xref{Init File Examples,,, emacs, The GNU Emacs Manual}, for
186examples of how to make various commonly desired customizations in your 186examples of how to make various commonly desired customizations in your
187@file{.emacs} file. 187@file{.emacs} file.
188 188
@@ -648,6 +648,23 @@ process-environment
648@end smallexample 648@end smallexample
649@end defvar 649@end defvar
650 650
651@defvar invocation-name
652This variable holds the program name under which Emacs was invoked. The
653value is a string, and does not include a directory name.
654@end defvar
655
656@defvar invocation-directory
657This variable holds the directory from which the Emacs executable was
658invoked, or perhaps @code{nil} if that directory cannot be determined.
659@end defvar
660
661@defvar installation-directory
662If non-@code{nil}, this is a directory within which to look for the
663@file{lib-src} and @file{etc} subdirectories. This is non-@code{nil}
664when Emacs can't find those directories in their standard installed
665locations, but can find them near where the Emacs executable was found.
666@end defvar
667
651@defun load-average 668@defun load-average
652This function returns the current 1 minute, 5 minute and 15 minute 669This function returns the current 1 minute, 5 minute and 15 minute
653load averages in a list. The values are integers that are 100 times 670load averages in a list. The values are integers that are 100 times
@@ -1321,6 +1338,7 @@ lowest level, Emacs never knows that the characters typed were anything
1321but @kbd{C-s} and @kbd{C-q}, so you can in effect type them as @kbd{C-\} 1338but @kbd{C-s} and @kbd{C-q}, so you can in effect type them as @kbd{C-\}
1322and @kbd{C-^} even when they are input for other commands. 1339and @kbd{C-^} even when they are input for other commands.
1323@xref{Translating Input}. 1340@xref{Translating Input}.
1341@end enumerate
1324 1342
1325If the terminal is the source of the flow control characters, then once 1343If the terminal is the source of the flow control characters, then once
1326you enable kernel flow control handling, you probably can make do with 1344you enable kernel flow control handling, you probably can make do with
diff --git a/lispref/positions.texi b/lispref/positions.texi
index 28f52d719bd..7d2c3ea40a6 100644
--- a/lispref/positions.texi
+++ b/lispref/positions.texi
@@ -106,11 +106,6 @@ buffer. In the absence of any narrowing (@pxref{Narrowing}),
106@end example 106@end example
107@end defun 107@end defun
108 108
109@defvar buffer-saved-size
110 The value of this buffer-local variable is the former length of the
111current buffer, as of the last time it was read in, saved or auto-saved.
112@end defvar
113
114@node Motion 109@node Motion
115@section Motion 110@section Motion
116 111
@@ -447,14 +442,19 @@ in, and even on the selected window (because the width, the truncation
447flag, and display table may vary between windows). @xref{Usual 442flag, and display table may vary between windows). @xref{Usual
448Display}. 443Display}.
449 444
450@defun vertical-motion count 445@defun vertical-motion count &optional window
451This function moves point to the start of the screen line @var{count} 446This function moves point to the start of the screen line @var{count}
452screen lines down from the screen line containing point. If @var{count} 447screen lines down from the screen line containing point. If @var{count}
453is negative, it moves up instead. 448is negative, it moves up instead.
454 449
455This function returns the number of lines moved. The value may be less 450@code{vertical-motion} returns the number of lines moved. The value may
456in absolute value than @var{count} if the beginning or end of the buffer 451be less in absolute value than @var{count} if the beginning or end of
457was reached. 452the buffer was reached.
453
454The window @var{window} is used for obtaining parameters such as the
455width, the horizontal scrolling, and the display table. But
456@code{vertical-motion} always operates on the current buffer, even if
457@var{window} currently displays some other buffer.
458@end defun 458@end defun
459 459
460@deffn Command move-to-window-line count 460@deffn Command move-to-window-line count
@@ -478,7 +478,7 @@ The value returned is the window line number, with the top line in the
478window numbered 0. 478window numbered 0.
479@end deffn 479@end deffn
480 480
481@defun compute-motion from frompos to topos width offsets 481@defun compute-motion from frompos to topos width offsets window
482This function scan through the current buffer, calculating screen 482This function scan through the current buffer, calculating screen
483position. It scans the current buffer forward from position @var{from}, 483position. It scans the current buffer forward from position @var{from},
484assuming that is at screen coordinates @var{frompos}, to position 484assuming that is at screen coordinates @var{frompos}, to position
@@ -494,11 +494,16 @@ returned by @code{window-width} for the window of your choice.
494 494
495The argument @var{offsets} is either @code{nil} or a cons cell of the 495The argument @var{offsets} is either @code{nil} or a cons cell of the
496form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is 496form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is
497the number of columns not being displayed at the left margin; in most 497the number of columns not being displayed at the left margin; most
498calls, this comes from @code{window-hscroll}. Meanwhile, 498callers get this from @code{window-hscroll}. Meanwhile,
499@var{tab-offset} is the number of columns of an initial tab character 499@var{tab-offset} is the offset between column numbers on the screen and
500(at @var{from}) that aren't included in the display, perhaps because the 500column numbers in the buffer. This can be nonzero in a continuation
501line was continued within that character. 501line, when the previous screen lines' widths do not add up to a multiple
502of @code{tab-width}. It is always zero in a non-continuation line.
503
504The window @var{window} serves to specify which display table to use;
505that is its only effect. @code{compute-motion} always operates on the
506current buffer, regardless of what buffer is displayed in @var{window}.
502 507
503The return value is a list of five elements: 508The return value is a list of five elements:
504 509
@@ -530,6 +535,10 @@ the end of the visible section of the buffer, and pass @var{line} and
530 (window-width) 535 (window-width)
531 (cons (window-hscroll) 0)))) 536 (cons (window-hscroll) 0))))
532@end example 537@end example
538
539When you use @code{compute-motion} for the minibuffer, you need to use
540@code{minibuffer-prompt-width} to get the horizontal position of the
541beginning of the first screen line. @xref{Minibuffer Misc}.
533@end defun 542@end defun
534 543
535@node Vertical Motion 544@node Vertical Motion
@@ -590,31 +599,32 @@ sexps. For user-level commands, see @ref{Lists and Sexps,,, emacs, GNU
590Emacs Manual}. 599Emacs Manual}.
591 600
592@deffn Command forward-list arg 601@deffn Command forward-list arg
593Move forward across @var{arg} balanced groups of parentheses. 602This function moves forward across @var{arg} balanced groups of
594(Other syntactic entities such as words or paired string quotes 603parentheses. (Other syntactic entities such as words or paired string
595are ignored.) 604quotes are ignored.)
596@end deffn 605@end deffn
597 606
598@deffn Command backward-list arg 607@deffn Command backward-list arg
599Move backward across @var{arg} balanced groups of parentheses. 608This function moves backward across @var{arg} balanced groups of
600(Other syntactic entities such as words or paired string quotes 609parentheses. (Other syntactic entities such as words or paired string
601are ignored.) 610quotes are ignored.)
602@end deffn 611@end deffn
603 612
604@deffn Command up-list arg 613@deffn Command up-list arg
605Move forward out of @var{arg} levels of parentheses. 614This function moves forward out of @var{arg} levels of parentheses.
606A negative argument means move backward but still to a less deep spot. 615A negative argument means move backward but still to a less deep spot.
607@end deffn 616@end deffn
608 617
609@deffn Command down-list arg 618@deffn Command down-list arg
610Move forward down @var{arg} levels of parentheses. A negative argument 619This function moves forward down @var{arg} levels of parentheses. A
611means move backward but still go down @var{arg} levels. 620negative argument means move backward but still go down @var{arg}
621levels.
612@end deffn 622@end deffn
613 623
614@deffn Command forward-sexp arg 624@deffn Command forward-sexp arg
615Move forward across @var{arg} balanced expressions. 625This function moves forward across @var{arg} balanced expressions.
616Balanced expressions include both those delimited by parentheses 626Balanced expressions include both those delimited by parentheses and
617and other kinds, such as words and string constants. For example, 627other kinds, such as words and string constants. For example,
618 628
619@example 629@example
620@group 630@group
@@ -635,9 +645,29 @@ and other kinds, such as words and string constants. For example,
635@end deffn 645@end deffn
636 646
637@deffn Command backward-sexp arg 647@deffn Command backward-sexp arg
638Move backward across @var{arg} balanced expressions. 648This function moves backward across @var{arg} balanced expressions.
639@end deffn 649@end deffn
640 650
651@deffn Command beginning-of-defun arg
652This function moves back to the @var{arg}th beginning of a defun. If
653@var{arg} is negative, this actually moves forward, but it still moves
654to the beginning of a defun, not to the end of one.
655@end deffn
656
657@deffn Command end-of-defun arg
658Move forward to the @var{arg}th end of a defun. If @var{arg} is
659negative, this actually moves backward, but it still moves to the end of
660a defun, not to the beginning of one.
661@end deffn
662
663@defopt defun-prompt-regexp
664If non-@code{nil}, this variable holds a regular expression that
665specifies what text can appear before the open-parenthesis that starts a
666defun. That is to say, the a defun begins on a line which starts
667with a match for this regular expression, followed by a character
668with open-parenthesis syntax.
669@end defopt
670
641@node Skipping Characters 671@node Skipping Characters
642@comment node-name, next, previous, up 672@comment node-name, next, previous, up
643@subsection Skipping Characters 673@subsection Skipping Characters
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 28625c25bdb..f9faf1b0221 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -1002,11 +1002,11 @@ If @var{fixedcase} is non-@code{nil}, then the case of the replacement
1002text is not changed; otherwise, the replacement text is converted to a 1002text is not changed; otherwise, the replacement text is converted to a
1003different case depending upon the capitalization of the text to be 1003different case depending upon the capitalization of the text to be
1004replaced. If the original text is all upper case, the replacement text 1004replaced. If the original text is all upper case, the replacement text
1005is converted to upper case, except when all of the words in the original 1005is converted to upper case. If the first word of the original text is
1006text are only one character long. In that event, the replacement text 1006capitalized, then the first word of the replacement text is capitalized.
1007is capitalized. If @emph{any} of the words in the original text is 1007If the original text contains just one word, and that word is a capital
1008capitalized, then all of the words in the replacement text are 1008letter, @code{replace-match} considers this a capitalized first word
1009capitalized. 1009rather than all upper case.
1010 1010
1011If @var{literal} is non-@code{nil}, then @var{replacement} is inserted 1011If @var{literal} is non-@code{nil}, then @var{replacement} is inserted
1012exactly as it is, the only alterations being case changes as needed. 1012exactly as it is, the only alterations being case changes as needed.