aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorChong Yidong2012-09-30 17:18:38 +0800
committerChong Yidong2012-09-30 17:18:38 +0800
commit48de8b12215e22390db1bc822e809708070ab938 (patch)
tree125595be25583796bec86a019f75c8049164133e /doc/lispref
parent5938d5196d09aff887aa74603c102b1f303a613a (diff)
downloademacs-48de8b12215e22390db1bc822e809708070ab938.tar.gz
emacs-48de8b12215e22390db1bc822e809708070ab938.zip
Update docs for a bunch of 24.3 changes.
* doc/emacs/killing.texi (Rectangles): Document copy-rectangle-as-kill. * doc/emacs/search.texi (Special Isearch): Document the lax space search feature and M-s SPC. (Regexp Search): Move main search-whitespace-regexp description to Special Isearch. (Replace): Document replace-lax-whitespace. * doc/emacs/basic.texi (Position Info): Document C-u M-=. (Moving Point): Document move-to-column. * doc/emacs/display.texi (Useless Whitespace): Add delete-trailing-lines. * doc/emacs/misc.texi (emacsclient Options): Document the effect of initial-buffer-choice on client frames. Document server-auth-dir. Do not document server-host, which is bad security practice. * doc/emacs/building.texi (Lisp Libraries): Docstring lookups can trigger autoloading. Document help-enable-auto-load. * doc/emacs/mini.texi (Yes or No Prompts): New node. * doc/emacs/ack.texi (Acknowledgments): Remove obsolete packages. * doc/lispref/commands.texi (Click Events): Define "mouse position list". Remove mention of unimplemented horizontal scroll bars. (Drag Events, Motion Events): Refer to "mouse position list". (Accessing Mouse): Document posnp. * doc/lispref/errors.texi (Standard Errors): Tweak arith-error description. Tweak markup. Remove domain-error and friends, which seem to be unused after the floating-point code revamp. * doc/lispref/functions.texi (Obsolete Functions): Obsolescence also affects documentation commands. Various clarifications. (Declare Form): New node. * doc/lispref/loading.texi (Autoload): * doc/lispref/help.texi (Documentation Basics): The special sequences can trigger autoloading. * doc/lispref/macros.texi (Defining Macros): Move description of `declare' to Declare Form node. * doc/lispref/numbers.texi (Integer Basics): Copyedits. (Float Basics): Consider IEEE floating point always available. (Random Numbers): Document actual limits. (Arithmetic Operations): Clarify division by zero. Don't mention the machine-independence of negative division since it does not happen in practice. * doc/lispref/os.texi (Idle Timers): Minor clarifications. (User Identification): Add system-users and system-groups. * doc/lispref/strings.texi (String Basics): Copyedits. * lisp/minibuffer.el (minibuffer-local-filename-syntax): Doc fix. * lisp/server.el (server-host): Document the security implications. (server-auth-key): Doc fix. * lisp/startup.el (initial-buffer-choice): Doc fix. * src/fns.c (Frandom): Doc fix.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/ChangeLog42
-rw-r--r--doc/lispref/commands.texi142
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/errors.texi160
-rw-r--r--doc/lispref/frames.texi24
-rw-r--r--doc/lispref/functions.texi109
-rw-r--r--doc/lispref/help.texi16
-rw-r--r--doc/lispref/loading.texi8
-rw-r--r--doc/lispref/macros.texi39
-rw-r--r--doc/lispref/numbers.texi176
-rw-r--r--doc/lispref/os.texi110
-rw-r--r--doc/lispref/strings.texi45
12 files changed, 469 insertions, 403 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 76f06edaacb..b5c847b4b72 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,45 @@
12012-09-30 Chong Yidong <cyd@gnu.org>
2
3 * commands.texi (Click Events): Define "mouse position list".
4 Remove mention of unimplemented horizontal scroll bars.
5 (Drag Events, Motion Events): Refer to "mouse position list".
6 (Accessing Mouse): Document posnp.
7
8 * errors.texi (Standard Errors): Tweak arith-error description.
9 Tweak markup. Remove domain-error and friends, which seem to be
10 unused after the floating-point code revamp.
11
12 * functions.texi (Obsolete Functions): Obsolescence also affects
13 documentation commands. Various clarifications.
14 (Declare Form): New node.
15
16 * strings.texi (String Basics): Copyedits.
17
18 * os.texi (Idle Timers): Minor clarifications.
19 (User Identification): Add system-users and system-groups.
20
21 * macros.texi (Defining Macros): Move description of `declare' to
22 Declare Form node.
23
24 * loading.texi (Autoload):
25 * help.texi (Documentation Basics): The special sequences can
26 trigger autoloading.
27
28 * numbers.texi (Integer Basics): Copyedits.
29 (Float Basics): Consider IEEE floating point always available.
30 (Random Numbers): Document actual limits.
31 (Arithmetic Operations): Clarify division by zero. Don't mention
32 the machine-independence of negative division since it does not
33 happen in practice.
34
352012-09-28 Chong Yidong <cyd@gnu.org>
36
37 * os.texi (Startup Summary): Document leim-list.el change.
38
392012-09-25 Chong Yidong <cyd@gnu.org>
40
41 * functions.texi (Defining Functions): defun is now a macro.
42
12012-09-28 Leo Liu <sdl.web@gmail.com> 432012-09-28 Leo Liu <sdl.web@gmail.com>
2 44
3 * files.texi (Files): Fix typo. 45 * files.texi (Files): Fix typo.
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index dc0fa4c639d..93dba237013 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1275,12 +1275,21 @@ describe events by their types; thus, if there is a key binding for
1275@var{event-type} is @code{mouse-1}. 1275@var{event-type} is @code{mouse-1}.
1276 1276
1277@item @var{position} 1277@item @var{position}
1278This is the position where the mouse click occurred. The actual 1278@cindex mouse position list
1279format of @var{position} depends on what part of a window was clicked 1279This is a @dfn{mouse position list} specifying where the mouse click
1280on. 1280occurred; see below for details.
1281 1281
1282For mouse click events in the text area, mode line, header line, or in 1282@item @var{click-count}
1283the marginal areas, @var{position} has this form: 1283This is the number of rapid repeated presses so far of the same mouse
1284button. @xref{Repeat Events}.
1285@end table
1286
1287 To access the contents of a mouse position list in the
1288@var{position} slot of a click event, you should typically use the
1289functions documented in @ref{Accessing Mouse}. The explicit format of
1290the list depends on where the click occurred. For clicks in the text
1291area, mode line, header line, or in the fringe or marginal areas, the
1292mouse position list has the form
1284 1293
1285@example 1294@example
1286(@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp} 1295(@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp}
@@ -1289,18 +1298,16 @@ the marginal areas, @var{position} has this form:
1289@end example 1298@end example
1290 1299
1291@noindent 1300@noindent
1292The meanings of these list elements are documented below. 1301The meanings of these list elements are as follows:
1293@xref{Accessing Mouse}, for functions that let you easily access these
1294elements.
1295 1302
1296@table @asis 1303@table @asis
1297@item @var{window} 1304@item @var{window}
1298This is the window in which the click occurred. 1305The window in which the click occurred.
1299 1306
1300@item @var{pos-or-area} 1307@item @var{pos-or-area}
1301This is the buffer position of the character clicked on in the text 1308The buffer position of the character clicked on in the text area; or,
1302area, or if clicked outside the text area, it is the window area in 1309if the click was outside the text area, the window area where it
1303which the click occurred. It is one of the symbols @code{mode-line}, 1310occurred. It is one of the symbols @code{mode-line},
1304@code{header-line}, @code{vertical-line}, @code{left-margin}, 1311@code{header-line}, @code{vertical-line}, @code{left-margin},
1305@code{right-margin}, @code{left-fringe}, or @code{right-fringe}. 1312@code{right-margin}, @code{left-fringe}, or @code{right-fringe}.
1306 1313
@@ -1310,22 +1317,23 @@ happens after the imaginary prefix keys for the event are registered
1310by Emacs. @xref{Key Sequence Input}. 1317by Emacs. @xref{Key Sequence Input}.
1311 1318
1312@item @var{x}, @var{y} 1319@item @var{x}, @var{y}
1313These are the relative pixel coordinates of the click. For clicks in 1320The relative pixel coordinates of the click. For clicks in the text
1314the text area of a window, the coordinate origin @code{(0 . 0)} is 1321area of a window, the coordinate origin @code{(0 . 0)} is taken to be
1315taken to be the top left corner of the text area. @xref{Window 1322the top left corner of the text area. @xref{Window Sizes}. For
1316Sizes}. For clicks in a mode line or header line, the coordinate 1323clicks in a mode line or header line, the coordinate origin is the top
1317origin is the top left corner of the window itself. For fringes, 1324left corner of the window itself. For fringes, margins, and the
1318margins, and the vertical border, @var{x} does not have meaningful 1325vertical border, @var{x} does not have meaningful data. For fringes
1319data. For fringes and margins, @var{y} is relative to the bottom edge 1326and margins, @var{y} is relative to the bottom edge of the header
1320of the header line. In all cases, the @var{x} and @var{y} coordinates 1327line. In all cases, the @var{x} and @var{y} coordinates increase
1321increase rightward and downward respectively. 1328rightward and downward respectively.
1322 1329
1323@item @var{timestamp} 1330@item @var{timestamp}
1324This is the time at which the event occurred, in milliseconds. 1331The time at which the event occurred, as an integer number of
1332milliseconds since a system-dependent initial time.
1325 1333
1326@item @var{object} 1334@item @var{object}
1327This is either @code{nil} if there is no string-type text property at 1335Either @code{nil} if there is no string-type text property at the
1328the click position, or a cons cell of the form (@var{string} 1336click position, or a cons cell of the form (@var{string}
1329. @var{string-pos}) if there is one: 1337. @var{string-pos}) if there is one:
1330 1338
1331@table @asis 1339@table @asis
@@ -1371,8 +1379,7 @@ These are the pixel width and height of @var{object} or, if this is
1371@code{nil}, those of the character glyph clicked on. 1379@code{nil}, those of the character glyph clicked on.
1372@end table 1380@end table
1373 1381
1374@sp 1 1382For clicks on a scroll bar, @var{position} has this form:
1375For mouse clicks on a scroll-bar, @var{position} has this form:
1376 1383
1377@example 1384@example
1378(@var{window} @var{area} (@var{portion} . @var{whole}) @var{timestamp} @var{part}) 1385(@var{window} @var{area} (@var{portion} . @var{whole}) @var{timestamp} @var{part})
@@ -1380,32 +1387,35 @@ For mouse clicks on a scroll-bar, @var{position} has this form:
1380 1387
1381@table @asis 1388@table @asis
1382@item @var{window} 1389@item @var{window}
1383This is the window whose scroll-bar was clicked on. 1390The window whose scroll bar was clicked on.
1384 1391
1385@item @var{area} 1392@item @var{area}
1386This is the scroll bar where the click occurred. It is one of the 1393This is the symbol @code{vertical-scroll-bar}.
1387symbols @code{vertical-scroll-bar} or @code{horizontal-scroll-bar}.
1388 1394
1389@item @var{portion} 1395@item @var{portion}
1390This is the distance of the click from the top or left end of 1396The number of pixels from the top of the scroll bar to the click
1391the scroll bar. 1397position. On some toolkits, including GTK+, Emacs cannot extract this
1398data, so the value is always @code{0}.
1392 1399
1393@item @var{whole} 1400@item @var{whole}
1394This is the length of the entire scroll bar. 1401The total length, in pixels, of the scroll bar. On some toolkits,
1402including GTK+, Emacs cannot extract this data, so the value is always
1403@code{0}.
1395 1404
1396@item @var{timestamp} 1405@item @var{timestamp}
1397This is the time at which the event occurred, in milliseconds. 1406The time at which the event occurred, in milliseconds. On some
1407toolkits, including GTK+, Emacs cannot extract this data, so the value
1408is always @code{0}.
1398 1409
1399@item @var{part} 1410@item @var{part}
1400This is the part of the scroll-bar which was clicked on. It is one 1411The part of the scroll bar on which the click occurred. It is one of
1401of the symbols @code{above-handle}, @code{handle}, @code{below-handle}, 1412the symbols @code{handle} (the scroll bar handle), @code{above-handle}
1402@code{up}, @code{down}, @code{top}, @code{bottom}, and @code{end-scroll}. 1413(the area above the handle), @code{below-handle} (the area below the
1414handle), @code{up} (the up arrow at one end of the scroll bar), or
1415@code{down} (the down arrow at one end of the scroll bar).
1416@c The `top', `bottom', and `end-scroll' codes don't seem to be used.
1403@end table 1417@end table
1404 1418
1405@item @var{click-count}
1406This is the number of rapid repeated presses so far of the same mouse
1407button. @xref{Repeat Events}.
1408@end table
1409 1419
1410@node Drag Events 1420@node Drag Events
1411@subsection Drag Events 1421@subsection Drag Events
@@ -1429,10 +1439,9 @@ For a drag event, the name of the symbol @var{event-type} contains the
1429prefix @samp{drag-}. For example, dragging the mouse with button 2 1439prefix @samp{drag-}. For example, dragging the mouse with button 2
1430held down generates a @code{drag-mouse-2} event. The second and third 1440held down generates a @code{drag-mouse-2} event. The second and third
1431elements of the event give the starting and ending position of the 1441elements of the event give the starting and ending position of the
1432drag. They have the same form as @var{position} in a click event 1442drag, as mouse position lists (@pxref{Click Events}). You can access
1433(@pxref{Click Events}) that is not on the scroll bar part of the 1443the second element of any mouse event in the same way, with no need to
1434window. You can access the second element of any mouse event in the 1444distinguish drag events from others.
1435same way, with no need to distinguish drag events from others.
1436 1445
1437The @samp{drag-} prefix follows the modifier key prefixes such as 1446The @samp{drag-} prefix follows the modifier key prefixes such as
1438@samp{C-} and @samp{M-}. 1447@samp{C-} and @samp{M-}.
@@ -1575,13 +1584,14 @@ represented by lists that look like this:
1575(mouse-movement POSITION) 1584(mouse-movement POSITION)
1576@end example 1585@end example
1577 1586
1578The second element of the list describes the current position of the 1587@noindent
1579mouse, just as in a click event (@pxref{Click Events}). 1588@var{position} is a mouse position list (@pxref{Click Events}),
1589specifying the current position of the mouse cursor.
1580 1590
1581The special form @code{track-mouse} enables generation of motion events 1591The special form @code{track-mouse} enables generation of motion
1582within its body. Outside of @code{track-mouse} forms, Emacs does not 1592events within its body. Outside of @code{track-mouse} forms, Emacs
1583generate events for mere motion of the mouse, and these events do not 1593does not generate events for mere motion of the mouse, and these
1584appear. @xref{Mouse Tracking}. 1594events do not appear. @xref{Mouse Tracking}.
1585 1595
1586@node Focus Events 1596@node Focus Events
1587@subsection Focus Events 1597@subsection Focus Events
@@ -1648,13 +1658,11 @@ frame has already been made visible, Emacs has no work to do.
1648@cindex @code{wheel-up} event 1658@cindex @code{wheel-up} event
1649@cindex @code{wheel-down} event 1659@cindex @code{wheel-down} event
1650@item (wheel-up @var{position}) 1660@item (wheel-up @var{position})
1651@item (wheel-down @var{position}) 1661@itemx (wheel-down @var{position})
1652These kinds of event are generated by moving a mouse wheel. Their 1662These kinds of event are generated by moving a mouse wheel. The
1653usual meaning is a kind of scroll or zoom. 1663@var{position} element is a mouse position list (@pxref{Click
1654 1664Events}), specifying the position of the mouse cursor when the event
1655The element @var{position} is a list describing the position of the 1665occurred.
1656event, in the same format as used in a mouse-click event (@pxref{Click
1657Events}).
1658 1666
1659@vindex mouse-wheel-up-event 1667@vindex mouse-wheel-up-event
1660@vindex mouse-wheel-down-event 1668@vindex mouse-wheel-down-event
@@ -1922,14 +1930,8 @@ must be the last element of the list. For example,
1922 This section describes convenient functions for accessing the data in 1930 This section describes convenient functions for accessing the data in
1923a mouse button or motion event. 1931a mouse button or motion event.
1924 1932
1925 These two functions return the starting or ending position of a 1933 The following two functions return a mouse position list
1926mouse-button event, as a list of this form (@pxref{Click Events}): 1934(@pxref{Click Events}), specifying the position of a mouse event.
1927
1928@example
1929(@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp}
1930 @var{object} @var{text-pos} (@var{col} . @var{row})
1931 @var{image} (@var{dx} . @var{dy}) (@var{width} . @var{height}))
1932@end example
1933 1935
1934@defun event-start event 1936@defun event-start event
1935This returns the starting position of @var{event}. 1937This returns the starting position of @var{event}.
@@ -1948,9 +1950,15 @@ event, the value is actually the starting position, which is the only
1948position such events have. 1950position such events have.
1949@end defun 1951@end defun
1950 1952
1953@defun posnp object
1954This function returns non-@code{nil} if @var{object} is a mouse
1955oposition list, in either of the formats documented in @ref{Click
1956Events}); and @code{nil} otherwise.
1957@end defun
1958
1951@cindex mouse position list, accessing 1959@cindex mouse position list, accessing
1952 These functions take a position list as described above, and 1960 These functions take a mouse position list as argument, and return
1953return various parts of it. 1961various parts of it:
1954 1962
1955@defun posn-window position 1963@defun posn-window position
1956Return the window that @var{position} is in. 1964Return the window that @var{position} is in.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index db770616820..d46cb071bf7 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -516,6 +516,7 @@ Functions
516* Obsolete Functions:: Declaring functions obsolete. 516* Obsolete Functions:: Declaring functions obsolete.
517* Inline Functions:: Defining functions that the compiler 517* Inline Functions:: Defining functions that the compiler
518 will expand inline. 518 will expand inline.
519* Declare Form:: Adding additional information about a function.
519* Declaring Functions:: Telling the compiler that a function is defined. 520* Declaring Functions:: Telling the compiler that a function is defined.
520* Function Safety:: Determining whether a function is safe to call. 521* Function Safety:: Determining whether a function is safe to call.
521* Related Topics:: Cross-references to specific Lisp primitives 522* Related Topics:: Cross-references to specific Lisp primitives
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index a822a2d9608..b7b26c8708c 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -37,78 +37,69 @@ handled.
37 37
38@table @code 38@table @code
39@item error 39@item error
40@code{"error"}@* 40The message is @samp{error}. @xref{Errors}.
41@xref{Errors}.
42 41
43@item quit 42@item quit
44@code{"Quit"}@* 43The message is @samp{Quit}. @xref{Quitting}.
45@xref{Quitting}.
46 44
47@item args-out-of-range 45@item args-out-of-range
48@code{"Args out of range"}@* 46The message is @samp{Args out of range}. This happens when trying to
49This happens when trying to access an element beyond the range of a 47access an element beyond the range of a sequence, buffer, or other
50sequence or buffer.@* 48container-like object. @xref{Sequences Arrays Vectors}, and
51@xref{Sequences Arrays Vectors}, @xref{Text}. 49@xref{Text}.
52 50
53@item arith-error 51@item arith-error
54@code{"Arithmetic error"}@* 52The message is @samp{Arithmetic error}. This occurs when trying to
53perform integer division by zero. @xref{Numeric Conversions}, and
55@xref{Arithmetic Operations}. 54@xref{Arithmetic Operations}.
56 55
57@item beginning-of-buffer 56@item beginning-of-buffer
58@code{"Beginning of buffer"}@* 57The message is @samp{Beginning of buffer}. @xref{Character Motion}.
59@xref{Character Motion}.
60 58
61@item buffer-read-only 59@item buffer-read-only
62@code{"Buffer is read-only"}@* 60The message is @samp{Buffer is read-only}. @xref{Read Only Buffers}.
63@xref{Read Only Buffers}.
64 61
65@item circular-list 62@item circular-list
66@code{"List contains a loop"}@* 63The message is @samp{List contains a loop}. This happens when a
67This happens when some operations (e.g. resolving face names) 64circular structure is encountered. @xref{Circular Objects}.
68encounter circular structures.@*
69@xref{Circular Objects}.
70 65
71@item cl-assertion-failed 66@item cl-assertion-failed
72@code{"Assertion failed"}@* 67The message is @samp{Assertion failed}. This happens when the
73This happens when the @code{assert} macro fails a test.@* 68@code{assert} macro fails a test. @xref{Assertions,,, cl, Common Lisp
74@xref{Assertions,,, cl, Common Lisp Extensions}. 69Extensions}.
75 70
76@item coding-system-error 71@item coding-system-error
77@code{"Invalid coding system"}@* 72The message is @samp{Invalid coding system}. @xref{Lisp and Coding
78@xref{Lisp and Coding Systems}. 73Systems}.
79 74
80@item cyclic-function-indirection 75@item cyclic-function-indirection
81@code{"Symbol's chain of function indirections contains a loop"}@* 76The message is @samp{Symbol's chain of function indirections contains
82@xref{Function Indirection}. 77a loop}. @xref{Function Indirection}.
83 78
84@item cyclic-variable-indirection 79@item cyclic-variable-indirection
85@code{"Symbol's chain of variable indirections contains a loop"}@* 80The message is @samp{Symbol's chain of variable indirections contains
86@xref{Variable Aliases}. 81a loop}. @xref{Variable Aliases}.
87 82
88@item dbus-error 83@item dbus-error
89@code{"D-Bus error"}@* 84The message is @samp{D-Bus error}. This is only defined if Emacs was
90This is only defined if Emacs was compiled with D-Bus support.@* 85compiled with D-Bus support. @xref{Errors and Events,,, dbus, D-Bus
91@xref{Errors and Events,,, dbus, D-Bus integration in Emacs}. 86integration in Emacs}.
92 87
93@item end-of-buffer 88@item end-of-buffer
94@code{"End of buffer"}@* 89The message is @samp{End of buffer}. @xref{Character Motion}.
95@xref{Character Motion}.
96 90
97@item end-of-file 91@item end-of-file
98@code{"End of file during parsing"}@* 92The message is @samp{End of file during parsing}. Note that this is
99Note that this is not a subcategory of @code{file-error}, 93not a subcategory of @code{file-error}, because it pertains to the
100because it pertains to the Lisp reader, not to file I/O.@* 94Lisp reader, not to file I/O. @xref{Input Functions}.
101@xref{Input Functions}.
102 95
103@item file-already-exists 96@item file-already-exists
104This is a subcategory of @code{file-error}.@* 97This is a subcategory of @code{file-error}. @xref{Writing to Files}.
105@xref{Writing to Files}.
106 98
107@item file-date-error 99@item file-date-error
108This is a subcategory of @code{file-error}. It occurs when 100This is a subcategory of @code{file-error}. It occurs when
109@code{copy-file} tries and fails to set the last-modification time of 101@code{copy-file} tries and fails to set the last-modification time of
110the output file.@* 102the output file. @xref{Changing Files}.
111@xref{Changing Files}.
112 103
113@item file-error 104@item file-error
114We do not list the error-strings of this error and its subcategories, 105We do not list the error-strings of this error and its subcategories,
@@ -116,122 +107,109 @@ because the error message is normally constructed from the data items
116alone when the error condition @code{file-error} is present. Thus, 107alone when the error condition @code{file-error} is present. Thus,
117the error-strings are not very relevant. However, these error symbols 108the error-strings are not very relevant. However, these error symbols
118do have @code{error-message} properties, and if no data is provided, 109do have @code{error-message} properties, and if no data is provided,
119the @code{error-message} property @emph{is} used.@* 110the @code{error-message} property @emph{is} used. @xref{Files}.
120@xref{Files}.
121 111
122@c jka-compr.el 112@c jka-compr.el
123@item compression-error 113@item compression-error
124This is a subcategory of @code{file-error}, which results from 114This is a subcategory of @code{file-error}, which results from
125problems handling a compressed file.@* 115problems handling a compressed file. @xref{How Programs Do Loading}.
126@xref{How Programs Do Loading}.
127 116
128@c userlock.el 117@c userlock.el
129@item file-locked 118@item file-locked
130This is a subcategory of @code{file-error}.@* 119This is a subcategory of @code{file-error}. @xref{File Locks}.
131@xref{File Locks}.
132 120
133@c userlock.el 121@c userlock.el
134@item file-supersession 122@item file-supersession
135This is a subcategory of @code{file-error}.@* 123This is a subcategory of @code{file-error}. @xref{Modification Time}.
136@xref{Modification Time}.
137 124
138@c net/ange-ftp.el 125@c net/ange-ftp.el
139@item ftp-error 126@item ftp-error
140This is a subcategory of @code{file-error}, which results from problems 127This is a subcategory of @code{file-error}, which results from
141in accessing a remote file using ftp.@* 128problems in accessing a remote file using ftp. @xref{Remote Files,,,
142@xref{Remote Files,,, emacs, The GNU Emacs Manual}. 129emacs, The GNU Emacs Manual}.
143 130
144@item invalid-function 131@item invalid-function
145@code{"Invalid function"}@* 132The message is @samp{Invalid function}. @xref{Function Indirection}.
146@xref{Function Indirection}.
147 133
148@item invalid-read-syntax 134@item invalid-read-syntax
149@code{"Invalid read syntax"}@* 135The message is @samp{Invalid read syntax}. @xref{Printed
150@xref{Printed Representation}. 136Representation}.
151 137
152@item invalid-regexp 138@item invalid-regexp
153@code{"Invalid regexp"}@* 139The message is @samp{Invalid regexp}. @xref{Regular Expressions}.
154@xref{Regular Expressions}.
155 140
156@c simple.el 141@c simple.el
157@item mark-inactive 142@item mark-inactive
158@code{"The mark is not active now"}@* 143The message is @samp{The mark is not active now}. @xref{The Mark}.
159@xref{The Mark}.
160 144
161@item no-catch 145@item no-catch
162@code{"No catch for tag"}@* 146The message is @samp{No catch for tag}. @xref{Catch and Throw}.
163@xref{Catch and Throw}.
164 147
165@ignore 148@ignore
166@c Not actually used for anything? Probably definition should be removed. 149@c Not actually used for anything? Probably definition should be removed.
167@item protected-field 150@item protected-field
168@code{"Attempt to modify a protected field"} 151The message is @samp{Attempt to modify a protected fiel.
169@end ignore 152@end ignore
170 153
171@item scan-error 154@item scan-error
172@code{"Scan error"}@* 155The message is @samp{Scan error}. This happens when certain
173This happens when certain syntax-parsing functions 156syntax-parsing functions find invalid syntax or mismatched
174find invalid syntax or mismatched parentheses.@* 157parentheses. @xref{List Motion}, and @xref{Parsing Expressions}.
175@xref{List Motion}, and @ref{Parsing Expressions}.
176 158
177@item search-failed 159@item search-failed
178@code{"Search failed"}@* 160The message is @samp{Search failed}. @xref{Searching and Matching}.
179@xref{Searching and Matching}.
180 161
181@item setting-constant 162@item setting-constant
182@code{"Attempt to set a constant symbol"}@* 163The message is @samp{Attempt to set a constant symbol}. This happens
183The values of the symbols @code{nil} and @code{t}, 164when attempting to assign values to @code{nil}, @code{t}, and keyword
184and any symbols that start with @samp{:}, 165symbols. @xref{Constant Variables}.
185may not be changed.@*
186@xref{Constant Variables, , Variables that Never Change}.
187 166
188@c simple.el 167@c simple.el
189@item text-read-only 168@item text-read-only
190@code{"Text is read-only"}@* 169The message is @samp{Text is read-only}. This is a subcategory of
191This is a subcategory of @code{buffer-read-only}.@* 170@code{buffer-read-only}. @xref{Special Properties}.
192@xref{Special Properties}.
193 171
194@item undefined-color 172@item undefined-color
195@code{"Undefined color"}@* 173The message is @samp{Undefined color}. @xref{Color Names}.
196@xref{Color Names}.
197 174
198@item void-function 175@item void-function
199@code{"Symbol's function definition is void"}@* 176The message is @samp{Symbol's function definition is void}.
200@xref{Function Cells}. 177@xref{Function Cells}.
201 178
202@item void-variable 179@item void-variable
203@code{"Symbol's value as variable is void"}@* 180The message is @samp{Symbol's value as variable is void}.
204@xref{Accessing Variables}. 181@xref{Accessing Variables}.
205 182
206@item wrong-number-of-arguments 183@item wrong-number-of-arguments
207@code{"Wrong number of arguments"}@* 184The message is @samp{Wrong number of arguments}. @xref{Classifying
208@xref{Classifying Lists}. 185Lists}.
209 186
210@item wrong-type-argument 187@item wrong-type-argument
211@code{"Wrong type argument"}@* 188The message is @samp{Wrong type argument}. @xref{Type Predicates}.
212@xref{Type Predicates}.
213@end table 189@end table
214 190
191@ignore The following seem to be unused now.
215 The following kinds of error, which are classified as special cases of 192 The following kinds of error, which are classified as special cases of
216@code{arith-error}, can occur on certain systems for invalid use of 193@code{arith-error}, can occur on certain systems for invalid use of
217mathematical functions. @xref{Math Functions}. 194mathematical functions. @xref{Math Functions}.
218 195
219@table @code 196@table @code
220@item domain-error 197@item domain-error
221@code{"Arithmetic domain error"} 198The message is @samp{Arithmetic domain error}.
222 199
223@item overflow-error 200@item overflow-error
224@code{"Arithmetic overflow error"}@* 201The message is @samp{Arithmetic overflow error}. This is a subcategory
225This is a subcategory of @code{domain-error}. 202of @code{domain-error}.
226 203
227@item range-error 204@item range-error
228@code{"Arithmetic range error"} 205The message is @code{Arithmetic range error}.
229 206
230@item singularity-error 207@item singularity-error
231@code{"Arithmetic singularity error"}@* 208The mssage is @samp{Arithmetic singularity error}. This is a
232This is a subcategory of @code{domain-error}. 209subcategory of @code{domain-error}.
233 210
234@item underflow-error 211@item underflow-error
235@code{"Arithmetic underflow error"}@* 212The message is @samp{Arithmetic underflow error}. This is a
236This is a subcategory of @code{domain-error}. 213subcategory of @code{domain-error}.
237@end table 214@end table
215@end ignore
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 356a891fbcd..af6f4b4c079 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1529,24 +1529,14 @@ track of such changes. @xref{Misc Events}.
1529@node Raising and Lowering 1529@node Raising and Lowering
1530@section Raising and Lowering Frames 1530@section Raising and Lowering Frames
1531 1531
1532 Most window systems use a desktop metaphor. Part of this metaphor is 1532@cindex raising a frame
1533the idea that windows are stacked in a notional third dimension
1534perpendicular to the screen surface, and thus ordered from ``highest''
1535to ``lowest''. Where two windows overlap, the one higher up covers
1536the one underneath. Even a window at the bottom of the stack can be
1537seen if no other window overlaps it.
1538
1539@c @cindex raising a frame redundant with raise-frame
1540@cindex lowering a frame 1533@cindex lowering a frame
1541 A window's place in this ordering is not fixed; in fact, users tend 1534 Most window systems use a desktop metaphor. Part of this metaphor
1542to change the order frequently. @dfn{Raising} a window means moving 1535is the idea that system-level windows (e.g.@: Emacs frames) are
1543it ``up'', to the top of the stack. @dfn{Lowering} a window means 1536stacked in a notional third dimension perpendicular to the screen
1544moving it to the bottom of the stack. This motion is in the notional 1537surface. Where two overlap, the one higher up covers the one
1545third dimension only, and does not change the position of the window 1538underneath. You can @dfn{raise} or @dfn{lower} a frame using the
1546on the screen. 1539functions @code{raise-frame} and @code{lower-frame}.
1547
1548 With Emacs, frames constitute the windows in the metaphor sketched
1549above. You can raise and lower frames using these functions:
1550 1540
1551@deffn Command raise-frame &optional frame 1541@deffn Command raise-frame &optional frame
1552This function raises frame @var{frame} (default, the selected frame). 1542This function raises frame @var{frame} (default, the selected frame).
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 9e1d3f9c6ae..cab6d12a3d8 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -23,6 +23,7 @@ define them.
23* Closures:: Functions that enclose a lexical environment. 23* Closures:: Functions that enclose a lexical environment.
24* Obsolete Functions:: Declaring functions obsolete. 24* Obsolete Functions:: Declaring functions obsolete.
25* Inline Functions:: Functions that the compiler will expand inline. 25* Inline Functions:: Functions that the compiler will expand inline.
26* Declare Form:: Adding additional information about a function.
26* Declaring Functions:: Telling the compiler that a function is defined. 27* Declaring Functions:: Telling the compiler that a function is defined.
27* Function Safety:: Determining whether a function is safe to call. 28* Function Safety:: Determining whether a function is safe to call.
28* Related Topics:: Cross-references to specific Lisp primitives 29* Related Topics:: Cross-references to specific Lisp primitives
@@ -521,7 +522,7 @@ Scheme.)
521is called @dfn{defining a function}, and it is done with the 522is called @dfn{defining a function}, and it is done with the
522@code{defun} special form. 523@code{defun} special form.
523 524
524@defspec defun name argument-list body-forms... 525@defmac defun name argument-list body-forms...
525@code{defun} is the usual way to define new Lisp functions. It 526@code{defun} is the usual way to define new Lisp functions. It
526defines the symbol @var{name} as a function that looks like this: 527defines the symbol @var{name} as a function that looks like this:
527 528
@@ -578,7 +579,7 @@ without any hesitation or notification. Emacs does not prevent you
578from doing this, because redefining a function is sometimes done 579from doing this, because redefining a function is sometimes done
579deliberately, and there is no way to distinguish deliberate 580deliberately, and there is no way to distinguish deliberate
580redefinition from unintentional redefinition. 581redefinition from unintentional redefinition.
581@end defspec 582@end defmac
582 583
583@cindex function aliases 584@cindex function aliases
584@defun defalias name definition &optional docstring 585@defun defalias name definition &optional docstring
@@ -1132,29 +1133,46 @@ examining or altering the structure of closure objects.
1132@node Obsolete Functions 1133@node Obsolete Functions
1133@section Declaring Functions Obsolete 1134@section Declaring Functions Obsolete
1134 1135
1135You can use @code{make-obsolete} to declare a function obsolete. This 1136 You can mark a named function as @dfn{obsolete}, meaning that it may
1136indicates that the function may be removed at some stage in the future. 1137be removed at some point in the future. This causes Emacs to warn
1138that the function is obsolete whenever it byte-compiles code
1139containing that function, and whenever it displays the documentation
1140for that function. In all other respects, an obsolete function
1141behaves like any other function.
1142
1143 The easiest way to mark a function as obsolete is to put a
1144@code{(declare (obsolete @dots{}))} form in the function's
1145@code{defun} definition. @xref{Declare Form}. Alternatively, you can
1146use the @code{make-obsolete} function, described below.
1147
1148 A macro (@pxref{Macros}) can also be marked obsolete with
1149@code{make-obsolete}; this has the same effects as for a function. An
1150alias for a function or macro can also be marked as obsolete; this
1151makes the alias itself obsolete, not the function or macro which it
1152resolves to.
1137 1153
1138@defun make-obsolete obsolete-name current-name &optional when 1154@defun make-obsolete obsolete-name current-name &optional when
1139This function makes the byte compiler warn that the function 1155This function marks @var{obsolete-name} as obsolete.
1140@var{obsolete-name} is obsolete. If @var{current-name} is a symbol, the 1156@var{obsolete-name} should be a symbol naming a function or macro, or
1141warning message says to use @var{current-name} instead of 1157an alias for a function or macro.
1142@var{obsolete-name}. @var{current-name} does not need to be an alias for 1158
1143@var{obsolete-name}; it can be a different function with similar 1159If @var{current-name} is a symbol, the warning message says to use
1144functionality. If @var{current-name} is a string, it is the warning 1160@var{current-name} instead of @var{obsolete-name}. @var{current-name}
1145message. 1161does not need to be an alias for @var{obsolete-name}; it can be a
1162different function with similar functionality. @var{current-name} can
1163also be a string, which serves as the warning message. The message
1164should begin in lower case, and end with a period. It can also be
1165@code{nil}, in which case the warning message provides no additional
1166details.
1146 1167
1147If provided, @var{when} should be a string indicating when the function 1168If provided, @var{when} should be a string indicating when the function
1148was first made obsolete---for example, a date or a release number. 1169was first made obsolete---for example, a date or a release number.
1149@end defun 1170@end defun
1150 1171
1151You can define a function as an alias and declare it obsolete at the
1152same time using the macro @code{define-obsolete-function-alias}:
1153
1154@defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring 1172@defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring
1155This macro marks the function @var{obsolete-name} obsolete and also 1173This convenience macro marks the function @var{obsolete-name} obsolete
1156defines it as an alias for the function @var{current-name}. It is 1174and also defines it as an alias for the function @var{current-name}.
1157equivalent to the following: 1175It is equivalent to the following:
1158 1176
1159@example 1177@example
1160(defalias @var{obsolete-name} @var{current-name} @var{docstring}) 1178(defalias @var{obsolete-name} @var{current-name} @var{docstring})
@@ -1236,6 +1254,63 @@ body uses the arguments, as you do for macros.
1236 After an inline function is defined, its inline expansion can be 1254 After an inline function is defined, its inline expansion can be
1237performed later on in the same file, just like macros. 1255performed later on in the same file, just like macros.
1238 1256
1257@node Declare Form
1258@section The @code{declare} Form
1259@findex declare
1260
1261 @code{declare} is a special macro which can be used to add ``meta''
1262properties to a function or macro: for example, marking it as
1263obsolete, or giving its forms a special @key{TAB} indentation
1264convention in Emacs Lisp mode.
1265
1266@anchor{Definition of declare}
1267@defmac declare @var{specs}@dots{}
1268This macro ignores its arguments and evaluates to @code{nil}; it has
1269no run-time effect. However, when a @code{declare} form occurs as the
1270@emph{very first form} in the body of a @code{defun} function
1271definition or a @code{defmacro} macro definition (@pxref{Defining
1272Macros}, for a description of @code{defmacro}), it appends the
1273properties specified by @var{specs} to the function or macro. This
1274work is specially performed by the @code{defun} and @code{defmacro}
1275macros.
1276
1277Note that if you put a @code{declare} form in an interactive function,
1278it should go before the @code{interactive} form.
1279
1280Each element in @var{specs} should have the form @code{(@var{property}
1281@var{args}@dots{})}, which should not be quoted. These have the
1282following effects:
1283
1284@table @code
1285@item (advertised-calling-convention @var{signature} @var{when})
1286This acts like a call to @code{set-advertised-calling-convention}
1287(@pxref{Obsolete Functions}); @var{signature} specifies the correct
1288argument list for calling the function or macro, and @var{when} should
1289be a string indicating when the variable was first made obsolete.
1290
1291@item (debug @var{edebug-form-spec})
1292This is valid for macros only. When stepping through the macro with
1293Edebug, use @var{edebug-form-spec}. @xref{Instrumenting Macro Calls}.
1294
1295@item (doc-string @var{n})
1296Use element number @var{n}, if any, as the documentation string.
1297
1298@item (indent @var{indent-spec})
1299Indent calls to this function or macro according to @var{indent-spec}.
1300This is typically used for macros, though it works for functions too.
1301@xref{Indenting Macros}.
1302
1303@item (obsolete @var{current-name} @var{when})
1304Mark the function or macro as obsolete, similar to a call to
1305@code{make-obsolete} (@pxref{Obsolete Functions}). @var{current-name}
1306should be a symbol (in which case the warning message says to use that
1307instead), a string (specifying the warning message), or @code{nil} (in
1308which case the warning message gives no extra details). @var{when}
1309should be a string indicating when the function or macro was first
1310made obsolete.
1311@end table
1312@end defmac
1313
1239@node Declaring Functions 1314@node Declaring Functions
1240@section Telling the Compiler that a Function is Defined 1315@section Telling the Compiler that a Function is Defined
1241@cindex function declaration 1316@cindex function declaration
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 5dd8f3c11f5..1375a057a5a 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -58,11 +58,17 @@ use @kbd{C-h f} (@code{describe-function}) or @kbd{C-h v}
58are many other conventions for documentation strings; see 58are many other conventions for documentation strings; see
59@ref{Documentation Tips}. 59@ref{Documentation Tips}.
60 60
61 Documentation strings can contain several special substrings, which 61 Documentation strings can contain several special text sequences,
62stand for key bindings to be looked up in the current keymaps when the 62referring to key bindings which are looked up in the current keymaps
63documentation is displayed. This allows documentation strings to refer 63when the user views the documentation. This allows the help commands
64to the keys for related commands and be accurate even when a user 64to display the correct keys even if a user rearranges the default key
65rearranges the key bindings. (@xref{Keys in Documentation}.) 65bindings. @xref{Keys in Documentation}.
66
67 In the documentation string of an autoloaded command
68(@pxref{Autoload}), these special text sequences have an additional
69special effect: they cause @kbd{C-h f} (@code{describe-function}) on
70the command to trigger autoloading. (This is needed for correctly
71setting up the hyperlinks in the @file{*Help*} buffer).
66 72
67@vindex emacs-lisp-docstring-fill-column 73@vindex emacs-lisp-docstring-fill-column
68 Emacs Lisp mode fills documentation strings to the width 74 Emacs Lisp mode fills documentation strings to the width
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 3c9bee96639..aa243185359 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -384,11 +384,13 @@ non-@acronym{ASCII} characters written as @code{?v@var{literal}}.
384@section Autoload 384@section Autoload
385@cindex autoload 385@cindex autoload
386 386
387 The @dfn{autoload} facility allows you to register the existence of 387 The @dfn{autoload} facility lets you register the existence of a
388a function or macro, but put off loading the file that defines it. 388function or macro, but put off loading the file that defines it. The
389The first call to the function automatically reads the proper file, in 389first call to the function automatically loads the proper library, in
390order to install the real definition and other associated code, then 390order to install the real definition and other associated code, then
391runs the real definition as if it had been loaded all along. 391runs the real definition as if it had been loaded all along.
392Autoloading can also be triggered by looking up the documentation of
393the function or macro (@pxref{Documentation Basics}).
392 394
393 There are two ways to set up an autoloaded function: by calling 395 There are two ways to set up an autoloaded function: by calling
394@code{autoload}, and by writing a special ``magic'' comment in the 396@code{autoload}, and by writing a special ``magic'' comment in the
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index efe298bf647..0a5152a43a1 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -235,43 +235,8 @@ of constants and nonconstant parts. To make this easier, use the
235@end example 235@end example
236 236
237 The body of a macro definition can include a @code{declare} form, 237 The body of a macro definition can include a @code{declare} form,
238which can specify how @key{TAB} should indent macro calls, and how to 238which specifies additional properties about the macro. @xref{Declare
239step through them for Edebug. 239Form}.
240
241@defmac declare @var{specs}@dots{}
242@anchor{Definition of declare}
243A @code{declare} form is used in a macro definition to specify various
244additional information about it. The following specifications are
245currently supported:
246
247@table @code
248@item (debug @var{edebug-form-spec})
249Specify how to step through macro calls for Edebug.
250@xref{Instrumenting Macro Calls}.
251
252@item (indent @var{indent-spec})
253Specify how to indent calls to this macro. @xref{Indenting Macros},
254for more details.
255
256@item (doc-string @var{number})
257Specify which element of the macro is the documentation string, if
258any.
259@end table
260
261A @code{declare} form only has its special effect in the body of a
262@code{defmacro} form if it immediately follows the documentation
263string, if present, or the argument list otherwise. (Strictly
264speaking, @emph{several} @code{declare} forms can follow the
265documentation string or argument list, but since a @code{declare} form
266can have several @var{specs}, they can always be combined into a
267single form.) When used at other places in a @code{defmacro} form, or
268outside a @code{defmacro} form, @code{declare} just returns @code{nil}
269without evaluating any @var{specs}.
270@end defmac
271
272 No macro absolutely needs a @code{declare} form, because that form
273has no effect on how the macro expands, on what the macro means in the
274program. It only affects the secondary features listed above.
275 240
276@node Problems with Macros 241@node Problems with Macros
277@section Common Problems Using Macros 242@section Common Problems Using Macros
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 7c9672a38c0..a086f2b3af1 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -48,9 +48,8 @@ to
48@tex 48@tex
49@math{2^{29}-1}), 49@math{2^{29}-1}),
50@end tex 50@end tex
51but some machines provide a wider range. Many examples in this 51but many machines provide a wider range. Many examples in this
52chapter assume that an integer has 30 bits and that floating point 52chapter assume the minimum integer width of 30 bits.
53numbers are IEEE double precision.
54@cindex overflow 53@cindex overflow
55 54
56 The Lisp reader reads an integer as a sequence of digits with optional 55 The Lisp reader reads an integer as a sequence of digits with optional
@@ -160,8 +159,9 @@ The value of this variable is the smallest integer that Emacs Lisp can
160handle. It is negative. 159handle. It is negative.
161@end defvar 160@end defvar
162 161
163 @xref{Character Codes, max-char}, for the maximum value of a valid 162 In Emacs Lisp, text characters are represented by integers. Any
164character codepoint. 163integer between zero and the value of @code{max-char}, inclusive, is
164considered to be valid as a character. @xref{String Basics}.
165 165
166@node Float Basics 166@node Float Basics
167@section Floating Point Basics 167@section Floating Point Basics
@@ -171,8 +171,8 @@ character codepoint.
171not integral. The precise range of floating point numbers is 171not integral. The precise range of floating point numbers is
172machine-specific; it is the same as the range of the C data type 172machine-specific; it is the same as the range of the C data type
173@code{double} on the machine you are using. Emacs uses the 173@code{double} on the machine you are using. Emacs uses the
174@acronym{IEEE} floating point standard where possible (the standard is 174@acronym{IEEE} floating point standard, which is supported by all
175supported by most modern computers). 175modern computers.
176 176
177 The read syntax for floating point numbers requires either a decimal 177 The read syntax for floating point numbers requires either a decimal
178point (with at least one digit following), an exponent, or both. For 178point (with at least one digit following), an exponent, or both. For
@@ -316,17 +316,16 @@ compare them, then you test whether two values are the same
316@emph{object}. By contrast, @code{=} compares only the numeric values 316@emph{object}. By contrast, @code{=} compares only the numeric values
317of the objects. 317of the objects.
318 318
319 At present, each integer value has a unique Lisp object in Emacs Lisp. 319 In Emacs Lisp, each integer value is a unique Lisp object.
320Therefore, @code{eq} is equivalent to @code{=} where integers are 320Therefore, @code{eq} is equivalent to @code{=} where integers are
321concerned. It is sometimes convenient to use @code{eq} for comparing an 321concerned. It is sometimes convenient to use @code{eq} for comparing
322unknown value with an integer, because @code{eq} does not report an 322an unknown value with an integer, because @code{eq} does not report an
323error if the unknown value is not a number---it accepts arguments of any 323error if the unknown value is not a number---it accepts arguments of
324type. By contrast, @code{=} signals an error if the arguments are not 324any type. By contrast, @code{=} signals an error if the arguments are
325numbers or markers. However, it is a good idea to use @code{=} if you 325not numbers or markers. However, it is better programming practice to
326can, even for comparing integers, just in case we change the 326use @code{=} if you can, even for comparing integers.
327representation of integers in a future Emacs version. 327
328 328 Sometimes it is useful to compare numbers with @code{equal}, which
329 Sometimes it is useful to compare numbers with @code{equal}; it
330treats two numbers as equal if they have the same data type (both 329treats two numbers as equal if they have the same data type (both
331integers, or both floating point) and the same value. By contrast, 330integers, or both floating point) and the same value. By contrast,
332@code{=} can treat an integer and a floating point number as equal. 331@code{=} can treat an integer and a floating point number as equal.
@@ -439,15 +438,16 @@ If @var{number} is already a floating point number, @code{float} returns
439it unchanged. 438it unchanged.
440@end defun 439@end defun
441 440
442There are four functions to convert floating point numbers to integers; 441 There are four functions to convert floating point numbers to
443they differ in how they round. All accept an argument @var{number} 442integers; they differ in how they round. All accept an argument
444and an optional argument @var{divisor}. Both arguments may be 443@var{number} and an optional argument @var{divisor}. Both arguments
445integers or floating point numbers. @var{divisor} may also be 444may be integers or floating point numbers. @var{divisor} may also be
446@code{nil}. If @var{divisor} is @code{nil} or omitted, these 445@code{nil}. If @var{divisor} is @code{nil} or omitted, these
447functions convert @var{number} to an integer, or return it unchanged 446functions convert @var{number} to an integer, or return it unchanged
448if it already is an integer. If @var{divisor} is non-@code{nil}, they 447if it already is an integer. If @var{divisor} is non-@code{nil}, they
449divide @var{number} by @var{divisor} and convert the result to an 448divide @var{number} by @var{divisor} and convert the result to an
450integer. An @code{arith-error} results if @var{divisor} is 0. 449integer. integer. If @var{divisor} is zero (whether integer or
450floating-point), Emacs signals an @code{arith-error} error.
451 451
452@defun truncate number &optional divisor 452@defun truncate number &optional divisor
453This returns @var{number}, converted to an integer by rounding towards 453This returns @var{number}, converted to an integer by rounding towards
@@ -524,14 +524,12 @@ depending on your machine.
524@section Arithmetic Operations 524@section Arithmetic Operations
525@cindex arithmetic operations 525@cindex arithmetic operations
526 526
527 Emacs Lisp provides the traditional four arithmetic operations: 527 Emacs Lisp provides the traditional four arithmetic operations
528addition, subtraction, multiplication, and division. Remainder and modulus 528(addition, subtraction, multiplication, and division), as well as
529functions supplement the division functions. The functions to 529remainder and modulus functions, and functions to add or subtract 1.
530add or subtract 1 are provided because they are traditional in Lisp and 530Except for @code{%}, each of these functions accepts both integer and
531commonly used. 531floating point arguments, and returns a floating point number if any
532 532argument is a floating point number.
533 All of these functions except @code{%} return a floating point value
534if any argument is floating.
535 533
536 It is important to note that in Emacs Lisp, arithmetic functions 534 It is important to note that in Emacs Lisp, arithmetic functions
537do not check for overflow. Thus @code{(1+ 536870911)} may evaluate to 535do not check for overflow. Thus @code{(1+ 536870911)} may evaluate to
@@ -620,40 +618,49 @@ quotient. If there are additional arguments @var{divisors}, then it
620divides @var{dividend} by each divisor in turn. Each argument may be a 618divides @var{dividend} by each divisor in turn. Each argument may be a
621number or a marker. 619number or a marker.
622 620
623If all the arguments are integers, then the result is an integer too. 621If all the arguments are integers, the result is an integer, obtained
624This means the result has to be rounded. On most machines, the result 622by rounding the quotient towards zero after each division.
625is rounded towards zero after each division, but some machines may round 623(Hypothetically, some machines may have different rounding behavior
626differently with negative arguments. This is because the Lisp function 624for negative arguments, because @code{/} is implemented using the C
627@code{/} is implemented using the C division operator, which also 625division operator, which permits machine-dependent rounding; but this
628permits machine-dependent rounding. As a practical matter, all known 626does not happen in practice.)
629machines round in the standard fashion.
630
631@cindex @code{arith-error} in division
632If you divide an integer by 0, an @code{arith-error} error is signaled.
633(@xref{Errors}.) Floating point division by zero returns either
634infinity or a NaN if your machine supports @acronym{IEEE} floating point;
635otherwise, it signals an @code{arith-error} error.
636 627
637@example 628@example
638@group 629@group
639(/ 6 2) 630(/ 6 2)
640 @result{} 3 631 @result{} 3
641@end group 632@end group
633@group
642(/ 5 2) 634(/ 5 2)
643 @result{} 2 635 @result{} 2
636@end group
637@group
644(/ 5.0 2) 638(/ 5.0 2)
645 @result{} 2.5 639 @result{} 2.5
640@end group
641@group
646(/ 5 2.0) 642(/ 5 2.0)
647 @result{} 2.5 643 @result{} 2.5
644@end group
645@group
648(/ 5.0 2.0) 646(/ 5.0 2.0)
649 @result{} 2.5 647 @result{} 2.5
648@end group
649@group
650(/ 25 3 2) 650(/ 25 3 2)
651 @result{} 4 651 @result{} 4
652@end group
652@group 653@group
653(/ -17 6) 654(/ -17 6)
654 @result{} -2 @r{(could in theory be @minus{}3 on some machines)} 655 @result{} -2
655@end group 656@end group
656@end example 657@end example
658
659@cindex @code{arith-error} in division
660If you divide an integer by the integer 0, Emacs signals an
661@code{arith-error} error (@pxref{Errors}). If you divide a floating
662point number by 0, or divide by the floating point number 0.0, the
663result is either positive or negative infinity (@pxref{Float Basics}).
657@end defun 664@end defun
658 665
659@defun % dividend divisor 666@defun % dividend divisor
@@ -661,10 +668,18 @@ otherwise, it signals an @code{arith-error} error.
661This function returns the integer remainder after division of @var{dividend} 668This function returns the integer remainder after division of @var{dividend}
662by @var{divisor}. The arguments must be integers or markers. 669by @var{divisor}. The arguments must be integers or markers.
663 670
664For negative arguments, the remainder is in principle machine-dependent 671For any two integers @var{dividend} and @var{divisor},
665since the quotient is; but in practice, all known machines behave alike. 672
673@example
674@group
675(+ (% @var{dividend} @var{divisor})
676 (* (/ @var{dividend} @var{divisor}) @var{divisor}))
677@end group
678@end example
666 679
667An @code{arith-error} results if @var{divisor} is 0. 680@noindent
681always equals @var{dividend}. If @var{divisor} is zero, Emacs signals
682an @code{arith-error} error.
668 683
669@example 684@example
670(% 9 4) 685(% 9 4)
@@ -676,18 +691,6 @@ An @code{arith-error} results if @var{divisor} is 0.
676(% -9 -4) 691(% -9 -4)
677 @result{} -1 692 @result{} -1
678@end example 693@end example
679
680For any two integers @var{dividend} and @var{divisor},
681
682@example
683@group
684(+ (% @var{dividend} @var{divisor})
685 (* (/ @var{dividend} @var{divisor}) @var{divisor}))
686@end group
687@end example
688
689@noindent
690always equals @var{dividend}.
691@end defun 694@end defun
692 695
693@defun mod dividend divisor 696@defun mod dividend divisor
@@ -697,10 +700,9 @@ in other words, the remainder after division of @var{dividend}
697by @var{divisor}, but with the same sign as @var{divisor}. 700by @var{divisor}, but with the same sign as @var{divisor}.
698The arguments must be numbers or markers. 701The arguments must be numbers or markers.
699 702
700Unlike @code{%}, @code{mod} returns a well-defined result for negative 703Unlike @code{%}, @code{mod} permits floating point arguments; it
701arguments. It also permits floating point arguments; it rounds the 704rounds the quotient downward (towards minus infinity) to an integer,
702quotient downward (towards minus infinity) to an integer, and uses that 705and uses that quotient to compute the remainder.
703quotient to compute the remainder.
704 706
705If @var{divisor} is zero, @code{mod} signals an @code{arith-error} 707If @var{divisor} is zero, @code{mod} signals an @code{arith-error}
706error if both arguments are integers, and returns a NaN otherwise. 708error if both arguments are integers, and returns a NaN otherwise.
@@ -1086,8 +1088,8 @@ numbers as arguments.
1086@defun sin arg 1088@defun sin arg
1087@defunx cos arg 1089@defunx cos arg
1088@defunx tan arg 1090@defunx tan arg
1089These are the ordinary trigonometric functions, with argument measured 1091These are the basic trigonometric functions, with argument @var{arg}
1090in radians. 1092measured in radians.
1091@end defun 1093@end defun
1092 1094
1093@defun asin arg 1095@defun asin arg
@@ -1154,20 +1156,6 @@ This function returns the logarithm of @var{arg}, with base
1154returns a NaN. 1156returns a NaN.
1155@end defun 1157@end defun
1156 1158
1157@ignore
1158@defun expm1 arg
1159This function returns @code{(1- (exp @var{arg}))}, but it is more
1160accurate than that when @var{arg} is negative and @code{(exp @var{arg})}
1161is close to 1.
1162@end defun
1163
1164@defun log1p arg
1165This function returns @code{(log (1+ @var{arg}))}, but it is more
1166accurate than that when @var{arg} is so small that adding 1 to it would
1167lose accuracy.
1168@end defun
1169@end ignore
1170
1171@defun log10 arg 1159@defun log10 arg
1172This function returns the logarithm of @var{arg}, with base 10: 1160This function returns the logarithm of @var{arg}, with base 10:
1173@code{(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}. 1161@code{(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}.
@@ -1201,20 +1189,20 @@ The mathematical constant @math{pi} (3.14159@dots{}).
1201@section Random Numbers 1189@section Random Numbers
1202@cindex random numbers 1190@cindex random numbers
1203 1191
1204A deterministic computer program cannot generate true random numbers. 1192 A deterministic computer program cannot generate true random
1205For most purposes, @dfn{pseudo-random numbers} suffice. A series of 1193numbers. For most purposes, @dfn{pseudo-random numbers} suffice. A
1206pseudo-random numbers is generated in a deterministic fashion. The 1194series of pseudo-random numbers is generated in a deterministic
1207numbers are not truly random, but they have certain properties that 1195fashion. The numbers are not truly random, but they have certain
1208mimic a random series. For example, all possible values occur equally 1196properties that mimic a random series. For example, all possible
1209often in a pseudo-random series. 1197values occur equally often in a pseudo-random series.
1210 1198
1211In Emacs, pseudo-random numbers are generated from a ``seed''. 1199 Pseudo-random numbers are generated from a ``seed''. Starting from
1212Starting from any given seed, the @code{random} function always 1200any given seed, the @code{random} function always generates the same
1213generates the same sequence of numbers. Emacs typically starts with a 1201sequence of numbers. By default, Emacs initializes the random seed at
1214different seed each time, so the sequence of values of @code{random} 1202startup, in such a way that the sequence of values of @code{random}
1215typically differs in each Emacs run. 1203(with overwhelming likelihood) differs in each Emacs run.
1216 1204
1217Sometimes you want the random number sequence to be repeatable. For 1205 Sometimes you want the random number sequence to be repeatable. For
1218example, when debugging a program whose behavior depends on the random 1206example, when debugging a program whose behavior depends on the random
1219number sequence, it is helpful to get the same behavior in each 1207number sequence, it is helpful to get the same behavior in each
1220program run. To make the sequence repeat, execute @code{(random "")}. 1208program run. To make the sequence repeat, execute @code{(random "")}.
@@ -1227,8 +1215,10 @@ This function returns a pseudo-random integer. Repeated calls return a
1227series of pseudo-random integers. 1215series of pseudo-random integers.
1228 1216
1229If @var{limit} is a positive integer, the value is chosen to be 1217If @var{limit} is a positive integer, the value is chosen to be
1230nonnegative and less than @var{limit}. Otherwise, the value 1218nonnegative and less than @var{limit}. Otherwise, the value might be
1231might be any integer representable in Lisp. 1219any integer representable in Lisp, i.e.@: an integer between
1220@code{most-negative-fixnum} and @code{most-positive-fixnum}
1221(@pxref{Integer Basics}).
1232 1222
1233If @var{limit} is @code{t}, it means to choose a new seed based on the 1223If @var{limit} is @code{t}, it means to choose a new seed based on the
1234current time of day and on Emacs's process @acronym{ID} number. 1224current time of day and on Emacs's process @acronym{ID} number.
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 68e53c78972..54754f8e5e9 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -70,13 +70,11 @@ in their turn. The files @file{subdirs.el} are normally generated
70automatically when Emacs is installed. 70automatically when Emacs is installed.
71 71
72@item 72@item
73It registers input methods by loading any @file{leim-list.el} file 73If the library @file{leim-list.el} exists, Emacs loads it. This
74found in the @code{load-path}. 74optional library is intended for registering input methods; Emacs
75 75looks for it in @code{load-path} (@pxref{Library Search}), skipping
76@c It removes PWD from the environment if it is not accurate. 76those directories containing the standard Emacs libraries (since
77@c It abbreviates default-directory. 77@file{leim-list.el} should not exist in those directories).
78
79@c Now normal-top-level calls command-line.
80 78
81@vindex before-init-time 79@vindex before-init-time
82@item 80@item
@@ -1159,6 +1157,20 @@ This function returns the effective @acronym{UID} of the user.
1159The value may be a floating point number. 1157The value may be a floating point number.
1160@end defun 1158@end defun
1161 1159
1160@defun system-users
1161This function returns a list of strings, listing the user names on the
1162system. If Emacs cannot retrieve this information, the return value
1163is a list containing just the value of @code{user-real-login-name}.
1164@end defun
1165
1166@cindex user groups
1167@defun system-groups
1168This function returns a list of strings, listing the names of user
1169groups on the system. If Emacs cannot retrieve this information, the
1170return value is @code{nil}.
1171@end defun
1172
1173
1162@node Time of Day 1174@node Time of Day
1163@section Time of Day 1175@section Time of Day
1164 1176
@@ -1812,6 +1824,29 @@ minutes, and even if there have been garbage collections and autosaves.
1812input. Then it becomes idle again, and all the idle timers that are 1824input. Then it becomes idle again, and all the idle timers that are
1813set up to repeat will subsequently run another time, one by one. 1825set up to repeat will subsequently run another time, one by one.
1814 1826
1827 Do not write an idle timer function containing a loop which does a
1828certain amount of processing each time around, and exits when
1829@code{(input-pending-p)} is non-@code{nil}. This approach seems very
1830natural but has two problems:
1831
1832@itemize
1833@item
1834It blocks out all process output (since Emacs accepts process output
1835only while waiting).
1836
1837@item
1838It blocks out any idle timers that ought to run during that time.
1839@end itemize
1840
1841@noindent
1842Similarly, do not write an idle timer function that sets up another
1843idle timer (including the same idle timer) with @var{secs} argument
1844less than or equal to the current idleness time. Such a timer will
1845run almost immediately, and continue running again and again, instead
1846of waiting for the next time Emacs becomes idle. The correct approach
1847is to reschedule with an appropriate increment of the current value of
1848the idleness time, as described below.
1849
1815@defun current-idle-time 1850@defun current-idle-time
1816If Emacs is idle, this function returns the length of time Emacs has 1851If Emacs is idle, this function returns the length of time Emacs has
1817been idle, as a list of four integers: @code{(@var{sec-high} 1852been idle, as a list of four integers: @code{(@var{sec-high}
@@ -1820,60 +1855,34 @@ been idle, as a list of four integers: @code{(@var{sec-high}
1820 1855
1821When Emacs is not idle, @code{current-idle-time} returns @code{nil}. 1856When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
1822This is a convenient way to test whether Emacs is idle. 1857This is a convenient way to test whether Emacs is idle.
1858@end defun
1823 1859
1824The main use of this function is when an idle timer function wants to 1860 The main use of @code{current-idle-time} is when an idle timer
1825``take a break'' for a while. It can set up another idle timer to 1861function wants to ``take a break'' for a while. It can set up another
1826call the same function again, after a few seconds more idleness. 1862idle timer to call the same function again, after a few seconds more
1827Here's an example: 1863idleness. Here's an example:
1828 1864
1829@smallexample 1865@example
1830(defvar resume-timer nil 1866(defvar my-resume-timer nil
1831 "Timer that `timer-function' used to reschedule itself, or nil.") 1867 "Timer for `my-timer-function' to reschedule itself, or nil.")
1832 1868
1833(defun timer-function () 1869(defun my-timer-function ()
1834 ;; @r{If the user types a command while @code{resume-timer}} 1870 ;; @r{If the user types a command while @code{my-resume-timer}}
1835 ;; @r{is active, the next time this function is called from} 1871 ;; @r{is active, the next time this function is called from}
1836 ;; @r{its main idle timer, deactivate @code{resume-timer}.} 1872 ;; @r{its main idle timer, deactivate @code{my-resume-timer}.}
1837 (when resume-timer 1873 (when my-resume-timer
1838 (cancel-timer resume-timer)) 1874 (cancel-timer my-resume-timer))
1839 ...@var{do the work for a while}... 1875 ...@var{do the work for a while}...
1840 (when @var{taking-a-break} 1876 (when @var{taking-a-break}
1841 (setq resume-timer 1877 (setq my-resume-timer
1842 (run-with-idle-timer 1878 (run-with-idle-timer
1843 ;; Compute an idle time @var{break-length} 1879 ;; Compute an idle time @var{break-length}
1844 ;; more than the current value. 1880 ;; more than the current value.
1845 (time-add (current-idle-time) 1881 (time-add (current-idle-time)
1846 (seconds-to-time @var{break-length})) 1882 (seconds-to-time @var{break-length}))
1847 nil 1883 nil
1848 'timer-function)))) 1884 'my-timer-function))))
1849@end smallexample 1885@end example
1850@end defun
1851
1852 Do not write an idle timer function containing a loop which does a
1853certain amount of processing each time around, and exits when
1854@code{(input-pending-p)} is non-@code{nil}. This approach seems very
1855natural but has two problems:
1856
1857@itemize
1858@item
1859It blocks out all process output (since Emacs accepts process output
1860only while waiting).
1861
1862@item
1863It blocks out any idle timers that ought to run during that time.
1864@end itemize
1865
1866@noindent
1867For similar reasons, do not write an idle timer function that sets
1868up another idle time (including the same idle timer) with the
1869@var{secs} argument less or equal to the current idleness time. Such
1870a timer will run almost immediately, and continue running again and
1871again, instead of waiting for the next time Emacs becomes idle.
1872
1873@noindent
1874The correct approach is for the idle timer to reschedule itself after
1875a brief pause, using the method in the @code{timer-function} example
1876above.
1877 1886
1878@node Terminal Input 1887@node Terminal Input
1879@section Terminal Input 1888@section Terminal Input
@@ -1907,7 +1916,6 @@ If @var{flow} is non-@code{nil}, then Emacs uses @sc{xon/xoff}
1907(@kbd{C-q}, @kbd{C-s}) flow control for output to the terminal. This 1916(@kbd{C-q}, @kbd{C-s}) flow control for output to the terminal. This
1908has no effect except in @sc{cbreak} mode. 1917has no effect except in @sc{cbreak} mode.
1909 1918
1910@c Emacs 19 feature
1911The argument @var{meta} controls support for input character codes 1919The argument @var{meta} controls support for input character codes
1912above 127. If @var{meta} is @code{t}, Emacs converts characters with 1920above 127. If @var{meta} is @code{t}, Emacs converts characters with
1913the 8th bit set into Meta characters. If @var{meta} is @code{nil}, 1921the 8th bit set into Meta characters. If @var{meta} is @code{nil},
@@ -1916,7 +1924,6 @@ it as a parity bit. If @var{meta} is neither @code{t} nor @code{nil},
1916Emacs uses all 8 bits of input unchanged. This is good for terminals 1924Emacs uses all 8 bits of input unchanged. This is good for terminals
1917that use 8-bit character sets. 1925that use 8-bit character sets.
1918 1926
1919@c Emacs 19 feature
1920If @var{quit-char} is non-@code{nil}, it specifies the character to 1927If @var{quit-char} is non-@code{nil}, it specifies the character to
1921use for quitting. Normally this character is @kbd{C-g}. 1928use for quitting. Normally this character is @kbd{C-g}.
1922@xref{Quitting}. 1929@xref{Quitting}.
@@ -1925,7 +1932,6 @@ use for quitting. Normally this character is @kbd{C-g}.
1925The @code{current-input-mode} function returns the input mode settings 1932The @code{current-input-mode} function returns the input mode settings
1926Emacs is currently using. 1933Emacs is currently using.
1927 1934
1928@c Emacs 19 feature
1929@defun current-input-mode 1935@defun current-input-mode
1930This function returns the current mode for reading keyboard input. It 1936This function returns the current mode for reading keyboard input. It
1931returns a list, corresponding to the arguments of @code{set-input-mode}, 1937returns a list, corresponding to the arguments of @code{set-input-mode},
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index b7097e057c0..865435c91b3 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -35,28 +35,31 @@ keyboard character events.
35@node String Basics 35@node String Basics
36@section String and Character Basics 36@section String and Character Basics
37 37
38 Characters are represented in Emacs Lisp as integers; 38 A character is a Lisp object which represents a single character of
39whether an integer is a character or not is determined only by how it is 39text. In Emacs Lisp, characters are simply integers; whether an
40used. Thus, strings really contain integers. @xref{Character Codes}, 40integer is a character or not is determined only by how it is used.
41for details about character representation in Emacs. 41@xref{Character Codes}, for details about character representation in
42 42Emacs.
43 The length of a string (like any array) is fixed, and cannot be 43
44altered once the string exists. Strings in Lisp are @emph{not} 44 A string is a fixed sequence of characters. It is a type of
45terminated by a distinguished character code. (By contrast, strings in 45sequence called a @dfn{array}, meaning that its length is fixed and
46C are terminated by a character with @acronym{ASCII} code 0.) 46cannot be altered once it is created (@pxref{Sequences Arrays
47Vectors}). Unlike in C, Emacs Lisp strings are @emph{not} terminated
48by a distinguished character code.
47 49
48 Since strings are arrays, and therefore sequences as well, you can 50 Since strings are arrays, and therefore sequences as well, you can
49operate on them with the general array and sequence functions. 51operate on them with the general array and sequence functions
50(@xref{Sequences Arrays Vectors}.) For example, you can access or 52documented in @ref{Sequences Arrays Vectors}. For example, you can
51change individual characters in a string using the functions @code{aref} 53access or change individual characters in a string using the functions
52and @code{aset} (@pxref{Array Functions}). However, note that 54@code{aref} and @code{aset} (@pxref{Array Functions}). However, note
53@code{length} should @emph{not} be used for computing the width of a 55that @code{length} should @emph{not} be used for computing the width
54string on display; use @code{string-width} (@pxref{Width}) instead. 56of a string on display; use @code{string-width} (@pxref{Width})
55 57instead.
56 There are two text representations for non-@acronym{ASCII} characters in 58
57Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text 59 There are two text representations for non-@acronym{ASCII}
58Representations}). For most Lisp programming, you don't need to be 60characters in Emacs strings (and in buffers): unibyte and multibyte.
59concerned with these two representations. 61For most Lisp programming, you don't need to be concerned with these
62two representations. @xref{Text Representations}, for details.
60 63
61 Sometimes key sequences are represented as unibyte strings. When a 64 Sometimes key sequences are represented as unibyte strings. When a
62unibyte string is a key sequence, string elements in the range 128 to 65unibyte string is a key sequence, string elements in the range 128 to
@@ -88,7 +91,7 @@ for information about the syntax of characters and strings.
88representations and to encode and decode character codes. 91representations and to encode and decode character codes.
89 92
90@node Predicates for Strings 93@node Predicates for Strings
91@section The Predicates for Strings 94@section Predicates for Strings
92 95
93For more information about general sequence and array predicates, 96For more information about general sequence and array predicates,
94see @ref{Sequences Arrays Vectors}, and @ref{Arrays}. 97see @ref{Sequences Arrays Vectors}, and @ref{Arrays}.