aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog15
-rw-r--r--doc/emacs/dired.texi6
-rw-r--r--doc/emacs/help.texi3
-rw-r--r--doc/emacs/mule.texi6
-rw-r--r--doc/emacs/package.texi45
-rw-r--r--doc/lispref/ChangeLog38
-rw-r--r--doc/lispref/frames.texi3
-rw-r--r--doc/lispref/internals.texi182
-rw-r--r--doc/lispref/modes.texi4
-rw-r--r--doc/lispref/os.texi343
-rw-r--r--doc/lispref/package.texi41
11 files changed, 388 insertions, 298 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 5a1d1394b23..f5ccba1005f 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,18 @@
12012-03-17 Chong Yidong <cyd@gnu.org>
2
3 * package.texi (Package Installation): Document use of
4 package-initialize in init file.
5
62012-03-16 Glenn Morris <rgm@gnu.org>
7
8 * help.texi (Language Help):
9 * mule.texi (International Chars):
10 etc/HELLO is for character demonstration.
11
122012-03-15 Dani Moncayo <dmoncayo@gmail.com> (tiny change)
13
14 * dired.texi (Shell Commands in Dired): Fix typo.
15
12012-03-04 Chong Yidong <cyd@gnu.org> 162012-03-04 Chong Yidong <cyd@gnu.org>
2 17
3 * killing.texi (Clipboard): Document clipboard manager. 18 * killing.texi (Clipboard): Document clipboard manager.
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index e048237a4e2..7dd290939fe 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -823,9 +823,9 @@ replaces each occurrence.
823 823
824@item 824@item
825If the command string contains neither @samp{*} nor @samp{?}, Emacs 825If the command string contains neither @samp{*} nor @samp{?}, Emacs
826runs the shell command once for each file, adding the file name is 826runs the shell command once for each file, adding the file name at the
827added at the end. For example, @kbd{! uudecode @key{RET}} runs 827end. For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on
828@code{uudecode} on each file. 828each file.
829@end itemize 829@end itemize
830 830
831 To iterate over the file names in a more complicated fashion, use an 831 To iterate over the file names in a more complicated fashion, use an
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 05a3e546322..84da0a9a681 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -464,7 +464,8 @@ listing the associated character sets, coding systems, and input
464methods, as well as some sample text for that language environment. 464methods, as well as some sample text for that language environment.
465 465
466 The command @kbd{C-h h} (@code{view-hello-file}) displays the file 466 The command @kbd{C-h h} (@code{view-hello-file}) displays the file
467@file{etc/HELLO}, which shows how to say ``hello'' in many languages. 467@file{etc/HELLO}, which demonstrates various character sets by showing
468how to say ``hello'' in many languages.
468 469
469 The command @kbd{C-h I} (@code{describe-input-method}) describes an 470 The command @kbd{C-h I} (@code{describe-input-method}) describes an
470input method---either a specified input method, or by default the 471input method---either a specified input method, or by default the
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index aebff1e463a..aeaec2c502e 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1,5 +1,5 @@
1@c This is part of the Emacs manual. 1@c This is part of the Emacs manual.
2@c Copyright (C) 1997, 1999-2012 Free Software Foundation, Inc. 2@c Copyright (C) 1997, 1999-2012 Free Software Foundation, Inc.
3@c See file emacs.texi for copying conditions. 3@c See file emacs.texi for copying conditions.
4@node International, Modes, Frames, Top 4@node International, Modes, Frames, Top
5@chapter International Character Set Support 5@chapter International Character Set Support
@@ -137,8 +137,8 @@ writing files, and when exchanging data with subprocesses.
137@cindex undisplayable characters 137@cindex undisplayable characters
138@cindex @samp{?} in display 138@cindex @samp{?} in display
139 The command @kbd{C-h h} (@code{view-hello-file}) displays the file 139 The command @kbd{C-h h} (@code{view-hello-file}) displays the file
140@file{etc/HELLO}, which shows how to say ``hello'' in many languages. 140@file{etc/HELLO}, which illustrates various scripts by showing
141This illustrates various scripts. If some characters can't be 141how to say ``hello'' in many languages. If some characters can't be
142displayed on your terminal, they appear as @samp{?} or as hollow boxes 142displayed on your terminal, they appear as @samp{?} or as hollow boxes
143(@pxref{Undisplayable Characters}). 143(@pxref{Undisplayable Characters}).
144 144
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 7e2aa20d52e..91b25cfa00e 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -157,25 +157,38 @@ directory name of the package archive. You can alter this list if you
157wish to use third party package archives---but do so at your own risk, 157wish to use third party package archives---but do so at your own risk,
158and use only third parties that you think you can trust! 158and use only third parties that you think you can trust!
159 159
160 Once a package is downloaded and installed, it takes effect in the 160 Once a package is downloaded and installed, it is @dfn{loaded} into
161current Emacs session. What ``taking effect'' means depends on the 161the current Emacs session. Loading a package is not quite the same as
162package; most packages just make some new commands available, while 162loading a Lisp library (@pxref{Lisp Libraries}); its effect varies
163others have more wide-ranging effects on the Emacs session. For such 163from package to package. Most packages just make some new commands
164information, consult the package's help buffer. 164available, while others have more wide-ranging effects on the Emacs
165 165session. For such information, consult the package's help buffer.
166 By default, Emacs also automatically loads all installed packages 166
167(causing them to ``take effect'') in subsequent Emacs sessions. This 167 By default, Emacs also automatically loads all installed packages in
168happens at startup, after processing the init file (@pxref{Init 168subsequent Emacs sessions. This happens at startup, after processing
169File}). As an exception, Emacs does not load packages at startup if 169the init file (@pxref{Init File}). As an exception, Emacs does not
170invoked with the @samp{-q} or @samp{--no-init-file} options 170load packages at startup if invoked with the @samp{-q} or
171(@pxref{Initial Options}). 171@samp{--no-init-file} options (@pxref{Initial Options}).
172 172
173@vindex package-enable-at-startup 173@vindex package-enable-at-startup
174@findex package-initialize
175 To disable automatic package loading, change the variable 174 To disable automatic package loading, change the variable
176@code{package-enable-at-startup} to @code{nil}. If you do this, you 175@code{package-enable-at-startup} to @code{nil}.
177can use the command @kbd{M-x package-initialize} to load your 176
178packages. 177@findex package-initialize
178 The reason automatic package loading occurs after loading the init
179file is that user options only receive their customized values after
180loading the init file, including user options which affect the
181packaging system. In some circumstances, you may want to load
182packages explicitly in your init file (usually because some other code
183in your init file depends on a package). In that case, your init file
184should call the function @code{package-initialize}. It is up to you
185to ensure that relevant user options, such as @code{package-load-list}
186(see below), are set up prior to the @code{package-initialize} call.
187You should also set @code{package-enable-at-startup} to @code{nil}, to
188avoid loading the packages again after processing the init file.
189Alternatively, you may choose to completely inhibit package loading at
190startup, and invoke the command @kbd{M-x package-initialize} to load
191your packages manually.
179 192
180@vindex package-load-list 193@vindex package-load-list
181 For finer control over package loading, you can use the variable 194 For finer control over package loading, you can use the variable
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 3584c89d5fe..af0cb306245 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,41 @@
12012-03-18 Chong Yidong <cyd@gnu.org>
2
3 * internals.texi (Building Emacs, Garbage Collection): Copyedits.
4 (Writing Emacs Primitives): Re-organize discussion of functions
5 with variable Lisp arguments are handled. Delete an obsolete
6 remark, previously tagged as FIXME.
7
8 * os.texi (Idle Timers): Minor clarification.
9 (Idle Timers): Link to Time of Day for description of time list.
10
112012-03-18 Glenn Morris <rgm@gnu.org>
12
13 * os.texi (System Interface): Flow control was removed.
14 (Startup Summary): General update.
15 (Init File): Don't mention compiling it.
16
172012-03-17 Chong Yidong <cyd@gnu.org>
18
19 * os.texi (Startup Summary): Mention package loading.
20 (Init File): Don't refer to .emacs in section title. Copyedits.
21 (Terminal-Specific): Give a realistic example.
22 (Command-Line Arguments): Reference Entering Emacs instead of
23 repeating the spiel about not restarting Emacs.
24 (Time of Day): Discuss time representation at beginning of node.
25 (Sound Output): Copyedits.
26
27 * package.texi (Packaging Basics): Document package-initialize.
28
292012-03-17 Eli Zaretskii <eliz@gnu.org>
30
31 * frames.texi (Initial Parameters): Add an index entry for
32 minibuffer-only frame.
33
342012-03-16 Glenn Morris <rgm@gnu.org>
35
36 * modes.texi (Major Mode Conventions): Mention the strange
37 relationship between View mode and special modes. (Bug#10650)
38
12012-03-11 Chong Yidong <cyd@gnu.org> 392012-03-11 Chong Yidong <cyd@gnu.org>
2 40
3 * windows.texi (Window Configurations): save-window-excursion is 41 * windows.texi (Window Configurations): save-window-excursion is
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index a01ad051489..125d6071cab 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -420,10 +420,11 @@ the initial frame, specify the same parameters in
420@code{initial-frame-alist} with values that match the X resources. 420@code{initial-frame-alist} with values that match the X resources.
421@end defopt 421@end defopt
422 422
423If these parameters specify a separate minibuffer-only frame with 423If these parameters specify a separate @dfn{minibuffer-only frame} with
424@code{(minibuffer . nil)}, and you have not created one, Emacs creates 424@code{(minibuffer . nil)}, and you have not created one, Emacs creates
425one for you. 425one for you.
426 426
427@cindex minibuffer-only frame
427@defopt minibuffer-frame-alist 428@defopt minibuffer-frame-alist
428This variable's value is an alist of parameter values used when 429This variable's value is an alist of parameter values used when
429creating an initial minibuffer-only frame. This is the 430creating an initial minibuffer-only frame. This is the
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 83bbc140b13..edf892e751a 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -28,42 +28,39 @@ internal aspects of GNU Emacs that may be of interest to C programmers.
28 This section explains the steps involved in building the Emacs 28 This section explains the steps involved in building the Emacs
29executable. You don't have to know this material to build and install 29executable. You don't have to know this material to build and install
30Emacs, since the makefiles do all these things automatically. This 30Emacs, since the makefiles do all these things automatically. This
31information is pertinent to Emacs maintenance. 31information is pertinent to Emacs developers.
32 32
33 Compilation of the C source files in the @file{src} directory 33 Compilation of the C source files in the @file{src} directory
34produces an executable file called @file{temacs}, also called a 34produces an executable file called @file{temacs}, also called a
35@dfn{bare impure Emacs}. It contains the Emacs Lisp interpreter and I/O 35@dfn{bare impure Emacs}. It contains the Emacs Lisp interpreter and
36routines, but not the editing commands. 36I/O routines, but not the editing commands.
37 37
38@cindex @file{loadup.el} 38@cindex @file{loadup.el}
39 The command @w{@samp{temacs -l loadup}} uses @file{temacs} to create 39 The command @w{@command{temacs -l loadup}} would run @file{temacs}
40the real runnable Emacs executable. These arguments direct 40and direct it to load @file{loadup.el}. The @code{loadup} library
41@file{temacs} to evaluate the Lisp files specified in the file 41loads additional Lisp libraries, which set up the normal Emacs editing
42@file{loadup.el}. These files set up the normal Emacs editing 42environment. After this step, the Emacs executable is no longer
43environment, resulting in an Emacs that is still impure but no longer 43@dfn{bare}.
44bare.
45 44
46@cindex dumping Emacs 45@cindex dumping Emacs
47 It takes some time to load the standard Lisp files. Luckily, 46 Because it takes some time to load the standard Lisp files, the
48you don't have to do this each time you run Emacs; @file{temacs} can 47@file{temacs} executable usually isn't run directly by users.
49dump out an executable program called @file{emacs} that has these files 48Instead, as one of the last steps of building Emacs, the command
50preloaded. @file{emacs} starts more quickly because it does not need to 49@samp{temacs -batch -l loadup dump} is run. The special @samp{dump}
51load the files. This is the Emacs executable that is normally 50argument causes @command{temacs} to dump out an executable program,
52installed. 51called @file{emacs}, which has all the standard Lisp files preloaded.
53 52(The @samp{-batch} argument prevents @file{temacs} from trying to
53initialize any of its data on the terminal, so that the tables of
54terminal information are empty in the dumped Emacs.)
55
56@cindex preloaded Lisp files
54@vindex preloaded-file-list 57@vindex preloaded-file-list
55@cindex dumped Lisp files 58 The dumped @file{emacs} executable (also called a @dfn{pure} Emacs)
56 To create @file{emacs}, use the command @samp{temacs -batch -l loadup 59is the one which is installed. The variable
57dump}. The purpose of @samp{-batch} here is to prevent @file{temacs} 60@code{preloaded-file-list} stores a list of the Lisp files preloaded
58from trying to initialize any of its data on the terminal; this ensures 61into the dumped Emacs. If you port Emacs to a new operating system,
59that the tables of terminal information are empty in the dumped Emacs. 62and are not able to implement dumping, then Emacs must load
60The argument @samp{dump} tells @file{loadup.el} to dump a new executable 63@file{loadup.el} each time it starts.
61named @file{emacs}. The variable @code{preloaded-file-list} stores a
62list of the Lisp files that were dumped with the @file{emacs} executable.
63
64 If you port Emacs to a new operating system, and are not able to
65implement dumping, then Emacs must load @file{loadup.el} each time it
66starts.
67 64
68@cindex @file{site-load.el} 65@cindex @file{site-load.el}
69 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
@@ -134,7 +131,7 @@ in a different location since it was dumped.
134This function delays the initialization of @var{symbol} to the next 131This function delays the initialization of @var{symbol} to the next
135Emacs start. You normally use this function by specifying it as the 132Emacs start. You normally use this function by specifying it as the
136@code{:initialize} property of a customizable variable. (The argument 133@code{:initialize} property of a customizable variable. (The argument
137@var{value} is unused, and is provided only for compatiblity with the 134@var{value} is unused, and is provided only for compatibility with the
138form Custom expects.) 135form Custom expects.)
139@end defun 136@end defun
140 137
@@ -163,7 +160,7 @@ all the new data created during an Emacs session are kept
163in the preloaded standard Lisp files---data that should never change 160in the preloaded standard Lisp files---data that should never change
164during actual use of Emacs. 161during actual use of Emacs.
165 162
166 Pure storage is allocated only while @file{temacs} is loading the 163 Pure storage is allocated only while @command{temacs} is loading the
167standard preloaded Lisp libraries. In the file @file{emacs}, it is 164standard preloaded Lisp libraries. In the file @file{emacs}, it is
168marked as read-only (on operating systems that permit this), so that 165marked as read-only (on operating systems that permit this), so that
169the memory space can be shared by all the Emacs jobs running on the 166the memory space can be shared by all the Emacs jobs running on the
@@ -214,31 +211,27 @@ You should not change this flag in a running Emacs.
214 211
215@node Garbage Collection 212@node Garbage Collection
216@section Garbage Collection 213@section Garbage Collection
217@cindex garbage collection
218 214
219@cindex memory allocation 215@cindex memory allocation
220 When a program creates a list or the user defines a new function (such 216 When a program creates a list or the user defines a new function
221as by loading a library), that data is placed in normal storage. If 217(such as by loading a library), that data is placed in normal storage.
222normal storage runs low, then Emacs asks the operating system to 218If normal storage runs low, then Emacs asks the operating system to
223allocate more memory in blocks of 1k bytes. Each block is used for one 219allocate more memory. Different types of Lisp objects, such as
224type of Lisp object, so symbols, cons cells, markers, etc., are 220symbols, cons cells, markers, etc., are segregated in distinct blocks
225segregated in distinct blocks in memory. (Vectors, long strings, 221in memory. (Vectors, long strings, buffers and certain other editing
226buffers and certain other editing types, which are fairly large, are 222types, which are fairly large, are allocated in individual blocks, one
227allocated in individual blocks, one per object, while small strings are 223per object, while small strings are packed into blocks of 8k bytes.)
228packed into blocks of 8k bytes.)
229
230 It is quite common to use some storage for a while, then release it by
231(for example) killing a buffer or deleting the last pointer to an
232object. Emacs provides a @dfn{garbage collector} to reclaim this
233abandoned storage. (This name is traditional, but ``garbage recycler''
234might be a more intuitive metaphor for this facility.)
235 224
236 The garbage collector operates by finding and marking all Lisp objects 225@cindex garbage collection
237that are still accessible to Lisp programs. To begin with, it assumes 226 It is quite common to use some storage for a while, then release it
238all the symbols, their values and associated function definitions, and 227by (for example) killing a buffer or deleting the last pointer to an
239any data presently on the stack, are accessible. Any objects that can 228object. Emacs provides a @dfn{garbage collector} to reclaim this
240be reached indirectly through other accessible objects are also 229abandoned storage. The garbage collector operates by finding and
241accessible. 230marking all Lisp objects that are still accessible to Lisp programs.
231To begin with, it assumes all the symbols, their values and associated
232function definitions, and any data presently on the stack, are
233accessible. Any objects that can be reached indirectly through other
234accessible objects are also accessible.
242 235
243 When marking is finished, all objects still unmarked are garbage. No 236 When marking is finished, all objects still unmarked are garbage. No
244matter what the Lisp program or the user does, it is impossible to refer 237matter what the Lisp program or the user does, it is impossible to refer
@@ -336,11 +329,9 @@ The total size of all strings, in characters.
336The total number of elements of existing vectors. 329The total number of elements of existing vectors.
337 330
338@item used-floats 331@item used-floats
339@c Emacs 19 feature
340The number of floats in use. 332The number of floats in use.
341 333
342@item free-floats 334@item free-floats
343@c Emacs 19 feature
344The number of floats for which space has been obtained from the 335The number of floats for which space has been obtained from the
345operating system, but that are not currently being used. 336operating system, but that are not currently being used.
346 337
@@ -417,7 +408,6 @@ memory used by Lisp data, broken down by data type. By contrast, the
417function @code{memory-limit} provides information on the total amount of 408function @code{memory-limit} provides information on the total amount of
418memory Emacs is currently using. 409memory Emacs is currently using.
419 410
420@c Emacs 19 feature
421@defun memory-limit 411@defun memory-limit
422This function returns the address of the last byte Emacs has allocated, 412This function returns the address of the last byte Emacs has allocated,
423divided by 1024. We divide the value by 1024 to make sure it fits in a 413divided by 1024. We divide the value by 1024 to make sure it fits in a
@@ -428,7 +418,7 @@ memory usage.
428@end defun 418@end defun
429 419
430@defvar memory-full 420@defvar memory-full
431This variable is @code{t} if Emacs is close to out of memory for Lisp 421This variable is @code{t} if Emacs is nearly out of memory for Lisp
432objects, and @code{nil} otherwise. 422objects, and @code{nil} otherwise.
433@end defvar 423@end defvar
434 424
@@ -519,8 +509,9 @@ appearance.)
519@smallexample 509@smallexample
520@group 510@group
521DEFUN ("or", For, Sor, 0, UNEVALLED, 0, 511DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
522 doc: /* Eval args until one of them yields non-nil, then return that 512 doc: /* Eval args until one of them yields non-nil, then return
523value. The remaining args are not evalled at all. 513that value.
514The remaining args are not evalled at all.
524If all args return nil, return nil. 515If all args return nil, return nil.
525@end group 516@end group
526@group 517@group
@@ -566,14 +557,11 @@ This is the name of the Lisp symbol to define as the function name; in
566the example above, it is @code{or}. 557the example above, it is @code{or}.
567 558
568@item fname 559@item fname
569This is the C function name for this function. This is 560This is the C function name for this function. This is the name that
570the name that is used in C code for calling the function. The name is, 561is used in C code for calling the function. The name is, by
571by convention, @samp{F} prepended to the Lisp name, with all dashes 562convention, @samp{F} prepended to the Lisp name, with all dashes
572(@samp{-}) in the Lisp name changed to underscores. Thus, to call this 563(@samp{-}) in the Lisp name changed to underscores. Thus, to call
573function from C code, call @code{For}. Remember that the arguments must 564this function from C code, call @code{For}.
574be of type @code{Lisp_Object}; various macros and functions for creating
575values of type @code{Lisp_Object} are declared in the file
576@file{lisp.h}.
577 565
578@item sname 566@item sname
579This is a C variable name to use for a structure that holds the data for 567This is a C variable name to use for a structure that holds the data for
@@ -627,38 +615,35 @@ too.
627@end table 615@end table
628 616
629 After the call to the @code{DEFUN} macro, you must write the 617 After the call to the @code{DEFUN} macro, you must write the
630argument list that every C function must have, including the types for 618argument list for the C function, including the types for the
631the arguments. For a function with a fixed maximum number of 619arguments. If the primitive accepts a fixed maximum number of Lisp
632arguments, declare a C argument for each Lisp argument, and give them 620arguments, there must be one C argument for each Lisp argument, and
633all type @code{Lisp_Object}. When a Lisp function has no upper limit 621each argument must be of type @code{Lisp_Object}. (Various macros and
634on the number of arguments, its implementation in C actually receives 622functions for creating values of type @code{Lisp_Object} are declared
635exactly two arguments: the first is the number of Lisp arguments, and 623in the file @file{lisp.h}.) If the primitive has no upper limit on
636the second is the address of a block containing their values. They 624the number of Lisp arguments, it must have exactly two C arguments:
637have types @code{int} and @w{@code{Lisp_Object *}}. 625the first is the number of Lisp arguments, and the second is the
626address of a block containing their values. These have types
627@code{int} and @w{@code{Lisp_Object *}} respectively.
638 628
639@cindex @code{GCPRO} and @code{UNGCPRO} 629@cindex @code{GCPRO} and @code{UNGCPRO}
640@cindex protect C variables from garbage collection 630@cindex protect C variables from garbage collection
641 Within the function @code{For} itself, note the use of the macros 631 Within the function @code{For} itself, note the use of the macros
642@code{GCPRO1} and @code{UNGCPRO}. @code{GCPRO1} is used to 632@code{GCPRO1} and @code{UNGCPRO}. These macros are defined for the
643``protect'' a variable from garbage collection---to inform the garbage 633sake of the few platforms which do not use Emacs' default
644collector that it must look in that variable and regard its contents 634stack-marking garbage collector. The @code{GCPRO1} macro ``protects''
645as an accessible object. GC protection is necessary whenever you call 635a variable from garbage collection, explicitly informing the garbage
646@code{eval_sub} (or @code{Feval}) either directly or indirectly. 636collector that that variable and all its contents must be as
647At such a time, any Lisp object that this function may refer to again 637accessible. GC protection is necessary in any function which can
648must be protected somehow. 638perform Lisp evaluation by calling @code{eval_sub} or @code{Feval} as
639a subroutine, either directly or indirectly.
649 640
650 It suffices to ensure that at least one pointer to each object is 641 It suffices to ensure that at least one pointer to each object is
651GC-protected; that way, the object cannot be recycled, so all pointers 642GC-protected. Thus, a particular local variable can do without
652to it remain valid. Thus, a particular local variable can do without
653protection if it is certain that the object it points to will be 643protection if it is certain that the object it points to will be
654preserved by some other pointer (such as another local variable that 644preserved by some other pointer (such as another local variable that
655has a @code{GCPRO}). 645has a @code{GCPRO}). Otherwise, the local variable needs a
656@ignore 646@code{GCPRO}.
657@footnote{Formerly, strings were a special exception; in older Emacs
658versions, every local variable that might point to a string needed a
659@code{GCPRO}.}.
660@end ignore
661Otherwise, the local variable needs a @code{GCPRO}.
662 647
663 The macro @code{GCPRO1} protects just one local variable. If you 648 The macro @code{GCPRO1} protects just one local variable. If you
664want to protect two variables, use @code{GCPRO2} instead; repeating 649want to protect two variables, use @code{GCPRO2} instead; repeating
@@ -667,34 +652,17 @@ want to protect two variables, use @code{GCPRO2} instead; repeating
667implicitly use local variables such as @code{gcpro1}; you must declare 652implicitly use local variables such as @code{gcpro1}; you must declare
668these explicitly, with type @code{struct gcpro}. Thus, if you use 653these explicitly, with type @code{struct gcpro}. Thus, if you use
669@code{GCPRO2}, you must declare @code{gcpro1} and @code{gcpro2}. 654@code{GCPRO2}, you must declare @code{gcpro1} and @code{gcpro2}.
670Alas, we can't explain all the tricky details here.
671 655
672 @code{UNGCPRO} cancels the protection of the variables that are 656 @code{UNGCPRO} cancels the protection of the variables that are
673protected in the current function. It is necessary to do this 657protected in the current function. It is necessary to do this
674explicitly. 658explicitly.
675 659
676 Built-in functions that take a variable number of arguments actually
677accept two arguments at the C level: the number of Lisp arguments, and
678a @code{Lisp_Object *} pointer to a C vector containing those Lisp
679arguments. This C vector may be part of a Lisp vector, but it need
680not be. The responsibility for using @code{GCPRO} to protect the Lisp
681arguments from GC if necessary rests with the caller in this case,
682since the caller allocated or found the storage for them.
683
684 You must not use C initializers for static or global variables unless 660 You must not use C initializers for static or global variables unless
685the variables are never written once Emacs is dumped. These variables 661the variables are never written once Emacs is dumped. These variables
686with initializers are allocated in an area of memory that becomes 662with initializers are allocated in an area of memory that becomes
687read-only (on certain operating systems) as a result of dumping Emacs. 663read-only (on certain operating systems) as a result of dumping Emacs.
688@xref{Pure Storage}. 664@xref{Pure Storage}.
689 665
690@c FIXME is this still true? I don't think so...
691 Do not use static variables within functions---place all static
692variables at top level in the file. This is necessary because Emacs on
693some operating systems defines the keyword @code{static} as a null
694macro. (This definition is used because those systems put all variables
695declared static in a place that becomes read-only after dumping, whether
696they have initializers or not.)
697
698@cindex @code{defsubr}, Lisp symbol for a primitive 666@cindex @code{defsubr}, Lisp symbol for a primitive
699 Defining the C function is not enough to make a Lisp primitive 667 Defining the C function is not enough to make a Lisp primitive
700available; you must also create the Lisp symbol for the primitive and 668available; you must also create the Lisp symbol for the primitive and
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index b0e9d4a3139..946dcb91317 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -525,6 +525,10 @@ mode when creating new buffers (@pxref{Auto Major Mode}), but with such
525@code{special} modes, Fundamental mode is used instead. Modes such as 525@code{special} modes, Fundamental mode is used instead. Modes such as
526Dired, Rmail, and Buffer List use this feature. 526Dired, Rmail, and Buffer List use this feature.
527 527
528The function @code{view-buffer} does not enable View mode in buffers
529whose mode-class is special, because such modes usually provide their
530own View-like bindings.
531
528The @code{define-derived-mode} macro automatically marks the derived 532The @code{define-derived-mode} macro automatically marks the derived
529mode as special if the parent mode is special. Special mode is a 533mode as special if the parent mode is special. Special mode is a
530convenient parent for such modes to inherit from; @xref{Basic Major 534convenient parent for such modes to inherit from; @xref{Basic Major
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index f7df5f4bf87..1021787a0f4 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -8,8 +8,7 @@
8@chapter Operating System Interface 8@chapter Operating System Interface
9 9
10 This chapter is about starting and getting out of Emacs, access to 10 This chapter is about starting and getting out of Emacs, access to
11values in the operating system environment, and terminal input, output, 11values in the operating system environment, and terminal input, output.
12and flow control.
13 12
14 @xref{Building Emacs}, for related information. @xref{Display}, for 13 @xref{Building Emacs}, for related information. @xref{Display}, for
15additional operating system status information pertaining to the 14additional operating system status information pertaining to the
@@ -60,7 +59,7 @@ can customize these actions.
60@cindex @file{startup.el} 59@cindex @file{startup.el}
61 60
62 When Emacs is started up, it performs the following operations 61 When Emacs is started up, it performs the following operations
63(which are defined in @file{startup.el}): 62(see @code{normal-top-level} in @file{startup.el}):
64 63
65@enumerate 64@enumerate
66@item 65@item
@@ -70,6 +69,15 @@ adds the directory's subdirectories to the list, and those are scanned
70in their turn. The files @file{subdirs.el} are normally generated 69in their turn. The files @file{subdirs.el} are normally generated
71automatically when Emacs is installed. 70automatically when Emacs is installed.
72 71
72@item
73It registers input methods by loading any @file{leim-list.el} file
74found in the @code{load-path}.
75
76@c It removes PWD from the environment if it is not accurate.
77@c It abbreviates default-directory.
78
79@c Now normal-top-level calls command-line.
80
73@vindex before-init-time 81@vindex before-init-time
74@item 82@item
75It sets the variable @code{before-init-time} to the value of 83It sets the variable @code{before-init-time} to the value of
@@ -77,32 +85,49 @@ It sets the variable @code{before-init-time} to the value of
77@code{after-init-time} to @code{nil}, which signals to Lisp programs 85@code{after-init-time} to @code{nil}, which signals to Lisp programs
78that Emacs is being initialized. 86that Emacs is being initialized.
79 87
88@c set-locale-environment
89@item
90It sets the language environment and the terminal coding system,
91if requested by environment variables such as @code{LANG}.
92
93@item
94It does some basic parsing of the command-line arguments.
95
80@vindex initial-window-system@r{, and startup} 96@vindex initial-window-system@r{, and startup}
81@vindex window-system-initialization-alist 97@vindex window-system-initialization-alist
82@item 98@item
83It loads the initialization library for the window system specified by 99If not running in batch mode, it initializes the window system that
84the variable @code{initial-window-system} (@pxref{Window Systems, 100the variable @code{initial-window-system} specifies (@pxref{Window
85initial-window-system}). This library's name is 101Systems, initial-window-system}). The initialization function for
86@file{term/@var{windowsystem}-win.el}, where @var{windowsystem} is the 102each supported window system is specified by
87value of @code{initial-window-system}. From that library, it calls 103@code{window-system-initialization-alist}. If the value
88the appropriate initialization function. The initialization function 104of @code{initial-window-system} is @var{windowsystem}, then the
89for each supported window system is specified by 105appropriate initialization function is defined in the file
90@code{window-system-initialization-alist}. 106@file{term/@var{windowsystem}-win.el}. This file should have been
107compiled into the Emacs executable when it was built.
91 108
92@item 109@item
93It sets the language environment and the terminal coding system, 110It runs the normal hook @code{before-init-hook}.
94if requested by environment variables such as @code{LANG}.
95 111
96@item 112@item
97It processes the initial options. (Some of them are handled 113If appropriate (e.g., not in batch mode or started as a daemon), it
98even earlier than this.) 114creates a graphical frame.
99 115
100@item 116@item
101It runs the normal hook @code{before-init-hook}. 117It initializes the initial frame's faces, and sets up the menu bar
118and tool bar if needed. If graphical frames are supported, it sets up
119the tool bar even if the current frame is not a graphical one, since a
120graphical frame may be created later on.
102 121
103@item 122@item
104It initializes the initial frame's faces, and turns on the menu bar 123It use @code{custom-reevaluate-setting} to re-initialize the members
105and tool bar if needed. 124of the list @code{custom-delayed-init-variables}. These are any
125pre-loaded user options whose default value depends on the run-time,
126rather than build-time, context.
127@xref{Building Emacs, custom-initialize-delay}.
128
129@c @item
130@c It registers the colors available for tty frames.
106 131
107@item 132@item
108It loads the library @file{site-start}, if it exists. This is not 133It loads the library @file{site-start}, if it exists. This is not
@@ -127,6 +152,11 @@ It loads your abbrevs from the file specified by
127(@pxref{Abbrev Files, abbrev-file-name}). This is not done if the 152(@pxref{Abbrev Files, abbrev-file-name}). This is not done if the
128option @samp{--batch} was specified. 153option @samp{--batch} was specified.
129 154
155@item
156If @code{package-enable-at-startup} is non-@code{nil}, it calls the
157function @code{package-initialize} to activate any optional Emacs Lisp
158package that has been installed. @xref{Packaging Basics}.
159
130@vindex after-init-time 160@vindex after-init-time
131@item 161@item
132It sets the variable @code{after-init-time} to the value of 162It sets the variable @code{after-init-time} to the value of
@@ -149,13 +179,17 @@ Lisp library, which is specified by the variable
149@code{term-file-prefix} (@pxref{Terminal-Specific}). This is not done 179@code{term-file-prefix} (@pxref{Terminal-Specific}). This is not done
150in @code{--batch} mode, nor if @code{term-file-prefix} is @code{nil}. 180in @code{--batch} mode, nor if @code{term-file-prefix} is @code{nil}.
151 181
182@c Now command-line calls command-line-1.
183
152@item 184@item
153It displays the initial echo area message, unless you have suppressed 185It displays the initial echo area message, unless you have suppressed
154that with @code{inhibit-startup-echo-area-message}. 186that with @code{inhibit-startup-echo-area-message}.
155 187
156@item 188@item
157It processes the action arguments from the command line. 189It processes any command-line options that were not handled earlier.
158 190
191@c This next one is back in command-line, but the remaining bits of
192@c command-line-1 are not done if noninteractive.
159@item 193@item
160It now exits if the option @code{--batch} was specified. 194It now exits if the option @code{--batch} was specified.
161 195
@@ -164,6 +198,15 @@ If @code{initial-buffer-choice} is a string, it visits the file with
164that name. Furthermore, if the @samp{*scratch*} buffer exists and is 198that name. Furthermore, if the @samp{*scratch*} buffer exists and is
165empty, it inserts @code{initial-scratch-message} into that buffer. 199empty, it inserts @code{initial-scratch-message} into that buffer.
166 200
201@c To make things nice and confusing, the next three items can be
202@c called from two places. If displaying a startup screen, they are
203@c called in command-line-1 before the startup screen is shown.
204@c inhibit-startup-hooks is then set and window-setup-hook set to nil.
205@c If not displaying a startup screen, they are are called in
206@c normal-top-level.
207@c FIXME? So it seems they can be called before or after the
208@c daemon/session restore step?
209
167@item 210@item
168It runs @code{emacs-startup-hook} and then @code{term-setup-hook}. 211It runs @code{emacs-startup-hook} and then @code{term-setup-hook}.
169 212
@@ -176,21 +219,33 @@ specify.
176It runs @code{window-setup-hook}. @xref{Window Systems}. 219It runs @code{window-setup-hook}. @xref{Window Systems}.
177 220
178@item 221@item
179If the option @code{--daemon} was specified, it calls
180@code{server-start} and detaches from the controlling terminal.
181@xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
182
183@item
184It displays the @dfn{startup screen}, which is a special buffer that 222It displays the @dfn{startup screen}, which is a special buffer that
185contains information about copyleft and basic Emacs usage. This is 223contains information about copyleft and basic Emacs usage. This is
186not done if @code{initial-buffer-choice} or 224not done if @code{initial-buffer-choice} or
187@code{inhibit-startup-screen} are @code{nil}, nor if the 225@code{inhibit-startup-screen} are @code{nil}, nor if the
188@samp{--no-splash} or @samp{-Q} command-line options were specified. 226@samp{--no-splash} or @samp{-Q} command-line options were specified.
189 227
228@c End of command-line-1.
229
230@c Back to command-line from command-line-1.
231
232@c This is the point at which we actually exit in batch mode, but the
233@c last few bits of command-line-1 are not done in batch mode.
234
235@item
236If the option @code{--daemon} was specified, it calls
237@code{server-start} and detaches from the controlling terminal.
238@xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
239
190@item 240@item
191If started by the X session manager, it calls 241If started by the X session manager, it calls
192@code{emacs-session-restore} passing it as argument the ID of the 242@code{emacs-session-restore} passing it as argument the ID of the
193previous session. @xref{Session Management}. 243previous session. @xref{Session Management}.
244
245@c End of command-line.
246
247@c Back to normal-top-level from command-line.
248
194@end enumerate 249@end enumerate
195 250
196@defopt inhibit-startup-screen 251@defopt inhibit-startup-screen
@@ -242,17 +297,20 @@ is @code{nil}, the @samp{*scratch*} buffer is empty.
242@end defopt 297@end defopt
243 298
244@node Init File 299@node Init File
245@subsection The Init File, @file{.emacs} 300@subsection The Init File
246@cindex init file 301@cindex init file
247@cindex @file{.emacs} 302@cindex @file{.emacs}
303@cindex @file{init.el}
248 304
249 When you start Emacs, it normally attempts to load your @dfn{init 305 When you start Emacs, it normally attempts to load your @dfn{init
250file}. This is either a file named @file{.emacs} or @file{.emacs.el} 306file}. This is either a file named @file{.emacs} or @file{.emacs.el}
251in your home directory, or a file named @file{init.el} in a 307in your home directory, or a file named @file{init.el} in a
252subdirectory named @file{.emacs.d} in your home directory. Whichever 308subdirectory named @file{.emacs.d} in your home directory.
253place you use, you can also compile the file (@pxref{Byte 309@ignore
310Whichever place you use, you can also compile the file (@pxref{Byte
254Compilation}); then the actual file loaded will be @file{.emacs.elc} 311Compilation}); then the actual file loaded will be @file{.emacs.elc}
255or @file{init.elc}. 312or @file{init.elc}.
313@end ignore
256 314
257 The command-line switches @samp{-q}, @samp{-Q}, and @samp{-u} 315 The command-line switches @samp{-q}, @samp{-Q}, and @samp{-u}
258control whether and where to find the init file; @samp{-q} (and the 316control whether and where to find the init file; @samp{-q} (and the
@@ -267,13 +325,13 @@ file. If those environment variables are absent, though, Emacs uses
267your user-id to find your home directory. 325your user-id to find your home directory.
268 326
269@cindex default init file 327@cindex default init file
270 A site may have a @dfn{default init file}, which is the library 328 An Emacs installation may have a @dfn{default init file}, which is a
271named @file{default.el}. Emacs finds the @file{default.el} file 329Lisp library named @file{default.el}. Emacs finds this file through
272through the standard search path for libraries (@pxref{How Programs Do 330the standard search path for libraries (@pxref{How Programs Do
273Loading}). The Emacs distribution does not come with this file; sites 331Loading}). The Emacs distribution does not come with this file; it is
274may provide one for local customizations. If the default init file 332intended for local customizations. If the default init file exists,
275exists, it is loaded whenever you start Emacs, except in batch mode or 333it is loaded whenever you start Emacs, except in batch mode or if
276if @samp{-q} (or @samp{-Q}) is specified. But your own personal init 334@samp{-q} (or @samp{-Q}) is specified. But your own personal init
277file, if any, is loaded first; if it sets @code{inhibit-default-init} 335file, if any, is loaded first; if it sets @code{inhibit-default-init}
278to a non-@code{nil} value, then Emacs does not subsequently load the 336to a non-@code{nil} value, then Emacs does not subsequently load the
279@file{default.el} file. 337@file{default.el} file.
@@ -343,23 +401,22 @@ in the normal manner, by searching the @code{load-path} directories, and
343trying the @samp{.elc} and @samp{.el} suffixes. 401trying the @samp{.elc} and @samp{.el} suffixes.
344 402
345@cindex Termcap 403@cindex Termcap
346 The usual function of a terminal-specific library is to enable 404 The usual role of a terminal-specific library is to enable special
347special keys to send sequences that Emacs can recognize. It may also 405keys to send sequences that Emacs can recognize. It may also need to
348need to set or add to @code{input-decode-map} if the Termcap or 406set or add to @code{input-decode-map} if the Termcap or Terminfo entry
349Terminfo entry does not specify all the terminal's function keys. 407does not specify all the terminal's function keys. @xref{Terminal
350@xref{Terminal Input}. 408Input}.
351 409
352 When the name of the terminal type contains a hyphen, and no library 410 When the name of the terminal type contains a hyphen, and no library
353is found whose name is identical to the terminal's name, Emacs strips 411is found whose name is identical to the terminal's name, Emacs strips
354from the terminal's name the last hyphen and everything that follows 412from the terminal's name the last hyphen and everything that follows
355it, and tries again. This process is repeated until Emacs finds a 413it, and tries again. This process is repeated until Emacs finds a
356matching library or until there are no more hyphens in the name (the 414matching library, or until there are no more hyphens in the name
357latter means the terminal doesn't have any library specific to it). 415(i.g.@: there is no terminal-specific library). For example, if the
358Thus, for example, if there are no @samp{aaa-48} and @samp{aaa-30} 416terminal name is @samp{xterm-256color} and there is no
359libraries, Emacs will try the same library @file{term/aaa.el} for 417@file{term/xterm-256color.el} library, Emacs tries to load
360terminal types @samp{aaa-48} and @samp{aaa-30-rv}. If necessary, the 418@file{term/xterm.el}. If necessary, the terminal library can evaluate
361library can evaluate @code{(getenv "TERM")} to find the full name of 419@code{(getenv "TERM")} to find the full name of the terminal type.
362the terminal type.@refill
363 420
364 Your init file can prevent the loading of the 421 Your init file can prevent the loading of the
365terminal-specific library by setting the variable 422terminal-specific library by setting the variable
@@ -376,8 +433,8 @@ have their own libraries. @xref{Hooks}.
376 433
377@defvar term-file-prefix 434@defvar term-file-prefix
378@cindex @code{TERM} environment variable 435@cindex @code{TERM} environment variable
379If the @code{term-file-prefix} variable is non-@code{nil}, Emacs loads 436If the value of this variable is non-@code{nil}, Emacs loads a
380a terminal-specific initialization file as follows: 437terminal-specific initialization file as follows:
381 438
382@example 439@example
383(load (concat term-file-prefix (getenv "TERM"))) 440(load (concat term-file-prefix (getenv "TERM")))
@@ -409,29 +466,14 @@ feature.
409@subsection Command-Line Arguments 466@subsection Command-Line Arguments
410@cindex command-line arguments 467@cindex command-line arguments
411 468
412 You can use command-line arguments to request various actions when you 469 You can use command-line arguments to request various actions when
413start Emacs. Since you do not need to start Emacs more than once per 470you start Emacs. Command-line arguments should not be commonly used,
414day, and will often leave your Emacs session running longer than that, 471since the recommended way of using Emacs is to start it just once,
415command-line arguments are hardly ever used. As a practical matter, it 472after logging in, and do all editing in the same Emacs session
416is best to avoid making the habit of using them, since this habit would 473(@pxref{Entering Emacs,,, emacs, The GNU Emacs Manual}); nonetheless,
417encourage you to kill and restart Emacs unnecessarily often. These 474they can be useful when invoking Emacs from session scripts or
418options exist for two reasons: to be compatible with other editors (for 475debugging Emacs itself. This section describes how Emacs processes
419invocation by other programs) and to enable shell scripts to run 476command-line arguments.
420specific Lisp programs.
421
422 This section describes how Emacs processes command-line arguments,
423and how you can customize them.
424
425@ignore
426 (Note that some other editors require you to start afresh each time
427you want to edit a file. With this kind of editor, you will probably
428specify the file as a command-line argument. The recommended way to
429use GNU Emacs is to start it only once, just after you log in, and do
430all your editing in the same Emacs process. Each time you want to edit
431a different file, you visit it with the existing Emacs, which eventually
432comes to have many files in it ready for editing. Usually you do not
433kill the Emacs until you are about to log out.)
434@end ignore
435 477
436@defun command-line 478@defun command-line
437This function parses the command line that Emacs was called with, 479This function parses the command line that Emacs was called with,
@@ -525,9 +567,7 @@ as a file name to visit.
525 567
526 There are two ways to get out of Emacs: you can kill the Emacs job, 568 There are two ways to get out of Emacs: you can kill the Emacs job,
527which exits permanently, or you can suspend it, which permits you to 569which exits permanently, or you can suspend it, which permits you to
528reenter the Emacs process later. As a practical matter, you seldom kill 570reenter the Emacs process later.
529Emacs---only when you are about to log out. Suspending is much more
530common.
531 571
532@menu 572@menu
533* Killing Emacs:: Exiting Emacs irreversibly. 573* Killing Emacs:: Exiting Emacs irreversibly.
@@ -1105,24 +1145,47 @@ The value may be a floating point number.
1105@node Time of Day 1145@node Time of Day
1106@section Time of Day 1146@section Time of Day
1107 1147
1108 This section explains how to determine the current time and the time 1148 This section explains how to determine the current time and time
1109zone. 1149zone.
1110 1150
1151@cindex epoch
1152 Most of these functions represent time as a list of either three
1153integers, @code{(@var{sec-high} @var{sec-low} @var{microsec})}, or of
1154two integers, @code{(@var{sec-high} @var{sec-low})}. The integers
1155@var{sec-high} and @var{sec-low} give the high and low bits of an
1156integer number of seconds. This integer number,
1157@ifnottex
1158@var{high} * 2**16 + @var{low},
1159@end ifnottex
1160@tex
1161$high*2^{16}+low$,
1162@end tex
1163is the number of seconds from the @dfn{epoch} (0:00 January 1, 1970
1164UTC) to the specified time. The third list element @var{microsec}, if
1165present, gives the number of microseconds from the start of that
1166second to the specified time.
1167
1168 The return value of @code{current-time} represents time using three
1169integers, while the timestamps in the return value of
1170@code{file-attributes} use two integers (@pxref{Definition of
1171file-attributes}). In function arguments, e.g.@: the @var{time-value}
1172argument to @code{current-time-string}, both two- and three-integer
1173lists are accepted. You can convert times from the list
1174representation into standard human-readable strings using
1175@code{current-time}, or to other forms using the @code{decode-time}
1176and @code{format-time-string} functions documented in the following
1177sections.
1178
1111@defun current-time-string &optional time-value 1179@defun current-time-string &optional time-value
1112This function returns the current time and date as a human-readable 1180This function returns the current time and date as a human-readable
1113string. The format of the string is unvarying; the number of characters 1181string. The format of the string is unvarying; the number of
1114used for each part is always the same, so you can reliably use 1182characters used for each part is always the same, so you can reliably
1115@code{substring} to extract pieces of it. It is wise to count the 1183use @code{substring} to extract pieces of it. You should count
1116characters from the beginning of the string rather than from the end, as 1184characters from the beginning of the string rather than from the end,
1117additional information may some day be added at the end. 1185as additional information may some day be added at the end.
1118 1186
1119The argument @var{time-value}, if given, specifies a time to format 1187The argument @var{time-value}, if given, specifies a time to format
1120instead of the current time. This argument should have the same form 1188(represented as a list of integers), instead of the current time.
1121as the times obtained from @code{current-time} (see below) and from
1122@code{file-attributes} (@pxref{Definition of file-attributes}). It
1123should be a list whose first two elements are integers; a third
1124(microsecond) element, if present, is ignored. @var{time-value} can
1125also be a cons of two integers, but this usage is obsolete.
1126 1189
1127@example 1190@example
1128@group 1191@group
@@ -1133,33 +1196,16 @@ also be a cons of two integers, but this usage is obsolete.
1133@end defun 1196@end defun
1134 1197
1135@defun current-time 1198@defun current-time
1136This function returns the system's time value as a list of three 1199This function returns the current time, represented as a list of three
1137integers: @code{(@var{high} @var{low} @var{microsec})}. The integers 1200integers @code{(@var{sec-high} @var{sec-low} @var{microsec})}. On
1138@var{high} and @var{low} combine to give the number of seconds since 1201systems with only one-second time resolutions, @var{microsec} is 0.
11390:00 January 1, 1970 UTC (Coordinated Universal Time), which is
1140@ifnottex
1141@var{high} * 2**16 + @var{low}.
1142@end ifnottex
1143@tex
1144$high*2^{16}+low$.
1145@end tex
1146
1147The third element, @var{microsec}, gives the microseconds since the
1148start of the current second (or 0 for systems that return time with
1149the resolution of only one second).
1150
1151The first two elements can be compared with file time values such as you
1152get with the function @code{file-attributes}.
1153@xref{Definition of file-attributes}.
1154@end defun 1202@end defun
1155 1203
1156@defun float-time &optional time-value 1204@defun float-time &optional time-value
1157This function returns the current time as a floating-point number of 1205This function returns the current time as a floating-point number of
1158seconds since the epoch. The argument @var{time-value}, if given, 1206seconds since the epoch. The optional argument @var{time-value}, if
1159specifies a time to convert instead of the current time. The argument 1207given, specifies a time (represented as a list of integers) to convert
1160should have the same form as for @code{current-time-string} (see 1208instead of the current time.
1161above). Thus, it accepts the output of @code{current-time} and
1162@code{file-attributes} (@pxref{Definition of file-attributes}).
1163 1209
1164@emph{Warning}: Since the result is floating point, it may not be 1210@emph{Warning}: Since the result is floating point, it may not be
1165exact. Do not use this function if precise time stamps are required. 1211exact. Do not use this function if precise time stamps are required.
@@ -1180,11 +1226,8 @@ adjustment, then the value is constant through time.
1180If the operating system doesn't supply all the information necessary to 1226If the operating system doesn't supply all the information necessary to
1181compute the value, the unknown elements of the list are @code{nil}. 1227compute the value, the unknown elements of the list are @code{nil}.
1182 1228
1183The argument @var{time-value}, if given, specifies a time to analyze 1229The argument @var{time-value}, if given, specifies a time (represented
1184instead of the current time. The argument should have the same form 1230as a list of integers) to analyze instead of the current time.
1185as for @code{current-time-string} (see above). Thus, you can use
1186times obtained from @code{current-time} (see above) and from
1187@code{file-attributes}. @xref{Definition of file-attributes}.
1188@end defun 1231@end defun
1189 1232
1190The current time zone is determined by the @samp{TZ} environment 1233The current time zone is determined by the @samp{TZ} environment
@@ -1196,16 +1239,15 @@ time zone.
1196@node Time Conversion 1239@node Time Conversion
1197@section Time Conversion 1240@section Time Conversion
1198 1241
1199 These functions convert time values (lists of two or three integers) 1242 These functions convert time values (lists of two or three integers,
1200to calendrical information and vice versa. You can get time values 1243as explained in the previous section) into calendrical information and
1201from the functions @code{current-time} (@pxref{Time of Day}) and 1244vice versa.
1202@code{file-attributes} (@pxref{Definition of file-attributes}).
1203 1245
1204 Many 32-bit operating systems are limited to time values that contain 32 bits 1246 Many 32-bit operating systems are limited to time values containing
1205of information; these systems typically handle only the times from 124732 bits of information; these systems typically handle only the times
12061901-12-13 20:45:52 UTC through 2038-01-19 03:14:07 UTC. However, 64-bit 1248from 1901-12-13 20:45:52 UTC through 2038-01-19 03:14:07 UTC.
1207and some 32-bit operating systems have larger time values, and can 1249However, 64-bit and some 32-bit operating systems have larger time
1208represent times far in the past or future. 1250values, and can represent times far in the past or future.
1209 1251
1210 Time conversion functions always use the Gregorian calendar, even 1252 Time conversion functions always use the Gregorian calendar, even
1211for dates before the Gregorian calendar was introduced. Year numbers 1253for dates before the Gregorian calendar was introduced. Year numbers
@@ -1718,9 +1760,9 @@ certain length of time. Aside from how to set them up, idle timers
1718work just like ordinary timers. 1760work just like ordinary timers.
1719 1761
1720@deffn Command run-with-idle-timer secs repeat function &rest args 1762@deffn Command run-with-idle-timer secs repeat function &rest args
1721Set up a timer which runs when Emacs has been idle for @var{secs} 1763Set up a timer which runs the next time Emacs is idle for @var{secs}
1722seconds. The value of @var{secs} may be an integer or a floating point 1764seconds. The value of @var{secs} may be an integer or a floating
1723number; a value of the type returned by @code{current-idle-time} 1765point number; a value of the type returned by @code{current-idle-time}
1724is also allowed. 1766is also allowed.
1725 1767
1726If @var{repeat} is @code{nil}, the timer runs just once, the first time 1768If @var{repeat} is @code{nil}, the timer runs just once, the first time
@@ -1733,13 +1775,13 @@ can use in calling @code{cancel-timer} (@pxref{Timers}).
1733@end deffn 1775@end deffn
1734 1776
1735@cindex idleness 1777@cindex idleness
1736 Emacs becomes ``idle'' when it starts waiting for user input, and it 1778 Emacs becomes @dfn{idle} when it starts waiting for user input, and
1737remains idle until the user provides some input. If a timer is set for 1779it remains idle until the user provides some input. If a timer is set
1738five seconds of idleness, it runs approximately five seconds after Emacs 1780for five seconds of idleness, it runs approximately five seconds after
1739first becomes idle. Even if @var{repeat} is non-@code{nil}, this timer 1781Emacs first becomes idle. Even if @var{repeat} is non-@code{nil},
1740will not run again as long as Emacs remains idle, because the duration 1782this timer will not run again as long as Emacs remains idle, because
1741of idleness will continue to increase and will not go down to five 1783the duration of idleness will continue to increase and will not go
1742seconds again. 1784down to five seconds again.
1743 1785
1744 Emacs can do various things while idle: garbage collect, autosave or 1786 Emacs can do various things while idle: garbage collect, autosave or
1745handle data from a subprocess. But these interludes during idleness do 1787handle data from a subprocess. But these interludes during idleness do
@@ -1753,22 +1795,12 @@ minutes, and even if there have been garbage collections and autosaves.
1753input. Then it becomes idle again, and all the idle timers that are 1795input. Then it becomes idle again, and all the idle timers that are
1754set up to repeat will subsequently run another time, one by one. 1796set up to repeat will subsequently run another time, one by one.
1755 1797
1756@c Emacs 19 feature
1757@defun current-idle-time 1798@defun current-idle-time
1758If Emacs is idle, this function returns the length of time Emacs has 1799If Emacs is idle, this function returns the length of time Emacs has
1759been idle, as a list of three integers: @code{(@var{high} @var{low} 1800been idle, as a list of three integers: @code{(@var{sec-high}
1760@var{microsec})}. The integers @var{high} and @var{low} combine to 1801@var{sec-low} @var{microsec})}, where @var{high} and @var{low} are the
1761give the number of seconds of idleness, which is 1802high and low bits for the number of seconds and @var{microsec} is the
1762@ifnottex 1803additional number of microseconds (@pxref{Time of Day}).
1763@var{high} * 2**16 + @var{low}.
1764@end ifnottex
1765@tex
1766$high*2^{16}+low$.
1767@end tex
1768
1769The third element, @var{microsec}, gives the microseconds since the
1770start of the current second (or 0 for systems that return time with
1771the resolution of only one second).
1772 1804
1773When Emacs is not idle, @code{current-idle-time} returns @code{nil}. 1805When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
1774This is a convenient way to test whether Emacs is idle. 1806This is a convenient way to test whether Emacs is idle.
@@ -1801,9 +1833,9 @@ Here's an example:
1801@end smallexample 1833@end smallexample
1802@end defun 1834@end defun
1803 1835
1804 Some idle timer functions in user Lisp packages have a loop that 1836 Do not write an idle timer function containing a loop which does a
1805does a certain amount of processing each time around, and exits when 1837certain amount of processing each time around, and exits when
1806@code{(input-pending-p)} is non-@code{nil}. That approach seems very 1838@code{(input-pending-p)} is non-@code{nil}. This approach seems very
1807natural but has two problems: 1839natural but has two problems:
1808 1840
1809@itemize 1841@itemize
@@ -1816,9 +1848,9 @@ It blocks out any idle timers that ought to run during that time.
1816@end itemize 1848@end itemize
1817 1849
1818@noindent 1850@noindent
1819To avoid these problems, don't use that technique. Instead, write 1851The correct approach is for the idle timer to reschedule itself after
1820such idle timers to reschedule themselves after a brief pause, using 1852a brief pause, using the method in the @code{timer-function} example
1821the method in the @code{timer-function} example above. 1853above.
1822 1854
1823@node Terminal Input 1855@node Terminal Input
1824@section Terminal Input 1856@section Terminal Input
@@ -2014,9 +2046,8 @@ See also @code{open-dribble-file} in @ref{Recording Input}.
2014@cindex sound 2046@cindex sound
2015 2047
2016 To play sound using Emacs, use the function @code{play-sound}. Only 2048 To play sound using Emacs, use the function @code{play-sound}. Only
2017certain systems are supported; if you call @code{play-sound} on a system 2049certain systems are supported; if you call @code{play-sound} on a
2018which cannot really do the job, it gives an error. Emacs version 20 and 2050system which cannot really do the job, it gives an error.
2019earlier did not support sound at all.
2020 2051
2021 The sound must be stored as a file in RIFF-WAVE format (@samp{.wav}) 2052 The sound must be stored as a file in RIFF-WAVE format (@samp{.wav})
2022or Sun Audio format (@samp{.au}). 2053or Sun Audio format (@samp{.au}).
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index eb3612dc868..b17f13b6b89 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -15,6 +15,8 @@ install, uninstall, and upgrade it.
15 15
16 The following sections describe how to create a package, and how to 16 The following sections describe how to create a package, and how to
17put it in a @dfn{package archive} for others to download. 17put it in a @dfn{package archive} for others to download.
18@xref{Packages,,, emacs, The GNU Emacs Manual}, for a description of
19user-level features of the packaging system.
18 20
19@menu 21@menu
20* Packaging Basics:: The basic concepts of Emacs Lisp packages. 22* Packaging Basics:: The basic concepts of Emacs Lisp packages.
@@ -91,17 +93,34 @@ definitions are saved to a file named @file{@var{name}-autoloads.el}
91in the content directory. They are typically used to autoload the 93in the content directory. They are typically used to autoload the
92principal user commands defined in the package, but they can also 94principal user commands defined in the package, but they can also
93perform other tasks, such as adding an element to 95perform other tasks, such as adding an element to
94@code{auto-mode-alist} (@pxref{Auto Major Mode}). During this time, 96@code{auto-mode-alist} (@pxref{Auto Major Mode}). Note that a package
95Emacs will also byte-compile the Lisp files. 97typically does @emph{not} autoload every function and variable defined
96 98within it---only the handful of commands typically called to begin
97 After installation, and (by default) each time Emacs is started, the 99using the package. Emacs then byte-compiles every Lisp file in the
98installed package is @dfn{activated}. During activation, Emacs adds 100package.
99the package's content directory to @code{load-path}, and evaluates the 101
100autoload definitions in @file{@var{name}-autoloads.el}. 102 After installation, the installed package is @dfn{loaded}: Emacs
101 103adds the package's content directory to @code{load-path}, and
102 Note that a package typically does @emph{not} autoload every 104evaluates the autoload definitions in @file{@var{name}-autoloads.el}.
103function and variable defined within it---only the handful of commands 105
104typically called to begin using the package. 106 Whenever Emacs starts up, it automatically calls the function
107@code{package-initialize} to load installed packages. This is done
108after loading the init file and abbrev file (if any) and before
109running @code{after-init-hook} (@pxref{Startup Summary}). Automatic
110package loading is disabled if the user option
111@code{package-enable-at-startup} is @code{nil}.
112
113@deffn Command package-initialize &optional no-activate
114This function initializes Emacs' internal record of which packages are
115installed, and loads them. The user option @code{package-load-list}
116specifies which packages to load; by default, all installed packages
117are loaded. @xref{Package Installation,,, emacs, The GNU Emacs
118Manual}.
119
120The optional argument @var{no-activate}, if non-@code{nil}, causes
121Emacs to update its record of installed packages without actually
122loading them; it is for internal use only.
123@end deffn
105 124
106@node Simple Packages 125@node Simple Packages
107@section Simple Packages 126@section Simple Packages